场地搜索api返回不正确的纬度/经度的重复场地

时间:2012-03-06 15:18:30

标签: foursquare

我进行了一次场地搜索,返回了一个重复的场地。除了场地ID和纬度/经度信息之外,重复的场地是相同的。在foursquare.com上执行相同的搜索,并且不显示复制。如何排除副本?

这是API调用(减去秘密): https://api.foursquare.com/v2/venues/search?ll=38.468807,-77.372589&query=starbucks

结果:

{
    meta: {
        code: 200
    }
    notifications: [
    {
        type: "notificationTray"
        item: {
            unreadCount: 0
        }
    }]
    response: {
        venues: [
        {
            id: "4e4dc886bd41b76bef93082e"
            name: "Starbucks Coffee"
            contact: {
                phone: "5407209145"
                formattedPhone: "(540) 720-9145"
            }
            location: {
                address: "1495 Stafford Market Pl"
                lat: 38.47310969662029
                lng: -77.38591645407749
                distance: 1256
                postalCode: "22556"
                city: "Stafford"
                state: "VA"
                country: "United States"
            }
            categories: [
            {
                id: "4bf58dd8d48988d1e0931735"
                name: "Coffee Shop"
                pluralName: "Coffee Shops"
                shortName: "Coffee Shop"
                icon: {
                    prefix: "https://foursquare.com/img/categories/food/coffeeshop_"
                    sizes: [ 32 44 64 88 256 ]
                    name: ".png"
                }
                primary: true
            }]
            verified: false
            stats: {
                checkinsCount: 13
                usersCount: 11
                tipCount: 0
            }
            specials: {
                count: 0
                items: [ ]
            }
            hereNow: {
                count: 0
            }
        },
        {
            id: "4b8dd66ef964a520071033e3"
            name: "Starbucks"
            contact: {
                phone: "5407209145"
                formattedPhone: "(540) 720-9145"
            }
            location: {
                address: "1495 Stafford Market Place"
                crossStreet: "Garrisonville Road"
                lat: 38.470214117289444
                lng: -77.41142749786377
                distance: 3388
                postalCode: "22554"
                city: "Stafford"
                state: "VA"
                country: "United States"
            }
            categories: [
            {
                id: "4bf58dd8d48988d1e0931735"
                name: "Coffee Shop"
                pluralName: "Coffee Shops"
                shortName: "Coffee Shop"
                icon: {
                    prefix: "https://foursquare.com/img/categories/food/coffeeshop_"
                    sizes: [ 32 44 64 88 256 ]
                    name: ".png"
                }
                primary: true
            }]
            verified: true
            stats: {
                checkinsCount: 1885
                usersCount: 522
                tipCount: 14
            }
            url: "http://www.starbucks.com/"
            specials: {
                count: 0
                items: [ ]
            }
            hereNow: {
                count: 0
            }
            menu: {
                url: "https://foursquare.com/v/starbucks/4b8dd66ef964a520071033e3/menu"
                mobileUrl: "https://foursquare.com/v/4b8dd66ef964a520071033e3/device_menu"
            }
        },
        {
            id: "4d87c7bba98841bd5eaf3055"
            name: "Starbucks"
            contact: {
                phone: "5407209145"
                formattedPhone: "(540) 720-9145"
                twitter: "starbucks"
            }
            location: {
                address: "1495 Stafford Market Place"
                lat: 38.50188672
                lng: -77.37500964
                distance: 3688
                postalCode: "22556"
                city: "Stafford"
                state: "Virginia"
                country: "United States"
            }
            categories: [ ]
            verified: true
            stats: {
                checkinsCount: 17
                usersCount: 11
                tipCount: 0
            }
            specials: {
                count: 0
                items: [ ]
            }
            hereNow: {
                count: 0
            }
        }
    }
}

第二个场地,id = 4b8dd66ef964a520071033e3,是实际的。其他2个是重复的。

1 个答案:

答案 0 :(得分:2)

我会排除第一个结果,因为它的键/值为“verified:false”。 已验证:true表示所有者已声明它。

我会注意到第二个结果优于第三个结果,因为: 它有一个类别 2. checkinsCount更高。在这种情况下,要高得多。 它有一个网站链接(网址) 它有菜单链接 这个地方有一个十字路口

基本上,如果您创建了一个算法来对“紧凑场地”结果的完整性进行排名,您可以近似Foursquare.com的独特性。我会将所有不同属性的数量相加,并为经过验证的属性,签到和提示的数量(告诉您人们是否正在使用该场所)提供额外的权重。我可能会使用姓名,街道地址和可能的电话号码作为密钥。邮政编码似乎也是一个很好的使用,但在这种情况下你会注意到它的结果不正确应该是规范的。

我过去常常帮助回答的一个很好的参考文档是:https://developer.foursquare.com/docs/responses/venue