2

I used google maps api for selecting some points on map and find to shortest driving route.

Everythings works in localhost, but when i publish and upload it server, it doesn't work...

Why it's happen? There isn't any error. Map is coming on page but i can't see markers and directionResult doesn't load the result. Is it about authorization? I have valid account and api key etc. And i allowed referer of my domain.

Edit: I check the script with crome JS debugger. There is no response here;

directionsService.route(request, function (response, status) {
if (status == google.maps.DirectionsStatus.OK) 
{
    directionsDisplay.setDirections(response);    }
});

status returning "" value at live server, not "OK". In localhost its working! Anybody knows whats the reason?

You can see the example of google.maps.api here; view-source:https://google-developers.appspot.com/maps/documentation/javascript/examples/directions-simple

Thanks for any help.

linukus
  • 45
  • 1
  • 4
  • So you can see the map but not markers or directions? Might be useful to post your code, in case there's any errors (although the fact it works locally implies that won't be the case) – duncan Jan 30 '13 at 13:37
  • I was put some image but site doesnt allow it(becouse i m a new user here)... I m making script dinamicly on code behind(points etc)..I guess its an authorization problem. Cause its works in localhost... – linukus Jan 30 '13 at 15:01
  • V3 doesn't require authorization, and when there were an problem with the authorization you would receive an alert that give you a notice for an invalid key. Is it possible to post a link? – Dr.Molle Jan 31 '13 at 00:13

2 Answers2

2

I solved the problem. Its about decimal symbol of web server. In my localhost i'm using "." as decimal symbol. But in web server it was "," so in google maps, lat and lang points have wrong values and maps api couldnt find the points.

After changing web servers decimal symbol from Regional And Language Settings(for all users). Its start to work...

linukus
  • 45
  • 1
  • 4
0

Recently I had the same problem.
After creating my api key it started working on my server too.
The weird fact is that locally always worked perfectly, no keys needed.

j.c
  • 2,825
  • 3
  • 31
  • 45