Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Calvin Metcalf committed Mar 25, 2013
1 parent 5a91df9 commit 99a1aa2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions esri2geo.py
Expand Up @@ -245,15 +245,14 @@ def closeUp(out,fileType):
if fileType=="geojson" or fileType=="json": if fileType=="geojson" or fileType=="json":
out.write("""]}""") out.write("""]}""")
out.close() out.close()
def writeFile(outFile,featureClass,fileType,includeGeometry): def writeFile(outFile,featureClass,fileType,includeGeometry, first=True):
[shp,shpType]=getShp(featureClass) [shp,shpType]=getShp(featureClass)
fields=listFields(featureClass) fields=listFields(featureClass)
oid=getOID(fields) oid=getOID(fields)
sr=SpatialReference() sr=SpatialReference()
sr.loadFromString(wgs84) sr.loadFromString(wgs84)
rows=SearchCursor(featureClass,"",sr) rows=SearchCursor(featureClass,"",sr)
del fields[shp] del fields[shp]
first = True
i=0 i=0
iPercent=0 iPercent=0
featureCount = int(GetCount_management(featureClass).getOutput(0)) featureCount = int(GetCount_management(featureClass).getOutput(0))
Expand Down Expand Up @@ -307,7 +306,7 @@ def writeFile(outFile,featureClass,fileType,includeGeometry):
del row del row
del rows del rows
return True return True
def toOpen(featureClass, outJSON,includeGeometry="true"): def toOpen(featureClass, outJSON, includeGeometry="true"):
if not int(GetCount_management(featureClass).getOutput(0)): if not int(GetCount_management(featureClass).getOutput(0)):
AddMessage("No features found, skipping") AddMessage("No features found, skipping")
return return
Expand Down
Binary file modified esri2geo.tbx
Binary file not shown.
4 changes: 3 additions & 1 deletion merge.py
Expand Up @@ -6,8 +6,10 @@
fileType = "geojson" fileType = "geojson"
out=open(outJSON,"wb") out=open(outJSON,"wb")
prepareGeoJson(out) prepareGeoJson(out)
first=True
for feature in features: for feature in features:
if feature[0] in ("'",'"'): if feature[0] in ("'",'"'):
feature = feature[1:-1] feature = feature[1:-1]
writeFile(out,feature,fileType,includeGeometry) writeFile(out,feature,fileType,includeGeometry, first)
first=False
closeUp(out,fileType) closeUp(out,fileType)

0 comments on commit 99a1aa2

Please sign in to comment.