[OpenLayers-Dev] Integrating Google Maps and Mapserver

Bradley Mclain bradleym06 at gmail.com
Mon Jul 2 00:23:00 EDT 2007


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"
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
> > > >
> > > >
> > >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20070702/321625e9/attachment.html


More information about the Dev mailing list