Opened 11 years ago

Closed 11 years ago

#4883 closed defect (fixed)

libkml can't read own output

Reported by: 45136 Owned by: warmerdam
Priority: normal Milestone: 1.9.3
Component: OGR_SF Version: 1.9.2
Severity: normal Keywords: libkml
Cc: winkey, Even Rouault

Description

I have made the following simple kml file named kmltest.kml:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
	<name>kmltest.kml</name>
	<Folder>
		<name>testlayer</name>
		<Placemark>
			<name>Test point</name>
			<styleUrl>#L_WB</styleUrl>
			<ExtendedData>
				<Data name="System">
					<displayName>System</displayName>
					<value>foobar</value>
				</Data>
			</ExtendedData>
        <Point>
            <coordinates>36.1,36.2,0</coordinates>
        </Point>
		</Placemark>
	</Folder>
</Document>
</kml>

and performed the following operation with gdal 1.9.2 and libkml driver:

ogr2ogr -f libkml kmlexport.kml kmltest.kml
ogr2ogr -f libkml kmlexport2.kml kmlexport.kml

kmlexport has the following ExtendedData:

        <ExtendedData>
          <SchemaData schemaUrl="#testlayer.schema">
            <SimpleData name="System">
foobar            </SimpleData>
          </SchemaData>
        </ExtendedData>

(which is correct), but the second output looks like this:

<kml>
  <Document>
    <Schema id="testlayer.schema">
      <SimpleField name="" type="string"/>
    </Schema>
    <Document>
      <name>testlayer</name>
      <Placemark>
        <name>Test point</name>
        <styleUrl>#L_WB</styleUrl>
        <Point>
          <coordinates>
            36.1,36.2,0
          </coordinates>
        </Point>
      </Placemark>
    </Document>
  </Document>
</kml>

Looks like ExtendedData as provided by the first kmleport.kml is not read in the second running.

Change History (8)

comment:1 by warmerdam, 11 years ago

Cc: winkey Even Rouault added
Component: defaultOGR_SF
Milestone: 2.0.0

I am unable to reproduce the problem. For me the kmlexport2.kml file still has this:

<kml>
  <Document>
    <Schema id="testlayer.schema">
      <SimpleField name="drawOrder" type="int"/>
      <SimpleField name="icon" type="string"/>
      <SimpleField name="System" type="string"/>
    </Schema>
    <Document>
      <name>testlayer</name>
      <Placemark>
        <name>Test point</name>
        <styleUrl>#L_WB</styleUrl>
        <ExtendedData>
          <SchemaData schemaUrl="#testlayer.schema">
            <SimpleData name="System">
foobar            </SimpleData>
          </SchemaData>
        </ExtendedData>
        <Point>
          <coordinates>
            36.1,36.2,0
          </coordinates>
        </Point>
      </Placemark>
    </Document>
  </Document>
</kml>

This is running with the current head of the 1.9 branch but I don't see any noteworthy changes in libkml driver recently likely to explain this. Hmm, on review change set r25131 might possible relate. Perhaps you could try after patching this into your tree or building from the head of the 1.9 branch?

+winkey +rouault for comment.

comment:2 by 45136, 11 years ago

I'm sorry, I have only access to the OSGEo4W Installer on Windows 7, no chance to build myself. GDAL Version is 1.9.2-1 from 2012/10/8, and no newer available. Because this is a blocker for anyone using kml with ExtendedData from external sources: Can anybody build a new gdal version for OSGEo4W?

comment:3 by warmerdam, 11 years ago

Status: newassigned

Ah, interesting. I did the libkml build into OSGeo4W (just added recently) and I may have botched something. I'll investigate.

comment:4 by warmerdam, 11 years ago

Problem confirmed with OSGeo4W.

comment:5 by warmerdam, 11 years ago

Milestone: 1.9.3

This was a bug in the libkml driver that only manifested on some operating systems. Fixed in trunk (r25211) and 1.9 branch (r25210).

I'm rebuilding the OSGeo4W package now with the fix.

comment:6 by warmerdam, 11 years ago

The new package (1.9.2-2) is now uploaded. Could you upgrade and see if the problem is resolved for you?

comment:7 by 45136, 11 years ago

Works fine now, thanks. I will do further testing next days.

comment:8 by warmerdam, 11 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.