[OpenLayers-Users] [Fwd: Re: [Fwd: Re: Overlays with google maps]]

Stephen Woodbridge woodbri at swoodbridge.com
Mon Feb 19 12:32:18 EST 2007


Christopher,

Sorry, the Reply To did not include the list, thank you for asking.

We are not using WMS primarily because the route image generation was 
able to be done with much less overhead and infrastructure without 
mapserver and since we pre-generated our cache, we didn't need mapserver 
for anything else.

I can change our image request to better conform to your suggestions 
below and see how that works out. Thanks.

So if I understood correctly, your recommendation would be to serve the 
route via WMS if there were not other constraints on the problem.

Thank you and the team for all the work you have done on OL, it is 
really a wonderful tool.

Best regards,
   -Steve

-------- Original Message --------
Subject: Re: [Fwd: Re: [OpenLayers-Users] Overlays with google maps]
Date: Mon, 19 Feb 2007 11:51:24 -0500
From: Christopher Schmidt <crschmidt at metacarta.com>
To: Les Szklanny <lszklanny at where2getit.com>
CC: Stephen Woodbridge <woodbri at swoodbridge.com>
References: <45D7D0AF.4040701 at swoodbridge.com> 
<45D9AC86.2040504 at where2getit.com>

On Mon, Feb 19, 2007 at 07:56:22AM -0600, Les Szklanny wrote:
> Christopher, hi!
> 
> I'm responding to your question:
> 
> "Can you give an example chunk of code for how you're currently determining
> the bounds for the image that you request from your route generation
> tool? are you using map.getExtent()?"
> 
> Here's the function that generates a query string for the GET route image 
> request:
> 
> 	/**
> 	 * @method
> 	 * @return String
> 	 */
> 	_getImageQS: function() {
> 		var bounds = this.map.getExtent();
> 		var res = this.map.getResolution();
> 		var qs =	'top=' 		+ (-bounds.top/res) +
> 					'&left=' 	+ bounds.left/res +
> 					'&right=' 	+ bounds.right/res +
> 					'&bottom=' 	+ 
> 					(-bounds.bottom/res) +
> 					'&ratio=' 	+ res;	
> 		return qs;		
> 	}

That won't work with Google. The horizontal resolution is not the same
as the vertical resolution: because the units are in decimal degrees,
but the projection is in meters, there is a non-linear change in
geographic distance for every vertical pixel.

I can't tell you what your application server-side needs to do, but
somewhere along te line you need to support a different ratio for width
and height. You can then divide

   (bounds.top - bounds.bottom) / map.getSize()[1]

to get that vertical ratio. (I'd suggest doing something simiar for the
horizontal direction: getResolution picks one of those two values, but
I'm not sure which.)

Alternatively, simply change your code to accept a geographic bounds,
plus a width and height, and render that way. However, I'm assuming
that you're not using the tried-and-true method that WMS uses for a
reason, so that probably won't work for you for some reason I don't
understand.

(If possible, I'd like to send this email back to the mailing list. is
this information non-public, or were you simply not signed up to the
list?)

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list