JavaScript-the database holds a lot of plots, each area of the parcel is determined by the latitude and longitude of four vertices, I know a point of latitude and longitude, how to determine the location belongs to which land?

Source: Internet
Author: User
Ask you to give a thought ~

Reply content:

Ask you to give a thought ~

Correct the demand, PO Master's demand is "geo-fence"

Solution:
Postgis+postgresql
Elasticsearch/solr

I'm afraid I can't do it by MySQL.
or redesign the library.

place_id name
1 Block 1
ID place_id lat LNG
1 1 1.1111 1.1111
2 1 1.1111 1.1111
3 1 1.1111 1.1111
4 1 1.1111 1.1111

Reference: http://www.cnblogs.com/LBSer/...

You this seems to be a purely mathematical problem, to say the idea, you can use four small triangles t1-t4 the quadrilateral complement into a rectangular r, now inconvenient to draw, you imagine. And then judge to give the point P

p 在 R 内   &&   p 不在 {T1-T4} 内

Define a Point object: P[x,y], X is latitude, y is longitude
Area of the parcel four vertices are: a[x,y], b[x,y], c[x,y], D[x,y]
Known points are: Ptr[x,y]

UH ~ ~
You should give me a few samples.
Otherwise, also to you science and geography knowledge, it is too wordy ~

Using the MySQL space function and operation, save directly save a polygon area, judge the time using the St_contains function

Using Point, St_astext, POLYGON, st_x, st_y, st_distance, these are much better than direct-saving jingwei.

Http://dev.mysql.com/doc/refm ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.