Example #1
0
from arcpy import GetParameterAsText
from esri2open import writeFile, prepareGeoJSON, prepareTOPO, closeJSON, closeTOPOJSON, getExt, getName

#compute the peramaters
features = GetParameterAsText(0).split(";")
outJSON = GetParameterAsText(1)
includeGeometry = "geojson"
fileType = getExt(outJSON)
if fileType == 'geojson':
    prepare = prepareGeoJSON
    closing = closeJSON
elif fileType == 'topojson':
    prepare = prepareTOPO
    closing = closeTOPOJSON
out = prepare(outJSON)
first = True  #this makes sure sure we arn't missing commas
i = 0
for feature in features:
    i += 1
    if feature[0] in ("'", '"'):
        feature = feature[1:-1]
    writeFile(out, feature, fileType, includeGeometry, first, getName(feature))
    first = False
closing(out)
Example #2
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)
Example #3
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)
Example #4
0
from arcpy import GetParameterAsText
from esri2open import writeFile, prepareGeoJSON, prepareTOPO,closeJSON,closeTOPOJSON, getExt, getName

#compute the peramaters
features = GetParameterAsText(0).split(";")
outJSON=GetParameterAsText(1)
includeGeometry = "geojson"
fileType = getExt(outJSON)
if fileType == 'geojson':
    prepare = prepareGeoJSON
    closing = closeJSON
elif fileType == 'topojson':
    prepare = prepareTOPO
    closing = closeTOPOJSON
out=prepare(outJSON)
first=True#this makes sure sure we arn't missing commas
i=0
for feature in features:
    i+=1
    if feature[0] in ("'",'"'):
        feature = feature[1:-1]
    writeFile(out,feature,fileType,includeGeometry, first,getName(feature))
    first=False
closing(out)