+ Reply to Thread
Results 1 to 4 of 4

Thread: SQL-Spatial Analysis

  1. #1
    Barn Enthusiast Flam is an unknown quantity at this point Flam's Avatar
    Join Date
    Dec 2008
    Posts
    249
    Rep Power
    4

    SQL-Spatial Analysis

    This is probably something that would require GIS/ARCGIS type tools, but I'm wondering if any of you have any ideas on how I may be able to accomplish something just using MS SQL Server 2005.

    I've created queries before that determine the distance between 2 points based on the latitude and longitude of both points (and a number of calculations).

    However, consider this:

    Say you have a table called Addresses that has a record with a latitude and longitude. It also has a polygonid (id generated from the map database that represents a polygon comprised of various points/vertices on a map each with their own latitudes and longitudes).

    Now, if I wanted to see if the record with the latitude, longitude and polygonid was within the space of an actual polygon (comprised of various points/vertices on a map each with their own lats and longs), is there a way to accomplish this using sql?

    I guess the issue is that the polygon itself from the map database is made of hundreds of points on a map (hence, hundreds of records on per polygon). So how does one compare to see if the point from the Addresses table is within the polygon from the Maps database?

    In laymen's terms, how do I find if the point from one record in one table is within the area of a polygon from a map table?

    I know I'm not providing sample data, I apologize, just not sure how I would present it.

    As always, thanks!
    Craig

  2. #2
    Moderator don94403 is a jewel in the rough don94403 is a jewel in the rough don94403 is a jewel in the rough don94403's Avatar
    Join Date
    Mar 2008
    Location
    San Mateo, CA, USA
    Posts
    313
    Blog Entries
    8
    Real Name
    Don Ravey
    Rep Power
    6

    I have no experience with GIS, but I attended some MySQL MeetUps a year or two ago and one session was on this very technology. Check out the slide presentation at Index of /meetup/mysql/101/2006-06-12 and if you have more detailed questions, you might send email to webmaster@jcole.us. Jeremy Cole has a lot of knowledge/experience (he's a former MySQL AB employee, also was at Yahoo for several years).
    question = 2B || !2B

  3. #3
    Barn Enthusiast Flam is an unknown quantity at this point Flam's Avatar
    Join Date
    Dec 2008
    Posts
    249
    Rep Power
    4

    Hey Don,

    Thanks for the link..very cool! I'm thinking this is pretty much out of my league.
    I guess I was hoping that there was a way just using SQL to plot the points of a polygon as an "enclosure" and then to do a check to see if the single address point fall within or outside of that enclosure.

    I'll keep doing research though and might send Jeremy a note.

    Thanks again!

  4. #4
    Moderator don94403 is a jewel in the rough don94403 is a jewel in the rough don94403 is a jewel in the rough don94403's Avatar
    Join Date
    Mar 2008
    Location
    San Mateo, CA, USA
    Posts
    313
    Blog Entries
    8
    Real Name
    Don Ravey
    Rep Power
    6

    Well, I think that is do-able, but my only knowledge is from attending one presentation, so I can't really help. I know that MySQL does have some special computational syntax to support spatial comparisons, but right there is where my knowledge stops, I'm afraid.
    question = 2B || !2B

+ Reply to Thread

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

SEO by vBSEO