We have a property search site where the user draws a polygon on a map and then the app displays all properties that fall within the polygon.
We have properties stored within a Postgres table that included the longitude and latitude values for each individual property (ie: Property.Id
, Property.Longitude
, Property.Latitude
)
Example of the points of the polygon drawn by the user:
-83.39258193445859 42.5188864690573, -83.3550447440939 42.51981388191728, -83.34222679201048 42.50184518501131, -83.38033561769407 42.49526380665137, -83.41707115236205 42.505135614429214, -83.39155196619687 42.51896997517796, -83.39258193445859 42.5188864690573
How would I write a Postgres/PostGIS query that finds all records in my property table where the long/lat fall within the polygon coordinates displayed above?
geography
data type, andST_Within
.