This is a JavaScript application to convert between some common geographical coordinate formats.
It parses free text input, converting to and from the following formats:
- latitude/longitude decimal degrees
- latitude/longitude degrees with decimal minutes
- latitude/longitude degrees, minutes and seconds
- OpenLocationCode a.k.a. Plus Codes
- Ordnance Survey GB 1936 (British National Grid)
- Irish Grid
- Irish Transverse Mercator
The application can be run in the Play-with-docker environment.
-
Navigate to Play with Docker and login using a Docker ID. If you do not have one, you will see the option to sign up after clicking
Login
thenDocker
. -
Click
+ ADD NEW INSTANCE
-
Run the container with:
$ docker container run --publish 8080:80 --name cc -d fdean/convert-coord
-
Once the application is running a link titled
8080
will be shown next to theOPEN PORT
button at the top of the page. Click on the8080
link to open a new browser window to the running web server. If the port number doesn't show up, click onOPEN PORT
and enter the port number as8080
.
The application can be built using either Vite or Rollup. Rollup provides a simple build solution. Vite uses Rollup under the hood, simplifies the development process and the build supports cache-busting.
The following commands are executed in the root of the project directory.
Install the required packages:
$ npm install
$ yarn
Run the application using Vitefor development:
$ npm run dev
$ yarn dev
This builds the release using Rollup.
-
Build the release:
$ docker compose -f docker-compose-dev.yaml up -d --build
-
Monitor the build:
$ docker logs -f convert-coord_web_1
Nginx is configured with
dist
as it's root directory. Navigate to http://localhost:8090/ to view the application. -
The distribution files are created in the project's root directory on the host.
$ ls convert-coord-release-*
The files built under
dist
can be deployed using a static web-server such as Apache or Nginx. -
Re-build the release (using Rollup):
$ docker exec -it convert-coord_web_1 bash $ npm run rollup-build-release
-
Build the release using Vite:
$ npm run vite-build-release
The Vite files created under
dist
can be previewed with:$ npm run preview -- --host
Navigate to http://localhost:8081/ to view the application preview.
-
To develop using Rollup:
$ docker exec -it convert-coord_web_1 bash $ npm run lint $ npm audit $ npm outdated $ npm run rollup-build
After making any edits to the application, re-run the build and refresh the browser page at http://localhost:8090/.
-
To develop using Vite:
$ docker exec -it convert-coord_web_1 bash $ npm run lint $ npm audit $ npm outdated $ npm run dev -- --host
Navigate to http://localhost:8080/ to view the application.
If changes to the code are not recognised, press the
r
key to restart the Vite server. -
To stop the container, optionally including the
-v
switch to remove the volume used to hold the required npm packages:$ docker compose -f docker-compose-dev.yaml down -v
-
Rebuild the images with:
$ mv package-lock.json package-lock.json~ $ docker build --platform=linux/amd64 -t fdean/convert-coord:latest-amd64 . $ mv package-lock.json~ package-lock.json $ docker build --platform=linux/arm64 -t fdean/convert-coord:latest-arm64 .
-
Optionally start the container and browse to http://localhost:8090/ to view the running application.
$ docker compose up -d
-
Stop the running container with:
$ docker compose down
-
Push the releases:
$ docker push fdean/convert-coord:latest-amd64 $ docker push fdean/convert-coord:latest-arm64 $ docker manifest create fdean/convert-coord:latest \ fdean/convert-coord:latest-amd64 fdean/convert-coord:latest-arm64 $ docker push fdean/convert-coord:latest
-
Tag and push the versioned release:
$ docker tag fdean/convert-coord:latest fdean/convert-coord:$VERSION $ docker push fdean/convert-coord:$VERSION