doubiao9775 2016-08-12 14:30
浏览 134

从MySQL搜索Google地图多边形区域

we are a non profit charity organization. Planning to open up some support centers. We have a MySQL database of our support centers as following :

booth_id
booth_name
latitude
longitude
coverage
phone

Detail:

booth_id

Numeric unique ID for support booth.

booth_name

Alpha-numeric name for every support booth.

latitude

Google Map latitude for each booth.

longitude

Google Map longitude for each booth.

coverage

Json formated Google Map polygon for each booth. This is the support coverage area of each booth.

phone

Phone number of each support booth.


What we are trying to do is; getting user location and search if he is within any support booth coverage.

Here is the data stored on coverage field:

{
  "0": "23.86998,91.20611",
  "1": "23.86599,91.20609",
  "2": "23.86597,91.2091",
  "3": "23.86563,91.21251",
  "4": "23.87021,91.21249"
}

Which has this visual view

Depend on the coverage area here could be more Json indexed objects. Each Json objects has latitude and longitude comma separated.

Now my question is how to find from MySQL if latitude : 23.867467 and longitude : 91.2074338 (it can be any value) within coverage area or within which booth's coverage area. Is this possible to make this search with MySQL query with help of MySQL function?

Please let me know, that will be very helpful.

Thanks

  • 写回答

1条回答 默认 最新

  • doukuang6795 2016-08-12 15:08
    关注

    You can use spatial functions provided by MySQL to store geometric data.

    And then use http://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-object-shapes.html#function_st-within

    评论

报告相同问题?

悬赏问题

  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line