Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

create_utfgrids.py

Simple command line script to create UTFGrid json files from a polygon shapefile.

Usage:

$ ./create_utfgrids.py -h
Usage: create_utfgrids.py [options] shapefile minzoom maxzoom output_directory

Options:
  -h, --help            show this help message and exit
  -f FIELDS, --fields=FIELDS
                        Comma-seperated list of fields; default is all

Example:

$ ./create_utfgrids.py test_data/bailey_merc.shp 3 5 ecoregions -f dom_desc,div_desc

WARNING:
 This script assumes a polygon shapefile in spherical mercator projection.
  If any of these assumptions are not true, don't count on the results!
  * Processing Zoom Level 3
  * Processing Zoom Level 4
  * Processing Zoom Level 5

Inspect the output (for example, zoom level 5, X=20, Y=18)

$ cat ecoregions/5/20/18.json | python -mjson.tool
{
    "data": {
        "192": {
            "div_desc": "RAINFOREST REGIME MOUNTAINS", 
            "dom_desc": "HUMID TROPICAL DOMAIN"
        }, 
...
...

Requirements

  • Mapnik >= 2.0 with python bindings
  • OGR python bindings

About

Simple command line script to create UTFGrid json files from a shapefile

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.