SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MySQL GIS - Selecting shape that contains point

    So I have a table of points and a table of polygons (geometry types).

    In my php, I will have a given point and need to find the corresponding shape. So logically doing something like;

    Code:
    SELECT hb.`OGR_FID`, hb.`SHAPE`
    FROM boundaries hb
    WHERE ST_Within(Point(43.670913, -79.346739), hb.`SHAPE`);
    Should yield the shape ID and Shape that contains the point. It however returns no matches.

    Any idea what I'm doing wrong here?

    MySQL 5.6.5

  2. #2
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, found the solution myself. Seems I had the lat/lng backwords. Point() requires the parameters Point(lng, lat)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •