Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of ZM values and multi part polygon geometries #8

Open
lumobu opened this issue Sep 20, 2017 · 2 comments
Open

Support of ZM values and multi part polygon geometries #8

lumobu opened this issue Sep 20, 2017 · 2 comments

Comments

@lumobu
Copy link

lumobu commented Sep 20, 2017

I modified the code to accept also ZM values, e.g. shape.type = 15 (PolygonZ)
in preprocess.js (SHPParser.prototype.parseShape)
I added the shape.type 15 to case SHP.POLYGON, so ZM geometries are handled like normal Polygons.

Then I could not fix a multi part issue:
Loading of multi part geometries to my OpenLayers 3 Map is no problem, but I can not convert it correctly to WKT geometry in order to send the geometry to a SQL statement ('MULTIPOLYGON(((...)))'). The single parts are separated with single brackets like for donuts (holes), but not with double brackets like for multi parts.

correct multi part geometry with double brackets:
MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)), ((20 35, 10 30, 10 10, 30 5, 45 20, 20 35)))
correct donut geometry with single brackets:
MULTIPOLYGON (((20 35, 10 30, 10 10, 30 5, 45 20, 20 35), (30 20, 20 15, 20 25, 30 20)))

wrong result from shp2geojson:
MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40), (20 35, 10 30, 10 10, 30 5, 45 20, 20 35)))

Somebody has similar experiences? I need MULTIPOLYGON type and support of multi part, donuts and ZM values. Any ideas? Is it a bug?

Lucia

@adityadomakonda
Copy link

I found the same issue. The translation does not convert multiPolygons in a shape file to a GeoJson Multipolygon. This appears to be a bug. Can this be fixed please?

@the-villain
Copy link

Has anything be done on this topic? I ran into the same problem when reading a shape.zip-file.

Another converter correctly translates the data into a geojson multipolygon:

{ "type": "Feature", "properties": { "id": 22745422.0, "jahr": 2018, "btnr": "276073335010993", "slnr": "0042", "suna": 0, "sung": 0, "slfl": 3308, "bena": null, "erosion": "ccW1", "exte": null, "nuar": "843", "nutzung": "best.Rebf." }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 438820.377179712988436, 5499676.578428049571812 ], [ 438835.203070214018226, 5499714.028368099592626 ], [ 438835.933792842028197, 5499715.864978309720755 ], [ 438858.38432107801782, 5499706.857948659919202 ], [ 438886.831877611984964, 5499698.949071950279176 ], [ 438900.550243694975507, 5499706.416969849728048 ], [ 438962.277390454022679, 5499677.931921159848571 ], [ 439071.574323241016828, 5499635.604947189800441 ], [ 439084.19799250701908, 5499631.861122190020978 ], [ 439072.377153171983082, 5499588.164011799730361 ], [ 439043.146636357996613, 5499601.310067069716752 ], [ 438999.42977465497097, 5499615.831021130084991 ], [ 438990.086919921974186, 5499617.070001870393753 ], [ 438977.572197123023216, 5499617.423994019627571 ], [ 438970.344610690022819, 5499614.237176380120218 ], [ 438963.646866523020435, 5499606.44547399971634 ], [ 438952.36533917998895, 5499578.290653579868376 ], [ 438965.172378080023918, 5499574.585925769992173 ], [ 438981.208378079987597, 5499568.03692577034235 ], [ 438982.591886595997494, 5499566.272462540306151 ], [ 438983.444956274004653, 5499563.483292469754815 ], [ 438983.444082495989278, 5499563.482003410346806 ], [ 438927.725693240994588, 5499581.581048210151494 ], [ 438881.801695369009394, 5499596.26904753036797 ], [ 438863.208637124975212, 5499603.509068160317838 ], [ 438857.998012462980114, 5499605.53915738966316 ], [ 438858.781062507012393, 5499607.67134799994528 ], [ 438876.298719670972787, 5499654.862424430437386 ], [ 438820.377179712988436, 5499676.578428049571812 ] ] ], [ [ [ 438958.889383329020347, 5499585.601212779991329 ], [ 438968.580178692995105, 5499607.509570489637554 ], [ 438976.229853667027783, 5499614.972989239729941 ], [ 438993.78930591000244, 5499613.884952059946954 ], [ 439037.329305909981485, 5499599.894952059723437 ], [ 439071.698338767979294, 5499585.654942080378532 ], [ 439074.492628958018031, 5499584.797777440398932 ], [ 439063.032967070990708, 5499541.249745490029454 ], [ 439063.031680362008046, 5499541.249052460305393 ], [ 438989.801680362026673, 5499565.952052460052073 ], [ 438984.825357351975981, 5499571.665215279906988 ], [ 438974.304523228027392, 5499577.663120719604194 ], [ 438958.889383329020347, 5499585.601212779991329 ] ] ] ] } },

while shp2geojson.js makes a regular polygon out of it:

{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[8.152527837520736,49.64653240076539],[8.152727339175343,49.646870714197625],[8.152737173503628,49.64688730603637],[8.153049534501,49.646808575339676],[8.153444786012859,49.64674032753037],[8.153633629982485,49.64680888012124],[8.154493030328434,49.64655894302104],[8.15601344177649,49.64618931510771],[8.15618886808919,49.64615691894547],[8.156031937743961,49.64576272999462],[8.15562503866106,49.64587800885872],[8.155017281175272,49.646004187451794],[8.154887685461688,49.6460143859015],[8.154714295673562,49.64601630421953],[8.154614686612343,49.64598691228021],[8.154523133489057,49.64591615923657],[8.15437126571213,49.64566180418242],[8.15454922482732,49.64562978067254],[8.154772348819877,49.64557250306145],[8.154791785621127,49.64555677402562],[8.154804035214603,49.645531775524006],[8.154804023313213,49.64553176384234],[8.154029485001196,49.645688903703004],[8.153391130088142,49.645816352727735],[8.153132479263656,49.64587958339193],[8.153059993190315,49.645897313343426],[8.153070506077718,49.6459165687963],[8.153305771913393,49.646342762086164],[8.152527837520736,49.64653240076539]],[[8.154460487279314,49.64572821255422],[8.154591296256623,49.64592622826899],[8.15469608529614,49.64599412506083],[8.154939461078706,49.64598611504941],[8.1555446863239,49.645864694201066],[8.15602292602041,49.645740095817075],[8.156061761289152,49.64573266890868],[8.155909812517042,49.64533985699596],[8.15590979480354,49.64533985063318],[8.154891693530457,49.64555462131413],[8.1548218802488,49.64560550025253],[8.15467522901519,49.64565837935968],[8.154460487279314,49.64572821255422]]]},"properties":{"id":"22745422","jahr":"2018","btnr":"276073335010993","slnr":"0042","suna":"0","sung":"0","slfl":"3308","bena":"","erosion":"ccW1","exte":"","nuar":"843","nutzung":"best.Rebf."}},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants