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

spatialite-seraph

v0.1.1

Published

SpatiaLite for node

Downloads

1

Readme

node-spatialite Build Status

Statically linked cross-platform SpatiaLite 4.0 binding for node.js. The goal of this project is to have a completely standalone build of SpatiaLite that doesn't require any system dependencies (no need to apt-get install ... other than the ones required to build native node.js modules. The result is a consistent build across platforms with a guarantee of functionality and the versions of the dependencies. There are number of ways to get SpatiaLite binaries on the various platforms, but none of them include all of the features in a consistent way. This project contains a complete gyp build system for SpatiaLite - so someone might find it useful for other things outside of nodejs also.

If you're familiar with SQL, this is a great way to get easy access to the power of GEOS, Proj4, and SQL without needing a full PostGIS server.

Installation

$ npm install spatialite

Usage

This module simply exposes node-sqlite3 with an additional method on the Database object to enable SpatiaLite. I opted to re-use this awesome library and dynamically load the extension so you can still use the node-sqlite3 API without SpatiaLite if you like.

Here is a simple example that shows the usage of GEOS-enabled Centroid.

var sqlite = require('spatialite');
var db = new sqlite.Database(':memory:');

var query = "SELECT AsGeoJSON(Centroid(GeomFromText('POLYGON ((30 10, 10 20, 20 40, 40 40, 30 10))'))) AS geojson;";

db.spatialite(function(err) {
  db.each(query, function(err, row) {
    console.log(row.geojson);
  });
});

Tested on

  • OS X 64bit
  • Linux 64bit (Ubuntu)
  • Linux 32bit (Ubuntu)
  • Windows 64bit
  • Windows 32bit (pending some testing)

Included in this build

  • SpatiaLite 4.0.0 - SQL Reference
  • GEOS-3.4.0-dev - Compiled with GEOS_TRUNK flag so all of the latest functions are available:
    • DelaunayTriangulation
    • VoronojDiagram
    • ConcaveHull
  • liblwgeom 2.0.2 - from PostGIS 2.0.2
    • MakeValid
    • MakeValidDiscarded
    • Segmentize
    • Split
    • SplitLeft
    • SplitRight
    • Azimuth
    • SnapToGrid
    • GeoHash
    • AsX3D
    • MaxDistance
    • 3DDistance
    • 3DMaxDistance
  • Proj 4.8.0
  • iconv 1.14
  • FreeXL 1.0.0e

Building

There's a lot of code in these dependencies and the build scripts are fairly complex. If it doesn't work, submit an issue!

To build the shared library, you will need to first install node-gyp.

$ npm install -g node-gyp

Build it:

$ node-gyp configure build

Building on Windows

Compiling on Windows is a bit more involved. You will need to install these in this order. This should give you a working environment to compile native node.js bindings. The node-gyp repo also has some documentation on getting things working with Windows. It's possible it will also work with VS2012, but it's untested. I use veewee for testing with clean versions of Windows and this process does work. If you have problems, it's most likely something else that's installed conflicting with the build environment. This information was taken from here.

Notes

A lot of this was inspired by @TooTallNate's post on embedding dependencies in node modules.

http://n8.io/converting-a-c-library-to-gyp

License

This module is BSD licensed. The dependencies have their own licenses which are available in their directories.