[OpenLayers-Users] How to do Google+TMS+Marker layers

Christopher Schmidt crschmidt at metacarta.com
Tue Aug 14 08:43:17 EDT 2007


On Tue, Aug 14, 2007 at 02:29:30PM +0200, Jochen Topf wrote:
> I want to create an OpenLayers map with switchable Google and TMS base
> layers and some markers on top. I only want to use WGS84 geographical
> coordinates and had hoped that OpenLayers would do everything else behind
> my back.

Nope. Not going to happen in the near future. OpenLayers doesn't do
client-side reprojection, and will not in 2.5. 

> But whatever I try I can't get this to run without having to reproject
> everything when I switch baselayers etc. because the Google layer works
> with lat/lon while the TMS layer uses the Mercator projection. The
> Markers layer will then use whatever the base layer uses.

Yep. This behavior will be improving in 2.5, because Google will no
longer be treated as lat/lon data, and instead projected data. You can
use this now in the GoogleMercator code that Tim is working on:

http://svn.openlayers.org/sandbox/tschaub/google/

This setup will improve the situation that you're currently suffering
under, and I think will solve the problem of switching -- but you're
still going to have to reproject your vector data and input x/y coords. 

> This is especially irksome because the tile format used by Google and by
> OpenStreetMap is exactly the same and only because they get accessed so
> differently going through the GMAP API and through TMS, respectively,
> the usage is so different. (In fact using OpenStreetMap tiles with GMAP
> API alone is very easy.) I tried using the LikeGoogle layer, but it has
> the same problem as TMS.

Yep.

> I feel rather stupid and keep thinking there must be a better and easier
> solution, but I can't find any. (Apart from just using GMAP alone.)

Nope. You're right. There's no better solution using OpenLayers at the
moment. In 2.5, the situation will get better, but we still don't solve
all the problems you're interested in solving. 

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list