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

d3LChoropleth data object #15

Closed
asilcetin opened this issue Apr 6, 2019 · 1 comment
Closed

d3LChoropleth data object #15

asilcetin opened this issue Apr 6, 2019 · 1 comment

Comments

@asilcetin
Copy link

Hi, thanks for this great package! I cannot get the d3LChoropleth show a map with the data object that I'm passing. I have the map initialised like this:

<d3-l-choropleth :data="mapData"></d3-l-choropleth>

Currently I'm passing a GeoJson object as mapData but getting the following three errors on the console:

[Vue warn]: Error in nextTick: "TypeError: Cannot read property 'lat' of undefined"
TypeError: Cannot read property 'lat' of undefined
Uncaught TypeError: Cannot read property 'x' of undefined

What is the right structure of the data object to be passed for the d3LChoropleth component? There is unfortunately no information about this on the docs. Thanks for your help.

@GopherJ
Copy link
Owner

GopherJ commented Apr 16, 2019

Hello @asilcetin, to be able to use d3LChoropleth, we need to prepare data and maybe options if you want to customlize, data should be a GeoJson FeatureCollection and the value for every zone should be in feature.properties

Here is what it looks like:

"data": { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "id": 61333, "name": "tech", "tags": [ "frigo" ], "rgb_color": null, "level": 0, "type": "map_zone", "value": 0.8 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 2.37260662004924, 48.8438652396112 ], [ 2.3726817580992, 48.8439130473407 ], [ 2.37271626348932, 48.8438892006837 ], [ 2.37266441507589, 48.8438575857975 ], [ 2.37261599913583, 48.8438285001021 ], [ 2.37258113243273, 48.8438516241332 ], [ 2.37260662004924, 48.8438652396112 ] ] ] } }, { "type": "Feature", "properties": { "id": 61332, "name": "sales", "tags": [ "café" ], "rgb_color": null, "level": 0, "type": "map_zone", "value": 0.5 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 2.37249370033574, 48.8437972465289 ], [ 2.37252585719145, 48.8437755677497 ], [ 2.37260859786514, 48.8438261515677 ], [ 2.37257680232242, 48.8438474690339 ], [ 2.37249370033574, 48.8437972465289 ] ] ] } }, { "type": "Feature", "properties": { "id": 61357, "name": "coffee", "tags": [ "café" ], "rgb_color": null, "level": 0, "type": "map_zone", "value": 0 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 2.37254728065663, 48.843755876192 ], [ 2.37273786465381, 48.8438700510955 ], [ 2.37271909501773, 48.8438873941188 ], [ 2.37253356438411, 48.8437732192153 ], [ 2.37254728065663, 48.843755876192 ] ] ] } } 

Sorry for the late reply~

@GopherJ GopherJ closed this as completed Apr 20, 2019
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