More routes on one map - google-maps

can I put more than one route on one map?
Here is only one connection
http://code.google.com/intl/pl/apis/maps/documentation/javascript/examples/directions-waypoints.html
For example I have 4 points on one map: A, B, C, D. Two connection A-B, C-D.
Is it possible?
EDIT
Points A-C and B-D should be disconnected.

Yes. From Google's own examples you can see multiple routes on a single map.

You will just have to compute two different routes and show them (A-B, C-D) as in the examples you have. Just do that twice for each route.

Related

Generating google map url for distance between two variables (town names)

I have two variables:
Start
Destinations
I want to enter start and destination in the applicable fields on this site
https://www.google.nl/maps/dir///#53.0845956,6.814237,13z/data=!4m2!4m1!3e0
So that the distance between the two locations is visible.
Any suggestions how to get this done?
You can use the directions action of Maps URLs:
https://developers.google.com/maps/documentation/urls/guide#directions-action
For example:
https://www.google.com/maps/dir/?api=1&origin=Space+Needle+Seattle+WA&destination=Pike+Place+Market+Seattle+WA&travelmode=bicycling

overpass-turbo.eu find all cities on maps

maybe someone can help me with a overpass-turbo.eu-query.
I'd like to highlight (center of it) all cities of a country or region (or current map).
Is there maybe an "simple" example on web?
(Google was not a good friend with this special request, yet. But I am sure someone must tried to search this way already.)
Many thanks for every idea.
Here is an example for finding all cities, towns, villages and hamlets in the country Andorra:
[out:json][timeout:25];
// fetch area “Andorra” to search in
{{geocodeArea:Andorra}}->.searchArea;
// gather results
(
node[place~"city|town|village|hamlet"](area.searchArea);
);
// print results
out body;
>;
out skel qt;
You can view the result at overpass-turbo.eu after clicking the run button.
Note: When running this query for larger countries you might need to increase the timeout value. Also rendering the result in the browser might not be possible due to performance reasons. In this case use the export button and download the raw data instead.

Google Maps Geocoding - Results in different order

Trying to get the state from maps.googleapis.com/maps/api/geocode/xml is not working for me because not all results are in the same order
The problem is not all locations are the same, I'm using coordinates as the parameter in the urls, most are address_component[5], but the others put the state any and ever where else. The only thing that seems consistant is the formatted address.
See these 2 examples, the states are in different order
for one $xml->result->address_component[5]->short_name is the state
for the other $xml->result->address_component[4]->short_name is the state
https://maps.googleapis.com/maps/api/geocode/xml?latlng=38.7811981,-75.6823615&sensor=false
http://maps.googleapis.com/maps/api/geocode/xml?latlng=36.370791599999996,%20-76.75601170000002&sensor=false
There has to be a simple answer! Thanks

Geocoder api returning single result

I need to Geocode all the branches of a chain within a country or state currently I am able to fetch a single result but I need to get the data for all the branches.
https://maps.googleapis.com/maps/api/geocode/json?address=macdonaldsIndia&key="MY-API-Key"
I think I am missing some extra parameters that need to be passed in the api.Please suggest if I am missing something
Thanks in advance
You should look into Places API web service. With nearby search or text search you can get up to 60 results.
For example if I search 'macdonalds India' for location 28.661898,77.227396 with radius 50km I can get 22 results. 20 results in the first page and 2 results in second page that I get using page token parameter.
https://maps.googleapis.com/maps/api/place/textsearch/json?query=macdonalds%20India&location=28.661898%2C77.227396&radius=50000&key=YOUR_API_KEY
https://maps.googleapis.com/maps/api/place/textsearch/json?pagetoken=CpQCDwEAANFmh2yBVwmsgsOuEDlbKLLHXYhkn7WZNsstXOHBatJm_Js2MwEPSwHb16ICXzdt5PYu37NYPTr17MBdM6c0fIqjlB7V5otC-55bjde7Ns3l9igjMvu_hePMn03WXiRaeT7PQ8eoVTNAJQu0OrINTFtNNtU7xCm1p6UIGAzMm_phr_ZL955wTTPtqWq3XadfsdAgkwdrl2lQEbbYXhikwo-SrSfKoH2scOYrdJQ4y3SaPx95BKLPjAz8D_RfncXzQ4jVJeamuITQXMAjr1DbzKPFFNiCP3Yq_Ps7iUiUZRW8cSi5XB9RGjQN8zCQCTKWYwTWCdwfz8f49dKmj8GLw0mMfLwjJaE9tNaT1ZiEB8FMEhAD9pDF_U4CbEN8qFcgEJWFGhQ0qCZwK5EHNlVqGqk9hCYpHw9p0Q&key=YOUR_API_KEY
Visually it looks like
Hope this helps!

how to check the google map api to know the place is existing one

I have use the code given below, please copy and paste in your URL, which gives latitude and longitude of a specific place.
But when I have used the same call with wrong place it returns latitude and longitude. How to check whether it is right and wrong?
http://maps.google.com/maps/api/geocode/json?address=dubai+United+Arab+Emirates&sensor=false
http://maps.google.com/maps/api/geocode/json?address=anu+India&sensor=false
Thanks
A typical scenario for using geocoding will be when you know that the address exists and you want to get the location coordinates, maybe to mark on a map. When you search an address in google geocoding api, it will find exact matches and also partial matches to correct for cases like spelling mistakes or multiple spellings in use. Due to partial match, when you search for a word, words close to that in terms of the letters used and the number of letters present will also be found. You can explore 2 options to refine the results:
1, If you want to avoid partial matches , you can try component filtering , where you specify filters on components like locality, country , etc and only exact matches will be returned.
2, You can process the json result in your code by retreiving different components and doing comparisons and taking only cases matching your requirement.