[OpenLayers-Users] Switching between a Google/Bing base layer to WMS base layer...

Paul james pauljame at gmail.com
Thu Aug 19 15:50:59 EDT 2010


Thanks for your help and patience so far...

I´ll try to explain better my problem...
I have a google base and several wms overlay layers ... Everthing is working
fine...
Relevant code:

Map
  PROJECTION
     "init=epsg:900913"
  END

  METADATA
     "wms_srs"       "EPSG:4326 EPSG:900913"

Layers Wms
PROJECTION
            "init=epsg:4326"
END

----------------------
But now I need to add other base layer, so I´ll  have 2 base layers:
- Google Base Layer : EPSG:900913
- WMS Base Layer : EPSG:4326

When I change to WMS Base Layer, my all layers are gone, including the
others WMS layers...

Relevante Code:
My map remain the same...

WMS BASE LAYER (Original projection : 4326):
METADATA
           "wms_srs"       "EPSG:900913 EPSG:4326"
            "wms_title"    "TESTBASE"
        END

        PROJECTION
            "init=epsg:4326"
        END

My openlayers config:

 map = new OpenLayers.Map('testt', {
         projection: new OpenLayers.Projection("EPSG:900913"),
         units: "m",
         displayProjection: new OpenLayers.Projection("EPSG:4326"),
         tileSize: new OpenLayers.Size(400, 400),
         numZoomLevels: 10,
         maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
20037508.34, 20037508.34)

 var googleBaseLayer = new OpenLayers.Layer.Google(
                "Google Streets",
                {'sphericalMercator': true}
            );

  var wmsBaseLayer = new OpenLayers.Layer.WMS("UFBASE",
                GetMapFileLocation(), {
                    "LAYERS": ['UFBASE'],
                     transparent: true,
                     format: "image/png"
                }, {
                    isBaseLayer: true,
                    displayInLayerSwitcher: true
                });

So, Am I missing something?

On Wed, Aug 18, 2010 at 11:39 AM, David Fawcett <david.fawcett at gmail.com>wrote:

> Your layer projection block should reflect the spatial reference
> system of the data that the layer is based on (input projection).  The
> projection block at the map level sets the output projection when your
> application receives a normal MapServer request.  For WMS requests,
> this is handled by the layer wms_srs metadata.
>
> I don't totally understand your problem, but I think that there are
> two potential areas to look at:
>
> 1.  Is OpenLayers sending the correct WMS request to your MapServer
> app to get the layer that it needs.
>
> 2.  If the WMS request is correct, is your MapServer app configured to
> return the correct layer?
>
> You can use FireBug to look at the WMS request.
>
> David.
>
> On Wed, Aug 18, 2010 at 9:18 AM, Paul james <pauljame at gmail.com> wrote:
> > Thanks!
> >
> > Yes, i tried my layer two ways :
> > PROJECTION
> >      "init=epsg:4326"
> > END
> >
> > ==> Nothing appears
> >
> > PROJECTION
> >      "init=epsg:900913"
> > END
> >
> > ==> The layer was draw, but in other location (0 0´0´´E 0 0´0´´N)
> >
> > Paul
> >
> > On Wed, Aug 18, 2010 at 11:08 AM, David Fawcett <david.fawcett at gmail.com
> >
> > wrote:
> >>
> >> Paul,
> >>
> >> I don't think that it matters for this case, but I think that you want
> >> to drop the '+' sign from your MAP level projection block.
> >>
> >> Do you have a projection block for your layer?  That is definitely
> >> required.
> >>
> >> David.
> >>
> >> On Wed, Aug 18, 2010 at 9:00 AM, Paul james <pauljame at gmail.com> wrote:
> >> > Yes, My proj.4 has EPSG:900913...
> >> >
> >> > My mapfile:
> >> >
> >> > MAP
> >> > ...
> >> >   PROJECTION
> >> >          "+init=epsg:4326"
> >> >   END
> >> >
> >> >   WEB
> >> >         IMAGEPATH '...'
> >> >         IMAGEURL '...'
> >> >
> >> >         METADATA
> >> >             "wms_title"     "WMS Server"
> >> >             "wms_onlineresource" "..."
> >> >             "wms_srs"       "EPSG:4326  EPSG:900913 EPSG:3857"
> >> >             "wms_feature_info_mime_type" "text/html"
> >> >             "labelcache_map_edge_buffer"    "-10"
> >> >         END
> >> >     END
> >> > ...
> >> >
> >> > LAYER
> >> >         NAME TestBase
> >> >         METADATA
> >> >             "wms_srs"       "EPSG:900913"
> >> >             "wms_title"    "TestBase"
> >> >             "wms_feature_info_mime_type" "text/html"
> >> >         END
> >> >
> >> >
> >> > Thanks
> >> >
> >> > Paul
> >> >
> >> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100819/8013f4aa/attachment.html


More information about the Users mailing list