google-geocoder

How to get location coordinates knowing place_id via google javascript api

北慕城南 提交于 2019-11-27 18:40:24
问题 I know place_id, and I need to know it's coordinates. I can do GET https://maps.googleapis.com/maps/api/geocode/json?place_id=ChIJOwE7_GTtwokRFq0uOwLSE9g&key=KEY_GOES_HERE which gives me something like that: ``` "results" : [ { "address_components" : [...], "formatted_address" : "New York County, NY, USA", "geometry" : { "bounds" : {...}, "location" : { "lat" : 40.7830603, "lng" : -73.9712488 }, "location_type" : "APPROXIMATE", "viewport" : {...} }, "partial_match" : true, "place_id" :

Mapping multiple locations with Google Maps JavaScript API v3 and Geocoding API

天涯浪子 提交于 2019-11-27 13:23:05
I'm using Google Maps JavaScript API v3 to generate a map with multiple locations/markers. I only have the address for these locations, not the coordinates, so I'm using the Geocoding API to get the coordinates. I finally got Google's geocoding to work, so the location markers are showing up where they are supposed to be. However, the same content is showing up in every InfoWindow. I seem to be unable to pass the location arrays into the geocode function. (Incidentally, I also tried creating a variable for the geocode results and moving the infoWindow function outside of the geocode function,

Google Maps API v3 - Geocoder results issue with bounds

故事扮演 提交于 2019-11-27 11:20:58
问题 Goal : I want to have a custom search (geocode) function and be able to list and click each result and display it on the map. Wanted : Adjust map bounds / zoom level accordingly, i.e. searching for "MA, USA" should zoom the map to let me see the whole Massachusetts state, while searching for "Boston, MA, USA" should zoom on the Boston area. When listing multiple results, the same should apply when clicking on a result. Issue : I can use the geometry.bounds object with fitBounds - but - some

geocoder.getFromLocationName returns only null

房东的猫 提交于 2019-11-27 09:08:16
I am going out of my mind for the last two days with an IllegalArgumentException error I receive in Android code when trying to get a coordinates out of an address, or even reverse, get address out of longitude and latitude. This is the code, but I cannot see an error. It is a standard code snippet that is easily found on a Google search. public GeoPoint determineLatLngFromAddress(Context appContext, String strAddress) { Geocoder geocoder = new Geocoder(appContext, Locale.getDefault()); GeoPoint g = null; try { System.out.println("str addres: " + strAddress); List<Address> addresses = geocoder

get driving distance between two longitude latitude points

不问归期 提交于 2019-11-27 08:50:30
问题 I am trying to get driving distance between two longitude latitude points on rails, geocoder or any other efficient way.. Is there? 回答1: The Google Maps API v3 documentation specifies that either the origin or the destination (or waypoints) can be either an address or a google.maps.LatLng. To get the driving distance between two longitude/latitude points, pass them in the request as google.maps.LatLng objects. related question: total distance and time for all waypoints in google maps v3 proof

Is it possible to get the latitude and longitude of a draggable marker in a map (using javascript) into a form in HTML?

别说谁变了你拦得住时间么 提交于 2019-11-27 08:35:05
问题 I am trying to obtain the Latitude and longitude of a draggable marker in google maps. I need this values to go directly into the value attribute in an <input type="text"> . I've managed to do this, the only problem is that I don't know how to add a geocoder so the user can type their own address and get the lat and lng, but they also need to be albe to drag the marker in case google maps isn't accurate. I'll put my code down here. Appreciate if anyone could help. HTML <!DOCTYPE html> <html>

Reverse geocoding is not working in some android devices?

天涯浪子 提交于 2019-11-27 08:31:24
问题 I am developing an application on maps, am not able to get address in this mobile, its android version is 4.3, like below -- But it is working fine in my mobile, its version is 4.1.2, like below -- It is working fine in some lollipop versions. final Geocoder gc = new Geocoder(this, Locale.getDefault()); try { List<Address> addresses = gc.getFromLocation(lat, lng, 1); StringBuilder sb = new StringBuilder(); if (addresses.size() > 0) { Address address = addresses.get(0); for (int i = 0; i <

json with google geocoding api

岁酱吖の 提交于 2019-11-27 06:20:08
问题 Here is code which gets latitude and longitute when entered a location.I believe that my code right according to my knowledge.but i get a blank page after entering a place. Here is the code: <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ var url="http://maps.googleapis.com/maps/api/geocode/json?address="; var query; var sensor="&sensor=false"; var

Google Geocoder service is unavaliable (Coordinates to address)

房东的猫 提交于 2019-11-27 04:08:27
I have to get an address by coordinates, but it doesnt work and outputs "Couldnt get address": public String GetAddress(String lat, String lon) { Geocoder geocoder = new Geocoder(this, Locale.ENGLISH); String ret = ""; try { List<Address> addresses = geocoder.getFromLocation(Double.parseDouble(lat), Double.parseDouble(lon), 1); if(addresses != null) { Address returnedAddress = addresses.get(0); StringBuilder strReturnedAddress = new StringBuilder(""); for(int i=0; i<returnedAddress.getMaxAddressLineIndex(); i++) { strReturnedAddress.append(returnedAddress.getAddressLine(i)).append("\n"); } ret

[Android][Google Maps]: Get the Address of location on touch

筅森魡賤 提交于 2019-11-27 03:00:36
问题 I have been googling this for hours but no luck so far. I want to get the address of the location where the map is touched / tapped. I understand that in order to get the address i need to reverse geocode the coordinates. But how do i get the coordinates from the map in the first place? 回答1: All you need to do is set up a OnMapClickListener, and then the onMapClick() override will give you a LatLng object. Then, use a Geocoder object to get the address of the point that was just clicked on.