I am trying to get the location (preferably city name) based on any image uploaded.
I can see similar functionality used in Google image search where we drag drop an image and it gives a lot of information including location.

Is there any API (or any other way) through which I can get similar sort of information? I have checked tineye but it requires commercial license so can't use that

有帮助吗?

解决方案

I got a solution for this.
Basically its using multiple google apis to get one result

  1. Google Image Search API call the JSON api https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=http://www.aparisguide.com/eiffeltower/eiffel-tower1.jpg
    This will result json with information/content about image. We can use this content in step 2

  2. Google Search api
    with the content or title obtained from previous search, try accessing google search api http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=Eiffel%20Tower
    this will return the lat and lng for search results as JSON

  3. Google geocode api
    with the available lat and lng from previous search we can call the geocode api as below
    http://maps.googleapis.com/maps/api/geocode/json?latlng=48.858228,2.294388&sensor=true
    this will again return JSON with the list of possible address. With little processing of data it can give me the City.

Note: The results are not very consistent but it can solve the purpose to some extent

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top