I want to be able to do the following:
Select a Polygon and a point and see if the point lies within the polygon…I thought I could do this with MySQL but after a whole day of research it is simply not possible.
I have seen I need to use postgres and postgis, I have never used postgres before.
I have managed to install postgres and postpgadmin and it looks like I have created a database and got it up and running. Now I apparently need to add postgis to the database in order to use the functions? arent they just part of the postgres library? and why are people saying I need to add tables to the database to use the functions?
How do I add postgis to my database?
Can anyone give me any simple clear examples of a query to see if a point is in a polygon?
For purely geometrical queries you won’t need postgis. Postgis is required when you want to mess with geographical data.
For an example of checking if a point is inside a polygon, this query should make it clear to you:
This will print true, meaning that the triangle formed by the points (0,0), (1,1) and (1,0) contains the point (.5, .5).
For more info check: http://www.postgresql.org/docs/9.0/interactive/datatype-geometric.html and http://www.postgresql.org/docs/9.0/interactive/functions-geometry.html