superset icon indicating copy to clipboard operation
superset copied to clipboard

[SIP-63] Incorporating other map sources in Superset

Open gk1089 opened this issue 6 years ago • 51 comments

[SIP] Proposal for Incorporating other map sources in Superset

Motivation

Superset currently uses MapBox to display maps which has its own limitations. There are other map sources available as Web Map Services (WMS). For example, Open Street Maps (OSM) that can be called upon using many js libraries like Leaflet or OpenLayers. This would pave way for more GIS functionalities in SuperSet in true open source spirit.

Later, the same could also apply to the deck,gl visualizations that simply use mapbox for its simplicity.

Proposed Change

Module can be created that permit adding WMS services during the creation of charts. Other features may include:

  1. Adding multiple layers and providing facility to turn them on/off.
  2. Permitting clicking on features (points) to show a popup with more data/links on the map itself.

New or Changed Public Interfaces

Same as described above.

New dependencies

Leaflet (https://www.npmjs.com/package/leaflet) and OpenLayers (https://www.npmjs.com/package/ol)

Migration Plan and Compatibility

Should work with existing setup.

Rejected Alternatives

I am proposing considering the open data sources right now. So, no Google/Bing maps etc.

Describe alternative approaches that were considered and rejected.

I would like to attempt this but I am really at a loss for where to begin with implementing it. I have seen discussions about new chart types here and although the documentation is old regarding that, some of the issue threads provide pointers in the right direction.

I intend this thread to be something of the same kind where some of the developers may point us to the right section of the code where we can begin exploring and implementing open source mapping visualizations.

I hope the developers see some merit in it.

gk1089 avatar Mar 11 '20 11:03 gk1089

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

stale[bot] avatar May 10 '20 11:05 stale[bot]

Any Update on this ?

dharamgajera avatar Jul 06 '20 11:07 dharamgajera

I would be interested in engaging with the community about this. MapBox is a non-starter for us and a solid block for us to use Superset. Are there plans to implement support for open mapping projects? We would be interested in helping to get open mapping projects added so the package is a truly open source solution.

juen1jp avatar Jul 15 '20 20:07 juen1jp

@juen1jp I'm sure a contribution would be warmly welcomed by the community. As it will probably be a major change, I would propose opening a SIP (Superset Improvement Proposal) to make sure the community is able to chime with ideas and concerns prior to any major development work taking place.

villebro avatar Jul 15 '20 20:07 villebro

@juen1jp I'm sure a contribution would be warmly welcomed by the community. As it will probably be a major change, I would propose opening a SIP (Superset Improvement Proposal) to make sure the community is able to chime with ideas and concerns prior to any major development work taking place.

@villebro I opened this thread as a SIP itself. Are you proposing a fresh SIP be opened?

I just need a few indicators regarding what part of the code to look into, as in, the code files that make the mapbox magic happen. Just searching with 'mapbox' keyword in the code files has not given me much to go upon.

gk1089 avatar Jul 20 '20 06:07 gk1089

@gk1089 my bad, I didn't notice this was in fact opened as a SIP as it wasn't indicated in the title. The title should be prefixed with [SIP-XX] where XX is the next available unused SIP id. I believe SIP-50 is the next available id.

I assume most mapping systems require some for of token. This should be added to config.py so that it can be defined in the local superset_config.py. Currently the mapbox token is returned by viz.py to the relevant visualizations; I believe the plan is to return this type of data in the bootstrap payload in the future. The committers can surely help with the details once we get that far. I propose reaching out on Slack, e.g. the #visualization_plugins channel.

villebro avatar Jul 20 '20 07:07 villebro

@villebro Thanks for your response. As far as I understand it, tokens are compulsory only for metered map services like MapBox, ESRI, Bing, Google map services etc. For the open map services like Open Street Map (OSM), this is not a requirement and maps can be accessed directly by including the corresponding (Web Map Service) WMS URL through some js libraries like Leaflet or OpenLayers.

For example, I found the WMS URL (http://maps.heigit.org/osm-wms/service?REQUEST=GetCapabilities&SERVICE=WMS) for a world map on the info section of https://www.osm-wms.de/, which in turn was found on the OSM page on WMS (https://wiki.openstreetmap.org/wiki/WMS). I can use this WMS URL to show a map in my own page and the corresponding Leaflet/OpenLayers library will provide me tools to navigate on the map, show popups, make measurements etc.

It would be great to have the same control through a custom Superset visualization.

I shall try to join the slack and discuss it there and I request @juen1jp to chime in with his ideas. Meanwhile, may I request you to tag contributors who may have worked on the mapbox module in the past to share their take on this in this thread.

gk1089 avatar Jul 20 '20 07:07 gk1089

@villebro May I also request for this thread to be marked as active. It is currently marked as 'closed' by the activity bot.

gk1089 avatar Jul 20 '20 07:07 gk1089

In case there is no need for a token, then this will be quite straight forward, and should not be any different from any other new viz plugin. Please see the Hello World blog post on how to get started of you haven't already.

villebro avatar Jul 20 '20 07:07 villebro

In case there is no need for a token, then this will be quite straight forward, and should not be any different from any other new viz plugin. Please see the Hello World blog post on how to get started of you haven't already.

Thanks! I was not aware of this post.

While I have a go at it, for the sake of reusing the code is it possible to point to the files which deal with the existing MapBox code?

gk1089 avatar Jul 20 '20 07:07 gk1089

I was curious to know the status of this SIP so I was digging around in the repo and saw that SIP-50 already exists in the SIP Project board. Here's SIP-50 as it exists on the project board: https://github.com/apache/incubator-superset/issues/10418

May I suggest this SIP number be updated to 53?

roaur avatar Aug 21 '20 22:08 roaur

Most plugins live here: https://github.com/apache-superset/superset-ui/tree/master/plugins

DeckGl plugins here: https://github.com/apache-superset/superset-ui-plugins-deckgl

mistercrunch avatar Aug 21 '20 22:08 mistercrunch

We recently made the resolution to use ECharts as our primary visualization library https://github.com/apache/incubator-superset/issues/10418

Do the maps in ECharts depend on mapbox?

mistercrunch avatar Aug 21 '20 22:08 mistercrunch

https://echarts.apache.org/en/download-extension.html I believe mapbox is one of them..

On Fri, Aug 21, 2020 at 3:54 PM Maxime Beauchemin [email protected] wrote:

We recently made the resolution to use ECharts as our primary visualization library #10418 https://github.com/apache/incubator-superset/issues/10418

Do the maps in ECharts depend on mapbox?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/apache/incubator-superset/issues/9281#issuecomment-678547963, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQFR5UYRTCOKNNUYCUMVGFDSB33KRANCNFSM4LFTS4TA .

junlincc avatar Aug 22 '20 00:08 junlincc

🏷chart

junlincc avatar Aug 22 '20 00:08 junlincc

I think there is some confusion. Those of us who work for corporations don't want a commercial provider (Mapbox, Google, etc)

We need to keep to freely available solutions. This generally looks like running our own tileset servers and then something like leaflet to serve the mapping visualization.

ECharts looks nice and even has a rudimentary leaflet plugin. My only initial concern is that it is introducing more layers of complexity; however, that may be fine.

In general, I am new to the community. I am currently scoping the work that would need to be done in order for us to use this project. Defining a good default visualization framework is great. Outlining a formal way to contribute plugins and defining how to create a plugin is much better.

It looks like echarts will make an excellent default for the visualizations. However, realistically we will probably have to create some more custom working visualizations for our use cases. If they are generalizable we would be happy to push them to a less formal community plugin visualization library that users can pick/choose what types to install. I would greatly recommend such a "visualization library" be created to allow folks to contribute a wider variety of charts. No matter what library you go with, you will get a much larger variety of use cases covered if you harness the open source community to contribute new chart types.

juen1jp avatar Aug 22 '20 01:08 juen1jp

The thing with plugins is that you're free to do just that. For now the proper plugin framework is very recent, and the "plugin ecosystem" hasn't had the time to emerge just yet.

Everyone is free to start their own repo and publish plugins, it becomes fairly easy for anyone to build whomever else's plugin or sets of plugins into their Superset instances. The core team has decided directionally to standardize on ECharts as the main library to help us achieve more visual and technical consistency, and that applies to the the core plugins managed and maintained by the committers. Historically it's been challenging for Superset to be a patchworks of visualization frameworks and libraries that look slightly different, have different APIs, and evolve [or stagnate!] at different paces.

Longer term, we'd love to have a proper plugin ecosystem with one-click installs. We have a proof of concept somewhere that we can share, where you can point your installation to a built bundle (inside a CRUD view listing out your plugins) and it hot loads it and does the proper thing.

We may consider promoting plugins or plugin sets into the core plugins that ship with Superset too, but I'd much rather working towards a frictionless ecosystem that fosters distributed maintenance and ownership.

mistercrunch avatar Aug 22 '20 16:08 mistercrunch

Directionally, I vote against brining "Incorporating other map sources in Superset" if "incorporating" means bringing alternate map plugins to the main project, that the core team has to maintain/stabilize/evolve/release.

We could be doing a better job on the Deck-GL-based plugins, and the fact that we're not doing this as well as we should screams that we shouldn't bring in an alternate approach to geospatial.

BUT! we're super happy to work on the plugin ecosystem, by enabling things like:

  • having a page on the website that points to all existing plugins
  • make it easy to discover and install plugins inside Superset
  • improve the plugin interface to support more use cases and make it easier for people to author and publish plugins
  • ....

mistercrunch avatar Aug 22 '20 16:08 mistercrunch

That sounds fair. Between the Hello World blog post (thanks a lot, @villebro) and ECharts examples could a JS newbie implement the leaflet EChart example into Superset? Could you point me in other places you'd look if you were to implement such a chart into Superset?

roaur avatar Aug 24 '20 18:08 roaur

Keeping the alternate plugins outside seems like the smart way to go for me too. Perhaps we should instead close this and open another SIP focused on formalizing the plugin ecosystem (although I am assuming that is already on the roadmap)

juen1jp avatar Aug 26 '20 16:08 juen1jp