GitHub - topojson/topojson-server: Convert GeoJSON to TopoJSON.
Skip to content
Sign up
Why GitHub?
Features →
Mobile →
Actions →
Codespaces →
Packages →
Security →
Code review →
Project management →
Integrations →
GitHub Sponsors →
Customer stories →
Security →
Team
Enterprise
Explore
Explore GitHub →
Learn & contribute
Topics →
Collections →
Trending →
Learning Lab →
Open source guides →
Connect with others
The ReadME Project →
Events →
Community forum →
GitHub Education →
GitHub Stars program →
Marketplace
Pricing
Plans →
Compare plans →
Contact Sales →
Nonprofit →
Education →
In this repository
All GitHub
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub
↵
Jump to
↵
In this organization
All GitHub
↵
Jump to
↵
In this repository
All GitHub
↵
Jump to
↵
Sign in
Sign up
{{ message }}
topojson
/
topojson-server
Watch
6
Star
82
Fork
26
Convert GeoJSON to TopoJSON.
ISC License
82
stars
26
forks
Star
Watch
Code
Issues
5
Pull requests
4
Actions
Projects
0
Security
Insights
More
Code
Issues
Pull requests
Actions
Projects
Security
Insights
master
4
branches
3
tags
Go to file
Code
Clone
HTTPS
GitHub CLI
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI.
Learn more.
Open with GitHub Desktop
Download ZIP
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Go back
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Go back
Launching Xcode
If nothing happens, download Xcode and try again.
Go back
Launching Visual Studio
If nothing happens, download the GitHub extension for Visual Studio and try again.
Go back
Latest commit
mbostock
3.0.1
…
a6b8592
Sep 6, 2019
3.0.1
a6b8592
Git stats
27
commits
Files
Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
bin
src
test
.eslintrc.json
.gitignore
LICENSE
README.md
package.json
rollup.config.js
topojson-server.sublime-project
yarn.lock
View code
README.md
TopoJSON Server
The topojson-server module provides tools for converting GeoJSON to TopoJSON. See How to Infer Topology for details on how the topology is constructed.
See shapefile for converting ESRI shapefiles to GeoJSON, ndjson-cli for manipulating newline-delimited JSON streams, d3-geo-projection for manipulating GeoJSON, and topojson-client for manipulating TopoJSON and converting it back to GeoJSON. See also us-atlas and world-atlas for pre-built TopoJSON.
Installing
If you use NPM, npm install topojson-server. Otherwise, download the latest release. You can also load directly from unpkg. AMD, CommonJS, and vanilla environments are supported. In vanilla, a topojson global is exported:
Try topojson-server in your browser.
API Reference
# topojson.topology(objects[, quantization]) <>
Returns a TopoJSON topology for the specified GeoJSON objects. The returned topology makes a shallow copy of the input objects: the identifier, bounding box, properties and coordinates of input objects may be shared with the output topology.
If a quantization parameter is specified, the input geometry is quantized prior to computing the topology, the returned topology is quantized, and its arcs are delta-encoded. Quantization is recommended to improve the quality of the topology if the input geometry is messy (i.e., small floating point error means that adjacent boundaries do not have identical values); typical values are powers of ten, such as 1e4, 1e5 or 1e6. See also topojson.quantize to quantize a topology after it has been constructed, without altering the topological relationships.
Command-Line Reference
geo2topo
# geo2topo [options…] [name=]file… <>
Converts one or more GeoJSON objects to an output topology. For example, to convert a GeoJSON FeatureCollection in the input file us-states.json to a TopologyJSON topology in the output file us.json:
geo2topo states=us-states.json > us.json
The resulting topology has a “states” object which corresponds to the input geometry. For convenience, you can omit the object name and specify only the output file name; the object name will then be the basename of the file, with the directory and extension removed. For example, to convert the states.json GeoJSON FeatureCollection to a TopologyJSON topology with the “states” object in us.json:
geo2topo states.json > us.json
Any properties and identifiers of input feature objects are propagated to the output. If you want to transform or filter properties, try ndjson-cli as demonstrated in Command-Line Cartography.
See also topo2geo.
# geo2topo -h
# geo2topo --help
Output usage information.
# geo2topo -V
# geo2topo --version
Output the version number.
# geo2topo -n
# geo2topo --newline-delimited
Accept newline-delimited JSON, with one feature per line.
# geo2topo -o file
# geo2topo --out file
Specify the output TopoJSON file name. Defaults to “-” for stdout.
# geo2topo -q count
# geo2topo --quantization count
Specify a pre-quantization paramter. 0 disables quantization. See topojson.topology for a description of quantization.
About
Convert GeoJSON to TopoJSON.
Resources
Readme
License
ISC License
Releases
3
v3.0.1
Latest
Sep 5, 2019
+ 2 releases
Packages 0
No packages published
Used by 3k
+ 2,975
Contributors 3
mbostock
Mike Bostock
Fil
Philippe Rivière
mfogel
Mike Fogel
Languages
JavaScript
100.0%
© 2021 GitHub, Inc.
Terms
Privacy
Security
Status
Docs
Contact GitHub
Pricing
API
Training
Blog
About
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.