<div dir="ltr">
<div>Dear all,</div><div><br></div><div>
<p>I have a headache inducing problem. Whenever I try to convert a GeoJSON feature collection which contains
multiple different geometry shapes (i.e. polygon, linestring and point)
I get this type of error:</p>
<blockquote>
<p>"ERROR 1: Attempt to write non-polygon (LINESTRING) geometry to
POLYGON type shapefile.\nERROR 1: Unable to write feature 1 from layer
OGRGeoJSON.\nERROR 1: Terminating translation prematurely after
failed\ntranslation of layer OGRGeoJSON (use -skipfailures to skip
errors)\n"</p>
</blockquote>
<p>This is the sample GeoJSON I'm trying to convert:</p>
<p><code></code><font size="2"><span style="font-family:times new roman,serif">{<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>}</span></font></p><p><br></p>
<p>I validated the GeoJSON on <a href="http://geojsonlint.com/" rel="nofollow" target="_blank">geojsonlint</a> and it's all good. It happens every time I have a stack of different geometry types. It happens using <a href="http://ogre.adc4gis.com" target="_blank">ogre.adc4gis.com</a>
or ogr2ogr. It happens in the opposite way also and when I use the
skipfailure option I just get the first feature in my shapefile.</p><p>Any ideas what's going on?<br></p><p><br></p><p>Thanks!</p><p><br></p><p>Chris</p></div>
</div>