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

multipolygon-to-js-array

v1.0.0

Published

Multipolygon data type to js array conversion.

Downloads

4

Readme

multipolygon-to-js-array

Convert Multiploygon data to JS array.

Build Status Coverage Status

Tech

multipolygon-to-js-array uses a number of open source projects to work properly:

Setup

npm install --save multipolygon-to-js-array

Usage

const Convert = require('multipolygon-to-js-array');

const data = 'MULTIPOLYGON (((121.5084001170001 16.59158600700005, 121.508331995 16.59068907600005, 121.5082491630001 16.58922843100004, 121.508076779 16.58777499900003, 121.5080869200001 16.58664605500007, 121.5079830980001 16.58522653800003, 121.5083788520001 16.58357880900007, 121.5110527090001 16.57842555600007, 121.5112836340001 16.57823109400005, 121.511599635 16.57779355400004, 121.511830559 16.57747755200006, 121.5121100990001 16.57721016700003, 121.5124625620001 16.57620139300008, 121.512474716 16.57587323800004, 121.5124868690001 16.57530200500003, 121.51214656 16.57468215600005, 121.51164825 16.57395292200005, 121.5111742480001 16.57329661100005, 121.510748862 16.57283476300006, 121.5106151690001 16.57253091600006, 121.510578707 16.57228783800002, 121.5105908610001 16.57209337500007, 121.5106759390001 16.57178952800007, 121.5105908610001 16.57150998800006, 121.510517938 16.57125475600003, 121.510262706 16.57074429300008, 121.5101897830001 16.57047690700006, 121.510116859 16.57014875200002, 121.5098812580001 16.56999285700005, 121.5096947180001 16.57043545900007, 121.5071868130001 16.57618010000004, 121.505404773 16.58039997100008, 121.505190928 16.58077063500002, 121.504951545 16.58147212700004, 121.504901407 16.58162881000004, 121.504832466 16.58177922600004, 121.5041217040001 16.58337954200005, 121.504007654 16.58383574400006, 121.503337607 16.58541819600003, 121.503351863 16.58657295800003, 121.5034088880001 16.58685808400003, 121.503551452 16.58835499800006, 121.503722527 16.58978063000006, 121.5036847920001 16.59008999700006, 121.5035222400001 16.59050798800007, 121.503208746 16.59084470400006, 121.50287203 16.59126269500007, 121.5028139760001 16.59136719300005, 121.5031809620001 16.59147063100005, 121.5036833620001 16.59152273200004, 121.5038589550001 16.59144847000005, 121.5048484870001 16.59162120700006, 121.5055952260001 16.59162969300007, 121.505965056 16.59180432800002, 121.5064888820001 16.59188072000006, 121.507241882 16.59182615400005, 121.5084001170001 16.59158600700005)))';

const array = Convert(data);
/*
Values:

[[121.5084001170001,16.59158600700005],[121.508331995,16.59068907600005],[121.5082491630001,16.58922843100004],[121.508076779,16.5877749990
0003],[121.5080869200001,16.58664605500007],[121.5079830980001,16.58522653800003],[121.5083788520001,16.58357880900007],[121.5110527090001,16.57842555600007],[121.5112836340001,16.57823109400005],[121.511599635,16.57779355400004],[121.511830559,16.57747755200006],[121.5121100990001,16.57721016700003],[121.5124625620001,16.57620139300008],[121.512474716,16.57587323800004],[121.5124868690001,16.57530200500003],[121.51214656,16.57468215600005],[121.51164825,16.57395292200005],[121.5111742480001,16.57329661100005],[121.510748862,16.57283476300006],[121.5106151690001,16.57253091600006],[121.510578707,16.57228783800002],[121.5105908610001,16.57209337500007],[121.5106759390001,16.57178952800007],[121.5105908610001,16.57150998800006],[121.510517938,16.57125475600003],[121.510262706,16.57074429300008],[121.5101897830001,16.57047690700006],[121.510116859,16.57014875200002],[121.5098812580001,16.56999285700005],[121.5096947180001,16.57043545900007],[121.5071868130001,16.57618010000004],[121.505404773,16.58039997100008],[121.505190928,16.58077063500002],[121.504951545,16.58147212700004],[121.504901407,16.58162881000004],[121.504832466,16.58177922600004],[121.5041217040001,16.58337954200005],[121.504007654,16.58383574400006],[121.503337607,16.58541819600003],[121.503351863,16.58657295800003],[121.5034088880001,16.58685808400003],[121.503551452,16.58835499800006],[121.503722527,16.58978063000006],[121.5036847920001,16.59008999700006],[121.5035222400001,16.59050798800007],[121.503208746,16.59084470400006],[121.50287203,16.59126269500007],[121.5028139760001,16.59136719300005],[121.5031809620001,16.59147063100005],[121.5036833620001,16.59152273200004],[121.5038589550001,16.59144847000005],[121.5048484870001,16.59162120700006],[121.5055952260001,16.59162969300007],[121.505965056,16.59180432800002],[121.5064888820001,16.59188072000006],[121.507241882,16.59182615400005],[121.5084001170001,16.59158600700005]]
*/

Tests

 jay@ThinkPad  /usr/share/nginx/html/multipolygon-to-js-array  npm test

> [email protected] test /usr/share/nginx/html/multipolygon-to-js-array
> jest test --coverage

 PASS  __tests__/index.test.js
  testing index.js
    ✓ it should call anonymous function that accepts MULTIPOLYGON string and should return array of coordinates (4ms)
    ✓ it should call anonymous function that accepts empty string and should return empty array

----------|----------|----------|----------|----------|-------------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files |      100 |      100 |      100 |      100 |                   |
 index.js |      100 |      100 |      100 |      100 |                   |
----------|----------|----------|----------|----------|-------------------|
Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        0.826s, estimated 1s
Ran all test suites matching /test/i