-->

Find a place description in Freebase using latitud

2019-09-03 09:06发布

问题:

I'm receiving lat and long data from Google Maps and I want to send that along to Freebase to get a description of the relevant place.

There's a geocode schema (http://www.freebase.com/location/geocode?schema=) but it seems like you have to to enter them separately?

I'd like to, let's say using the lat / long of Berlin, get the following description from Freebase: http://www.freebase.com/m/0156q

Would love any help, thank you.

回答1:

If you convert your point to a small bounding box, you could get the Freebase data for all topics included in the bounding box like this:

[{
  "id": null,
  "name": null,
  "/location/location/geolocation": [{
    "latitude>=": 52.5,
    "latitude<=": 52.6,
    "latitude": null,
    "longitude>=": 13.38,
    "longitude<=": 13.39,
    "longitude": null
  }]
}]

You can make your bounding box arbitrarily small, but remember that for something like a city, the point probably represents something like the centroid while the actual bounds will be much larger. If you expand to the city limits, your search will, of course, return all the churches, stadiums, pubs, etc which are located within the city. You can add additional filters to only return certain types of entities if that helps for your purposes.