<div dir="ltr"><div>Thanks for the prompt answers! Ok, it's clear now on what's the problem here.</div><div>Is there a way I can iterate through a .zip file containing individual .shp files, each file with its own geometry type (point, line, polygon), using <a href="http://ogre.adc4gis.com">ogre.adc4gis.com</a> API? I could then append each feature to a geojson feature class and show it to the user. If
<a href="http://ogre.adc4gis.com">ogre.adc4gis.com</a> doesn't work I can try to run ogr2ogr in my app so suggestions in that way are helpful also.</div><div><br></div><div>Thanks,</div><div><br></div><div>Chris<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">pet, 29. stu 2019. u 09:28 jratike80 <<a href="mailto:jukka.rahkonen@maanmittauslaitos.fi">jukka.rahkonen@maanmittauslaitos.fi</a>> napisao je:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
You just can't save lines and polygons into same shapefile. Read<br>
<a href="https://www.esri.com/library/whitepapers/pdfs/shapefile.pdf" rel="noreferrer" target="_blank">https://www.esri.com/library/whitepapers/pdfs/shapefile.pdf</a> "All the<br>
non-Null shapes in a shapefile are required to be of the same shape type."<br>
<br>
<br>
-Jukka Rahkonen-<br>
<br>
<br>
Kristijan Cindrić wrote<br>
> Dear all,<br>
> <br>
> I have a headache inducing problem. Whenever I try to convert a GeoJSON<br>
> feature collection which contains multiple different geometry shapes (i.e.<br>
> polygon, linestring and point) I get this type of error:<br>
> <br>
> "ERROR 1: Attempt to write non-polygon (LINESTRING) geometry to POLYGON<br>
> type shapefile.\nERROR 1: Unable to write feature 1 from layer<br>
> OGRGeoJSON.\nERROR 1: Terminating translation prematurely after<br>
> failed\ntranslation of layer OGRGeoJSON (use -skipfailures to skip<br>
> errors)\n"<br>
> <br>
> This is the sample GeoJSON I'm trying to convert:<br>
> <br>
> {<br>
> "type": "FeatureCollection",<br>
> "features": [{<br>
> "type": "Feature",<br>
> "properties": {},<br>
> "geometry": {<br>
> "type": "Polygon",<br>
> "coordinates": [<br>
> [<br>
> [31.816406250000004, 55.27911529201564],<br>
> [34.27734375000001, 51.944264879028765],<br>
> [43.94531250000001, 51.944264879028765],<br>
> [46.93359375000001, 58.35563036280967],<br>
> [40.42968750000001, 60.1524422143808],<br>
> [34.45312500000001, 59.085738569819505],<br>
> [31.816406250000004, 55.27911529201564]<br>
> ]<br>
> ]<br>
> }<br>
> }, {<br>
> "type": "Feature",<br>
> "properties": {},<br>
> "geometry": {<br>
> "type": "LineString",<br>
> "coordinates": [<br>
> [0.5273437500000001, 21.289374355860424],<br>
> [30.585937500000004, 20.632784250388028]<br>
> ]<br>
> }<br>
> }, {<br>
> "type": "Feature",<br>
> "properties": {},<br>
> "geometry": {<br>
> "type": "Point",<br>
> "coordinates": [14.062500000000002, 50.064191736659104]<br>
> }<br>
> }]<br>
> }<br>
> <br>
> <br>
> I validated the GeoJSON on geojsonlint <<a href="http://geojsonlint.com/>" rel="noreferrer" target="_blank">http://geojsonlint.com/></a>; and<br>
> it's<br>
> all good. It happens every time I have a stack of different geometry<br>
> types.<br>
> It happens using <a href="http://ogre.adc4gis.com" rel="noreferrer" target="_blank">ogre.adc4gis.com</a> or ogr2ogr. It happens in the opposite<br>
> way also and when I use the skipfailure option I just get the first<br>
> feature<br>
> in my shapefile.<br>
> <br>
> Any ideas what's going on?<br>
> <br>
> <br>
> Thanks!<br>
> <br>
> <br>
> Chris<br>
> <br>
> _______________________________________________<br>
> gdal-dev mailing list<br>
<br>
> gdal-dev@.osgeo<br>
<br>
> <a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
<br>
<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html" rel="noreferrer" target="_blank">http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html</a><br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a></blockquote></div>