开发者

Correct typos in place names using Google Maps API

开发者 https://www.devze.com 2023-03-17 11:08 出处:网络
I have a web form which asks fo开发者_Python百科r the user\'s address, but I would like to correct possible typos using the database underlying Google Maps. For example, when I search \'Amsterda\' in

I have a web form which asks fo开发者_Python百科r the user's address, but I would like to correct possible typos using the database underlying Google Maps. For example, when I search 'Amsterda' in Google Maps, it immediately jumps to Amsterdam.

Can I use Google Maps API for this?


Yes I use the Google Geocoding API to search for user's input. It corrects typos and returns one or more valid locations for the user's search. If it returns more than one, then I ask the user to clarify by choosing one.

Edit: It also breaks a user's input into lines of address, town/city, postcode, country which is great for storing neatly in a database if required

Hope that helps

0

精彩评论

暂无评论...
验证码 换一张
取 消