Open abarciauskas-bgse opened 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
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
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
ah interesting, 🤔 looking more into this
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.
Note coordinates are in different orders
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.
GeoJSON reference