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

Get empty paths when use converter #461

Open
t-walker-wei opened this issue Mar 23, 2020 · 2 comments
Open

Get empty paths when use converter #461

t-walker-wei opened this issue Mar 23, 2020 · 2 comments

Comments

@t-walker-wei
Copy link

t-walker-wei commented Mar 23, 2020

Environment: Python 3.5.2 Ubuntu16.04LTS.
The shp file I download from: http://www.naturalearthdata.com/
Json config file:

[{
    "name": "read_data",
    "file_name": "ne_110m_admin_0_countries_lakes/ne_110m_admin_0_countries_lakes.shp",
    "longitude0": 11.5
  },{
    "name": "write_data",
    "format": "jvectormap",
    "file_name": "origin-world.js",
    "params": {
      "code_field": "ISO_A2",
      "name_field": "NAME",
      "name": "world"
    }
  }]

Out put in origin-world.js :
jQuery.fn.vectorMap('addMap', 'world_merc',{"height": 779.9122978262657, "projection": {"centralMeridian": 11.5, "type": "merc"}, "width": 900.0, "paths": {}, "insets": [{"height": 779.9122978262657, "bbox": [{"x": -20004297.15152583, "y": -18449355.690353}, {"x": 20026572.394749388, "y": 16240163.70055698}], "left": 0, "width": 900, "top": 0}]});
The paths attribute is empty.
Do somebody have any ideas?
Thx.

@t-walker-wei
Copy link
Author

t-walker-wei commented Mar 23, 2020

I should solved it.I flow the document and use script processor.py
Change

from booleano.parser import Grammar, EvaluableParseManager, SymbolTable, Bind
to

from booleano.parser import Grammar, SymbolTable, Bind
from booleano.parser.core EvaluableParseManager

If have import EvaluableParseManager issue .
For the empty paths issue, because the Python3 filter() / map() function return a filter object / map object instead of list. After iteration, the pointer will go the end of the object. My solution is convert the filter / map object to list.
Example:
After

geometries = filter(lambda g: g.properties[self.config['code_field']] in codes, data_source.geometries)
add line:
geometries = list(geometries)

@t-walker-wei
Copy link
Author

t-walker-wei commented Mar 23, 2020

And, I should try the converter.py.It would be better have document for how to use script converter.py

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

1 participant