Closed nigelhorne closed 8 years ago
I'll have a look at the markers issue tomorrow. FWIW this is generated from the library and it shows markers, can you be more specific?
You don't need an API key for the v3 maps API unless you need analytics, so if you want that functionality i'll accept a PR.
Ta! Lee.
Here is the program I wrote to test it:
#!/usr/bin/env perl
use strict;
use warnings;
use HTML::GoogleMaps::V3;
my $map = HTML::GoogleMaps::V3->new;
$map->center("19 Kingston Ave., Garlinge, Kent, England");
$map->add_marker(point => "33 Fulham Ave., Garlinge, Kent, England");
my ($head, $map_div) = $map->onload_render;
print "<html><head>\n$head</head>";
print "<body onload=\"html_googlemaps_initialize()\">Foo:<br>$map_div</body></html>\n";
I saved the output in a file and opened in Firefox. The markers didn't show so I opened firebug and reloaded, that's when I saw the error message.
I just tried it on Safari. Same problem, and same error message on the developer screen.
But I also got this error message which may help:
file://maps.gstatic.com/mapfiles/markers2/marker.png Failed to load resource: The requested URL was not found on this server.
So, it's trying to load a png file from file:// rather than https:??
Still not sure why you're seeing this, i've pushed a little example in the above commit that seems to work for me:
morbo examples/mojo_map.pl
Gives:
However, i have added support for sending an api key in that commit and when i do that i get a "too much recursion" error so it looks like i will need to spend some time updating the javascript. I'll have a look at this at the weekend.
Perhaps the problem lies in that I'm open an HTML file directly in a browser, whereas you're loading from a server? That will also be the case when I load your out.html file over http.
To try to reproduce it, can I suggest you try exactly the same steps that I took, namely create an HTML file on your local machine and open that directly (e.g. "firefox foo.html" at the command line)?
Confirmed, that's the problem. I copied my HTML file to my server, and I can confirm the marker appeared. So that means that the problem is less urgent, but there is a problem nevertheless and I now understand why I saw it and you didn't.
OK, thanks. I'll have a dig into this at the weekend.
So, if you're interested, I've put it into gedsite (https://github.com/nigelhorne/gedsite) and thus into my genealogy website (https://genealogy.nigelhorne.com). Works a treat - thank you!
So, if you're interested, I've put it into gedsite (https://github.com/nigelhorne/gedsite) and thus into my genealogy website (https://genealogy.nigelhorne.com). Works a treat - thank you!
Cool! If it's working ok then i won't rush to update this, but if i get time i shall do so.
@nigelhorne - updated to use V3 of the maps API. v0.04 pushed to CPAN. This should allow you to use an API key if you wish (to get stats) and should also allow much more customisation (although i'll need pull requests if anything else is required).
Markers don't appear, and Firebug gives this error:
Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys
In utils.js line 220.