I'm trying to use CARTO for a school project and so I've just been trying to get the hang of the basics of using it and Postgis at the same time. I've read their docs about the difference between the_geom
and the_geom_webmercator
but I keep constantly tripping on it when writing queries.
Their docs:
the_geom
: field where the geometries (points, lines, or polygons) are stored in the CARTO dataset. The geometries must be in the projection EPSG:4326 (WGS84 - Geodetic coordinate system for World)
the_geom_webmercator
: this field is hidden in the dataset, and it stores the geometries in the projection EPSG:3857 (WGS84 Web Mercator (Auxiliary Sphere) - Projected coordinate system for World), this field is used to render the geometries on the map. This field is automatically updated when a geometry in the_geom field is added or updated.
Why does it seem like I find some query examples that use the_geom
but others that use the_geom_webmercator
? Why do I find queries that mix the two? Why do they have both of these to begin with? When using postgis functions like st_intersects
, should I always call it on one or the other?
I've read up on projections and coordinate systems and I generally get all this. But for some reason, I am constantly confused when trying to write queries in the Carto context.