Contains与ST_Contains Mysql之间的区别

时间:2018-07-19 09:50:09

标签: mysql

ContainsST_Contains之间有什么区别,使用哪个?

Contains(region_data," +"GeomFromText('Point(" + latitude + " " + longitude + ")'))

vs

ST_Contains(region_data," +"GeomFromText('Point(" + latitude + " " + longitude + ")'))

1 个答案:

答案 0 :(得分:1)

{
  "result_count": 251175,
  "images": [
    {
      "id": "649682800",
      "display_sizes": [
        {
          "is_watermarked": false,
          "name": "thumb",
          "uri": "https://media.gettyimages.com/photos/sergi-roberto-of-barcelona-celebrates-as-he-scores-their-sixth-goal-picture-id649682800?b=1&k=6&m=649682800&s=170x170&h=UjuhQ2k4pOnhCh5a1oLuC4t5rwX8332a-PEqZ8dpUfY="
        }
      ],
      "referral_destinations": [
        {
          "site_name": "gettyimages",
          "uri": "https://www.gettyimages.com/detail/news-photo/sergi-roberto-of-barcelona-celebrates-as-he-scores-their-news-photo/649682800"
        }
      ],
      "title": "FC Barcelona v Paris Saint-Germain - UEFA Champions League Round of 16: Second Leg"
    }

返回1或0以指示g1是否完全包含g2。这将测试与ST_Within()相反的关系。

ST_Contains(g1, g2)

我认为此链接将为您带来很多帮助MySQL Spatial Functions for Geo-Enabled Applications