Skip to content

Instantly share code, notes, and snippets.

@keum
Forked from defiantShaun/Topojson install
Last active December 24, 2015 14:59
Show Gist options
  • Save keum/6816171 to your computer and use it in GitHub Desktop.
Save keum/6816171 to your computer and use it in GitHub Desktop.
1. Install Anaconda to get your python 2.7.
2. Install .Net Framework - dotNetFx45_Full_setup.exe
3. Uninstall the Microsoft Visual C++ 2010 instances.
4. Install the Microsoft SDK - winsdk_web.exe #http://www.microsoft.com/en-us/download/details.aspx?id=8279
5. Install Node.js - http://nodejs.org/download/
6. Open your command prompt as an administrator
>Start
>"cmd" in Search for All Programs
>Ctrl-RightClick on CMD and "Run as Administrator"
7. Set your environment for the SDK (this was tricky to figure out!)
> call "C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\Setenv.cmd" /Release /x64
(if it doesn't work try "/x86" instead of "/x64" in the above #use /x86 for Windows xp
8. Install your Topojson from NPN
>npm install -g topojson
> topojson --id-property BASIN -p name -o Basins_topo.json Basins.geojson <
1. --id-property - <The unique ID field?>
2. -p name - <list fields to bring over. "" will return all fields>
3. -o - <the name of your output file - I use *_topo.json to differentiate from *.json and *.geojson>
4. Finally the input file.)
topojson has file size limit.
How large are those input GeoJSON files? If they are anything near ~1GB,
you must use shapefile input rather than GeoJSON, since shapefiles are more
compact and can be streamed. (Node.js has a maximum buffer size of 1GB, which makes
it difficult to parse JSON files larger than that.) You can also increase the amount
of memory available using node --max-old-space-size=XXXX bin/topojson,
where XXXX is a large number of megabytes. – mbostock May 3 '13 at 4:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment