Loving Google Maps API V3, but having difficulty in getting accurate driving directions and manipulating the destination address displayed when using DirectionsRenderer.
Regardless if I pass an address string or a latLng instance as the destination to DirectionsService, when I use the DirectionsRenderer to output step-by-step directions, the destination text is always the geocoded result of my original destination (i.e. the address, rather than COMPANY NAME).
Ideally, I want to pass a precise latLng destination to DirectionsService, but control the text displayed as the 'destination'.
I guess I could manually output the HTML, but part lazy, part not wanting to re-invent the wheel, would prefer to use DirectionsRenderer.
Any ideas?
You may use:
response.routes[0].legs[0].end_address="Company";
before calling
directionsDisplay.setDirections(response);
Related
Iam Using this library https://github.com/wimagguc/jquery-latitude-longitude-picker-gmaps
to make map with marker
and use in the backend laravel
i want to get the name of place where the marker located on it
how can i do it ?!
in the database i am saved the lat and lng
any way to get the name of place ???
enter image description here
Reverse Geocoding in Geocoding API would be able to help you convert latlng coordinates into addresses. You may refer to this documentation: https://developers.google.com/maps/documentation/geocoding/intro#ReverseGeocoding
Here is a sample HTTP request: https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&key=YOUR_API_KEY
However, kindly note that, and as mentioned in the doc, Reverse geocoding is an estimate. The geocoder will attempt to find the closest addressable location within a certain tolerance. If no match is found, the geocoder will return zero results.
I hope this helps!
I am already done push pin on bing map but the issue is more than 100 push pin is not visible on bing map. I have REST api and I am getting data from api and fetch longitude and latitude on map. By the REST api push pin on map is working fine.
But more than 100 pins are not showing on map.
Is that any limitation for Bing map to allow less than push pins are showing ?
I'm assuming you're using the static map API although you didn't provide any sample code or explicitly list which API you were using.
If you check the documentation here under the "pushpin limits" section:
https://msdn.microsoft.com/en-us/library/ff701724.aspx?f=255&MSPPError=-2147217396
The static maps API only supports 18 pushpins if passed through the URL, or 100 pushpins if passed via POST. This is for performance and practical reasons - more than 100 pins on a small static map would just cover the whole image.
If you want to display more pushpins, you should use the interactive map control, not the static map API.
https://msdn.microsoft.com/en-us/library/mt712542.aspx
I plot locations of real estate on a map. The address listed below is mapped incorrectly because it is a new build and I assume the street and everything is a new build, which is the reason Google can't find it in it's database.
What I want to happen is Google return "GeocoderStatus.ZERO_RESULTS" and not just pick a location with a related name and give me those coords.
The address I'm plotting is:
14018 Lonecreek Ave
Orlando, Florida 32828
If you submit the request via http, you get the same results i get through the API, see this link: http://maps.googleapis.com/maps/api/geocode/json?address=140
You'll see it comes back with "Lone Hill Drive" which is incorrect location. How can I tell Google return ZERO_RESULTS status in this instance?
Google's geocoding process isn't perfect (none are.)
What you can check for is the result's geometry.location_type property and test if it's value is "APPROXIMATE" to see if you can trust the returned lat/lng. Read more in the Documentation.
If it's way off you can report it directly to google.
You can use the API's Component Filtering to filter the results by a specific postcode. In such cases a non-exact match will have location_type of "APPROXIMATE" rather than the "GEOMETRIC_CENTER" you were seeing before.
http://maps.googleapis.com/maps/api/geocode/json?address=[address]&components=postal_code:[postcode]&sensor=false
Here's your geocoding request WITH component filtering
and WITHOUT component filtering
We need to track user's path.
So for that we are using Google's map API --> input parameters are start location & End location to get route .
http://maps.google.com/maps/api/js?sensor=false
But in document of Google api
https://developers.google.com/maps/documentation/javascript/directions#DirectionsResults
As in document ---"end_location contains the LatLng of the destination of this leg. Because the DirectionsService calculates directions between locations by using the nearest transportation option (usually a road) at the start and end points, end_location may be different than the provided destination of this leg if, for example, a road is not near the destination."
In this API instead of returning route , it returns nearby place like bus stop etc.
I need to calculate the distance between two addresses and I don't need a map view or anything graphical.
I simply want the user to type in the address (end location is defined by myself) and let the javascript calculate the distance between the two points.
However I don't find a way to send an address string and get the GPS-coordinates from it using the Google Maps API.
(I really only need the two GPS points, the distance calculation is trivial.)
What you are trying to do is called geocoding. It is possible with the Maps API. See the Geocoding section for more details. This is the basic idea:
var geocoder = new google.maps.Geocoder();
geocoder.geocode({
"address": inputAddress
}, function(results) {
console.log(results[0].geometry.location); //LatLng
});
However, you are limited to 2500 geocoding requests a day, and what you are trying to do is against the terms of use:
Note: the Geocoding API may only be used in conjunction with a Google
map; geocoding results without displaying them on a map is prohibited.
This page describes a Google JSON service that you can extract gps coordinates from. I think this would also be under the "No Use of Content without a Google Map" in the TOS.
This is possible. See below link
http://briancray.com/posts/how-to-calculate-the-distance-between-two-addresses-with-javascript-and-google-maps-api