Wrong Multipolygon
mindflayer opened this issue · 5 comments
mindflayer commented
Hi there, I am reading a shapefile with pyshp
:
sf = shapefile.Reader(os.path.join(cwd, shapefile_name))
for i in range(3):
print(pygeoif.as_shape(sf.shape(i)).wkt)
The print
result is the following one, with three single Polygon
:
POLYGON((10.225265936197262 52.55248772818054, 10.2245 52.5526, 10.239898977006918 52.587244203792714, 10.257158479683646 52.626074168135474, 10.852814795836748 53.96616570784997, 10.869259391910935 54.00316231726286, 10.8855 54.0397, 10.886403440289543 54.0395673568947, 13.6072 53.6401, 13.588449967690627 53.603121815044084, 12.878710662659484 52.20339775809922, 12.8599 52.1663, 10.225265936197262 52.55248772818054))
POLYGON((4.994589472083415 51.136294699609905, 4.99387 51.1364, 5.009205610686967 51.17282464256336, 5.024854148511461 51.20999253946237, 5.590074308333594 52.552485036916316, 5.605067138274774 52.58809551782692, 5.62111 52.6262, 5.621949238159022 52.626076986136376, 8.26066 52.2393, 8.24233115618 52.20101287449061, 7.570667393061582 50.79797430581851, 7.55335 50.7618, 4.994589472083415 51.136294699609905))
POLYGON((11.174866239143656 51.13628785575964, 11.1741 51.1364, 11.1904078402353 51.175130145676, 11.205089843196898 51.20999902501951, 11.770362674077559 52.55248820634584, 11.7850061463172 52.58726557752808, 11.8014 52.6262, 11.802253839101338 52.62607484358844, 14.4409 52.2393, 14.422065104984824 52.19995522778889, 13.751660545626997 50.79952721075059, 13.7336 50.7618, 11.174866239143656 51.13628785575964))
Now, I am using pygeoif
to create a Multipolygon
with these given Polygon
:
m = pygeoif.MultiPolygon(sf.shapes())
print(m.wkt)
and the result is broken (missing comma separation).
MULTIPOLYGON(((10.225265936197262 52.55248772818054, 10.2245 52.5526, 10.239898977006918 52.587244203792714, 10.257158479683646 52.626074168135474, 10.852814795836748 53.96616570784997, 10.869259391910935 54.00316231726286, 10.8855 54.0397, 10.886403440289543 54.0395673568947, 13.6072 53.6401, 13.588449967690627 53.603121815044084, 12.878710662659484 52.20339775809922, 12.8599 52.1663, 10.225265936197262 52.55248772818054))((4.994589472083415 51.136294699609905, 4.99387 51.1364, 5.009205610686967 51.17282464256336, 5.024854148511461 51.20999253946237, 5.590074308333594 52.552485036916316, 5.605067138274774 52.58809551782692, 5.62111 52.6262, 5.621949238159022 52.626076986136376, 8.26066 52.2393, 8.24233115618 52.20101287449061, 7.570667393061582 50.79797430581851, 7.55335 50.7618, 4.994589472083415 51.136294699609905))((11.174866239143656 51.13628785575964, 11.1741 51.1364, 11.1904078402353 51.175130145676, 11.205089843196898 51.20999902501951, 11.770362674077559 52.55248820634584, 11.7850061463172 52.58726557752808, 11.8014 52.6262, 11.802253839101338 52.62607484358844, 14.4409 52.2393, 14.422065104984824 52.19995522778889, 13.751660545626997 50.79952721075059, 13.7336 50.7618, 11.174866239143656 51.13628785575964)))
If I add comma as separator, I get this:
MULTIPOLYGON(((10.225265936197262 52.55248772818054, 10.2245 52.5526, 10.239898977006918 52.587244203792714, 10.257158479683646 52.626074168135474, 10.852814795836748 53.96616570784997, 10.869259391910935 54.00316231726286, 10.8855 54.0397, 10.886403440289543 54.0395673568947, 13.6072 53.6401, 13.588449967690627 53.603121815044084, 12.878710662659484 52.20339775809922, 12.8599 52.1663, 10.225265936197262 52.55248772818054)),((4.994589472083415 51.136294699609905, 4.99387 51.1364, 5.009205610686967 51.17282464256336, 5.024854148511461 51.20999253946237, 5.590074308333594 52.552485036916316, 5.605067138274774 52.58809551782692, 5.62111 52.6262, 5.621949238159022 52.626076986136376, 8.26066 52.2393, 8.24233115618 52.20101287449061, 7.570667393061582 50.79797430581851, 7.55335 50.7618, 4.994589472083415 51.136294699609905)),((11.174866239143656 51.13628785575964, 11.1741 51.1364, 11.1904078402353 51.175130145676, 11.205089843196898 51.20999902501951, 11.770362674077559 52.55248820634584, 11.7850061463172 52.58726557752808, 11.8014 52.6262, 11.802253839101338 52.62607484358844, 14.4409 52.2393, 14.422065104984824 52.19995522778889, 13.751660545626997 50.79952721075059, 13.7336 50.7618, 11.174866239143656 51.13628785575964)))
mindflayer commented
cleder commented
Thanks I look into it ASAP (as possible means I cannot do it before easter)
mindflayer commented
I forked the repo and I'm building our production package using my fork. No worries.
Keep in mind that the module is really broken, preventing people to use it
for almost anything that is more complex than a demo, and I've already
fixed the problem, so you only need to check it out.
Thanks for the consideration.
Giorgio
Il 15 mar 2017 6:20 PM, "Christian Ledermann" <notifications@github.com> ha
scritto:
… Thanks I look into it ASAP (as possible means I cannot do it before easter)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#14 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAgL3SvC-xtUe2Lxc1gYvSFk7qPbpyBlks5rmB3QgaJpZM4Mdr7s>
.
mindflayer commented
Hi @cleder, any news?
cleder commented
Published 0.7 on pypi