Please forgive what I am sure is a very noob question, but I need to do some research into the best way to achieve this and I am a beginner to GIS.

My employer has a Geoserver instance set up which can serve up files in all manner of formats. Is it possible to plot one of these onto Google Maps v3 in such a way as to make the feature's properties available to an information pop-up?

My development server is not on the same domain as the Geoserver, but the Geoserver serves up files publicly.

I have tried using GeoJSON but this seems to rely on the Geoserver and web server being on the same domain, otherwise cross site scripting protection prevents the connection - this works fine as long as I download the GeoJSON into a text file and store it on the web server but the source database will be regularly updated so the mapping needs to be dynamic.

I've tried using a KML layer, but nothing displays at all when I use this method replacing the KML file URL with my own Geoserver's KML file url.

I think this must not be a weird question as having a map with features that pop up info when you click them seems to be a fairly common thing, so can someone advise me where to start?

e.g. What is the best format to use to serve up dynamically updated data from Geoserver? Is it possible to display this kind of info on Google Maps? I believe that this needs to be a web feature service in order to plot vector objects rather than image-based maps - how would you handle this kind of request?


You need to implement a WebGIS application which base layer is provided by Google Maps and which main feature layer is provided by your employer GeoServer instance. For this purpose you may use the excellent open source library OpenLayers. In its home site you can find tutorials and examples which can help you to implement your application. Alternatively you may use maps provided by OpenStreetMap or other open data services in your application.

Web browsers prevent applications from performing AJAX requests to domains different from domain serving the application. Therefore this will prevent your application to reach data provided by the GeoServer instance. For avoiding this limitation you may enable cross-origin resource sharing (CORS) in the GeoServer instance. You can find more information about CORS in this web site.


Since google maps would just be a reference layer served under your own data hosted on geoserver you need to build an application that queries and returns text field data to a text box, the layer you are serving from your local hosted data, the Google data is really just a graphic background to your map window is not related to your data base but through synchronization of a nonreferenced raster hosted by google, about the only data you might get from google data would be lat lon and a hundred geo referenced points within query limits restricted by google through a developer contract.


What is your frontend tool ? If you use for example Leaflet, you can use the google map as background, WMS layer from geoserver as "foreground" and script like


to get detailed information about the clicked item (you can modify the geoserver to return for example HTML table or JSON data, if you prefer to work with them in some script way, display specific popup and so on)

  • Hi @Radek, I was trying to do this using only the Google Maps API. I seem to have found a way around this using a php file to CURL a GeoJSON file from the remote server - effectively using the PHP file as a proxy - and then setting this as the source for a Google maps data layer. It's working so far, but I haven't seen anyone suggest this before - is it bad practice in some way? – Ambulare Apr 24 '14 at 15:05
  • you are doing it right, that is another way how to do it - use PHP proxy file to proxy requests from your domain-A.com to domain-B.com and then send it back to client on domain-A.com website. Well done ! – Radek Apr 25 '14 at 7:27

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.