2

I'm using QGIS 3.10. I generated a contour map from a DEM. It looked good. Now, I wanted to check the contours in Google Earth. From the contour layer in QGIS, I selected Export - Save Features As - KML. I ran the export and a KML layer was generated as a file. Problem is, Google Earth expects the coordinates to be longitude, latitude but the exported file has them as latitude, longitude. When the KML file is displayed in GE, it zooms to Antarctica.

The schema used by QGIS is KML 2.2 which suggests the required coordinate sequence is longitude, latitude. But QGIS is sequencing latitude, longitude.

Is there a way in QGIS to specify the sequence to be longitude, latitude?

Excerpt from the KML file generated by QGIS:

<?xml version="1.0" encoding="utf-8" ?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document id="root_doc">
<Schema name="Watersprite_contours" id="Watersprite_contours">
    <SimpleField name="fid" type="float"></SimpleField>
    <SimpleField name="ID" type="int"></SimpleField>
    <SimpleField name="ELEV" type="float"></SimpleField>
</Schema>
<Folder><name>Watersprite_contours</name>
  <Placemark>
    <Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style>
    <ExtendedData><SchemaData schemaUrl="#Watersprite_contours">
        <SimpleData name="fid">1</SimpleData>
        <SimpleData name="ID">0</SimpleData>
        <SimpleData name="ELEV">800</SimpleData>
    </SchemaData></ExtendedData>
        <LineString><coordinates>50.0173281602732,-122.806140688556 50.0172702778432,-122.806140688556 50.0172606307647,-122.806050857117 50.0172702778432,-122.80587119424 50.0173281602732,-122.80587119424</coordinates></LineString>
  </Placemark>
2
  • Title should be QGIS 3.10 export layer to kml reverses coordinates – Paul604 Dec 2 '19 at 0:18
  • 1
    That's what the edit button is for – Vince Dec 2 '19 at 1:35
0

Did you check the coordinate reference system in original dataset? KML standard (v.2.2) is fully supported in Qgis since previous versions. Before conversion to KML Qgis make a datum conversion of coordinates to WGS84 CRS (WGS84 is CRS used for lat and lon in KML files); for do this without error you must to set correct CRS in the DEM (your original dataset) Try this before.

0

I confirm that also with python .ExportToKML() the resulting KML text has reversed coordinates. I tested

QGIS_VERSION: 30802 - Zanzibar - Proj 5 works !!! QGIS_VERSION: 31000 - Coruna - GDAL/OGR 2.4.1 - Proj 5 works !!!

QGIS_VERSION: 31200 - Belfagor :) - GDAL/OGR 3.0.4 - Proj 6 does NOT work

this is documented in the OGR issues:

https://github.com/qgis/QGIS/issues/33014

I hope can help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.