Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

topojson-server

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

topojson-server

Convert GeoJSON to TopoJSON for smaller files and the power of topology!

  • 3.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
107K
decreased by-83.47%
Maintainers
1
Weekly downloads
 
Created

What is topojson-server?

The topojson-server npm package is used to convert GeoJSON objects to TopoJSON. TopoJSON is an extension of GeoJSON that encodes topology, which can significantly reduce the size of the data and improve the efficiency of spatial operations.

What are topojson-server's main functionalities?

Convert GeoJSON to TopoJSON

This feature allows you to convert a GeoJSON object into a TopoJSON object. The code sample demonstrates how to use the `topology` function to achieve this conversion.

const topojson = require('topojson-server');
const geojson = { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [ [ [0, 0], [0, 1], [1, 1], [1, 0], [0, 0] ] ] } } ] };
const topology = topojson.topology({ myGeo: geojson });
console.log(JSON.stringify(topology));

Simplify TopoJSON

This feature allows you to simplify a TopoJSON object, which can be useful for reducing the complexity of the data. The code sample demonstrates how to use the `simplify` function to simplify a TopoJSON object.

const topojson = require('topojson-server');
const geojson = { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [ [ [0, 0], [0, 1], [1, 1], [1, 0], [0, 0] ] ] } } ] };
const topology = topojson.topology({ myGeo: geojson });
const simplified = topojson.simplify(topology, 0.01);
console.log(JSON.stringify(simplified));

Quantize TopoJSON

This feature allows you to quantize a TopoJSON object, which can help in reducing the file size by limiting the precision of the coordinates. The code sample demonstrates how to use the `quantize` function to quantize a TopoJSON object.

const topojson = require('topojson-server');
const geojson = { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [ [ [0, 0], [0, 1], [1, 1], [1, 0], [0, 0] ] ] } } ] };
const topology = topojson.topology({ myGeo: geojson });
const quantized = topojson.quantize(topology, 1e4);
console.log(JSON.stringify(quantized));

Other packages similar to topojson-server

Keywords

FAQs

Package last updated on 31 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc