title: Use python to pick out and delete features with less than 3 coordinates in geojson
body: <p>I have a GeoJSON file containing 100s of features.
  Some of them I have noticed are only linestrings and not polygons.</p>
  <p>I'd like to write a python code to pick out and delete the features which have less than 3 coordinates in the geojson file, but I'm unsure how to do this.</p>
  <p>I know I need a <code>for</code> and <code>if</code> loop, so I have gotten this far, but can't work out how to specify the less than 3 coordinates part.</p>
  <pre><code>import json
  
     file = open('file.geojson', 'r')
     data = json.load(file)
     
     for i in data['features']:
  </code></pre>
  <p>File example</p>
  <pre><code>&quot;crs&quot;: { &quot;type&quot;: &quot;name&quot;, &quot;properties&quot;: { &quot;name&quot;: &quot;urn:ogc:def:crs:OGC:1.3:CRS84&quot; } },
  &quot;features&quot;: [{ &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;62&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref36&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDbPolyline&quot;, &quot;EntityHandle&quot;: &quot;22002&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.887936622094115, 54.618954147445741, -7.3 ], [ -5.88753172216424, 54.61894917351524, -7.3 ], [ -5.887440778252523, 54.620769155685082, -7.3 ], [ -5.887526655330053, 54.62244565276194, -7.3 ], [ -5.887453014956853, 54.623926916256401, -7.3 ], [ -5.887450787638267, 54.623971716263107, -7.3 ], [ -5.890522161350234, 54.622828812872726, -7.3 ], [ -5.890547531832277, 54.622772167816805, -7.3 ], [ -5.890272672621835, 54.622673266966245, -7.3 ], [ -5.889545615138673, 54.62195303872921, -7.3 ], [ -5.888956059094582, 54.620953546743664, -7.3 ], [ -5.888904608649223, 54.619870645137233, -7.3 ], [ -5.888966440862339, 54.618559225436805, -7.3 ], [ -5.889037595793397, 54.61838849149008, -7.3 ], [ -5.889291687862707, 54.617690949111768, -7.3 ], [ -5.888927897852784, 54.617621015725618, -7.3 ], [ -5.889790161477309, 54.616110299708147, -7.3 ], [ -5.890229803751783, 54.616194813948539, -7.3 ], [ -5.889166141692859, 54.614995773327962, -7.3 ], [ -5.889268056138125, 54.612912234383849, -7.3 ], [ -5.888868667420563, 54.612693308366403, -7.3 ], [ -5.888335798340909, 54.612548305797212, -7.3 ], [ -5.888275590411526, 54.614056230303071, -7.3 ], [ -5.88773110071378, 54.614048542306797, -7.3 ], [ -5.887608025100007, 54.614438880590328, -7.3 ], [ -5.88811887231485, 54.61444779687001, -7.3 ], [ -5.888047190821367, 54.616220363648253, -7.3 ], [ -5.888016758159484, 54.616972852041378, -7.3 ], [ -5.887936622094115, 54.618954147445741, -7.3 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;63&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref52-&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;EntityHandle&quot;: &quot;2277C&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.881052020169729, 54.62981311635351, -11.3 ], [ -5.880730650147907, 54.629666620207963, -2.5 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;64&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref51&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;EntityHandle&quot;: &quot;22780&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.880345087067367, 54.630343524687945, -11.3 ], [ -5.880019591844672, 54.630200137059965, -2.5 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;65&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref52&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;EntityHandle&quot;: &quot;22784&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.882115562941912, 54.629008362012357, -11.3 ], [ -5.881682322682144, 54.628946521181796, -2.5 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;66&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref51&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;EntityHandle&quot;: &quot;22788&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.878970095400486, 54.631016245634285, -2.5 ], [ -5.879300166872021, 54.631156079664251, -11.3 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;67&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref51&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;EntityHandle&quot;: &quot;2278C&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.879280661325875, 54.631221212929972, -9.1 ], [ -5.878981327386499, 54.631181892876789, -2.5 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;68&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref51&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;EntityHandle&quot;: &quot;22790&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.878799035939746, 54.631790591657015, -2.5 ], [ -5.878946789814882, 54.632336072795887, -9.1 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;69&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref45&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;Linetype&quot;: &quot;Continuous&quot;, &quot;EntityHandle&quot;: &quot;22B71&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.890809531248387, 54.622760260593964, -12.95 ], [ -5.890547531832277, 54.622772167816805, -7.3 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;70&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref45&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;Linetype&quot;: &quot;Continuous&quot;, &quot;EntityHandle&quot;: &quot;22B76&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.890902513361069, 54.622552653352464, -12.95 ], [ -5.890272672621835, 54.622673266966245, -7.3 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;71&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref45&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;Linetype&quot;: &quot;Continuous&quot;, &quot;EntityHandle&quot;: &quot;22B7A&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.891851404312894, 54.622693053783095, -12.95 ], [ -5.892008147615435, 54.622712645859941, -7.5 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;72&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref45&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;Linetype&quot;: &quot;Continuous&quot;, &quot;EntityHandle&quot;: &quot;22B7E&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.891757679145733, 54.622901544278882, -12.95 ], [ -5.891880590876987, 54.622996396162321, -7.5 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;73&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref45&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;Linetype&quot;: &quot;Continuous&quot;, &quot;EntityHandle&quot;: &quot;22B82&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.891757679145733, 54.622901544278882, -12.95 ], [ -5.891862839872977, 54.623018746748407, -9.3 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;74&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref45&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;Linetype&quot;: &quot;Continuous&quot;, &quot;EntityHandle&quot;: &quot;22B86&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.890809531248387, 54.622760260593964, -12.95 ], [ -5.890663880060426, 54.62284008972955, -9.3 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;75&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref10&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;EntityHandle&quot;: &quot;22F44&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.910798253998712, 54.611243048089676, -5.5 ], [ -5.910722703306485, 54.611234855196507, -6.0 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;76&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref10&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;Linetype&quot;: &quot;Continuous&quot;, &quot;EntityHandle&quot;: &quot;22F51&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.909063847930645, 54.611274900827347, -6.0 ], [ -5.909050209923891, 54.611284442275362, -6.400000000202057 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;77&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref12&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;Linetype&quot;: &quot;Continuous&quot;, &quot;EntityHandle&quot;: &quot;22F58&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.901395955548104, 54.616256186068412, -6.4 ], [ -5.901224182653579, 54.6163786067251, -9.1 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;78&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref19&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;Linetype&quot;: &quot;Continuous&quot;, &quot;EntityHandle&quot;: &quot;22F63&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.910932182938841, 54.612974676924125, -4.0 ], [ -5.910959735727921, 54.612901648194558, -6.4 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;79&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref16&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;Linetype&quot;: &quot;Continuous&quot;, &quot;EntityHandle&quot;: &quot;22F67&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.912204715032693, 54.612763136939328, -6.4 ], [ -5.912292471798091, 54.612802991249943, -4.0 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;80&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref16&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;Linetype&quot;: &quot;Continuous&quot;, &quot;EntityHandle&quot;: &quot;22F6B&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.913153166931155, 54.612994531162059, -6.4 ], [ -5.913083077761696, 54.613044796044548, -4.0 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;81&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref16&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;Linetype&quot;: &quot;Continuous&quot;, &quot;EntityHandle&quot;: &quot;22F6F&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.91328153391156, 54.612992411198732, -8.5 ], [ -5.913149061172596, 54.61308628063238, -4.0 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;82&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref1&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;Linetype&quot;: &quot;Continuous&quot;, &quot;EntityHandle&quot;: &quot;22F73&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.913634538565916, 54.613157762575192, -8.5 ], [ -5.91350332790106, 54.613252687577841, -4.0 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;83&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref19&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDb3dPolyline&quot;, &quot;Linetype&quot;: &quot;Continuous&quot;, &quot;EntityHandle&quot;: &quot;22F80&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.91009718855703, 54.613131738487034, -4.000000000071991 ], [ -5.909919047530581, 54.613097285060839, -6.399999999902643 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;84&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref60&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDbPolyline&quot;, &quot;EntityHandle&quot;: &quot;E58EA&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.775160638198986, 54.694417134728809, -9.6 ], [ -5.77114162233595, 54.695772598663574, -9.6 ], [ -5.76283339864894, 54.698574565809153, -9.6 ], [ -5.759686539936373, 54.695443498589412, -9.6 ], [ -5.767993867108963, 54.692642102771394, -9.6 ], [ -5.773785476803047, 54.692595379393715, -9.6 ], [ -5.775160638198986, 54.694417134728809, -9.6 ] ] } },
  { &quot;type&quot;: &quot;Feature&quot;,&quot;id&quot;:&quot;85&quot;,&quot;properties&quot;: { &quot;Layer&quot;: &quot;Ref38&quot;, &quot;SubClasses&quot;: &quot;AcDbEntity:AcDbPolyline&quot;, &quot;EntityHandle&quot;: &quot;1461A8&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;LineString&quot;, &quot;coordinates&quot;: [ [ -5.893508789864172, 54.612251967302818, -6.4 ], [ -5.893117446685634, 54.612512719236747, -6.4 ] ] } }
  ]
  }
  </code></pre>