Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to overlay a polygon layer on Google map API V3 from a WFS output file in GML2 format from a remote WFS server. No other output format is available in the WFS server.

Is it possible to do this using GeoXML3 ?

It would be great if some can give me a demo link which using a GML2.

share|improve this question

GeoXML is for processing KML in the browser. GML is not KML, so that won't work. You can overlay GML on Google Maps API v3 using OpenLayers. I can't find a demo link, but here is an example:

<!DOCTYPE html>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
        <title>Google Maps API v3 and WFS</title>
        <link rel="stylesheet" href="" type="text/css">
        <link rel="stylesheet" href="" type="text/css">

        <link rel="stylesheet" href="" type="text/css">
        <script src=";sensor=false"></script>
        <script src=""></script>
        <script src=""></script>
        <script type="text/javascript">
          var map;

        function init() {
            OpenLayers.ProxyHost= "proxy.cgi?url=";
            map = new OpenLayers.Map('map');
            map.addControl(new OpenLayers.Control.LayerSwitcher());

            var gphy = new OpenLayers.Layer.Google(
                "Google Physical",
                {type: google.maps.MapTypeId.TERRAIN}

            var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
            renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;

            var wfs = new OpenLayers.Layer.Vector("States", {
                    strategies: [new OpenLayers.Strategy.BBOX()],
                    protocol: new OpenLayers.Protocol.WFS({
                        url: "",
                        featureType: "states",
                        featureNS: ""
                    renderers: renderer

            map.addLayers([gphy, wfs]);

            // Google.v3 uses EPSG:900913 as projection, so we have to
            // transform our coordinates
            map.setCenter(new OpenLayers.LonLat(-98.5795, 39.828175).transform(
                new OpenLayers.Projection("EPSG:4326"),
            ), 3);


    <body onload="init()">
        <h1 id="title">Google (v3) Layer Example + WFS</h1>
        <p id="shortdesc">
            Demonstrate use the Google Maps v3 API with WFS.
        <div id="map" class="smallmap"></div>

A couple of caveats:

  • the script pulls the stylesheets and OpenLayer.js from the OpenLayers site, you will want to change that to your local install of OpenLayers
  • you will need to set up a proxy since you are requesting GML from a site outside your domain, please see
  • the mapping portion (init()) is often written as a separate javascript file, but it's included here to be explicit
share|improve this answer
Thank you Sophia for your answer. I think here we are using Openlayers not Googlemap API V3. I am using Openlayers to pull the WFS GML data, Now I want to Overlay this Polygon over googlemaps API V3. – sur Sep 8 '11 at 10:39
Here is a link This is Google Map API V2 and I could not see a good example. Here is another link to a presentation( search for google_wfs_arch in google the first lik).Unfortunately their demo links are not working. I think It is possible but still looking for a good example which uses real GLM2 from WFS. – sur Sep 8 '11 at 10:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.