Skip to content
Huidae Cho edited this page May 5, 2021 · 26 revisions

Welcome to the projpicker wiki!

Main coordinate system

EPSG:4326 (unprojected lat/long)

Supported coordinate systems

Main CRSs:

  • Projected coordinate systems (projected_crs in proj.db)

Optional CRSs when we have time:

  • Geodetic coordinate systems (geodetic_crs in proj.db)
  • Vertical coordinate systems (vertical_crs in proj.db)
  • Compound coordinate systems (compound_crs in proj.db)

Listing all projections

https://gis.stackexchange.com/a/330283

sqlite3 /usr/share/proj/proj.db "SELECT name,auth_name,code FROM projected_crs WHERE auth_name = 'EPSG';"

Notice that names are not unique. For example,

sqlite3 /usr/share/proj/proj.db "select name,auth_name,code from projected_crs where name='WGS84 UTM Sud Fuseau 1'"
WGS84 UTM Sud Fuseau 1|IGNF|WGS84UTM1S
WGS84 UTM Sud Fuseau 1|IGNF|UTM01SW84

auth_name || code is unique.

sqlite3 /usr/share/proj/proj.db "select auth_name||code from projected_crs" | wc
   7401    7401   73596
sqlite3 /usr/share/proj/proj.db "select distinct (auth_name||code) from projected_crs" | wc
   7401    7401   73596

Retrieving projection information

projinfo -o projjson epsg:4326

outputs

PROJJSON:
{
  "$schema": "https://proj.org/schemas/v0.2/projjson.schema.json",
  "type": "GeographicCRS",
  "name": "WGS 84",
  "datum": {
    "type": "GeodeticReferenceFrame",
    "name": "World Geodetic System 1984",
    "ellipsoid": {
      "name": "WGS 84",
      "semi_major_axis": 6378137,
      "inverse_flattening": 298.257223563
    }
  },
  "coordinate_system": {
    "subtype": "ellipsoidal",
    "axis": [
      {
        "name": "Geodetic latitude",
        "abbreviation": "Lat",
        "direction": "north",
        "unit": "degree"
      },
      {
        "name": "Geodetic longitude",
        "abbreviation": "Lon",
        "direction": "east",
        "unit": "degree"
      }
    ]
  },
  "scope": "Horizontal component of 3D system.",
  "area": "World.",
  "bbox": {
    "south_latitude": -90,
    "west_longitude": -180,
    "north_latitude": 90,
    "east_longitude": 180
  },
  "id": {
    "authority": "EPSG",
    "code": 4326
  }
}

Input/output format

We will use JSON and GeoJSON for non-geospatial and geospatial data input and output, respectively.

API

Read latitude and longitude, and return a tuple of

{
  'epsg': epsg_code,
  'proj': proj_code,
  'extent': [[ulx, uly], [urx, ury], [lrx, lry], [llx, lly]]
}

Just four corners may not be enough to correctly represent the boundary of a certain projection on an EPSG:4326 map. Extent will be in coordinates in EPSG:4326.

Spatial indexing

Split the world into a 1-degree grid, and assign indices to rectangles in the grid. Establish a relational table between the grid and projection bounding boxes.

Database schemas

create table projbbox (
  auth_code varchar(100) primary key,
  name varchar(100) not null,
  south_latitude real not null,
  west_longitude real not null,
  north_latitude real not null,
  east_longitude real not null,
)

create table projbbox_to_products (
  id int primary key,
  auth_code varchar(100) not null,
  product varchar(100),
  agency varchar(100)
)

create table grid (
  index int primary key,
  row int not null,
  column int not null
)

create table grid_to_projbbox (
  id int primary key,
  index int not null,
  auth_code varchar(100) not null
)

Project workflow

The project started on May 5, 2021 and will end in July 31, 2021.

  1. Week 1: Understand the database proj.db
  2. Extract all bboxes from proj.db
  3. Create a new spatialite database that contains all densified bboxes (number of points as a parameter).
  4. OPTIONAL: Create spatial indexing
  5. Implement the reverse intersection search from a pair of lat/long to a list of selected densified bboxes
  6. Return all coordinate systems that contain the input lat/long

If we have more time,

  1. Do research and find major agencies and products
  2. Relate coordinate systems with this information
  3. Output this information with selected coordinate systems in step 6 above

Discussions

https://github.com/OSGeo/grass/issues/1253#issuecomment-776849517

WKT2 has a optional EXTENT::BBOX attribute -- "the geographic bounding box is an approximate description of location". For a given CRS, it shouldn't be too complicated to implement a qgis-like solution. The other way around, all CRS' for a given coordinate, is more complicated as you need some kind of searchable database for this. There is a SE post on this topic, see the section "EPSG.io" for possible database solution.

Clone this wiki locally