Exemple #1
0
def doStuff(inFile, login, description):
    base = mkdtemp()
    oName = getName(inFile)
    outFile = base + '//' + oName + '.geojson'
    outTopo = base + '//' + oName + '.topojson'
    toOpen(inFile, outFile, "geojson")
    topojson(outFile, outTopo)
    postGist(outFile, oName, login, description)
    cleanUp(base, outFile, outTopo)
Exemple #2
0
def doStuff(inFile,login,description):
    base = mkdtemp()
    oName = getName(inFile)
    outFile = base+'//'+oName+'.geojson'
    outTopo = base+'//'+oName+'.topojson'
    toOpen(inFile,outFile,"geojson")
    topojson(outFile,outTopo)
    postGist(outFile,oName,login,description)
    cleanUp(base,outFile,outTopo)
Exemple #3
0
from arcpy import GetParameterAsText
from esri2open import toOpen
from topojson import topojson
from tempfile import mkdtemp
from os import remove, rmdir, path
dr = mkdtemp()
tempfl = dr + path.splitext(path.split(
    GetParameterAsText(1))[1])[0] + '.geojson'
toOpen(GetParameterAsText(0), tempfl, "geojson")
topojson(tempfl, GetParameterAsText(1))
remove(tempfl)
rmdir(dr)
Exemple #4
0
from arcpy import GetParameterAsText
from esri2open import toOpen
from topojson import topojson
from tempfile import mkdtemp
from os import remove, rmdir,path
dr = mkdtemp()
tempfl = dr + path.splitext(path.split(GetParameterAsText(1))[1])[0]+'.geojson'
toOpen(GetParameterAsText(0),tempfl,"geojson")
topojson(tempfl,GetParameterAsText(1))
remove(tempfl)
rmdir(dr)
Exemple #5
0
from esri2open import toOpen
from os import path, sep


def getName(feature):
    name = path.splitext(path.split(feature)[1])
    if name[1]:
        if name[1] == ".shp":
            return name[0]
        else:
            return name[1][1:]
    else:
        return name[0]


features = GetParameterAsText(0).split(";")
outFolder = GetParameterAsText(1)
outType = GetParameterAsText(2)
includeGeometries = ("geojson" if (GetParameterAsText(3) == "Default") else
                     GetParameterAsText(3)).lower()
for feature in features:
    if feature[0] in ("'", '"'):
        feature = feature[1:-1]
    outName = getName(feature)
    outPath = "{0}{1}{2}.{3}".format(outFolder, sep, outName, outType)
    if path.exists(outPath):
        AddMessage("{0} exists, skipping".format(outName))
        continue
    AddMessage("starting {0}".format(outName))
    toOpen(feature, outPath, includeGeometries)
Exemple #6
0
from arcpy import GetParameterAsText, AddMessage
from esri2open import toOpen, getName
from os import path, sep
features = GetParameterAsText(0).split(";")
outFolder = GetParameterAsText(1)
outType = GetParameterAsText(2)
includeGeometries = ("geojson" if (GetParameterAsText(3)=="Default") else GetParameterAsText(3)).lower()
for feature in features:
    if feature[0] in ("'",'"'):
        feature = feature[1:-1]
    outName = getName(feature)
    outPath = "{0}{1}{2}.{3}".format(outFolder,sep,outName,outType)
    if path.exists(outPath):
        AddMessage("{0} exists, skipping".format(outName))
        continue
    AddMessage("starting {0}".format(outName))
    toOpen(feature,outPath,includeGeometries)
Exemple #7
0
def doStuff(inFile, login, description):
    base = mkdtemp()
    outFile = base + '//output.geojson'
    toOpen(inFile, outFile, "geojson")
    postGist(outFile, getName(inFile), login, description)
    cleanUp(base, outFile)
Exemple #8
0
def doStuff(inFile,dbUrl,login,createDB):
    base = mkdtemp()
    outFile = base+'//output.json'
    toOpen(inFile,outFile,"geojson")
    postToCouch(dbUrl,outFile,login,createDB)
    cleanUp(base,outFile)
Exemple #9
0
from topojson import topojson
from random import randint
def getName(feature):
    name = path.splitext(path.split(feature)[1])
    if name[1]:
        if name[1]==".shp":
            return name[0]
        else:
            return name[1][1:]
    else:
        return name[0]
    
features = GetParameterAsText(0).split(";")
outFile = GetParameterAsText(1)
outStuff = {}
tmpdir=mkdtemp()
for feature in features:
    if feature[0] in ("'",'"'):
        feature = feature[1:-1]
    outName = getName(feature)
    outPath = tmpdir+'//'+str(randint(0,1000000))+'temp.geojson'
    if path.exists(outPath):
        remove(outPath)
    toOpen(feature,outPath)
    outStuff[outName]=load(open(outPath))
    remove(outPath)
    #AddMessage(outName)
topo = topojson(outStuff)
dump(topo,open(outFile,'w'))
rmdir(tmpdir)
Exemple #10
0
def getName(feature):
    name = path.splitext(path.split(feature)[1])
    if name[1]:
        if name[1] == ".shp":
            return name[0]
        else:
            return name[1][1:]
    else:
        return name[0]


features = GetParameterAsText(0).split(";")
outFile = GetParameterAsText(1)
outStuff = {}
tmpdir = mkdtemp()
for feature in features:
    if feature[0] in ("'", '"'):
        feature = feature[1:-1]
    outName = getName(feature)
    outPath = tmpdir + '//' + str(randint(0, 1000000)) + 'temp.geojson'
    if path.exists(outPath):
        remove(outPath)
    toOpen(feature, outPath)
    outStuff[outName] = load(open(outPath))
    remove(outPath)
    #AddMessage(outName)
topo = topojson(outStuff)
dump(topo, open(outFile, 'w'))
rmdir(tmpdir)
Exemple #11
0
def doStuff(inFile,login,description):
    base = mkdtemp()
    outFile = base+'//output.geojson'
    toOpen(inFile,outFile,"geojson")
    postGist(outFile,getName(inFile),login,description)
    cleanUp(base,outFile)
Exemple #12
0
features = GetParameterAsText(0).split(";")
outFolder = GetParameterAsText(1)
outType = GetParameterAsText(2)
includeGeometries = ("geojson" if (GetParameterAsText(3) == "Default") else
                     GetParameterAsText(3)).lower()
for feature in features:
    if feature[0] in ("'", '"'):
        feature = feature[1:-1]
    outName = getName(feature)
    outPath = "{0}{1}{2}.{3}".format(outFolder, sep, outName, outType)
    if path.exists(outPath):
        AddMessage("{0} exists, skipping".format(outName))
        continue
    AddMessage("starting {0}".format(outName))
    toOpen(feature, outPath, includeGeometries)
########NEW FILE########
__FILENAME__ = single
from arcpy import GetParameterAsText
from esri2open import toOpen
toOpen(GetParameterAsText(0), GetParameterAsText(1),
       ("geojson" if
        (GetParameterAsText(2) == "Default") else GetParameterAsText(2)))
########NEW FILE########
__FILENAME__ = makeaddin
import os
import re
import zipfile

current_path = os.path.dirname(os.path.abspath(__file__))
Exemple #13
0
from arcpy import GetParameterAsText
from esri2open import toOpen
toOpen(GetParameterAsText(0), GetParameterAsText(1),
       ("geojson" if
        (GetParameterAsText(2) == "Default") else GetParameterAsText(2)))
Exemple #14
0
        return name[0]
    
features = GetParameterAsText(0).split(";")
outFolder = GetParameterAsText(1)
outType = GetParameterAsText(2)
includeGeometries = ("geojson" if (GetParameterAsText(3)=="Default") else GetParameterAsText(3)).lower()
for feature in features:
    if feature[0] in ("'",'"'):
        feature = feature[1:-1]
    outName = getName(feature)
    outPath = "{0}{1}{2}.{3}".format(outFolder,sep,outName,outType)
    if path.exists(outPath):
        AddMessage("{0} exists, skipping".format(outName))
        continue
    AddMessage("starting {0}".format(outName))
    toOpen(feature,outPath,includeGeometries)
########NEW FILE########
__FILENAME__ = single
from arcpy import GetParameterAsText
from esri2open import toOpen
toOpen(GetParameterAsText(0),GetParameterAsText(1),("geojson" if (GetParameterAsText(2)=="Default") else GetParameterAsText(2)))
########NEW FILE########
__FILENAME__ = makeaddin
import os
import re
import zipfile

current_path = os.path.dirname(os.path.abspath(__file__))

out_zip_name = os.path.join(current_path, 
                            os.path.basename(current_path) + ".esriaddin")