Getting location type by coordinates - geolocation

I have a problem, that i need to get location type by coordinates. Simple scenario would be this:
1) Getting coordinates
2) Getting location type
By saying "location type" i mean if it is road, water or smth else.
Maybe somebody has any idea how to do that? I use google geocoding in couple projects, but i couldn't find the way it could help me. Maybe there are some other ways to do that?

Related

What are the solutions when geocoding a wrong or incomplete address?

My company gets the addresses the loading hubs for our freights every week. We need to geocode them into coordinates. But often the addresses either are incomplete or contain minor grammar mistakes, so it's impossible to input them for geocoding.
My question : when dealing with a list of wrong or incomplete addresses when geocoding, is there any general solution to solve the issue ?
If there are useful articles or resources about this topic, please let me know.
Thank you.
Geocoding / Autocomplete
According to the Geocoding Addresses Best Practices documentation:
"Geocoding is the process of converting addresses (like a street address) into geographic coordinates (latitude and longitude), which you can use to place markers on a map, or position the map."
"In general, use the Geocoding API when geocoding complete addresses (for example, “48 Pirrama Rd, Pyrmont, NSW, Australia”). Use the Places API Place Autocomplete service when geocoding ambiguous (incomplete) addresses."
The Place Autocomplete service returns place predictions according to your inputs. This would solve your problem of having wrongly spelled addresses.
How to get the coordinates after using Place Autocomplete?
example request for Place Autocomplete would look like this:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Paris&types=geocode&key=YOUR_API_KEY
The Place Autocomplete is able to return the address description together with its place_id. In this sample request, you are able to get "description": "Paris, France" with a "place_id": "ChIJD7fiBh9u5kcRYJSMaMOCCwQ".
Then you can use the Place ID of the predicted location to obtain the coordinates of that place by using Place Details request
You can request it like this:
https://maps.googleapis.com/maps/api/place/details/json?fields=geometry&place_id=ChIJD7fiBh9u5kcRYJSMaMOCCwQ&key=YOUR_API_KEY
We used here the fields=geometry to only return the coordinates of the location and as previously mentioned the Place ID we used is the one we had from the Autocomplete query.
The returned data will be the expected result according to your question. But feel free to comment if you need anything.
To read more about the fields parameter, refer to the Place Details documentation.
I hope this helps!

How to show user location on custom map?

I want to show user location and other object location on custom map as follows :
For that I have Googled the things that says "we need to convert the lat long data in to X Y Coordinates in the image and then we need to show it on image"
Other option I found is geocode the image to show the location data.
I didn't find anything else other than this. Can anyone please guide me to show user current location on the custom map as follows?
For translating your lattitude and longitute you should know the projection of your custom map. Then you can use PROJ.4 open source library to convert them. Or you can hardcode translation function to you app. For example, here at GitHub you may found code to translate from lat&lon to EPSG:900913 (google mercator projection)

How can I determine if a postal code is inside a defined area?

I’m building an ordering/delivery website for a restaurant with a PHP backend.
I’d like to determine if the delivery postal code (Canada) is within a predetermined delivery zone. The zone is oddly shaped around specific streets and neighborhood, so radius is not an option.
What is the best way to achieve this?
I assume Google Maps could help with that but I haven’t found any clear path yet.
You could use something like
if ($zip > 5600 && $zip < 6000) {
//do stuff
You have to map GIS data to your postal codes. Maybe such a mapping already exists and you "only" have to asked "Canada Post" for it (assuming a commercial project).

See if lat / long falls within a polygon using mysql, there is any function now?

I´m trying to know if '5.03529 -754368' is within the polygon, can you help me, how can I do that?
I see that the two fields have different formats, how can I fix this?
select within ('5.03529 -754368',PyPolygon) from manuelitapolygon
PyPolygon = 'POLYGON((5.035247876391217 -75.43594128570524,5.035158505114919 -75.43594598760016,5.03507011299693 -75.43596004176999,5.034983668480416 -75.43598329423428,5.0349001186705165 -75.43601549023417,5.034820378957751 -75.43605627702355,5.034745322988647 -75.436105207733864))'
See Spatial Extensions.

how to get latitude and longitude for particular landmark?

how to get latitude and longitude for particular landmark/business, i would like to get lat/long for specific address how to i do that? shall i use gps device to get the lat/long?
Very recently, two or three weeks ago, Google released a new API that lets you do just what you want.
This is how it works:
http://maps.google.com/maps/api/geocode/format?address=some_address&sensor=true_or_false
And here is an example:
http://maps.google.com/maps/api/geocode/xml?address=Lenox+Hill&sensor=false
The format can be JSON or XML.
You will need to use a Geolocation API (such as Google or Bing or Yahoo), and there might be others as well. But those are the "free" (with caveats) ones that come to mind.
Just remember they have rather strict Terms-of-use of how you can use their API, so be sure you are on the right side of the law.
http://msdn.microsoft.com/en-us/library/cc981067.aspx
http://code.google.com/apis/maps/documentation/
Can you elaborate a bit more on that? What type of application is that? What is the format of the landmark/business? Basically there are geo web services out there that do this kind of stuff...
Have a look at this for example:
http://www.geonames.org/maps/us-reverse-geocoder.html
http://www.geonames.org/export/ws-overview.html
Yahoo http://developer.yahoo.com/geo/geoplanet/guide/concepts.html
You can query for a free-form name such as address, etc, and it will return what is called a WOEID, then query the WOEID for its lat long.

Resources