Chrismarsh / CHM

The Canadian Hydrological Model
GNU General Public License v3.0
38 stars 25 forks source link

Lat / Long support #35

Closed Chrismarsh closed 8 years ago

Chrismarsh commented 8 years ago

Experimental support is now enabled for lat/long input files in commit 65693a0.

Current problems

Chrismarsh commented 8 years ago

Added back in support for geographic.

Internal (fast) distance calculations such as those used to cull stations in a radius and for buffer calculations (e.g., Liston wind) will be wrong as they assume meters, but the underlying mesh is in lat/long units.

I need a way to take meter distances and convert to delta-latlong. @NicWayand do you know if such a thing exists?

NicWayand commented 8 years ago

Hey Chris did you find a way for meter to delta-latlong? I have some scripts to go the other way. But hisw would depend where you are and what direction you are going I believe. Will think about it.

Chrismarsh commented 8 years ago

I've introduced point_from_bearing to solve this. Given a starting lat/long point, a bearing, and a distance, it computes the destination point. I have implemented a similiar version for UTM. These are in the new math/distance.*pp files. core::init() then uses boost function to hook up the function to the lat/long or UTM version. This way modules can seamlessly ask for "point X distance away in direction Y" regardless of coordinate system. This point can then be used as input to the existing find closest triangle functions.

The distance function is similar and computes the distance between two points and at runtime is hooked up to the right backend function depending on the coordinate system

Chrismarsh commented 8 years ago

This should be resolved in commit 6b4ee3a1e8bfd