[OpenLayers-Dev] Integrating Google Maps and Mapserver

Bradley Mclain bradleym06 at gmail.com
Tue Jul 3 20:14:26 EDT 2007


Sorry for taking so long on this but I can't work out why this won't work
and my knowledge of this kinda stuff is rather limited so all your help is
much appreciated.

Anyway using the example and adding in my own URL and parameters this is
what i came up with. I have attached the relevant mapfile and html document.
At the moment the google layers work fine it is just the wms layer that I am
struggling with I am not sure if this is how you meant to define it.

On 7/3/07, Ludwig M Brinckmann <ludwigbrinckmann at gmail.com> wrote:
>
> 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://openlayers.org/pipermail/dev/attachments/20070704/11d6d659/attachment-0001.htm 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://openlayers.org/pipermail/dev/attachments/20070704/11d6d659/attachment-0001.html 
-------------- next part --------------
#De Bortoli Wines Map

MAP
	NAME dbw
		PROJECTION
		"init=epsg:28355"
		END
	IMAGETYPE PNG24
	EXTENT 418485.188 6204834.362 424295.450 6208828.520
	SIZE 640 480
	UNITS meters
	SHAPEPATH "/usr/local/mapdata"
	TRANSPARENT on
	
#########################################
#Web Object

	WEB
		METADATA
			wms_title "De Bortoli Mapserver"
			wms_srs "EPSG:28355"
		END
	END
	
#########################################
#Aerial Photo Layer

	LAYER
		NAME dbwap
			METADATA
				wms_title "De Bortoli Aerial Photo"
			END
			PROJECTION
				"init=epsg:28355"
			END
		DATA "MI Aerial Photo/mi_debortoli_mga.vrt"
		STATUS ON
		TYPE RASTER
	END
	
#########################################
#Cadastral Boundary Layers
	
	LAYER
		NAME bcadbd
		DATA DBW_Home_Bilbul_Cadastral_Boundary
		STATUS ON
		TYPE POLYGON
		GROUP cadbd
			METADATA
				wms_title "Bilbul Cadastral Boundary"
			END
			PROJECTION
				"init=epsg:28355"	
			END
			CLASS
				NAME "Bilbul Cadastral Boundary"
					STYLE
						COLOR -1 -1 -1
						OUTLINECOLOR 50 70 255
						
				END
			END
	END 
    
	LAYER
		NAME hcadbd
		DATA DBW_Hemley_2593_Cadastral_Boundary
		STATUS ON
		TYPE POLYGON
		GROUP cadbd
			METADATA
				wms_title "Hemley Cadastral Boundary"
			END
			PROJECTION
				"init=epsg:28355"	
			END
			CLASS
				NAME "Hemley Cadastral Boundary"
					STYLE
						COLOR -1 -1 -1
						OUTLINECOLOR 50 70 255
				END
			END
	END
	
#########################################
#Property Boundary Layers
	
		LAYER
		NAME bpropbd
		DATA DBW_Home_Bilbul_Property_Boundary
		STATUS ON
		TYPE POLYGON
		GROUP propbd
			METADATA
				wms_title "Bilbul Property Boundary"
			END
			PROJECTION
				"init=epsg:28355"	
			END
			CLASS
				NAME "Bilbul Property Boundary"
					STYLE
						COLOR -1 -1 -1
						OUTLINECOLOR 0 0 0
				END
			END
		END
		
		LAYER
		NAME hpropbd
		DATA DBW_Hemley_2593_Property_Boundary
		STATUS ON
		TYPE POLYGON
		GROUP propbd
			METADATA
				wms_title "Hemley Property Boundary"
			END
			PROJECTION
				"init=epsg:28355"	
			END
			CLASS
				NAME "Hemley Property Boundary"
					STYLE
						COLOR -1 -1 -1
						OUTLINECOLOR 0 0 0
				END
			END
		END
		
#########################################
#Farm Blocks Layers
		
		LAYER
		NAME bfmbl
		DATA DBW_Home_Bilbul_Farm_Blocks
		STATUS ON
		TYPE POLYGON
		GROUP fmbl
			METADATA
				wms_title "Bilbul Farm Blocks"
			END
			PROJECTION
				"init=epsg:28355"	
			END
		TRANSPARENCY 30
			CLASS
				NAME "Bilbul Farm Blocks"
					STYLE
						COLOR 0 255 0
						OUTLINECOLOR 0 255 0
				END
			END
		END
		
		LAYER
		NAME hfmbl
		DATA DBW_Hemley_2593_Farm_Blocks
		STATUS ON
		TYPE POLYGON
		GROUP fmbl
			METADATA
				wms_title "Hemley Farm Blocks"
			END
			PROJECTION
				"init=epsg:28355"	
			END
		TRANSPARENCY 30
			CLASS
				NAME "Hemley Farm Blocks"
					STYLE
						COLOR 0 255 0
						OUTLINECOLOR 0 255 0
				END
			END
		END
		
#########################################
#Variety Blocks Layers
		
		LAYER
		NAME bvarbl
		DATA DBW_Home_Bilbul_Variety_Blocks
		STATUS ON
		TYPE POLYGON
		TRANSPARENCY 30
		GROUP varbl
			METADATA
				wms_title "Bilbul Variety Blocks"
			END
			PROJECTION
				"init=epsg:28355"	
			END
			CLASS
				NAME "Bilbul Variety Blocks"
					STYLE
						COLOR 255 0 0
						OUTLINECOLOR 255 0 0
				END
			END
		END
		
		LAYER
		NAME hvarbl
		DATA DBW_Hemley_2593_Variety_Blocks
		STATUS ON
		TYPE POLYGON
		GROUP varbl
			METADATA
				wms_title "Hemley Variety Blocks"
			END
			PROJECTION
				"init=epsg:28355"	
			END
		TRANSPARENCY 30
			CLASS
				NAME "Hemley Variety Blocks"
					STYLE
						COLOR 255 0 0
						OUTLINECOLOR 255 0 0
				END
			END
		END
		
#########################################
	
END


More information about the Dev mailing list