Is there a way to only get the city name from gps coords ?
curl 'http://maps.google.com/maps/api/geocode/xml?latlng=43.7,7.26&sensor=false'
gives me several addresses, much more than I need. I did not find any filter options in the query, I would expect something like an additionnal "q=city" for instance.
I found GeoLite. At least for those who need the centre location of cities using an integrated database.
I finally used geocoder module (for node.js) and parse the json response to get the locality.
Related
I'm using MapQuest's GeoCoding API for a weather app I'm creating (this is due to having many complications using google's API), and the response returns each aspect of the address as a separate value, however unlike Google's API, there does not seem to be a value that returns the full formatted address (i.e 10 Duke Street, Putney, London, SW15 6EH, United Kingdom).
Am I missing something, or do I have to recreate this manually?
Use the outformat function
Reverse Geocode
outFormat
optional, defaults to json
Specifies the format of the response. Must be one of the following, if supplied:
json
xml
csv (character delimited)
Example: XML response
outFormat=xml
If you return the data as a csv from the API it is closer to the format you require as an address.
"Country","State","County","City","PostalCode","Street","Lat","Lng","DragPoint","LinkId","Type","GeocodeQualityCode","GeocodeQuality","SideOfStreet","DisplayLat","DisplayLng"
"US","FL","Duval","Jacksonville","32225","12714 Ashley Melisse Blvd","30.333472","-81.470448","false","0","s","L1AAA","ADDRESS","R","30.333472","-81.470448"
I'm using WireCloud, I'm trying to connect the output of a Map Viewer (PoI selected) to the input of a WebBrowser Widget (filter the PoI and get the URL of the image field). I saw some examples on the web doing it, but I'm not able to find the operator. Does anybody knows where can I get it?
Thanks a lot
We had custom operators for that tasks, and I've been cleaning and updating code to publish it as a new operator.
Such operator is called Value Filter, and you can find it on: https://github.com/Wirecloud/value-filter-operator
It does require a preference in dot-sepparated syntax as the path to the data you want to filter. It does receive a JSON object, extracts the path-addressed data and outputs it, so it can be instantiated in-line. In case original data is a POI, the path should be something like poi.data.something.
Best regards
I developed an app that sends GPS points to a server and the server convert those GPS points into a path, which is shown in a map.
Now the server makes a call to Google Maps Directions service and gets a response. From that response I use the value overview_polyline, which based on the documentation:
Contains an object holding an array of encoded points that represent
an approximate path of the resulting directions.
The problem is that sometimes the line I get is really weird. Sometimes it gives me a path where there's no street at all.
Here are some screenshots to describe my problem. The yellow marker is the start point (A), and the blue marker is the end point (B).
So I asked Google to give a route from A to B, with driver mode, so it shows the actually path.
And this is the result:
This is the API call I use. My question is: Any idea why would it return that path?
http://www.geocodezip.com/v3_example_geo2.asp?addr1=53%20Imperial%20Avenue,%20Westport,%20CT%2006880,%20USA&addr2=2%20Harborview%20Road,%20Westport,%20CT%2006880,%20USA&geocode=1&geocode=2&type=m
Looks to me like the encoded polyline is not being rendered correctly. How is your code handling that?
example using the geometry library decodePath function
Looks to me like Google broke their polyline encoding.
If I paste it into here (which admittedly doesn't expect polylines, it expects polyons)
I need to escape the "`", change:
{pazFraw~L|#|#f#^`#N\\?XIx#a#n#[
to:
{pazFraw~L|#|#f#^\`#N\\?XIx#a#n#[
to make it have a more reasonable shape.
when i make a request for a specific latlang direction service responses with the same json. so instead of making the same requests always, i want to store the json somehow.i tried parsing the json and sent to my function which i render the responses, but it didn't work. is something like this even possible?
var direction = JSON.parse('{"routes":[{"bounds":......}');
directionRenderer.setDirections(direction);
It's not possible by using directionRenderer.setDirections() , because not all properties of a directionsResult may be stored in JSON.
But you may of course draw the route on your own, fetch the important details (LatLng's, descriptions etc. out of the directionsResult and use them to 1. draw a polyline and 2. providing route-details)
hi I am trying to develop an application where I import an XML file with addresses and then google maps should tell me the closest places according to my current location.
Can anyone please help me with this.
Thanks
You may use google.maps.geometry.spherical.computeDistanceBetween() to calculate the distance between 2 LatLng's. When you didn't know the LatLng's first request them via the geocoding-service.
This will give you the calculated distance between the points.
When you wan't to get the distance based on a route(e.g. driving-distance) request the directions-Service , the response will contain route and the distance. To request distances for multiple routes with 1 request you also may use a DistanceMatrixRequest
Looks like the perfect use case for Distance Matrix. You'll have to parse the XML file first, and then create a distance matrix request that includes all your locations. That will return a response that gives you the distances to all locations.