npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

iso19139_mapx_converter

v1.3.9

Published

Provides functions to translate ISO19139 from/to MapX format

Downloads

7

Readme

iso19139_mapx_converter

JS functions to translate ISO19139 from/to MapX format

Environment

The package has been developed and tested using

  • node v12.16.2
  • npm 6.14.4

Building and Installing

Grab the source by git cloning and run

npm install

to install the required dependencies.

Build the bundle

In order to build the standalone bundle file, run

npm run build

You'll find the compiled js in dist/iso19139_mapx_converter.js.

Run the tests

In order to run the tests, run

npm run test

Please note that the test script is run using the --experimental-module option, since full ES6 support is only implemented starting from node version 13.

For a syntax check, run

npx eslint src/

Run a test on browser

If you want to run a local test, first build the module, then make sure you have python installed on your machine.

If you have python 2.x, run:

python -m SimpleHTTPServer

For python 3, run:

python -m SimpleHTTPServer

then point the browser on http://localhost:8000/test/test.html

Build jsdoc

You can create the JSDoc for the functions in index.js by running:

npm run jsdoc

you'll find the generated doc in the doc/ directory.

Reformat code

You can reformat the code with:

npm run format

Make sure you installed js-beautify globally:

npm -g install js-beautify

Running on command line

This package implements a mapping from ISO19139 XML documents to MAPX JSON and vice versa.

There are a couple of command line scripts that performs the conversions. These scripts can also be used as examples for using the mapping functions.

ISO19139 to MAPX conversion

Basic usage:

node --experimental-modules ./src/loadISO.js [-v | -vv] INPUT OUTPUT
  • -v: verbose output (i.e. INFO level logging)
  • -vv: very verbose output (i.e. DEBUG level logging)
  • INPUT: local filename
  • OUTPUT: the output file name for the mapx JSON

MAPX to ISO19139 conversion

Basic usage from command line:

node --experimental-modules ./src/loadMAPX.js [-v | -vv] INPUT OUTPUT
  • -v: verbose output (i.e. INFO level logging)
  • -vv: very verbose output (i.e. DEBUG level logging)
  • INPUT: local filename
  • OUTPUT: the output file name for the ISO19139 XML

Using the converter in the browser

You can find a working example in the test/test.html file.

You need to include the bundle file, e.g.

<script src="dist/iso19139_mapx_converter.js"></script>

You can then call the functions in this way:

        function iso2mapx() {
            var iso_xml = document.getElementById("ta_iso").value;
            var mapx_txt = window.iso19139_mapx_converter.iso19139_to_mapx(iso_xml);
            document.getElementById("ta_mapx").value = mapx_txt;
        }

        function mapx2iso() {
            var mapx = document.getElementById("ta_mapx").value;
            var iso = window.iso19139_mapx_converter.mapx_to_iso19139(mapx);
            document.getElementById("ta_iso").value = iso;
        }

You may want to read the wiki pages for more detailed info.