ajnisbet / opentopodata

Open alternative to the Google Elevation API!
https://www.opentopodata.org
MIT License
312 stars 69 forks source link

Feature request: MOLA/DTM dataset support #51

Closed 0xCoto closed 1 year ago

0xCoto commented 2 years ago

I'm not sure if this has been requested before, but it would be super useful if the Open Topo Data API server was extended to include elevation data from Mars. The two datasets I'm aware are described in this SE answer:

DTM coverage is small, but the resulting topo models are awesomely detailed - they are good for assessing landing sites and building hi-fi virtual terrains at great locations (Marineris, Olympus etc.)

For the things I'm working on, the MOLA dataset would suffice to support my experiments, as it covers the entire Martian surface. Perhaps this might help others working in fields like astrogeology, space exploration and more!


How challenging would you say it would be to integrate this dataset to the current API? Do you think the available dataset format varies significantly from Earth-based data, or is it just as easy to implement?

Cheers!

ajnisbet commented 2 years ago

This is great thanks for bringing this up! It's something I would love to support: I looked at adding a lunar at one point.

From memory, technically non-earth datasets would work: gdal doesn't recognise the MOLA data you linked but I think the projection information could be added like in this SE question.

The main issue I had was with the API: users give lat,lon WGS84 coordinates, which don't make sense not on earth, and I'm not sure if gdal can translate between datums on different planets.

Some potential solutions:

If you're familiar with non-earth datasets I have a couple of questions:

0xCoto commented 2 years ago

Edit: also found this post on working with mars data using QGIS - again, not sure if it helps.

ajnisbet commented 2 years ago

Thanks! I'll look through this, figure out what exactly would be needed, then make a call on if it's worth the changes!

0xCoto commented 2 years ago

@ajnisbet Hi Andrew, just wanted to follow up in case you'vr found anything interesting or determined the difficulty of implementing something like this? Hopefully I'm not disturbing too much :)

ajnisbet commented 2 years ago

I had a look at this today.

Because Open Topo Data treats input coordinates as WGS-84, pyproj can't convert those coordinates to lunar/martian ones. You get the error

Error creating Transformer from CRS.: (Internal Proj Error: proj_create_operations: Source and target ellipsoid do not belong to the same celestial body)

The best way to handle this would be to add some parameters like xy_locations and locations_srs to let you specify coordinates that aren't wgs84 latlons. I will add this at some point, but it's non-trivial so I'm not sure when I'll be able to get round to it.

I'd accept a PR though! The steps needed are