Christian Ledermann
2012-11-13 09:37:57 UTC
I want to parse a kml like :
<kml:MultiGeometry xmlns:kml="http://www.opengis.net/kml/2.2">
<kml:Polygon>
<kml:outerBoundaryIs>
<kml:LinearRing>
<kml:coordinates>3.000000,0.000000 4.000000,0.000000
4.000000,1.000000 3.000000,0.000000</kml:coordinates>
</kml:LinearRing>
</kml:outerBoundaryIs>
</kml:Polygon>
<kml:Point>
<kml:coordinates>0.000000,1.000000</kml:coordinates>
</kml:Point>
<kml:LineString>
<kml:coordinates>0.000000,0.000000 1.000000,1.000000</kml:coordinates>
</kml:LineString>
</kml:MultiGeometry>
into a shapely geometry
I tried
po = Polygon([(3,0), (4,0), (4,1), (3,0)])
l = LineString([(0,0), (1,1)])
p = Point(0,1)
g = GeometryCollection([po,p,l])
which fails with:
TypeError: __init__() takes exactly 1 argument (2 given)
and
geo_if = {'type': 'GeometryCollection', 'geometries': [
po.__geo_interface__, l.__geo_interface__,
p.__geo_interface__ ]}
g = asShape(geo_if)
which fails with:
ValueError: Unknown geometry type: geometrycollection
How can I create a GeometryCollection?
--
Best Regards,
Christian Ledermann
Nairobi - Kenya
Mobile : +254 702978914
<*)))>{
If you save the living environment, the biodiversity that we have left,
you will also automatically save the physical environment, too. But If
you only save the physical environment, you will ultimately lose both.
1) Don?t drive species to extinction
2) Don?t destroy a habitat that species rely on.
3) Don?t change the climate in ways that will result in the above.
}<(((*>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gispython.org/pipermail/community/attachments/20121113/903e1391/attachment.htm>
<kml:MultiGeometry xmlns:kml="http://www.opengis.net/kml/2.2">
<kml:Polygon>
<kml:outerBoundaryIs>
<kml:LinearRing>
<kml:coordinates>3.000000,0.000000 4.000000,0.000000
4.000000,1.000000 3.000000,0.000000</kml:coordinates>
</kml:LinearRing>
</kml:outerBoundaryIs>
</kml:Polygon>
<kml:Point>
<kml:coordinates>0.000000,1.000000</kml:coordinates>
</kml:Point>
<kml:LineString>
<kml:coordinates>0.000000,0.000000 1.000000,1.000000</kml:coordinates>
</kml:LineString>
</kml:MultiGeometry>
into a shapely geometry
I tried
po = Polygon([(3,0), (4,0), (4,1), (3,0)])
l = LineString([(0,0), (1,1)])
p = Point(0,1)
g = GeometryCollection([po,p,l])
which fails with:
TypeError: __init__() takes exactly 1 argument (2 given)
and
geo_if = {'type': 'GeometryCollection', 'geometries': [
po.__geo_interface__, l.__geo_interface__,
p.__geo_interface__ ]}
g = asShape(geo_if)
which fails with:
ValueError: Unknown geometry type: geometrycollection
How can I create a GeometryCollection?
--
Best Regards,
Christian Ledermann
Nairobi - Kenya
Mobile : +254 702978914
<*)))>{
If you save the living environment, the biodiversity that we have left,
you will also automatically save the physical environment, too. But If
you only save the physical environment, you will ultimately lose both.
1) Don?t drive species to extinction
2) Don?t destroy a habitat that species rely on.
3) Don?t change the climate in ways that will result in the above.
}<(((*>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gispython.org/pipermail/community/attachments/20121113/903e1391/attachment.htm>