using postgresql and postgis, i would like to create a table with one polygon and one point. then use st_contains to check if the point is inside the polygon or not.
so first, I should create a table :
CREATE TABLE my_schema.my_table (id serial);
then add
SELECT AddGeometryColumn( 'my_table', 'geo_polygon', 4326, 'POLYGON', 2);
UPDATE my_table
SET geo_polygon=GeomFromText('POLYGON((0 0,4 0,4 4,0 4,0 0))',4326)
WHERE id='p1';
SELECT AddGeometryColumn( 'my_table', 'geo_point', 4326, 'POINT', 2);
UPDATE my_table
SET geo_point=GeomFromText('POINT((2 2))',4326)
WHERE id='p2';
Finally, to check containing i should use :
SELECT ST_Contains(geo_polygon, geo_ponts, 4326))
FROM my_table
WHERE ???
I am not sure about the condition here. do I have to use the ids ? and how ?