Ticket #2736 (closed bug: duplicate)

Opened 3 years ago

Last modified 3 years ago

Google v3 layer issues

Reported by: pwr Owned by:
Priority: minor Milestone: 2.10 Release
Component: Layer.Google.v3 Version: 2.9
Keywords: Cc:
State:

Description

I've found 2 problems with using the v3 layer:

1. Google Chrome fails with "Uncaught TypeError: Cannot read property 'childNodes' of null". This seems to be specific to Chrome and does not occur with other webkit browsers. It also does not occur with the example, but only with more complex pages which read in more scripts. Presumably, the first time the repositionMapElements() loop is executed, the mapObject has a div but without children, so the problem can be fixed by checking this as in the attached patch.

2. I was adding a Google scale control. This seems to include the zoombar in the mapObject, meaning that there are 4 controls not 3, and they are in a different sequence, so using lastChild means the wrong child gets put in the wrong div, and general confusion results. You could put in complicated logic to loop through the controls putting them in the right div, but as the scale control is largely meaningless at many latitudes/zoomlevels this hardly seems worthwhile. So I've just added a comment in the docs that the layer is not compatible with Google Controls.

Also, the current docs at the top (line 13) says 'Note that' - something seems to be missing :-)

Attachments

google3diff Download (0.9 KB) - added by pwr 3 years ago.

Change History

Changed 3 years ago by pwr

follow-up: ↓ 3   Changed 3 years ago by ahocevar

  • status changed from new to closed
  • state Review deleted
  • resolution set to duplicate

It seems you were not working with the most recent code. What you describe in 1. was fixed in r10484, so this is a duplicate of #2731.

Using GMaps API controls on a Google layer is not supported by the OpenLayers API. And since the "Note that" used to say "Note that Google.v3 layers only work when sphericalMercator is set to true", which is now explained in the docs for the DEFAULTS constant, I am fine with adding your comment to the class docs instead.

  Changed 3 years ago by ahocevar

(In [10485]) Added a note about incompatibility with UI controls provided by the GMaps API. Thanks pwr for pointing this out (see #2736)

in reply to: ↑ 1   Changed 3 years ago by pwr

Replying to ahocevar:

It seems you were not working with the most recent code. What you describe in 1. was fixed in r10484, so this is a duplicate of #2731.

yup, I was investigating this yesterday before 10484 was committed, and only got around to submitting the bug today. Have now updated to latest trunk and works fine.

I have also noticed that occasionally the attribution is not displayed on the first map displayed (the text in the div is blank), though I've not been able to work out if this is an OL problem or a Google one. Subsequent displays, such as zoom in then out, are fine. Google seems to load the terms link first, then the map tiles, then the attribution (which is dependent on the zoomlevel/layer displayed), and there can be a considerable delay while this happens, so I suppose it's possible it just gets lost in the pipeline somewhere.

  Changed 3 years ago by ahocevar

@pwr: Can you please create a separate issue for the attribution issue? Thanks.

follow-up: ↓ 6   Changed 3 years ago by ahocevar

@pwr: Before you create a new ticket: I noticed that the attribution for a view of the whole world does not include a copyright, just the "Terms of Use" link. Please check what your zoom level is when you don't see the attribution, and if you see the "Terms of Use" link on every zoom level.

in reply to: ↑ 5   Changed 3 years ago by pwr

ok, I've just added #2737. I was using an intermediate zoomlevel (Europe).

Note: See TracTickets for help on using tickets.