How do I get the location type (apartment building, house, office complex, etc.) from confirmed address?
I built a web application that uses Yahoo Geocoding API or Google Maps API to validate the user's address. Now I want confirm if the user need to enter an apartment (or suite) number by the exact address I have.
Maybe there is an API that provides b开发者_高级运维oth services.
Right now, my application asks the user if he is in apartment building, house, office complex, etc. This is not an error proof input.
Any suggestions?
Both Google's and Yahoo's geocoding services do not offer that level of accuracy, at least at the moment, for residential buildings.
For some important or noteworthy buildings, hospitals, parks, and other significant landmarks the Google geocoder may return an accuracy level of 9, which means "premise-level" accuracy, but it would still not indicate whether the building is a block of apartments, or a single house.
Unfortunately I really doubt that you will find a publicly available geocoding service with this level of accuracy. Let us know if you do!
You would have to have some sort of lookup for every address somebody could possibly enter. Getting an address programatically is normally done by knowing that the houses on the road go from, say, 1 to 200. It'd also know which side is even, which is odd, and which end 1 is at. It then uses this information to calculate the address on the street, or the location of the address.
This sort of thing saves a lot of space, since it can simply calculate an address, but it isn't always accurate (like my house is 89, Google Maps says it's 124)
Trying to store what each place is, though, would mean actually going to every address imaginable and recording it in a database somewhere, which isn't practical. That, and it can get out-of-date very quickly, or a house could be rented out into 2 apartments, so somebody would enter, say, 123 Fake Street Apartment 2, but it's recorded as a house in the town planning.
So, it's not possible with modern systems to be able to tell. With the amount of data that would be needed, the possible lookup times for large groups, etc. it's not profitable for any company to offer it. They do store a good amount of this information, but only for notable places (businesses, malls, government buildings, etc.) since this is a relatively small number, and is the level of service they would need to bring profits.
As such, no, you cannot get that sort of information from an automated service, and you will have to rely on their word.
精彩评论