I am trying to download a Geoserver layer as KML using the KML Reflector. I actually use Leaflet and a plugin (leaflet-area-draw) in order to let the user design a rectangle and then pass the BB to the URL. The URL request I make is WMS and it looks like this:


I face two issues. First the whole layer is downloaded although I restrict it with the BBox. I wonder if this is related cause its a WMS request and maybe I should try to make a WFS one. Is it possible to make a WFS request to get KML?

The second issue appears when the projetion of the layer in geoserver is other than EPSG:4326. Then I get nothing back. What is the right approach to this? Should I use a Leaflet plugin to convert the BBOX coordinates from EPSG:4326 to the layer's srs?


I tried using KML scoring in order to get the data as vectors with the hope, that they will be rendered correctly and only the ones in BB will be shown. But it didn't work. I get all the features back.


  • 2
    Your example seems to be from the documentation docs.geoserver.org/2.6.x/en/user/googleearth/features/… which is good. Have you played with KML_Scoring, KML_Regionation, and superoverlay_subtype? The second issue in not an issue at all because KML by specification uses only a single projection, EPSG:4326. – user30184 May 17 '16 at 6:30
  • Thanks. So if KML uses only one projection, does it mean that I have to transform my geoserver layer to 4326? – user1919 May 17 '16 at 6:49
  • 2
    If you use KML reflector Geoserver is automatically reprojecting data if needed. If you use standard WMS GetMap requests with KML as format you must always use &SRS=4326. – user30184 May 17 '16 at 7:17
  • I use KML reflector but this is not the case at all. Geoserver doesn't reproject the data. I actually get nothing back. And provably this is a bigger issue cause I also try to get CSV and geoJSON files and I also get nothing back. – user1919 May 17 '16 at 9:32
  • Also, when my layer is originally in 4326 and I get some data back, for some reason they are not filtered based on BB. I just get the whole layer back. Unlike the CSV, shapefile and geojson case where they return data correctly. – user1919 May 17 '16 at 9:34

Your Answer

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

Browse other questions tagged or ask your own question.