New answers tagged point-in-polygon
@> is not a PostGIS bounding box operator. It is a PostgreSQL geometric operator with the box type. So essentially, the query in your question casts the PostGIS bounding box to PostgreSQL box types. Box types are not equivalent to point-in-polygon operators required for your problem. Furthermore, mixing PostGIS types and PostgreSQL geometric types is ...
You'll want to look inside the definition of ST_Contains, which is this: CREATE OR REPLACE FUNCTION ST_Contains(geom1 geometry, geom2 geometry) RETURNS boolean AS 'SELECT $1 ~ $2 AND _ST_Contains($1,$2)' LANGUAGE 'sql' IMMUTABLE; See what's going on? The function wraps a call to the box containment operator, ~, and the explicit polygon ...
Download the state boundary shapefiles from US Census bureau. Load the polygon shapefiles into SQL using Shape2SQL. If you don't already have a geography column on your points table, add it. Do a spatial join using code similar to this.
Top 50 recent answers are included