[OpenLayers-Users] maximum ZoomLevel for google maps

Rodolfo Moreno rmoreno at voxiva.com
Thu Nov 27 19:13:51 EST 2008


Arnd, You have a different extent in your map and thus you must have a
different init scale.
My map has a init scale equal to 144000 and the consecutive "zoom in" is the
half of it and so on.

Thanks Kenneth, your tip fixed the scale issue, however the problem of the
overlaying continues.
I thought that it was a problem of scales.

I keep on with the wiki sample "display mapguide maps using openlayers for
.NET" (do you remember?)
well when I star the application the google maps is shown suitable (since
it's the base layer),
next I check the option GetDynamicMapOverlayImage and the mapguide layer is
displayed in a wrong position (see attached image). but when I do "zoom in"
or "zoom out" the overlay Image(mapguide layer) is placed correctly.

This the client code:

   var map, map2, layer;
        //var url =
"http://demo01.dmsolutions.ca/mapguide/mapagent/mapagent.fcgi";
        //you can use this URL when MapGuide OS is installed locally
        var url = "http://localhost/mapguide/mapagent/mapagent.fcgi";

        var metersPerUnit = 111319.4908;  //value returned from mapguide
        var inPerUnit = OpenLayers.INCHES_PER_UNIT.m * metersPerUnit;
        OpenLayers.INCHES_PER_UNIT["dd"] = inPerUnit;
        OpenLayers.INCHES_PER_UNIT["degrees"] = inPerUnit;
        OpenLayers.DOTS_PER_INCH = 96;
   
        function init(){
          var mapBounds = new
OpenLayers.Bounds(-87.764986990963,43.691398128788,-
87.6955215109,43.79752000048);
	       
	var fixedScales =[1129,2257,4514,9028,18000,36000,72000,144000];	        


            var  maxZOOMLEVEL = 19;
            
            var mapOptions = {
                maxExtent: mapBounds,
                scales: fixedScales,
                numZoomLevels: maxZOOMLEVEL+1
            };
			
            map = new OpenLayers.Map( 'map', mapOptions );
			
			// google maps			
			//G_HYBRID_MAP, G_SATELLITE_MAP, G_NORMAL_MAP
			
			var satellite = new OpenLayers.Layer.Google(
                "Google Satellite" , {type: G_NORMAL_MAP , MAX_ZOOM_LEVEL:
maxZOOMLEVEL}
            );
            
            
            map.addLayer(satellite);
			
	        //tiled map
			var tiledParams = {
              mapdefinition:
'Library://Samples/Sheboygan/MapsTiled/Sheboygan.MapDefinition',
              basemaplayergroupname: "Base Layer Group",
			  session: '<%=sessionId%>'
            }

            var tiledOptions = {
              units: "dd",
              singleTile: false
            }
			
            var tiledLayer = new OpenLayers.Layer.MapGuide( "GetTileImage", 
				url, 
				tiledParams, 
				tiledOptions );
            map.addLayer(tiledLayer);
			
	//un-tiled versions

	 var dynamicOverlayOptions = {
              buffer: 1,
              singleTile: true,
			  isBaseLayer : false,
			  visibility : false
	         };

  		     var mapImageOptions = {
              buffer: 1,
              singleTile: true,
			  isBaseLayer : true
	          };


			var untiledParams = {
			  	session: '<%=sessionId%>',
                mapname: 'Sheboygan'
			};
		var dynamicLayer = new OpenLayers.Layer.MapGuide(
"GetDynamicMapOverlayImage", 
				url, 
				untiledParams, 
				dynamicOverlayOptions );
			map.addLayer(dynamicLayer);
			
			var mapImageLayer = new OpenLayers.Layer.MapGuide( "GetMapImage", 
				url, 
				untiledParams, 
				mapImageOptions );
			map.addLayer(mapImageLayer);


	        map.zoomToMaxExtent();

	        map.addControl(new OpenLayers.Control.MousePosition());
            map.addControl(new OpenLayers.Control.Scale());
			
    		var switcher=new OpenLayers.Control.LayerSwitcher();
			map.addControl(switcher);
			switcher.maximizeControl();

        }

I don't know what is the problem, or maybe the server code?

Cheers,


Arnd Wippermann wrote:
> 
> Sorry, but I have no experience with mapguide layers.
> 
> But what i not understand, is, that i get for my google layers other
> scales.
> 
> zoomlevel : 18, scale : 1692.7500637975315, res : 0.5971642833709717
> zoomlevel : 19, scale : 846.3750318987658, res : 0.29858214168548586
> 
> 
> Arnd Wippermann
> 
> -----Ursprüngliche Nachricht-----
> Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
> Auftrag von Rodolfo Moreno
> Gesendet: Donnerstag, 27. November 2008 20:51
> An: users at openlayers.org
> Betreff: Re: [OpenLayers-Users] maximum ZoomLevel for google maps
> 
> 
> Thanks Arnd, It works very good.
> On the other hands, I have another question related with it.
> I am overlaying google maps with mapguide's layers. The problem is that
> the
> displaying scales are different.
>        Google maps		MAPGUIDE
> 	144000		100000
> 	 72000	 	 52000
> 	 36000		 27000
> 	 18000		 14000
> 	  9028		  7197
> 	  4514		  3728
> 	  2257		  1931
> 	  1129		  1000
> 
> Then the overlay of these two layers (google and mapguide) doesn't
> coincide.
> For example: The corner of the street1 and street2 in google layer is 200m
> toward the north of the that corner itself in mapguide layer. It happens
> due
> to that google layer is to the scale of 1:2257 and mapguide layer is to
> the
> scale of 1:1931.
> 
> Is there any way that both layers have the same scales?
> 
> Regards
> 
> 
> Arnd Wippermann wrote:
>> 
>> Hi Rodolfo,
>> 
>> the patch from the old post is really not needed and there are only 21 
>> zoomlevels for Wuppertal.
>> 
>> Looking now at the question with a better understanding of OpenLayers, 
>> I see, that I have only to set the numZoomLevels for the map object 
>> and MAX_ZOOM_LEVEL for the Google layers.
>> 
>> The default values are
>> 
>> MAX_ZOOM_LEVEL = 19
>> numZoomLevels  = 16
>> 
>> With the set
>> 
>> MAX_ZOOM_LEVEL = 21      (0 - 21 => 22 numZoomLevels)
>> numZoomLevels  = 21+1
>> 
>> i can get the result without any patch.
>> 
>> 
>> var maxZOOMLEVEL = 21;
>> 
>> map = new OpenLayers.Map('map',
>> { 
>>     maxExtent: new
>> OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
>>     numZoomLevels: maxZOOMLEVEL+1,
>>     maxResolution: 156543.0399,
>>     units: 'm',
>>     projection: new OpenLayers.Projection("EPSG:900913")
>> });
>> 
>> var gsat = new OpenLayers.Layer.Google(
>>     "Google Satellite",
>>     {type: G_SATELLITE_MAP, sphericalMercator : true, MAX_ZOOM_LEVEL :
>> maxZOOMLEVEL}
>> );
>> 
>> At http://gis.ibbeck.de/ginfo/ you can zoom up to 21 zoomlevels.
>> 
>> I hope, that helps.
>> 
>> Arnd Wippermann
>> 
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>> 
>> 
> 
> 
> -----
> Rodolfo Moreno
> CivilEng
> 
> --
> View this message in context:
> http://n2.nabble.com/maximum-ZoomLevel-for-google-maps-tp1574304p1586605.htm
> l
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 
http://n2.nabble.com/file/n1587327/OverlayingError.jpg 

-----
Rodolfo Moreno
CivilEng

-- 
View this message in context: http://n2.nabble.com/maximum-ZoomLevel-for-google-maps-tp1574304p1587327.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list