2

I need to find all cities, towns or postal codes in radius of 20 km from place specified by latitude and longitude.

I've tried Places search from Google Places API with this query:

https://maps.googleapis.com/maps/api/place/radarsearch/json?location=53.09022140,21.21483510&radius=20000&types=(locality|postal_code)&sensor=false&key=myKey

but this seems not to work with geocode places (only business results are presented).

I've also read about Place Searches in Places Library of Google Maps JavaScript API v3, but I'm not sure if this is appropriate for Android Application (I have a http/php server, but I'm not sure how can I use it with my Android App). Can I use it directly from my application?

Maybe I could achieve it using other service? Do you have any suggestions?

4

1 回答 1

0

我意识到这个问题已经很老了,但由于还没有人回答,我想我会分享我如何解决这个问题。

有几种方法可以解决这个问题。第一种是使用此处提供的信息创建您自己的地点数据库:http: //download.geonames.org/export/dump/

这不是太难,但如果你没有时间,可能会很痛苦。

还有很多第三方服务可以为您做到这一点。我运行一项名为https://geo-info.co/的服务

在这种情况下,我们几乎可以完全满足您的需求。

https://geo-info.co/53.09022140,21.21483510

将最近的城市以及其他 10 个最近的邻近城市返回到这些坐标。

{
    "city": "Perzanki-Borek",
    "community": "Gmina Krasnosielc",
    "community2": "141104",
    "country": "PL",
    "county": "Powiat makowski",
    "county2": "1411",
    "latitude": "53.0902",
    "longitude": "21.2113",
    "nearby": [
        {
            "city": "Grabowo",
            "community": "Gmina Krasnosielc",
            "community2": "141104",
            "country": "PL",
            "county": "Powiat makowski",
            "county2": "1411",
            "latitude": "53.0809",
            "longitude": "21.2201",
            "state": "Mazovia",
            "state2": "78",
            "zipcode": "06-212"
        },
        {
            "city": "Papierny Borek",
            "community": "Gmina Krasnosielc",
            "community2": "141104",
            "country": "PL",
            "county": "Powiat makowski",
            "county2": "1411",
            "latitude": "53.0885",
            "longitude": "21.1844",
            "state": "Mazovia",
            "state2": "78",
            "zipcode": "06-214"
        },
        {
            "city": "W\u00f3lka Rakowska",
            "community": "Gmina Krasnosielc",
            "community2": "141104",
            "country": "PL",
            "county": "Powiat makowski",
            "county2": "1411",
            "latitude": "53.1019",
            "longitude": "21.1767",
            "state": "Mazovia",
            "state2": "78",
            "zipcode": "06-214"
        },
        {
            "city": "Amelin",
            "community": "Gmina Krasnosielc",
            "community2": "141104",
            "country": "PL",
            "county": "Powiat makowski",
            "county2": "1411",
            "latitude": "53.0646",
            "longitude": "21.2376",
            "state": "Mazovia",
            "state2": "78",
            "zipcode": "06-212"
        },
        {
            "city": "Raki",
            "community": "Gmina Krasnosielc",
            "community2": "141104",
            "country": "PL",
            "county": "Powiat makowski",
            "county2": "1411",
            "latitude": "53.0766",
            "longitude": "21.1691",
            "state": "Mazovia",
            "state2": "78",
            "zipcode": "06-214"
        },
        {
            "city": "Bagienice-Folwark",
            "community": "Gmina Krasnosielc",
            "community2": "141104",
            "country": "PL",
            "county": "Powiat makowski",
            "county2": "1411",
            "latitude": "53.0644",
            "longitude": "21.1855",
            "state": "Mazovia",
            "state2": "78",
            "zipcode": "06-212"
        },
        {
            "city": "El\u017cbiecin",
            "community": "Gmina Krasnosielc",
            "community2": "141104",
            "country": "PL",
            "county": "Powiat makowski",
            "county2": "1411",
            "latitude": "53.0909",
            "longitude": "21.161",
            "state": "Mazovia",
            "state2": "78",
            "zipcode": "06-214"
        },
        {
            "city": "Adamczycha",
            "community": "Gmina Baranowo",
            "community2": "141501",
            "country": "PL",
            "county": "Powiat ostro\u0142\u0119cki",
            "county2": "1415",
            "latitude": "53.1072",
            "longitude": "21.2633",
            "state": "Mazovia",
            "state2": "78",
            "zipcode": "06-320"
        },
        {
            "city": "Bagienice Szlacheckie",
            "community": "Gmina Krasnosielc",
            "community2": "141104",
            "country": "PL",
            "county": "Powiat makowski",
            "county2": "1411",
            "latitude": "53.0553",
            "longitude": "21.2046",
            "state": "Mazovia",
            "state2": "78",
            "zipcode": "06-212"
        },
        {
            "city": "Ruzieck",
            "community": "Gmina Krasnosielc",
            "community2": "141104",
            "country": "PL",
            "county": "Powiat makowski",
            "county2": "1411",
            "latitude": "53.0812",
            "longitude": "21.2733",
            "state": "Mazovia",
            "state2": "78",
            "zipcode": "06-212"
        }
    ],
    "state": "Mazovia",
    "state2": "78",
    "zipcode": "06-212"
}
于 2019-08-08T15:54:40.787 回答