[OpenLayers-Dev] Integrating Google Maps and Mapserver

Ludwig M Brinckmann ludwigbrinckmann at gmail.com
Tue Jul 3 04:28:11 EDT 2007


Bradley,


var mapservwms = new OpenLayers.Layer.WMS("De Bortoli Mapserver",
['http://192.168.1.130/cgi-bin/mapserv?map=/usr/local/mapfiles/dbwwms.map&service=wms&version=1.1&request=getmap&layers=dbwap,bcadbd,hcadbd'])<http://192.168.1.130/cgi-bin/mapserv?map=/usr/local/mapfiles/dbw.map&service=wms&version=1.1.1&request=getmap&layers=dbap>


I suggest you have a look into the examples directory in OpenLayers.
Essentially OpenLayers takes care of a lot of the underlying WMS protocol
stuff, like the protocol and service parameters. For your server the URL to
put into the OpenLayers.Layer.WMS would be
' http://192.168.1.130/cgi-bin/mapserv?map=/usr/local/mapfiles/dbwwms.map',
<http://192.168.1.130/cgi-bin/mapserv?map=/usr/local/mapfiles/dbw.map&service=wms&version=1.1.1&request=getmap&layers=dbap>
the layers go into a separate argument as a list.

Try to get the examples/wms.html to work -- once this is working, substitute
your URL and layer names.
Otherwise you will keep banging your head against the wall.

HTH

Ludwig


On 03/07/07, Bradley Mclain <bradleym06 at gmail.com> wrote:
>
> Ok this doesn't seem to be necessary can't I just use OpenLayers to tile?
> My main problem is just getting OpenLayers to display the Mapserver WMS data
> which is now correctly working (I can now query the WMS properly outside of
> openlayers) .
>
> Would it be easier to get a wrapping script working because i can't get
> that to work at the moment and all of the examples so far seem to be using a
> wrapping script of some sort.
>
>
> On 7/3/07, Bradley Mclain <bradleym06 at gmail.com> wrote:
> >
> > Its good its working now, I'll have a look through it and see what i can
> > do.
> >
> > On 7/3/07, Bradley Mclain <bradleym06 at gmail.com > wrote:
> > >
> > > Thanks how do i get to the configuration script?
> > >
> > > On 7/3/07, Anselm Hook <anselm at gmail.com > wrote:
> > > >
> > > > Those are ~probably~ done as a cgi alias?  And / or the actual
> > > > composition of specific arguments is handled in javascript?
> > > >
> > > > A while back I put together an example at civicmaps.org - I notice
> > > > that the home page is broken at the moment, but the configuration script
> > > > there may help.
> > > >
> > > > I must admit setting these things up can be a hassle.
> > > >
> > > >  - a
> > > >
> > > > On 7/1/07, Bradley Mclain <bradleym06 at gmail.com > wrote:
> > > > >
> > > > > Also just thought that I'd mention that my Mapserver is not
> > > > > properly set up as a WMS and it will be quite difficult to do so so I'd
> > > > > rather use the cgi mode of Mapserver. However when looking at the Mapserver
> > > > > examples I failed to see anything at all which resembled this. It calls "
> > > > > http://labs.metacarta.com/wms/vmap0" but shouldn't there be a
> > > > > "cgi-bin/mapserv?map=" somewhere.
> > > > >
> > > > > Cheers
> > > > >
> > > > > Brad
> > > > >
> > > > > On 7/2/07, Bradley Mclain <bradleym06 at gmail.com> wrote:
> > > > > >
> > > > > > Ok I made some progress but I have hit a few roadblocks. At the
> > > > > > moment my code successfully displays the google map, hybrid and satelite
> > > > > > images. However only if it is opened from its current location if I try to
> > > > > > open it on my server, i get an error displaying that my google maps api does
> > > > > > not correspond. However even when i registered a new one for
> > > > > > http://192.168.1.130 (my server address) the page simply
> > > > > > displays as plain white.
> > > > > >
> > > > > > My second problem is getting mapserver to display. Below is my
> > > > > > current attempt to get it to work. What am supposed to call the mapfile?, or
> > > > > > direct it to the url of the working map?
> > > > > >
> > > > > > <html>
> > > > > > <head>
> > > > > >   <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ<http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ>"
> > > > > > type="text/javascript"></script>
> > > > > >     <script src="../lib/OpenLayers.js"
> > > > > > type="text/javascript"></script>
> > > > > >
> > > > > > </head>
> > > > > > <body>
> > > > > > <h4>Debortoli Wines OpenLayers Test</h4>
> > > > > >
> > > > > >   <div style="width:100%; height:80%" id="map"></div>
> > > > > >
> > > > > >   <script defer="defer" type="text/javascript">
> > > > > >     OpenLayers.ProxyHost="/proxy/?url=";
> > > > > >
> > > > > >     var map = new OpenLayers.Map( 'map', {controls: [new
> > > > > > OpenLayers.Control.PanZoomBar()]} );
> > > > > > //Adding Controls
> > > > > >     map.addControl(new OpenLayers.Control.MouseToolbar());
> > > > > >     map.addControl(new OpenLayers.Control.MousePosition ());
> > > > > >     map.addControl(new OpenLayers.Control.Permalink());
> > > > > >
> > > > > >     var layer_switcher = new OpenLayers.Control.LayerSwitcher();
> > > > > >     map.addControl(layer_switcher);
> > > > > >     layer_switcher.maximizeControl();
> > > > > >
> > > > > > //Adding Layers
> > > > > >     var google = new OpenLayers.Layer.Google("Google");
> > > > > >     var googles = new OpenLayers.Layer.Google("Google
> > > > > > Satellite", { 'type': G_SATELLITE_MAP });
> > > > > >     var googleh = new OpenLayers.Layer.Google("Google Hybrid", {
> > > > > > 'type': G_HYBRID_MAP });
> > > > > >     var mapserv = new Openlayers.Layer.HTTPRequest("Debortoli
> > > > > > Mapserver", "http://192.168.1.130/cgi-bin/mapserv?map=/usr/local/mapfiles/dbw.map&layers=dbap&mode=browse
> > > > > > ");
> > > > > >
> > > > > >     map.addLayers([google, googles, googleh, mapserv]);
> > > > > >
> > > > > >     map.setCenter(new OpenLayers.LonLat(135,-28), 4);
> > > > > >
> > > > > >   </script>
> > > > > > </body>
> > > > > > </html>
> > > > > >
> > > > > > On 7/2/07, Bradley Mclain <bradleym06 at gmail.com> wrote:
> > > > > > >
> > > > > > > Cool I'll look into that and get back to you with my progress.
> > > > > > > Currently having issues getting my google map to display, its just shows up
> > > > > > > as white. I registered a new key and everything.
> > > > > > >
> > > > > > > On 7/2/07, Anselm Hook <anselm at gmail.com> wrote:
> > > > > > > >
> > > > > > > > Oh, actually that example is not perfectly clear; it doesn't
> > > > > > > > expressly illuminate that you can choose to leave more than one layer on at
> > > > > > > > a time....  in any case you can do so.
> > > > > > > >
> > > > > > > >  - a
> > > > > > > >
> > > > > > > > On 7/1/07, Anselm Hook <anselm at gmail.com> wrote:
> > > > > > > > >
> > > > > > > > > http://openlayers.org/gallery/multiple.html
> > > > > > > > >
> > > > > > > > > On 7/1/07, Bradley Mclain < bradleym06 at gmail.com> wrote:
> > > > > > > > >
> > > > > > > > > > Hey
> > > > > > > > > >
> > > > > > > > > > What I am looking to do is to integrate Google Maps with
> > > > > > > > > > a custom map which is being served from Mapserver. I currently have
> > > > > > > > > > Mapserver working and serving the correct layers. I just have a few
> > > > > > > > > > questions about this which I am hoping you can answer.
> > > > > > > > > >
> > > > > > > > > > Is it possible to use openlayers to integrate the two?
> > > > > > > > > > If not, are there any other possible programs which I
> > > > > > > > > > can use to do this?
> > > > > > > > > > If so, how do I go about this?
> > > > > > > > > >
> > > > > > > > > > Cheers
> > > > > > > > > >
> > > > > > > > > > Brad
> > > > > > > > > >
> > > > > > > > > > _______________________________________________
> > > > > > > > > > Dev mailing list
> > > > > > > > > > Dev at openlayers.org
> > > > > > > > > > http://openlayers.org/mailman/listinfo/dev
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20070703/b635194b/attachment.html


More information about the Dev mailing list