Hi all - Opening a new issue rather than re-opening #968090: Compatibility with OpenLayers 2.10 and Google Maps API v3

Working with the 7.x-2.x dev on a client site and was trying to get them set up to use the v3 API. Set the version in the Openlayers config with no API key and all page displays using Google maps give the pop up that an API key is required. I started to do some digging and found that the $url variable being built by render() in google.inc differs fairly significantly from the url given in the v3 API docs - however, while modifying the variable to more closely follow the documented example keeps the API key popup from appearing, no maps are displayed, and I see the error ReferenceError: G_NORMAL_MAP is not defined in the console. Anyone else having similar issues with the -dev branch?

CommentFileSizeAuthor
#2 openlayers-googlemapv3-1268210-2.patch2.88 KBnod_

Comments

jeffschuler’s picture

Subscribing. I had the same issue.

nod_’s picture

Status: Active » Needs review
StatusFileSize
new2.88 KB

Here is a patch that enable v3. It shouldn't break anything that is on v2.

I tried to show the api key field only when v2 is choosen, but i couldn't make ctools to work.

I made v3 the default choice and I bumped the version to 3.5.

nod_’s picture

Title: Google Maps API v3 support broken? » Google Maps API v3 support
nod_’s picture

Component: Code » OL Layers
zzolo’s picture

Status: Needs review » Fixed

Hey @nod_. Many thanks for the patch. Committed.

I am curious if you get the big attribution box? Screenshot: https://skitch.com/zzolo/gfxej/openlayers-openlayers7
It does not show up in this example: http://openlayers.org/dev/examples/google-v3.html
Maybe its just because I am on 2.10? I don't have much time to look into this.

nod_’s picture

nope, never saw this while I was testing gmap.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

svrontis’s picture

Status: Closed (fixed) » Active

Hi... i am new at drupal...
I am trying to make this code works (in php mode) and I get NOTHING:


          drupal_add_js('http://maps.googleapis.com/maps/api/js?key=AIzaSyDxmcKQhDx7v_G2WxaAPzVnJTQNJb-l1WA&sensor=false','external');
          $scripts = drupal_get_js();

        drupal_add_js('       function initialize() {
				           
                                        var myLatlng = new google.maps.LatLng(37.9833,23.7333);
                                        var myOptions = { zoom: 15, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP };
                                        var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
                                        var myIcon="images/bluehome.png";
                                        var contentString =\'Ioannis Kotrolos\';
                                        var infowindow = new google.maps.InfoWindow({content: contentString });

var myLatLng = new google.maps.LatLng(37.9833,23.7333);

var marker = new google.maps.Marker({position: myLatLng, map: map, icon: myIcon });
google.maps.event.addListener(marker, \'click\', function() { infowindow.open(map,marker); });

				   
}' ,'inline');

	 							            
         

Only local images are allowed.

Does anyone can help me?

nod_’s picture

Status: Active » Closed (fixed)

Hello, please open a new issue as a "support request" or ask for help on IRC: #drupal or #drupal-geo. What you're asking is not a reason to reopen this one.

Thank you.

spgd01’s picture

Status: Closed (fixed) » Active

In 6.2.x.dev

I am trying to use the v3 maps. If I select v3 in the settings and do not supply a key then the maps do not work. I get:

This web site needs a different Google Maps API key. A new key can be generated at http://code.google.com/apis/maps/documentation/javascript/v2/introduction.html#Obtaining_Key.

I then put in my API key and in Google turn on services for API v3 and trun off API v2 and get the following error:

Google has disabled use of the Maps API for this application. The provided key is not a valid Google API Key, or it is not authorized for the Google Maps Javascript API v2 on this site. If you are the owner of this application, you can learn about obtaining a valid key here: http://code.google.com/apis/maps/documentation/javascript/v2/introduction.html#Obtaining_Key

So in google I turn API v2 back on in services and maps are working.

This tells me that openlayers is looking for API v2. It is not using API v3. Am I doing something wrong? Do i need a different API Key? is this a bug?

spgd01’s picture

Any Help?

spgd01’s picture

Status: Active » Closed (works as designed)

Ok I works. There is a conflict with get directions module.

  • nod_ authored d0702a0 on 7.x-3.1.x
    Issue #1268210 by nod_ and zzolo: Fixing Google Maps Layers v3.