proj4js / mgrs

Utility for converting between WGS84 lat/lng and MGRS coordinates
MIT License
105 stars 45 forks source link

Defaul function of mgrs.js #86

Closed JanTrunecek closed 1 month ago

JanTrunecek commented 1 month ago

How can I make or where do I get a default function mgrs that proj4 requiers me to to have.

import mgrs from "../../mgrs/mgrs.js";

proj4.mgrs = mgrs;

I'm held up on this for weeks and cant find a way to fix it anywhere on the internet.

ahocevar commented 1 month ago
import mgrs from "mgrs";

proj4.mgrs = mgrs;

Does that work for you? Note that this is what proj4 does by default, so you should not need to do it manually.

JanTrunecek commented 1 month ago

The proble is I'm using pycharm and dont have any buil plug in so I'm doing everything manually as well as dependencies so I have to link thing manually

JanTrunecek commented 1 month ago

Maybe what is the main file to link in this liberary? I assumed its this on the bassis that its the only .js file with actuall code.

ahocevar commented 1 month ago

If you're looking for the CommonJS file, that's dist/mgrs.js in the mgrs package.

JanTrunecek commented 1 month ago

I was using the mgrj.js from the main directory so I changed them but this one doesnt have a defaul export either. It seams I will have to get some tool to instal the lib for me. Thank you for ur time.

ahocevar commented 1 month ago

mgrs.js in the root folder requires node or a bundler, and it only has named exports.