geomoose / gm3

GeoMoose 3.0 Development. Please submit pull requests to the 'main' branch.
https://www.geomoose.org
MIT License
58 stars 59 forks source link

Fix load-time performance issue with Proj4 #618

Open theduckylittle opened 3 years ago

theduckylittle commented 3 years ago

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:

  1. Use the new OpenLayers projection classes to define the projections. No need to bring along an extra version of Proj.
  2. 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).
brentfraser commented 3 years ago

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).

brentfraser commented 3 years ago

This is the technique we should use https://openlayers.org/en/latest/examples/measure.html. Note the comment on that page regarding great circles.