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

@lgb_developers/geotoolsconnector

v1.5.0

Published

Fast and reliable way to analize geospatial data.

Downloads

1

Readme

GeoTools Connector

Fast and reliable way to analize geospatial data.

This connector is used for easier access to GeoTools web service.

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js. Node.js 0.10 or higher is required.

If this is a brand new project, make sure to create a package.json first with the npm init command.

Installation is done using the npm install command:

$ npm install geotoolsconnector

Features

  • Geospatial analysis
    • Dissolve
    • Intersection
    • Centroid
    • Difference
    • Polygonize
    • Contours
    • Simplify
    • Multipart to singleparts
  • Pipe reqests
  • GUI for testing

Quick Start

After you have installed GeoTools Connector to your project, you have access to its features.

Simple example:

var connector =  require('geotoolsconnector');

var GeoTools =  new  connector(true); // setting enableGUI to true 

var centroid = GeoTools.centroid(myData); // myData needs to be formatted correctly

A simple GUI will become avaliable at http://localhost:4444 if you enable the enableGUI option when initializing GeoTools Connector.

More on how the data should look like and how API works on GeoTools API Docs or see the examples down below.

Example of geospatial analysis

Dissolve

myData = {
  "BY": [
    "SIFKO",
    "RANG"
  ],
  "DATA": {
    "type": "FeatureCollection",
    "features": [
      {
        "type": "Feature",
        "properties": {
          "SIFKO": "2391",
          "PARCELA": "2765/14",
          "RANG": "30"
        },
        "geometry": {
          "type": "MultiPolygon",
          "coordinates": [
            [
              [
                [
                  412315.79,
                  83594.22
                ],
                [
                  412316.46,
                  83598.8
                ],
                [
                  412319.57,
                  83598.16
                ],
                [
                  412318.8,
                  83593.5
                ],
                [
                  412315.79,
                  83594.22
                ]
              ]
            ]
          ]
        }
      }
    ]
  }
}

var dissolved = GeoTools.dissolved(myData);

console.log(dissolved);

Output:

{
  "features": [
    {
      "geometry": {
        "coordinates": [
          [
            [
              412315.79,
              83594.22
            ],
            [
              412316.46,
              83598.8
            ],
            [
              412319.57,
              83598.16
            ],
            [
              412318.8,
              83593.5
            ],
            [
              412315.79,
              83594.22
            ]
          ]
        ],
        "type": "Polygon"
      },
      "id": "0",
      "properties": {
        "PARCELA": "2765/14",
        "RANG": "30",
        "SIFKO": "2391"
      },
      "type": "Feature"
    }
  ],
  "type": "FeatureCollection"
}

In the same manner all the avaliable geospatial analysis can be done. For more details about format of the request body check out the API documentation.

Example of pipe request

Pipe request is a special way to send multiple requests in a row and use results of previous analysis without storing any data in between requests.

myPipeData = {
    "Data":
        [
            {
                "Tag": "A",
                "Value": {
                    "type": "FeatureCollection",
                    "name": "poly1",
                    "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
                    "features": [
                        { 
                            "type": "Feature", 
                            "properties": {}, 
                            "geometry": { 
                                "type": "Polygon", 
                                "coordinates": [
                                    [
                                        [-1.64941176470587, 0.672941176470587], 
                                        [-2.284705882352929, -0.625882352941178], 
                                        [-1.148235294117635, -1.225882352941178], 
                                        [0.34823529411766, -0.477647058823531], 
                                        [-1.64941176470587, 0.672941176470587]
                                    ]
                                ] 
                            } 
                        }
                    ]
                }
            },
            {
                "Tag": "B",
                "Value": {
                    "type": "FeatureCollection",
                    "name": "poly2",
                    "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
                    "features": [
                        { 
                            "type": "Feature", 
                            "properties": {}, 
                            "geometry": { 
                                "type": "Polygon", 
                                "coordinates": [
                                    [
                                        [-0.44941176470587, 0.658823529411763], 
                                        [-1.021176470588223, -0.484705882352943], 
                                        [-0.230588235294105, -1.776470588235295], 
                                        [1.95058823529413, -1.684705882352942], 
                                        [-0.44941176470587, 0.658823529411763]
                                    ]
                                ] 
                            } 
                        }
                    ]
                }

            }
        ],
    "Process":
        [
            { "Type": "Intersection", "Input1": "A", "Input2": "B", "Result": "C" },
            { "Type": "Centroid", "Input": "C", "Result": "D" }
        ],
    "Result":
        [
            "C", "D"
        ]
}

var pipeResults = GeoTools.pipe(myPipeData);

console.log(pipeResults);

output:

[
    {
        "Tag": "C",
        "Value": {
            "features": [
                {
                    "geometry": {
                        "coordinates": [
                            [
                                [
                                    0.34823529411766,
                                    -0.477647058823531
                                ],
                                [
                                    -0.7036180162441421,
                                    -1.0035737140044316
                                ],
                                [
                                    -1.021176470588223,
                                    -0.484705882352943
                                ],
                                [
                                    -0.7122440087145844,
                                    0.13315904139433424
                                ],
                                [
                                    0.34823529411766,
                                    -0.477647058823531
                                ]
                            ]
                        ],
                        "type": "Polygon"
                    },
                    "id": "0",
                    "properties": {},
                    "type": "Feature"
                }
            ],
            "type": "FeatureCollection"
        }
    },
    {
        "Tag": "D",
        "Value": {
            "bbox": [
                -0.4604118457228069,
                -0.4498927572241431,
                -0.4604118457228069,
                -0.4498927572241431
            ],
            "features": [
                {
                    "bbox": [
                        -0.4604118457228069,
                        -0.4498927572241431,
                        -0.4604118457228069,
                        -0.4498927572241431
                    ],
                    "geometry": {
                        "coordinates": [
                            -0.4604118457228069,
                            -0.4498927572241431
                        ],
                        "type": "Point"
                    },
                    "id": "0",
                    "properties": {},
                    "type": "Feature"
                }
            ],
            "type": "FeatureCollection"
        }
    }
]