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

Vector Maps / Choropleth Maps / Shapefile based fill maps #5039

Closed
ni-ka opened this issue Sep 25, 2015 · 27 comments
Closed

Vector Maps / Choropleth Maps / Shapefile based fill maps #5039

ni-ka opened this issue Sep 25, 2015 · 27 comments
Assignees
Labels
Feature:Coordinate Map Feature:New Vis Request for a new visualization type Feature:Visualizations Generic visualization features (in case no more specific feature label is available) release_note:enhancement WIP Work in progress

Comments

@ni-ka
Copy link

ni-ka commented Sep 25, 2015

Choropleth maps (http://leafletjs.com/examples/choropleth.html) are a great way to visualise a numeric property for a polygon on a map (often administrative regions like: countries, states, communities, city parts).

The world maps provided by Kibana 3 could be implemented as a preset of this functionality - #1971 in Kibana4

As an example the map below displays the calls of the national Ebola Hotline in Guinea in a week:
screen shot 2015-09-25 at 15 13 20

it should support:

  • geoJSON http://geojson.org/geojson-spec.html
  • specifying which field from the results is used to match a geoJSON polygon
  • coloring based on a value (+ specifying a color range or even color function)
  • adding labels / values based on geoJSON properties (ex: for region name) or any resultset field (ex: for additional data that can't be colormapped)

Potentially this could be leveraged? http://leafletjs.com/examples/choropleth.html (kudos to @recrudesce) or http://humangeo.github.io/leaflet-dvf/examples/html/colors.html .

We would be interested in contributing some developer time on this topic.

@lukasolson
Copy link
Member

This would necessitate an Elasticsearch aggregation that allows for bucketing on geo shapes, which is not currently supported.

@ni-ka
Copy link
Author

ni-ka commented Oct 15, 2015

@lukasolson sorry why would it require any change to elasticsearch? In the end it is just a different visualisation for a regular aggregation. The trick would be that the geo data is not part of the ElasticSearch data but instead is a parameter of the visualisation, so in the end the visualisation would map the chart results to some configurable geoJson. I agree however that it is different from the current tilemaps which indeed rely on ES to have geo coordinates.

We've started to play with the Kibana code. It's currently a bit of a hack, but we'll submit a PR as soon as we got some time to polish things. Here is how it looks right now:

screen shot 2015-10-06 at 12 49 08 pm 1

@rashidkpc
Copy link
Contributor

Looks like this is using the terms aggregation? What standard is being used for naming the fields? How What is the license on the maps?

Another way to accomplish this would be to come up with a pseudo aggregation which read the boundaries of a list of regions and used an Elasticsearch geo_shape filter (https://www.elastic.co/guide/en/elasticsearch/reference/1.4/query-dsl-geo-shape-filter.html) in combination with the filters aggregation to get back the regions. This would allow users to utilize lat/lon instead of having to follow some naming convention for their fields.

And you're right, this doesn't require an elasticsearch change.

@ni-ka
Copy link
Author

ni-ka commented Oct 16, 2015

@rashidkpc the idea would be to use geoJson polygons and a configurable property to match the data returned by the aggregation. in our example we have regional codes, but those could be any kind of identifier (country codes, postcode...). Check http://eric.clst.org/wupl/Stuff/gz_2010_us_040_00_20m.json for an example file, which has the following properties:

{ 
  "type": "Feature", 
  "properties": {
    "GEO_ID": "0400000US04", 
    "STATE": "04", 
    "NAME": "Arizona", 
    "LSAD": "", 
    "CENSUSAREA": 113594.084000 
  }, 
  "geometry": { "type": "Polygon", "coordinates": [ [ [ -112.538593, 37.000674 ],  [ -112.534545, 37.000684 ], [ -112.368946, 37.001125 ],  ... ] ] } 
}

In this case the property GEO_ID, STATE or NAME could be used depending of what data is in the index. So the geoJson property used to map the results should be configurable.

Re license, this particular shape in the screenshot was manually created, but there is a lot of open boundary data available, for example from OpenStreetMaps.

I'll check the geo_shape filters, sounds like it could be interesting too but not sure what the advantage would be.

@raffis
Copy link

raffis commented Nov 18, 2015

+1

5 similar comments
@boupetch
Copy link

+1

@dev-rke
Copy link

dev-rke commented Nov 21, 2015

+1

@FusionFC
Copy link

+1

@kouki-o
Copy link

kouki-o commented Dec 14, 2015

+1

@tun0
Copy link

tun0 commented Jan 7, 2016

+1

@spalger spalger added the P3 label Jan 7, 2016
@mjpowersjr
Copy link

+1

@ni-ka
Copy link
Author

ni-ka commented Jan 26, 2016

@rashidkpc here is the code of our proof of concept: https://github.com/eHealthAfrica/kibana/tree/kibanafillmap. It is quite far behind master, pretty rough and surely buggy. We've added a fill_map.js component. There is a lot of duplicate code because we didn't really know how to have a common map ancestor (it looks like it was supposed to happen at some point). The shapes are loaded via JSONP to overcome cross-site scripting.
Let me know if you have time to look at it and if you have suggestions on how to better integrate.

@i-ask-too-many-questions

+1

10 similar comments
@brtptrs
Copy link

brtptrs commented Feb 8, 2016

+1

@3h4x
Copy link

3h4x commented Feb 11, 2016

+1

@dmonroe85
Copy link

+1

@ale0xb
Copy link

ale0xb commented Feb 18, 2016

+1

@sharmashubham10
Copy link

+1

@agaon
Copy link

agaon commented Mar 23, 2016

+1

@michimau
Copy link

+1

@sgalaviz
Copy link

+1

@mrvincenzo
Copy link

+1

@ghost
Copy link

ghost commented Aug 13, 2016

+1

@nfornaro
Copy link

+1

@tbragin tbragin added Feature:New Vis Request for a new visualization type Feature:Visualizations Generic visualization features (in case no more specific feature label is available) labels Nov 4, 2016
@andrewkcarter
Copy link

+1

@thomasneirynck thomasneirynck self-assigned this Dec 29, 2016
@tbragin tbragin changed the title Choropleth Maps / Shapefile based fill maps Vector Maps / Choropleth Maps / Shapefile based fill maps Jan 5, 2017
@thomasneirynck thomasneirynck added the WIP Work in progress label Jan 17, 2017
@itg-abby
Copy link

+1, this is a really major feature for geographic data pertaining to countries.

@oschlueter
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Coordinate Map Feature:New Vis Request for a new visualization type Feature:Visualizations Generic visualization features (in case no more specific feature label is available) release_note:enhancement WIP Work in progress
Projects
None yet
Development

No branches or pull requests