Skip to content

Commit

Permalink
sqlite lines and multipoints are working
Browse files Browse the repository at this point in the history
  • Loading branch information
Calvin Metcalf committed May 3, 2013
1 parent a46d060 commit b1a9c33
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 303 deletions.
39 changes: 0 additions & 39 deletions big.css

This file was deleted.

56 changes: 0 additions & 56 deletions big.js

This file was deleted.

4 changes: 0 additions & 4 deletions esri2open/parseGeometry.py
@@ -1,6 +1,5 @@
from wkt import getWKTFunc
from wkb import getWKBFunc
from arcpy import AddMessage

def getPoint(pt):
return [pt.X,pt.Y]
Expand Down Expand Up @@ -192,12 +191,9 @@ def parseMultiPatch():

#this should probobly be a class
def getParseFunc(shpType, geo):
AddMessage(shpType)
AddMessage(geo)
if geo == "none":
return False
elif geo=="well known binary":
AddMessage("wkb")
return getWKBFunc(shpType)
else:
if shpType == "point":
Expand Down
4 changes: 2 additions & 2 deletions esri2open/prepare.py
Expand Up @@ -27,9 +27,9 @@ def prepareSqlite(out,featureClass,fileType,includeGeometry):
elif shpType == "multipoint":
gType = 4
elif shpType == "polyline":
gType = 5
gType = 2
elif shpType == "polygon":
gType = 6
gType = 3
fields=listFields(featureClass)
fieldNames = []
fieldNames.append("OGC_FID INTEGER PRIMARY KEY")
Expand Down
36 changes: 31 additions & 5 deletions esri2open/wkb.py
Expand Up @@ -2,6 +2,32 @@
from sqlite3 import Binary
def pts(c):
return ["dd",[c.X,c.Y]]
def pt4mp(c):
return ["Bidd",[1,1,c.X,c.Y]]
def mp(coordinates):
partCount=coordinates.partCount
i=0
out = ["I",[0]]
while i<partCount:
pt = coordinates.getPart(i)
[ptrn,c]=pt4mp(pt)
out[0]+=ptrn
out[1][0]+=1
out[1].extend(c)
i+=1
return out
def lineSt(coordinates):
partCount=coordinates.count
i=0
out = ["I",[0]]
while i<partCount:
pt = coordinates[i]
[ptrn,c]=pts(pt)
out[0]+=ptrn
out[1][0]+=1
out[1].extend(c)
i+=1
return out
def linearRing(coordinates):
partCount=coordinates.count
i=0
Expand Down Expand Up @@ -51,19 +77,19 @@ def makePoint(c):
return Binary(pack(*values))
def makeMultiPoint(c):
values = ["<BI",1,4]
[ptrn,coords]=linearRing(c)
[ptrn,coords]=mp(c)
values[0]+=ptrn
values.extend(coords)
return Binary(pack(*values))
def makeMultiLineString(c):
values = ["<BI",1,5]
[ptrn,coords]=multiRing(c)
values = ["<BI",1,2]
[ptrn,coords]=lineSt(c.getPart(0))
values[0]+=ptrn
values.extend(coords)
return Binary(pack(*values))
def makeMultiPolygon(c):
values = ["<BI",1,6]
[ptrn,coords]=multiRing(c)
values = ["<BI",1,3]
[ptrn,coords]=linearRing(c.getPart(0))
values[0]+=ptrn
values.extend(coords)
return Binary(pack(*values))
Expand Down
135 changes: 0 additions & 135 deletions index.html

This file was deleted.

62 changes: 0 additions & 62 deletions showdown.js

This file was deleted.

0 comments on commit b1a9c33

Please sign in to comment.