[Geoserver-users] Large vector layer in Google Maps

Hello all, it’s been a good while since I’ve come here

I have a (hopefully) straightforward problem at hand: I want to efficiently display a vector layer in Google Maps that may have a very large number of polygons. To do that, I need to load the polygons gradually on demand as the user navigates. Having some sort of multiresolution for the layer would be a plus, but I can also simply not show the layer if the zoom level is too small.

My first guess to solve this problem was to have GeoServer generate a KML super-overlay and feed that into Google Maps.

However, I was testing around with GeoServer generated KMLs and I couldn’t get even a basic KML (e.g., http://localhost:8080/geoserver/topp/wms/kml?layers=topp:states, which has a NetworkLink element in it) to show up on Google Maps.
If I download a self-contained KML with all the data it does show up on Google Maps, but obviously that’s not reasonable for layers with a lot of data.

Another interesting thing I noticed is that other KML files with NetworkLinks do work in Google Maps (e.g., http://cleanwater.goshen.edu/kml/ccwp.kml), so this does not seem to be something stupid I did on the Google Maps side (this KML I mentioned has a tag inside the , as opposed to a tag that comes in the one generated by GeoServer)

So my questions are:

  • Should this be working and I am indeed doing something stupid on the Google Maps side?
  • Is there any GeoServer configuration tweak I can use to get this to work, or is KML simply not fit for this purpose because Google Maps doesn’t support loading KML features on demand?
  • Is there another solution using GeoServer that could work well for this situation, using Google Maps?
  • Would this KML idea work well out of the box with other web clients (OpenLayers, Leaflet, etc)?

Thanks
Milton

···

Milton Jonathan
Grupo GIS e Meio Ambiente
Tecgraf/PUC-Rio
Tel: +55-21-3520-4222

On Wed, Jul 6, 2016 at 4:11 PM, Milton Jonathan <milton@anonymised.com>
wrote:

Hello all, it's been a good while since I've come here

I have a (hopefully) straightforward problem at hand: I want to
efficiently display a vector layer in Google Maps that may have a very
large number of polygons. To do that, I need to load the polygons gradually
on demand as the user navigates. Having some sort of multiresolution for
the layer would be a plus, but I can also simply not show the layer if the
zoom level is too small.

My first guess to solve this problem was to have GeoServer generate a KML
super-overlay and feed that into Google Maps.

However, I was testing around with GeoServer generated KMLs and I couldn't
get even a basic KML (e.g.,
http://localhost:8080/geoserver/topp/wms/kml?layers=topp:states, which
has a NetworkLink element in it) to show up on Google Maps.
If I download a self-contained KML with all the data it does show up on
Google Maps, but obviously that's not reasonable for layers with a lot of
data.
Another interesting thing I noticed is that other KML files with
NetworkLinks do work in Google Maps (e.g.,
http://cleanwater.goshen.edu/kml/ccwp.kml), so this does not seem to be
something stupid I did on the Google Maps side (this KML I mentioned has a
<Link> tag inside the <NetworkLink>, as opposed to a <Url> tag that comes
in the one generated by GeoServer)

So my questions are:
- Should this be working and I am indeed doing something stupid on the
Google Maps side?

Never tried, never tested, the target of KML generation has always been
Google Earth.. unfortunately nowadays GE just crashes on startup on my
linux system, so I could not check interactively right now, but as far as I
know, the default KML generation mode does no generate a superoverlay, you
should first configure the superoverlay strategy in the layer, and then use
a link like:

http://localhost:8080/geoserver/topp/wms/kml?layers=topp:states&mode=superoverlay

- Is there any GeoServer configuration tweak I can use to get this to
work, or is KML simply not fit for this purpose because Google Maps doesn't
support loading KML features on demand?

No idea

- Is there another solution using GeoServer that could work well for this
situation, using Google Maps?

I cannot think of another one, besides maybe plain WMS using some scale
based styles that show stuff progressively (but it would be different,
getting raster tiles). Or maybe some similar client side arrangement
downloading geojson with a different cql filter depending on the current
scale?
Unsure, I have no experience with google maps client side programming.

- Would this KML idea work well out of the box with other web clients
(OpenLayers, Leaflet, etc)?

Was not tested while developing KML support, so I don't know :slight_smile:

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

-------------------------------------------------------

Hi Milton,

That kind of url returns a perfectly valid kml for me that opens in
Google Earth.

A wrong setting in the "Proxy Base URL" field will show as an invalid
address in the <NetworkLink>...<Url><href> field inside your kml. Check
if that WMS address inside the KML is valid.

If it is not, fix "Settings"->"Global" option "Proxy Base URL". Make
sure it is set to a valid address. I have set mine to something like this:

https://mymachine.mydomain.gov.br/geoserver/

My machine is behind a Nginx reverse proxy that handles the https part.
That domain name is registered under our local DNS so it is resolvable.
You have to input an IP address if your hostname is not resolvable. If I
had put http://localhost:8080/geoserver in mine I believe I would see
similar symptoms to what you are seeing.

What happens if you go to Layer Preview and click on "OpenLayers"
instead of "KML"? Does it work?

Best,
Daniel Miranda
--
Daniel Araújo Miranda
Forensics Expert
Inteligeo - Geographic Intelligence
National Institute of Criminalistics
Brazilian Federal Police

Em 06/07/2016 11:11, Milton Jonathan escreveu:

Hello all, it's been a good while since I've come here

I have a (hopefully) straightforward problem at hand: I want to
efficiently display a vector layer in Google Maps that may have a very
large number of polygons. To do that, I need to load the polygons
gradually on demand as the user navigates. Having some sort of
multiresolution for the layer would be a plus, but I can also simply
not show the layer if the zoom level is too small.

My first guess to solve this problem was to have GeoServer generate a
KML super-overlay and feed that into Google Maps.

However, I was testing around with GeoServer generated KMLs and I
couldn't get even a basic KML (e.g.,
http://localhost:8080/geoserver/topp/wms/kml?layers=topp:states, which
has a NetworkLink element in it) to show up on Google Maps.
If I download a self-contained KML with all the data it does show up
on Google Maps, but obviously that's not reasonable for layers with a
lot of data.
Another interesting thing I noticed is that other KML files with
NetworkLinks do work in Google Maps (e.g.,
http://cleanwater.goshen.edu/kml/ccwp.kml), so this does not seem to
be something stupid I did on the Google Maps side (this KML I
mentioned has a <Link> tag inside the <NetworkLink>, as opposed to a
<Url> tag that comes in the one generated by GeoServer)

So my questions are:
- Should this be working and I am indeed doing something stupid on the
Google Maps side?
- Is there any GeoServer configuration tweak I can use to get this to
work, or is KML simply not fit for this purpose because Google Maps
doesn't support loading KML features on demand?
- Is there another solution using GeoServer that could work well for
this situation, using Google Maps?
- Would this KML idea work well out of the box with other web clients
(OpenLayers, Leaflet, etc)?

Thanks
Milton

--

Milton Jonathan
Grupo GIS e Meio Ambiente
Tecgraf/PUC-Rio
Tel: +55-21-3520-4222

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Thanks guys

So it looks like nobody ever uses GeoServer to load large vector layers on Google Maps. Ok, good to know!

(Daniel, it does work with Google Earth)

Best regards,
Milton

···

2016-07-06 13:08 GMT-03:00 Daniel Araujo Miranda <miranda.dam@anonymised.com>:

Hi Milton,

That kind of url returns a perfectly valid kml for me that opens in Google Earth.

A wrong setting in the “Proxy Base URL” field will show as an invalid address in the … field inside your kml. Check if that WMS address inside the KML is valid.

If it is not, fix “Settings”->“Global” option “Proxy Base URL”. Make sure it is set to a valid address. I have set mine to something like this:

https://mymachine.mydomain.gov.br/geoserver/

My machine is behind a Nginx reverse proxy that handles the https part. That domain name is registered under our local DNS so it is resolvable. You have to input an IP address if your hostname is not resolvable. If I had put http://localhost:8080/geoserver in mine I believe I would see similar symptoms to what you are seeing.

What happens if you go to Layer Preview and click on “OpenLayers” instead of “KML”? Does it work?

Best,
Daniel Miranda

Daniel Araújo Miranda
Forensics Expert
Inteligeo - Geographic Intelligence
National Institute of Criminalistics
Brazilian Federal Police

Em 06/07/2016 11:11, Milton Jonathan escreveu:

Hello all, it’s been a good while since I’ve come here

I have a (hopefully) straightforward problem at hand: I want to efficiently display a vector layer in Google Maps that may have a very large number of polygons. To do that, I need to load the polygons gradually on demand as the user navigates. Having some sort of multiresolution for the layer would be a plus, but I can also simply not show the layer if the zoom level is too small.

My first guess to solve this problem was to have GeoServer generate a KML super-overlay and feed that into Google Maps.

However, I was testing around with GeoServer generated KMLs and I couldn’t get even a basic KML (e.g., http://localhost:8080/geoserver/topp/wms/kml?layers=topp:states, which has a NetworkLink element in it) to show up on Google Maps.
If I download a self-contained KML with all the data it does show up on Google Maps, but obviously that’s not reasonable for layers with a lot of data.
Another interesting thing I noticed is that other KML files with NetworkLinks do work in Google Maps (e.g., http://cleanwater.goshen.edu/kml/ccwp.kml), so this does not seem to be something stupid I did on the Google Maps side (this KML I mentioned has a tag inside the , as opposed to a tag that comes in the one generated by GeoServer)

So my questions are:

  • Should this be working and I am indeed doing something stupid on the Google Maps side?
  • Is there any GeoServer configuration tweak I can use to get this to work, or is KML simply not fit for this purpose because Google Maps doesn’t support loading KML features on demand?
  • Is there another solution using GeoServer that could work well for this situation, using Google Maps?
  • Would this KML idea work well out of the box with other web clients (OpenLayers, Leaflet, etc)?

Thanks
Milton

Milton Jonathan
Grupo GIS e Meio Ambiente
Tecgraf/PUC-Rio
Tel: +55-21-3520-4222


Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape


Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Milton Jonathan
Grupo GIS e Meio Ambiente
Tecgraf/PUC-Rio
Tel: +55-21-3520-4222