3

I'm trying to export vector files from QGIS to KML. When I open the KML in Google Earth I get erratic lines all around the globe. All layers set to WGS84. I have read the other topics on KML export and tried the suggestions with no success. Seem so simple but something is off.

Here is the boundary I'm trying to export. It is a line not poly.

enter image description here

This is what i get when I open the Exported KML to GE

enter image description here

  • 3
    In QGIS what is the CRS of your project, of your boundary layer and of the other layer ? if you change any of those CRS how did you proceed ? Also if you turn on all the other layer did everything align ? – J.R Sep 24 at 13:58
  • 1
    Reproject to WGS84... – Mapperz Sep 24 at 14:19
  • The shapefiles' CRS was undefined so they all defaulted to WGS84 when I brought them in. The project CRS is also WGS84. All of the other layers do line up as they should when turned on. – BamaBob Sep 24 at 14:50
  • 1
    You might try the check validty and/or fix geometry processing tools. – johns Sep 24 at 16:34
  • What file format is the vector layer in QGIS? In the screenshot it looks like it may have curves, which aren't supported by all vector formats. – csk Sep 24 at 18:54
1

The procedure I normally use is to convert .shp to .Kml is below

  1. Right click on the layer,

  2. click on save as for qgis 2.8 and versions below, but for Qgis version 3.8.3, you have to go to export and click and Save Features As

  3. enter image description here When the above pop up displays change the format from ESRI shapefile to Keyhole Markup Language (KML).

Give the file name (File name).

Under CRS I will advise you chose EPSG:4326-WGS 84

Save the file and open the file. It should display now.

  • 1
    Yes this is the process I have been using. Not sure what is going on. It worked with some shape files last week that were downloaded from a municipality and it worked fine. These files were previously digitized by hand in ArcGis, but something is up with these files. – BamaBob Sep 24 at 17:00
  • 1
    Can you make your data available? – GBG Sep 24 at 17:05
  • 2
    Does your data cross the international date line? That could be a problem. – babel Sep 24 at 18:18
  • You could also try converting to kml with the plugin "layer2kmz" and see if you get the same result. If you don't find it in the plugin list, activate "show experimental plugins" in the "settings" tab. – A_NeriWinter Sep 25 at 13:32
  • Data does not cross international date line. Here's a link to the folder. Have a look and let me know what yall think. drive.google.com/open?id=1lCMn1zQ7kTCu1cm9ULw-WLfl2dgaW9_W – BamaBob Sep 25 at 14:35
0

I am working on this as well. Funky here too, but I just had a breakthrough. My process in version 3.8 is to diagnose where the issue is: 1. Export as KML (I have tried to set the CRS many different ways) MAKE SURE you have SAVE LAYER checked so that you get the layer exported in right beside the one you have exported from. 2. Turn visability on and off to see if the new, exported layer in QGIS is in the right place. 3. Mine often is not... even in QGIS! so... 4. Open Properties to see Information of the layer.

I started to realize that even though the CRS was the same, the Extents were reversed!

I am not sure why an export to KML would do this but to solve the issue, I started to set my CRS on export, as the more specific CRS. (In my case it is

Original Info from imported KML layer, which looks located correctly in QGIS:

CRS
EPSG:4326 - WGS 84 - Geographic
Extent
-82.5787124633789063,38.4103965759277344 : -82.5669479370117188,38.4228591918945313
Unit
degrees

Here is the exported using the CRS WGS 84:

CRS
EPSG:4326 - WGS 84 - Geographic
Extent
38.4103999976518011,-82.5787103514051068 : 38.4228528252385004,-82.5669500152173015
Unit
degrees

See the difference?

So, if I now export into KML and select CRS of WGS 84 [32617] (UTM Zone 17N), I get this again form the layer that was exported, BUT saved as a new layer in QGIS.

CRS
EPSG:4326 - WGS 84 - Geographic
Extent
-82.5787103514051068,38.4103999976518011 : -82.5669500152173015,38.4228528252385004
Unit
degrees

See! Extent shows exactly the opposite. Like you, I am pretty new to this and learning everyday. I do not know what this means, what it is for, or even if it is a bug, but it is certainly not intuitive.

  • Can a more knowledgeable GIS expert explain what we are seeing in this please? – Jim Garner Sep 25 at 16:34
  • Thanks man. I'll give this a shot. Oh and I've been messing with GIS on and off since I took some college courses in 2011 and nothing is intuitive. – BamaBob Sep 25 at 17:35
  • If you would like to continue to discuss this and other learning things about QGIS with me, I would love that. Just trying to learn and expand. No idea how to private message here yet. – Jim Garner Sep 26 at 15:57
0

Your data has no CRS defined (prj-file missing). So it seems to be a CRS-problem. When I open your data, they are defined as 4326 (the default in my QGIS), but they do not correspond to this CRS. You should find the right CRS for your data and set in manually to solve the problem.

When I open your boundary, it shows very strange coordinates, like 421108,4033009 - see screenshot below. Scale shows as 0:1 and OpenStreetMap background map does not show (normally, it automatically warps to conform with 4326).

WGS84 Bounds are: -180.0000, -90.0000, 180.0000, 90.0000, see EPSG Projection 4326 - WGS 84 - but your coordinates are far off: 421108,4033009 ! When saving such data to another format, it ends up in a mess.

enter image description here

So you have to find out what projection your data was created in. When I assign CRS 3857 to your boundary (NOT re-project, but set CRS), at least it is shown in somehow meaningful way on top of OpenStreetMap, even though probably not in the right place and size (you're not working on Algeria, are you?):

enter image description here

Where did you get your data from? What EPSG was used for it? Which area are you working on? That could give a hint which EPSG could be appropriate. Than simply change Coordiante reference system: right-cling on your layer - set CRS - set CRS for layer (do NOT reproject, but set CRS). Than, you can save it as KML - in in the export-dialogue, you should use (reproject to) 4326.

  • I digitized these files back in 2014 to create a map of a hunting club property in NE Tennessee in the US. I believe I digitized them on top of an areal photo of the area. I don't remember what ESPG was used. I assume it would have been whatever the aerial photo came in as which would have come from USGS. I have tried setting the CRS to TN State Plane and then export with reproject to 4326 with no luck. Thank you for the help. I don't mean to sound dumb. It was just so long ago when I put this together the first time. – BamaBob Sep 26 at 12:30
  • OK, but in QGIS, the boundary is positioned correctly - if you have an underlying basemap? In this case: could you try to export the boundare to a geopackage (gpkg) to test it that way? Not for Google Earth, but to see here on my system – babel Sep 26 at 12:49
  • No the Boundary doesn't show up in the correct place. I started a new file and imported an aerial image from usgs first. Then brought in the Boundary. Nowhere near it. I have exported a geopackage of the boundary layer. drive.google.com/open?id=1oLbRwlAeeFUculvMJX2Y84Cb_mnbssA1 – BamaBob Sep 26 at 14:49
0

If the file doesn't show correctly in QGIS, than your shapefile seems to be corrupted somehow/or in the "wrong" CRS - at least it is not a problem with kml-export, the problem seems to be with your shapefile. A workaround would be to just "move" your object in the right place - maybe ask another question here for that.

This is however a quick and dirty-solution - shift your object by selecting it, toggle edit mode and use the shift-function - see screenshot. Or ask a new question here how to shift/place your shapefile in the right position. Or find the correct CRS-setting.

enter image description here

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.