Ticket #686 (closed feature: fixed)

Opened 6 years ago

Last modified 6 years ago

Treat Google Layer as projected data

Reported by: euzuro Owned by:
Priority: blocker Milestone: 2.5 Release
Component: general Version: 2.4 RC2
Keywords: Cc:
State:

Description (last modified by crschmidt) (diff)

Currently, Google is treated inside OpenLayers as unprojected data. However, the data is actually projected - it's simply that the API which exposes that data is not. Instead of trying to work with projected data as if it is unprojected, we should treat it as projected, and talk to the API in the language that it understands.

This would resolve a number of issues that we have had over and over again with the Google layer not fitting into line with the way the rest of OpenLayers works.

Tim Schaub has started work on this in the 'google' sandbox, via the GoogleMercator layer. This work should be extended to be a base class against which we can subclass the other layers, similar to the EventPane or FixedZoomLevels mixins.

Attachments

openlayers-google.patch Download (4.2 KB) - added by euzuro 6 years ago.
sphericalmercator.patch Download (33.0 KB) - added by crschmidt 6 years ago.
spherical-mercator.patch Download (32.1 KB) - added by crschmidt 6 years ago.

Change History

Changed 6 years ago by euzuro

  Changed 6 years ago by tschaub

  Changed 6 years ago by crschmidt

  • description modified (diff)
  • summary changed from Adapt WMS Overlay to Google Layer to Treat Google Layer as projected data

I think that Tim's solution here is the more appropriate one. I'd like to propose we move forward with that, rather than the zoom-level based hack that everyone seems to use.

  Changed 6 years ago by crschmidt

  • priority changed from minor to blocker

Changed 6 years ago by crschmidt

  Changed 6 years ago by crschmidt

Add SphericalMercator mixin. Use sphericalmercator mixin on all current commercial layers. Create a bunch of examples. Add a few tests.

follow-up: ↓ 6   Changed 6 years ago by crschmidt

  • keywords review added

I don't know how much testing we want to do on this, but I'm tapped out on it: for now, marking review just to garner comments from anyone interested in the code. This is just a diff between  http://dev.openlayers.org/sandbox/tschaub/google/ and trunk -- The code can be checked out from:

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

and the way you use it is to set:

sphericalMercator: true

as an option on the layer.

I think this is going to be the final API: the GoogleMercator layer is going to go away, and it's just going to be an option on the layer.

in reply to: ↑ 5   Changed 6 years ago by elemoine

Replying to crschmidt:

I don't know how much testing we want to do on this, but I'm tapped out on it: for now, marking review just to garner comments from anyone interested in the code. This is just a diff between  http://dev.openlayers.org/sandbox/tschaub/google/ and trunk -- The code can be checked out from:  http://svn.openlayers.org/sandbox/tschaub/google/ and the way you use it is to set: sphericalMercator: true as an option on the layer. I think this is going to be the final API: the GoogleMercator layer is going to go away, and it's just going to be an option on the layer.

I've just taken a look at the patch. Excellent work. One comment: your patch adds GoogleMercator.js to the js list in OpenLayers.js, which, I guess, is not something you want in the final patch.

Changed 6 years ago by crschmidt

  Changed 6 years ago by crschmidt

Removed googlemercator.js from OpenLayers.js

  Changed 6 years ago by crschmidt

  • keywords review removed
  • status changed from new to closed
  • resolution set to fixed

(In [4221]) With review from elem, and oversight from tschaub, rolling in SphericalMercator changes. Note that this explicitly does *not* include r4182 , so as to keep changes to a single logical set: that should be filed in a seperate bug if it can be reproduced against trunk after this commit. Hooray for Tim, thanks for all the feedback, onward and upward! (Closes #686)

Note: See TracTickets for help on using tickets.