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

Bryan Keith bryan at geomega.com
Sun Apr 8 19:16:03 EDT 2007


Offlist I sent some files to Lennox.  Now, however, I don't think this 
is a problem with the ogr2ogr conversion, definitely not a problem with 
the line length that I wondered about earlier.

I have a kml (~1MB) that illustrates the problem.  I'll be happy to send 
it to anyone, but I think I'll search around and post a question to a 
google earth group.

Bryan

Lennox Antoine wrote:
> Can you supply one of the problematic polygon coordlist? I haven't run into
> any problems with complex polygons (without holes), so I don't know what
> could be the problem off hand without trying it.
> 
> -Lennox
> 
> On 4/8/07, Bryan Keith <bryan at geomega.com> wrote:
>> Lennox,
>>
>> I got your suggestion to work for polygons that weren't giving me
>> problems, but it did not change anything for the problematic polygons.
>>
>> Bryan
>>
>> Lennox Antoine wrote:
>>> You are probably experiencing a tesselation problem. Here is a polygon
>>> template I normally use for filling complex polygons in GE. Note the
>>> tesselation attribute, and how to use it.
>>>
>>> <Polygon>
>>>   <extrude>0</extrude>
>>>   <altitudeMode>clampToGround</altitudeMode>
>>>   <tessellate>1</tessellate>
>>>   <outerBoundaryIs>
>>>      <LinearRing><coordinates></coordinates></LinearRing>
>>>   </outerBoundaryIs>
>>> </Polygon>
>>>
>>> <Style>
>>>   <LineStyle>
>>>     <color></color>
>>>     <width></width>
>>>   </LineStyle>
>>>   <PolyStyle>
>>>     <fill>1</fill>
>>>     <color></color>
>>>   </PolyStyle>
>>> </Style>
>>>
>>> -Lennox
>>>
>>> On 4/8/07, Bryan Keith <bryan at geomega.com> wrote:
>>>> 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
>>>>
>>>> _______________________________________________
>>>> FWTools mailing list
>>>> FWTools at lists.maptools.org
>>>> http://lists.maptools.org/mailman/listinfo/fwtools
>>>> http://fwtools.maptools.org/
>>>>
> 


More information about the FWTools mailing list