<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>