Element84 / cmr-stac-api-proxy

Other
5 stars 4 forks source link

pointStringToPoints should return items in lon, lat order #29

Open abarciauskas-bgse opened 4 years ago

abarciauskas-bgse commented 4 years ago

From what I can tell, CMR json returns coordinate strings starting with a latitude

A few examples: https://cmr.earthdata.nasa.gov/search/granules.json?concept_id=G1440976305-ORNL_DAAC https://cmr.earthdata.nasa.gov/search/granules.json?concept_id=G1624810005-NSIDC_ECS

The current pointStringToPoints code chunks the coordinate strings in order but geojson expects coordinates starting with a longitude, so the first and second items for each coordinate pair need to be swapped.

Point coordinates are in x, y order (longitude, latitude for geographic coordinates).

GeoJSON reference

abarciauskas-bgse commented 4 years ago

@matthewhanson @PeteShepley let me know if this makes sense to you, and I can open a PR to swap the order + add a unit test. Would also be good to verify this issue is persistent across geometries for CMR json

matthewhanson commented 4 years ago

If STAC-CMR is using the ATOM (https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html#atom) response from CMR, or the JSON response which is the ATOM fields converted to JSON, then that uses GeoRSS to define geometries and looks like they are in lat, long order: http://www.georss.org/simple

matthewhanson commented 4 years ago

Looking at some Items through the STAC API dev endpoint though it looks like the coordinates are correct. https://cmr-stac-api.dev.element84.com/stac/catalog/items/G1018763934-LPDAAC_ECS

abarciauskas-bgse commented 4 years ago

ah interesting, 🤔 looking more into this

abarciauskas-bgse commented 4 years ago

I've determined that there is something different between how coordinates are being ordered when I run the app locally versus the live dev deployed api.

Screen Shot 2019-10-10 at 4 00 12 PM Screen Shot 2019-10-10 at 4 00 05 PM Screen Shot 2019-10-10 at 4 00 01 PM Screen Shot 2019-10-10 at 3 59 55 PM

Note coordinates are in different orders