gm3
gm3 copied to clipboard
Fix load-time performance issue with Proj4
This line of code in src/application.js is causing all sorts of problems:
register(proj4);
Why? Not sure yet.
What's the problem? This line alone takes 2-3 seconds to run and seems to spike the CPU at times.
What's it supposed to do? GeoMoose does two fun things with projections: 1) It uses the UTM projections to provide better accuracy for measurement versus just using 3857. 2) It allows the users to display the mouse coordinates in local projections. Helpful for not having to know all of state-plane or handle lat-lon preferences at the local level.
Ideas on a fix:
- Use the new OpenLayers projection classes to define the projections. No need to bring along an extra version of Proj.
- Do not use Proj to calculate the points in the measure tool and just do the math for the UTM projections manually (see the USNG tool for an example of UTM math).
As for measure, in previous versions of GeoMoose (1? 2? sometime around 2010) we switched to using Geodesic option in OpenLayers as this works far better in Northern latitudes. I would prefer using that (might need a search of OpenLayers to find the current status).
This is the technique we should use https://openlayers.org/en/latest/examples/measure.html. Note the comment on that page regarding great circles.