Skip to content

Unable to parse kml with gx:LatLonQuad node #650

Closed

Description

@acespring78

Hello. I have a kml file that uses the xmlns:gx="http://www.google.com/kml/ext/2.2" namespace and uses the gx:LatLonQuad node with the coordinates defining the lat/lon coordinates of the box, instead of LatLonBox

When loading this kml file to KmlLayer, it throws an exception because I believe it doesn't read the gx:LatLonQuad node, but instead is looking for LatLonBox to parse the north, south, east, and west nodes. The following exception trace is as follows:

java.lang.NullPointerException: Attempt to invoke virtual method 'double java.lang.Double.doubleValue()' on a null object reference
        at com.google.maps.android.data.kml.KmlFeatureParser.createLatLngBounds(KmlFeatureParser.java:452)
        at com.google.maps.android.data.kml.KmlFeatureParser.createGroundOverlay(KmlFeatureParser.java:150)
        at com.google.maps.android.data.kml.KmlContainerParser.assignPropertiesToContainer(KmlContainerParser.java:113)
        at com.google.maps.android.data.kml.KmlContainerParser.createContainer(KmlContainerParser.java:67)
        at com.google.maps.android.data.kml.KmlParser.parseKml(KmlParser.java:89)
        at com.google.maps.android.data.kml.KmlLayer.parseKml(KmlLayer.java:189)
        at com.google.maps.android.data.kml.KmlLayer.<init>(KmlLayer.java:156)
        at com.google.maps.android.data.kml.KmlLayer.<init>(KmlLayer.java:79)

This kml file works when loading to Google Earth by the way.

Is there plans to support gx:LatLonQuad in later releases?

Activity

  1. added
    triage meI really want to be triaged.
    type: questionRequest for information or clarification. Not an issue.
    on Mar 6, 2020
  2. arriolac commented on Mar 6, 2020

    @arriolac
    Contributor

    Thanks for reporting. This was not something we were planning on adding, however, contributions are certainly welcome to get this working.

  3. added
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    and removed
    type: questionRequest for information or clarification. Not an issue.
    triage meI really want to be triaged.
    on Mar 6, 2020
  4. arriolac commented on Mar 6, 2020

    @arriolac
    Contributor

    Would you mind sharing an example KML file / snippet in case someone wants to take this on?

  5. acespring78 commented on Mar 6, 2020

    @acespring78
    Author

    Here's a sample. The icon field can be replaced with any image file, but the key item here is the gx:LatLonQuad node and the absence of the LatLonBox

    <?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>HelloSanDiego</name>
    		<description>Simple overlay bitmap in San Diego</description>
    		<GroundOverlay>
    			<name>Simple overlay bitmap in San Diego</name>
    			<LookAt>
    				<longitude>-117.16818999089882</longitude>
    				<latitude>32.71496098150528</latitude>
    				<altitude>5.073048377858894</altitude>
    				<heading>4.842019007966769E-10</heading>
    				<tilt>0.0</tilt>
    				<range>0.0</range>
    				<altitudeMode>relativeToGround</altitudeMode>
    			</LookAt>
    			<Icon>
    				<href>files/image.png</href>
    			</Icon>
    			<gx:LatLonQuad>
    				<coordinates>-117.16818999089882,32.71496098150528,5.073048377858894 -117.1675446751236,32.71496097984488,5.073048377858894 -117.1675446751236,32.7155966911221,5.073048377858894 -117.16818999089882,32.715596692782505,5.073048377858894</coordinates>
    			</gx:LatLonQuad>
    		</GroundOverlay>
    	</Document>
    </kml>
    
  6. stale commented on Sep 2, 2020

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you!

  7. acespring78 commented on Sep 2, 2020

    @acespring78
    Author

    Hi, do we know if there are still plans to support gx:LatLonQuad in the near future?

  8. stale commented on Dec 31, 2020

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you!

  9. stale commented on Jul 1, 2021

    @stale

    Closing this. Please reopen if you believe it should be addressed. Thank you for your contribution.

  10. noberasco commented on Oct 3, 2024

    @noberasco
    Contributor

    Old ticket, but it has recently become relevant to one of our workflows (offline cartography), so I have raised a PR to fix this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority: p4An issue that should be addressed eventually.staletype: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions