Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generation of map fails when using a filter #40

Open
gevatter opened this issue Jan 31, 2014 · 1 comment
Open

Generation of map fails when using a filter #40

gevatter opened this issue Jan 31, 2014 · 1 comment

Comments

@gevatter
Copy link

I use a simple json file:

{
  "layers": {
    "rrance": {
       "src": "ne_50m_admin_0_countries.shp",
       "filter": { "ISO3": "FRA" }
    }
  }
}

When starting kartograph I only get a trace, but no error message.

Output:

user@python:~/kartograph-test$ kartograph world.json -o world.svg
  cli.py, in render_map()
  71: K.generate(cfg, args.output, preview=args.preview, format=format, stylesheet=css)  kartograph.py, in generate()
  46: _map = Map(opts, self.layerCache, format=format)  map.py, in __init__()
  48: me.proj = me._init_projection()  map.py, in _init_projection()
  88: map_center = self.__get_map_center()  map.py, in __get_map_center()
  140: features = self._get_bounding_geometry()  map.py, in _get_bounding_geometry()
  257: charset=layer.options['charset']  layersource/shplayer.py, in get_features()
  96: if filter is None or filter(drec):  map.py, in <lambda>()
  252: filter = lambda rec: layerFilter(rec) and boundsFilter(rec)  map.py, in <lambda>()
  239: layerFilter = lambda rec: filter_record(layer.options['filter'], rec)  filter.py, in filter_record()
  25: res = res and filter_record([key, '=', filt[key]], record)  filter.py, in filter_record()
  27: res = filter_single(filt, record)  filter.py, in filter_single()
  35: prop = record[key]
u'ISO3'user@python:~/kartograph-test$

When deleting the line containing the filter option everything wors fine and I get a svg file.

I installed it on a fresh Debian 7.3, python is version 2.7.3. I followed this instructions: http://kartograph.org/docs/kartograph.py/install-ubuntu.html

@webbird
Copy link

webbird commented Apr 9, 2015

Seems you use a naturalearth shape. There is no ISO3 attribute in these shape files. Two options:

  1. Use "adm0_a3" instead in your filter

  2. Map the attribute name to the name you like (in your layer properties):

    "attributes": {
    "adm0_a3": "ISO3"
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants