Skip to content

"Minimal proj.db"? #186

@kylebarron

Description

@kylebarron

In #184 I'm making an example with NAIP data. I didn't want to embed all of geotiff-geokeys-to-proj4, so I started just defining the specific UTM zones that I needed, and then I realized a lot of the CRS definitions are quite rote:

import proj4 from "proj4";

// Hard-code UTM definitions so we don't need all of geotiff-geokeys-to-proj4 in
// this example app.
// These defintions are from:
// https://epsg.io/26910.js
const utmDef = (zone: number) =>
  `+proj=utm +zone=${zone} +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs`;

for (let zone = 10; zone <= 20; zone++) {
  proj4.defs(`EPSG:269${zone}`, utmDef(zone));
}

That bundle size is very tiny, especially since we can duplicate

I imagine there are many CRS definitions that have a pretty simple mapping from EPSG code to proj4 string.

We probably want this to be non-required?

Maybe we have a few different import declarations?

import "@developmentseed/deck.gl-geotiff/proj-minimal"

or, we don't call the methods in global scope ourselves, but we do like

import {defineUTM} from "@developmentseed/deck.gl-geotiff/proj-minimal";

and then the user calls defineUTM in their App?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions