1

I have a shapefile in WGS84 enter image description here and I'm trying to save to a KML. Something is going wrong in this save and my KML file contains all of the polygons stacked in a sort of column shape.

enter image description here

Why is this happening and how can I solve it?

Phil Jones
  • 35
  • 6

1 Answers1

3

Your data is not in WGS84.

Your coordinates should be in between -180 and 180, unlike the 200000 seen in the screenshot.

When converting to KML, it will convert it to EPSG:4326.

HeikkiVesanto
  • 16,433
  • 2
  • 46
  • 68
  • Ahh thank you. The layer was in British National grid before but I saved it as WGS84. Do you know why this has not converted the layer? – Phil Jones Sep 27 '17 at 15:45
  • Did you follow these instructions: https://gis.stackexchange.com/questions/35590/reprojecting-vector-layer-in-qgis – HeikkiVesanto Sep 27 '17 at 15:54
  • You could just save directly to KML from British National Grid. It should convert it for you. – HeikkiVesanto Sep 27 '17 at 15:55
  • 1
    @HeikkiVesanto why do you think that KML has anything to do with EPSG:3857? http://www.gdal.org/drv_kml.html notes that KML by specification uses only a single projection, EPSG:4326. All OGR KML output will be presented in EPSG:4326. – AndreJ Sep 27 '17 at 18:14
  • Heikki will probably correct soon what he wrote about EPSG:3857 but the source data must indeed have wrong projection. Compare "I have a shapefile in WGS84" with the first screen capture where QGIS map is in EPSG:4326 and coordinate view shows all too big coordinates. GDAL must know the correct source SRS before it can make convertion into EPSG:4326 for KML. Now it believes that data are already in right system and just writes the big coordinates into KML withour conversion. – user30184 Sep 28 '17 at 05:52
  • 1
    @HeikkiVesanto The reproject function wasn't working, it was just producing the same result when run. However your suggestion of saving directly from British National Grid did work. Thank you. – Phil Jones Sep 28 '17 at 08:36
  • @AndreJ sorry got my Mercators and pseudo Mercators in KML backwards. I have edited the answer, however the idea was correct. Phil: I'm glad that worked. – HeikkiVesanto Sep 28 '17 at 09:03