[OpenLayers-Users] WFS Google overlay reprojection problem

Alex Zeit zeitalex at googlemail.com
Thu Jun 24 11:33:03 EDT 2010


Dear All,
I am trying to overlay some points with google satellite layer and access
the attributes of these points using OpenLayers.Protocol.WFS and GeoExt
Popup.
It only works if I use native projection of the point layer without overlay
with google.
I tried to reproject point layer to google Projection. Probably it is the
best option as in this case the geoserver do not need to reproject data on
fly for each request.
I used Q-GIS and 2 different proj4 strings:
+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0
+k=1.0 +units=m +nadgrids=@null +no_defs
+proj=merc +lon_0=0 +lat_ts=0 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +units=m
+no_defs
But in this case my data is slightly shifted when I overlay it with google.
Please, please help me to either reproject original data into Google
projection or to set up OpenLayers to reproject data into Google on fly and
be able to access features.

If I use protocol: OpenLayers.Protocol.WFS.fromWMSLayer(points) then Popup
shortly comes up in a different place and dissappears.

I am using OpenLayers OpenLayers 2.8 -- $Revision: 9492
Point layer comes from Geoserver 2.0.0

Any help would be highly appreciated,
Alex


Here is the code:

     var points = new OpenLayers.Layer.WMS(
        "Pegel BW",
        "http://hboard.iwk.uni-karlsruhe.de:8080/geoserver/wms",
        {
            transparent: 'TRUE',
            layers: 'regio:pegel_bw',
            styles: ''
        },
        {
            isBaseLayer: false,
            reproject: true
        });

    select = new OpenLayers.Layer.Vector("Selection", {
        styleMap: new
OpenLayers.Style(OpenLayers.Feature.Vector.style["select"])
    , projection: "EPSG:31467"
        , reproject: true
    });

    control = new OpenLayers.Control.GetFeature({
          protocol: new OpenLayers.Protocol.WFS.v1_1_0({
            url: "http://hboard.iwk.uni-karlsruhe.de:8080/geoserver/wfs",
            maxFeatures: 200,
            featureType:"pegel_bw",
            featureNS: "
http://ihwarcgis2.bau-verm.uni-karlsruhe.de:8080/geoserver/regio",
            geometryName: "the_geom",
            srsName: "EPSG:31467",
            reproject: true
          }),
      box: false,
      toggleKey: "ctrlKey",
     'reproject': true
    });

    control.events.register("featureselected", this, function(e) {
        select.addFeatures([e.feature]);

        popup = new GeoExt.Popup({
               title: 'BW-Abluss',
               feature: e.feature,
               width:390,
               height:360,
               html: "",
               maximizable: false,
               collapsible: true,
               autoScroll: true
           });
           popup.add(tabpanel);
           popup.show();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100624/61a98995/attachment.html


More information about the Users mailing list