Ticket #3312 (closed feature: wontfix)

Opened 2 years ago

Last modified 21 months ago

Google XYZ layer with with tiles provided by the GMaps v3 JavaScript API

Reported by: ahocevar Owned by: euzuro
Priority: minor Milestone: 2.11 Release
Component: Layer Version: 2.11 RC1
Keywords: Cc: keithmoss
State:

Description

We all know the problems with commercial layers integrated through Layer.EventPane. For Google layers, it is now possible to use the tiles from the API, instead of interacting with a full blown google.maps.Map instance. This works by using the google.maps.MapType's getTile method, which is available even for unrendered google.maps.Map instances, and returns markup for a tile with the same x, y and z tile addressing scheme that we use for Layer.XYZ.

This ticket suggests a new layer type, Layer.GoogleNG, which inherits from Layer.XYZ and uses a new tile class, Tile.Google, for its tiles.

Attachments

google-ng.patch Download (17.5 KB) - added by ahocevar 2 years ago.
openlayers-3312.patch Download (24.7 KB) - added by ahocevar 2 years ago.
with tests
openlayers-3312.3.2.patch Download (25.2 KB) - added by ahocevar 2 years ago.
incorporated Bart's comments, improved tests, fixed initialize
openlayers-3312.4.patch Download (25.7 KB) - added by ahocevar 2 years ago.
attempt to make tests easier to read; note about attribution

Change History

  Changed 2 years ago by ahocevar

The above patch has no unit tests yet. The new layer type can be seen in action on  http://svn.openlayers.org/sandbox/ahocevar/google-ng

  Changed 2 years ago by keithmoss

  • cc keithmoss added

follow-up: ↓ 4   Changed 2 years ago by bartvde

Hey Andreas, this is great! How did you find out about this? Also, I assume this does not violate the ToS?

in reply to: ↑ 3   Changed 2 years ago by ahocevar

Replying to bartvde:

Hey Andreas, this is great! How did you find out about this? Also, I assume this does not violate the ToS?

Spent some time this weekend reading the GMaps v3 API documentation and the ToS. This method of getting tiles is API compliant, and the attribution meets the requirement of the ToS. So I am pretty confident it does not violate the ToS.

Changed 2 years ago by ahocevar

  Changed 2 years ago by ahocevar

  • state set to Review

openlayers-3312.patch Download is now a complete patch with tests. Tests pass and example works in Safari 5, Chromium 11, Firefox 3.6, Firefox 4, Opera 11, IE7, IE8. Thanks for any review.

Changed 2 years ago by ahocevar

with tests

  Changed 2 years ago by bartvde

  • state changed from Review to Needs More Work

Hey Andreas, thanks for this great work.

Here is my review (all minor):

  • Google Tile: this.node should be nullified in destructor
  • typo: prelaoded instead of preloaded
  • constructor of Layer.GoogleNG: options instead of config, and type should be google.maps.MapTypeId instead of string?
  • initLayer: options.restrictedMinZoom -> should be this instead of options?
  • addOptions: use restrictedMinZoom instead of mapType.minZoom?
  • addTile docs: Goolge instead of Google
  • should we really trigger a changelayer event when the attribution changes? If I read the APIDocs in Map.js I would not think so. When would people use this?

Thanks again.

  Changed 2 years ago by ahocevar

  • state changed from Needs More Work to Review

Thanks Bart for the review. I've uploaded a new patch and incorporated all of your comments, except the last. The changelayer event is needed for the Attribution control to update the map attribution. I added additional tests to make sure that restrictedMinZoom is set properly, and by doing so, I found issues with initialize not calling initLayer when the mapTypes are available already. I added additional tests for this in test_initLayer, and removed some that I copied over from Layer.Bing that were not appropriate.

Thanks for another review.

Changed 2 years ago by ahocevar

incorporated Bart's comments, improved tests, fixed initialize

  Changed 2 years ago by bartvde

  • state changed from Review to Commit

Thanks, looks good to go now Andreas (although I am still not 100% sure if this meets the ToS [1], do we know someone legal to check that out for us?), some minor remarks/questions:

  • why do you destroy the map objects in test_initLayer before the last batch of tests? Maybe I am missing something obvious here though
  • in test_attribution map variable is redefined

Ofcourse people would still violate the ToS if they do not use the Attribution Control in OpenLayers, maybe we need to state that somewhere very clear to be safe on our side?

[1]

(f) delete, obscure, or in any manner alter any warning, notice (including but not limited to any copyright or other proprietary rights notice), or link that appears in the Products or the Content; or

Changed 2 years ago by ahocevar

attempt to make tests easier to read; note about attribution

  Changed 2 years ago by ahocevar

Thanks Bart for the ongoing reviewing efforts. The final patch that I'm going to commit incorporates your suggestions on the tests. The tests are now easier to read, and by adding two tests for numResolutions there is a nice symmetry with the restrictedMinZoom tests, which are also rewritten.

I also added a note on proper use of the Attribution control. Regarding the section of the terms of service you cite, we don't delete, obscure or alter any warning, notice or link. On the contrary: with quite some effort we provide all this information, because the product does not do it for us.

  Changed 2 years ago by ahocevar

  • status changed from new to closed
  • resolution set to fixed

(In [12000]) New GoogleNG layer using tiles from the v3 API's mapType::getTile method. r=bartvde (closes #3312)

  Changed 22 months ago by tschaub

  • state Commit deleted
  • version changed from 2.10 to 2.11 RC1
  • milestone changed from 2.12 Release to 2.11 Release

  Changed 21 months ago by dcabasson

  • status changed from closed to reopened
  • resolution fixed deleted

This does not seem to be included in the 2.11 release. Any ideas when this will officially be included in the openmap release?

  Changed 21 months ago by dcabasson

  • status changed from reopened to closed
  • resolution set to wontfix

Got it, this feature was removed in #3481 because of licensing issues.

Note: See TracTickets for help on using tickets.