1

I've been using QGIS for sometime its a great software, it suits my needs in my project until I encounter this issue in Google Earth.

Are there any plugins or any "work around" method to be able to include layer styles when exporting layers to Google Earth format (KML)?

I am wondering how to export a styled layer (probably styled in QGIS) to Google Earth format that will include its color and especially labels.

  • 1
    Why export in the first place? Sure, Earth is easier to use for inexperienced users, but at my place of work it always irks meto have to provide additional data for Earth. – Erik Jul 31 '18 at 9:54
  • well in my case i need to export things because i do the GIS processes and extraction (such as contour generation) and use it in google earth for presentation because google earth have better graphics and lighter to manipulate. thanks – GridZone Jul 31 '18 at 10:02
3

What I would do is use Geoserver to publish services as KML.

We use PostGIS, but you could use Shapefiles, etc.

The PostGIS data is styled in QGIS, then that style is exported as an SLD file.

We then publish the same data source in Geoserver, use the SLD from QGIS in the Styles section, then apply it to the layer.

When consumed in Google Earth, you can see the data styled the same as if it was in QGIS.

Here is a service from PostGIS originally styled in QGIS and applied to the Geoserver service via SLD, then consumed as KML in Google Earth:

enter image description here

  • thanks for your comment sir/maam. do you have any tutorials on how to do it?. it will be very helpful. thanks – GridZone Aug 1 '18 at 1:41
1

QGIS has lots of complex styling options. When you style and then export, or saves as KML, QGIS is able to replicate some of its styles in the KML styling language, but not all of them. Some are because KML doesn't have good ways to represent complex styles, others because the correct conversions simply haven't been included in the code. You might try some different ways of styling your data, to see if something else works.

If you want more specific help, please describe the dataset you're trying to style & export. Is it raster or vector? Point, line or polygon? How are you trying to style it in QGIS? What would you like the styles in KML to look like And what mapping platform will you eventually want to visualize or publish it to? The last question is because not all platforms that support KML handle styling the same way.

1

Two quick'n'dirty approaches I've used, recognizing that KML line and point styling are much more limited than QGIS, so that the best you could ever hope to transfer automatically in terms of, say, line styling, is colour and width -- and that's what a simple QGIS export already does.

First, if you want to display in GE just a couple of vector layers, export the features as KML. Then, in KML, manually create a set of styles that represents how you'll want to see things in GE, which will likely be simpler and different than how you styled in QGIS. Using search and replace in your favorite editor, or a script if so inclined, replace the <Style>...</Style> lines in your export with the corresponding <styleUrl>s. QGIS kindly keeps the whole style block in one line, making this easier.

Second, if you want to display either a complex map with the QGIS styling intact, or a raster layer, it's easier if you export it as an image and then bring it into Google Earth via Add Image Overlay. This is then draped over GE's terrain so you can visualize it in 3D etc. I'm sure if done right, the correct positioning info of the QGIS export could be imported into GE along with the image via geoTIFF or a world file, but I always export one specific layer extent and so I copied over the bounding box info manually when this didn't work as expected for me the first time around.

(Realize this is old, but stumbled across it and thought might be useful...)

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.