Running a GDAL command

 ogr2ogr -f "KML" test.kml test.shp 

to convert a shapefile to a kml file. The issue I am having is that the info window is being converted into tags which do not turn into info windows on KML. I can certainly parse through these files and create the new tags with info pulled from SimpleData, but if this is possible on conversion it would be nice. Also the polygon seems to be missing its fill coming from Shapefile.

https://sites.google.com/site/gmaptest123/kml/test.kml?attredirects=0&d=1
有帮助吗?

解决方案

The <PolyStyle> in your KML is set to 0 if you change it to 1 it will fill. The PolyStyle also lets you set the color and opacity of the polygon.

<Style>
  <LineStyle>
    <color>ff0000ff</color>
  </LineStyle>
  <PolyStyle>
    <fill>0</fill>
  </PolyStyle>
</Style>

For the data in the infowindows, you can add a <name> and <description> tag to each Placemark, that will appear in the infowindow. If you have a lot of Polygons, doing that manually might be painful, not sure without looking at your input files why that didn't get generated automatically.

your original polygon

my local copy

with fill 1

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top