我有一个geojson文件。此文件包含行字符串列表。我想从这个列表中创建多边形。但每个线串都是一个特征,我不知道哪个线串创建了具体的多边形。注意-文件包含不创建多边形的linestring。如何在python中从该列表创建多边形?
谢谢
以下是源geojson文件的示例:
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4608" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.221220950217189, 50.402385261904207, 0.0 ], [ 13.22153156591205, 50.402482799654649, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4609" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.221220950217189, 50.402385261904207, 0.0 ], [ 13.22133755383933, 50.402232016707117, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "460A" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.221734958434849, 50.40254665166141, 0.0 ], [ 13.221220950217189, 50.402385261904207, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "460B" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.22185150756343, 50.402393475850303, 0.0 ], [ 13.221734958434849, 50.40254665166141, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "460C" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.22133755383933, 50.402232016707117, 0.0 ], [ 13.22185150756343, 50.402393475850303, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "460D" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.22291033809379, 50.40282492699145, 0.0 ], [ 13.222895393557071, 50.402844559529669, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "460E" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.223033588941, 50.402863642240689, 0.0 ], [ 13.22291033809379, 50.40282492699145, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "460F" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.223018644443661, 50.402883274794704, 0.0 ], [ 13.223033588941, 50.402863642240689, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4610" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.222895393557071, 50.402844559529669, 0.0 ], [ 13.223018644443661, 50.402883274794704, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4611" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.222895393557071, 50.402844559529669, 0.0 ], [ 13.22288044900805, 50.402864192065778, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4612" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.223018644443661, 50.402883274794704, 0.0 ], [ 13.222895393557071, 50.402844559529669, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4613" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.22300369993404, 50.402902907346707, 0.0 ], [ 13.223018644443661, 50.402883274794704, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4614" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.22288044900805, 50.402864192065778, 0.0 ], [ 13.22300369993404, 50.402902907346707, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4615" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.223204825873809, 50.402856679802063, 0.0 ], [ 13.22318988144989, 50.402876312378339, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4616" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.2232738035546, 50.402878346693967, 0.0 ], [ 13.223204825873809, 50.402856679802063, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4617" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.22325885915274, 50.40289797927916, 0.0 ], [ 13.2232738035546, 50.402878346693967, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4618" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.22318988144989, 50.402876312378339, 0.0 ], [ 13.22325885915274, 50.40289797927916, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4619" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.222787087444059, 50.402786211612217, 0.0 ], [ 13.222757198279551, 50.40282547665489, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "461A" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.22291033809379, 50.40282492699145, 0.0 ], [ 13.222787087444059, 50.402786211612217, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "461B" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.22288044900805, 50.402864192065778, 0.0 ], [ 13.22291033809379, 50.40282492699145, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "461C" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.222757198279551, 50.40282547665489, 0.0 ], [ 13.22288044900805, 50.402864192065778, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "461D" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.223159038334259, 50.40292017970603, 0.0 ], [ 13.22314409387173, 50.402939812276081, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "461E" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.22322801608748, 50.402941846625133, 0.0 ], [ 13.223159038334259, 50.40292017970603, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "461F" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.223213071646979, 50.402961479204023, 0.0 ], [ 13.22322801608748, 50.402941846625133, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4620" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.22314409387173, 50.402939812276081, 0.0 ], [ 13.223213071646979, 50.402961479204023, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4621" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.22301907990558, 50.40270786193026, 0.0 ], [ 13.22300413545018, 50.402727494483138, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4622" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.223088057288001, 50.40272952893168, 0.0 ], [ 13.22301907990558, 50.40270786193026, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4623" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.22307311285466, 50.402749161493418, 0.0 ], [ 13.223088057288001, 50.40272952893168, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4624" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.22300413545018, 50.402727494483138, 0.0 ], [ 13.22307311285466, 50.402749161493418, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4625" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.222937768713861, 50.402682320586521, 0.0 ], [ 13.22292282423251, 50.402701953128961, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4626" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.223006746023399, 50.402703987635981, 0.0 ], [ 13.222937768713861, 50.402682320586521, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4627" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.222991801564049, 50.402723620187217, 0.0 ], [ 13.223006746023399, 50.402703987635981, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4628" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.22292282423251, 50.402701953128961, 0.0 ], [ 13.222991801564049, 50.402723620187217, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "4629" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.22294218071627, 50.402808884313963, 0.0 ], [ 13.22292723619773, 50.40282851685631, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "462A" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.22301115821211, 50.402830551360971, 0.0 ], [ 13.22294218071627, 50.402808884313963, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "462B" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.222996213715611, 50.402850183912207, 0.0 ], [ 13.22301115821211, 50.402830551360971, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "462C" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.22292723619773, 50.40282851685631, 0.0 ], [ 13.222996213715611, 50.402850183912207, 0.0 ] ] } },
{ "type": "Feature", "properties": { "Layer": "foamglas_krovak_komplet", "SubClasses": "AcDbEntity:AcDbLine", "EntityHandle": "462D" }, "geometry": { "type": "LineString", "coordinates": [ [ 13.22288192851566, 50.402661619534953, 0.0 ], [ 13.222757198279551, 50.40282547665489, 0.0 ] ] } },
1条答案
按热度按时间lymgl2op1#
你可以尝试使用
polygonize
. 这将创建由线字符串包围的多边形。