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

Failing to create a map when using filters #105

Open
dunamos opened this issue May 14, 2014 · 8 comments
Open

Failing to create a map when using filters #105

dunamos opened this issue May 14, 2014 · 8 comments

Comments

@dunamos
Copy link

dunamos commented May 14, 2014

Hi,

First of all, sorry for the surely non-accurate informations, I am not used to Python.

I followed the doc in order to create the .svg map in need ( a map with only France, Italy, Spain and Portugal), but, whenever I want to use filters ( in order to keep only the countries I need), the map creation fail.

Here is my .json file :

{
    "layers": [{
        "id": "FTC",
        "src": "ne_50m_admin_0_countries.shp",
        "filter": { "ISO": ["FRA", "ITA", "ESP", "PRT"] }
     }]
}

And here is what the terminal is giving :

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()
  23: res = res and filter_record([key, 'in', filt[key]], record)  filter.py, in filter_record()
  27: res = filter_single(filt, record)  filter.py, in filter_single()
  35: prop = record[key]

I can create a map when I am not using filters, but it gives me a full map of the world...

I'm using Ubuntu, and I followed the installing to the letter.

Thanks in advance for you help,
Regards.

@rmbianchi
Copy link

A temporary solution, waiting for developers to fix this bug, is to use the filters inside the Python script, as I already described here: http://stackoverflow.com/a/22793960/320369

Cheers,

Ric.

On May 14, 2014, at 3:52 PM, dunamos wrote:

Hi,

First of all, sorry for the surely non-accurate informations, I am not used to Python.

I followed the doc in order to create the .svg map in need ( a map with only France, Italy, Spain and Portugal), but, whenever I want to use filters ( in order to keep only the countries I need), the map creation fail.

Here is my .json file :

{
"layers": [{
"id": "FTC",
"src": "ne_50m_admin_0_countries.shp",
"filter": { "ISO": ["FRA", "ITA", "ESP", "PRT"] }
}]
}
And here is what the terminal is giving :

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 ()
252: filter = lambda rec: layerFilter(rec) and boundsFilter(rec) map.py, in ()
239: layerFilter = lambda rec: filter_record(layer.options['filter'], rec) filter.py, in filter_record()
23: res = res and filter_record([key, 'in', filt[key]], record) filter.py, in filter_record()
27: res = filter_single(filt, record) filter.py, in filter_single()
35: prop = record[key]
I can create a map when I am not using filters, but it gives me a full map of the world...

I'm using Ubuntu, and I followed the installing to the letter.

Thanks in advance for you help,
Regards.


Reply to this email directly or view it on GitHub.

@dunamos
Copy link
Author

dunamos commented May 14, 2014

You sir are amazing ! Many thanks, really !

@rmbianchi
Copy link

Glad that I could help you.

Best!

On May 14, 2014, at 4:11 PM, dunamos wrote:

You sir are amazing ! Many thanks, really !


Reply to this email directly or view it on GitHub.

@dunamos
Copy link
Author

dunamos commented May 14, 2014

I am really sorry to add an other question to this thread, specially because it is not really in the subject, but, I can't remove the little islands, even using the "bounds" thing... It is the last time I ask for help.

Thanks in advance !

@rmbianchi
Copy link

Sorry, but I did not try that option yet.
Try to ask on Stackoverflow, maybe somebody could answer that question.

Best regards

On May 14, 2014, at 4:58 PM, dunamos wrote:

I am really sorry to add an other question to this thread, specially because it is not really in the subject, but, I can't remove the little islands, even using the "bounds" thing... It is the last time I ask for help.

Thanks in advance !


Reply to this email directly or view it on GitHub.

@dunamos
Copy link
Author

dunamos commented May 15, 2014

I followed your advice rmnianchi, for those who might be interested, the stackoverflow thread is here : http://stackoverflow.com/questions/23659073/cant-remove-the-little-island-when-creating-a-svg-map-with-kartograph-py

Regards.

@rmbianchi
Copy link

Thanks for the link!

I also saw your post on gis.stackexange. Very useful! I hope you'll get an answer. It could also be useful to me for one of my project where I use France and where I would like to separate French Guyana from European France territory.

Best regards,

Ric.

On May 15, 2014, at 11:41 AM, dunamos wrote:

I followed your advice rmnianchi, for those who might be interested, the stackoverflow thread is here : http://stackoverflow.com/questions/23659073/cant-remove-the-little-island-when-creating-a-svg-map-with-kartograph-py?noredirect=1#comment36340646_23659073

Regards.


Reply to this email directly or view it on GitHub.

@starrymirth
Copy link

If anyone else is having this issue with the "ne_50m_admin_0_countries.shp" shape-file from Natural Earth, a quick fix that worked for me is using "iso_a3" as the key for the filter (as opposed to "ISO").

(Also, it appears the keys are not standard across NE files, that works in the 50m file but not the 10m one).

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

3 participants