New answers tagged

1

If you are using Openlayers see here. If you are using leaflet see here. For pure javascript see here or for NPM resources here or here There are other solutions beyond these but this should be enough to be getting on with.


1

@> 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 ...


2

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 ...


0

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