4

我正在运行以下命令将 kml 文件转换为 geojson:

$ ogr2ogr -f GeoJSON geojson.json doc.kml -nln test -append

在 KML 样式中如下所示:

    <Document id="Point" xsi:schemaLocation="http://www.opengis.net/kml/2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd http://www.google.com/kml/ext/2.2 http://code.google.com/apis/kml/schema/kml22gx.xsd">
            <name>Point</name>
            <Snippet maxLines="0"></Snippet>
            <Style id="IconStyleOne">
                    <IconStyle>
                            <scale>0.8125</scale>
                            <Icon>
                                    <href>images/one.png</href>
                            </Icon>
                    </IconStyle>
                    <LabelStyle>
                            <color>00000000</color>
                            <scale>0</scale>
                    </LabelStyle>
                    <PolyStyle>
                            <color>ff000000</color>
                            <outline>0</outline>
                    </PolyStyle>
            </Style>
            <Style id="IconStyleTwo">
                    <IconStyle>
                            <Icon>
                                    <href>images/two.png</href>
                            </Icon>
                    </IconStyle>
                    <LabelStyle>
                            <color>00000000</color>
                            <scale>0</scale>
                    </LabelStyle>
                    <PolyStyle>
                            <color>ff000000</color>
                            <outline>0</outline>
                    </PolyStyle>
            </Style>

该层如下所示:

            <Folder id="FeatureLayer0">
                    <name>City</name>
                    <Snippet maxLines="0"></Snippet>
                    <Placemark id="ID_00000">
                            <name>NameOne</name>
                            <Snippet maxLines="0"></Snippet>
                            <description>Some desc</description>
                            <styleUrl>#IconStyleOne</styleUrl>
                            <Point>
                                    <coordinates>2,2,0</coordinates>
                            </Point>
                    </Placemark>

但是当我转换样式时完全丢失了:

{
"type": "FeatureCollection",

"features": [
{ 
  "type": "Feature", 
  "properties": { 
    "Name": "NameOne",     
    "Description": "Some desc", 
    "geometry": { 
      "type": "Point", 
      "coordinates": [ 2, 2, 0.0 ] 
    } 
  }
}

有什么方法可以参考geojson中的样式吗?

4

0 回答 0