Skip to content

Instantly share code, notes, and snippets.

@timfernando
Created November 7, 2012 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timfernando/4032633 to your computer and use it in GitHub Desktop.
Save timfernando/4032633 to your computer and use it in GitHub Desktop.
from kartograph import Kartograph
CSS_FILENAME = 'test.css'
k = Kartograph()
country = {"iso_a3": "GBR"}
config = {
"proj": {
"id": "robinson"
},
"layers": {
"graticule": {
"special": "graticule",
"latitudes": 3,
"longitudes": 3
},
"countries": {
"src": "10m_cultural/10m_cultural/ne_10m_admin_0_countries.shp",
"filter": country,
"min-area": 0.30,
},
"populated-places": {
"src": "10m_cultural/10m_cultural/ne_10m_urban_areas.shp",
"simplify": False,
"key": "NAME_1",
"crop-to": "countries"
},
},
"bounds": {
"mode": "polygons",
"data": {
"layer": "countries",
}
},
"export": {
"width": 500,
"height": 500,
}
}
with open(CSS_FILENAME, 'r') as f:
css = f.read()
k.generate(config, outfile='test.svg', stylesheet=css)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment