pacificclimate / scip-backend

Backend that serves salmon population data to the scip webpage
GNU Affero General Public License v3.0
0 stars 0 forks source link

handle projections mismatch between database and front end #12

Closed corviday closed 1 month ago

corviday commented 8 months ago

The new high-resolution postGIS database uses the BC Albers projection. The front end uses an unspecified latitude-longitude projection. This PR adds a couple of functions to convert between them.

Rationale: the postGIS database needed to have some sort of projection for its various geographies, as we someday want to do calculations involving areas, such as determining how much a watershed and a salmon habitat overlap by so we can ignore incidental corner overlaps. As far as which projection to pick, the input data is all in BC Albers, so that is the projection I used in the database. However, the data all needs to be translated to a latitude-longitude projection for the benefit of leaflet and the PCEX frontend, so this backend needs to do that translation.

resolves #11

corviday commented 2 months ago

Demo: the production SCIP, which was somewhat rushed into production to meet a funding deadline.

corviday commented 1 month ago

@QSparks is there a more correct or up to date way to indicate what projection a geojson string is?

QSparks commented 1 month ago

@QSparks is there a more correct or up to date way to indicate what projection a geojson string is?

No, the CRS for all GeoJSON data is fixed as EPSG:4326 and the ability to specify alternate CRSs has been deprecated. This should not pose an issue if we are confident that all relevant processing libraries can handle custom CRS definitions in the GeoJson.

corviday commented 1 month ago

Huh, weird. That's very useful to know, thanks.I'll add a comment about it.