I'm storing polygons in a PostGIS database. The shape of the polygons is stored in a field of type geometry(Polygon,4326)
.
From time to time, I need to check if a point (of type geometry(Point,4326)
) is inside one of the polygons. Please note that I just need to check if the point is inside the polygon. I don't need to do any measurement.
Directly from the book "PostGIS in action":
PostGIS can store WGS 84 lon/lat (4326) as a geometry data type, but more often than not you’ll want to transform it to another SRS or store it in the geography data type so it’s usable. You can sometimes get away with using it as a geometry data type for small distances along the same longitude and when two things intersect, but keep in mind that when you use it, PostGIS is really projecting it. PostGIS squashes it on a flat surface, treating longitude as X and latitude as Y, so even though it looks unprojected, in reality it’s projected and in a mostly unusable way
Should I cast the types of the polygons and the point to geography before checking if the point is within the polygon, or can I get away with just the geometries?
From what I'm reading it looks like the geometries should be enough, but I would like to be sure.