[FWTools] ogr2ogr shp --> kml conversion failing on some complicated polygons

Bryan Keith bryan at geomega.com
Sun Apr 8 17:11:32 EDT 2007


Hello,

I have a shapefile with a single record, a polygon shape.  I tried 
attaching the shapefile to this e-mail, but the server didn't like it. 
I'll gladly e-mail the shapefile to anyone who's willing to look into 
this.  It's ~722KB.  I can convert the shapefile to kml like this:

ogr2ogr -f kml testblm_py.kml testblm_py.shp

When I look at the kml in Google Earth, it looks fine.  The outline of
the shapefile shows up as a red line which, I guess, is the default for
ogr2ogr kml output.  However, I want to see filled polygons so I replace
part of the "style" line in the kml like this:

cat testblm_py.kml | sed "s/<fill>0<\/fill>/<color>ff37d9f0<\/color>/" >
testblmfill_py.kml

The shaded area does not show up correctly in Google Earth.  It shows up
as lots of vertical striped areas within the polygon.

My actual workflow is a fair bit different from what I've described
here, but I've tried to boil the problem down to a simple example.  I
realize, however, that this polygon is not simple.  I'm processing over
10000 land ownership polygons in Utah, and I'm only having a problem
with a few of the big, complicated polygons.

I'm wondering if it might be a problem with the line length in the kml,
but I'm not sure.  I'm still doing some testing.  Any ideas are appreciated.

Bryan



More information about the FWTools mailing list