【问题标题】:venue search api returns duplicate venue with incorrect lat/lon场地搜索 api 返回具有不正确纬度/经度的重复场地
【发布时间】:2012-03-06 15:18:30
【问题描述】:

我执行了场地搜索,结果返回了一个重复的场地。重复的场地是相同的,除了场地 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,是实际的。另外两个是重复的。

【问题讨论】:

  • 你能提供实际的 API 调用(减去秘密)和结果吗?没有更多细节是不可能帮你调试的。

标签: foursquare


【解决方案1】:

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

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

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

我用来帮助回答这个问题的一个很好的参考文档是:https://developer.foursquare.com/docs/responses/venue

【讨论】:

  • 希望我在请求中遗漏了一些内容,但这听起来是最好的方法。谢谢。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-12-26
  • 2015-02-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多