Skip to main content
7 events
when toggle format what by license comment
Dec 9, 2021 at 16:46 comment added AenidMansarde Thanks. If I cast the st_makepoints and the st_dwithin statements as geography, that will by default set the SRIDs to 4326, correct? I know the crash data I'm using uses 4326, but I'm not sure about the school locations data. If it turns out the school locations data uses a different SRID, will it return false results if I just cast it all as geography (and, as such, implicitly as 4326)? Do these concerns even matter when we're talking about a collection of individual points that are all within one city?
Dec 9, 2021 at 12:52 comment added JGH If you start to have a lot of data, you would greatly benefit from storing the geography points and to add a spatial index, it will greatly speed up the query
Dec 9, 2021 at 12:51 comment added JGH @AenidMansarde 1) geometry considers a flat world while geometry considers a round world. This has implication for distances computations (straight lines vs great circles), and one of the side effect is that the datatype geography natively computes distances between lat-longs in meters. 2) it's up to you and what you want to do with the geometry/geography! 3) I personally always specify an SRID, and constraint my columns to a specific data type, subtype, and CRS (like geometry(point, 4326)), as it prevents errors.
Dec 8, 2021 at 21:19 comment added AenidMansarde Brilliant! This works. Thanks. If I can ask, just so I understand: (1) Why do I need to cast as geography? Aren't lat/long/the point they create already geographic coordinates? (2) Do I need to cast the ST_MAKEPOINT lines as geography in the SELECT statement as well? (3) Do I need to specify an SRID? Either with the ST_MAKEPOINT statements or ST_DWithin? Why/why not?
Dec 8, 2021 at 21:19 vote accept AenidMansarde
Dec 8, 2021 at 18:35 history edited JGH CC BY-SA 4.0
added 11 characters in body
Dec 8, 2021 at 18:29 history answered JGH CC BY-SA 4.0