Package for map visualizations?

Is there a Julia package with resources for plotting map visualizations - something similar to R’s ggmap, perhaps? I’ve scanned through the Gadfly and Plots documentation and and didn’t see anything obvious.

I’m interested in making visualizations similar to this:


Is there code available for that (neat) visualization?

1 Like


OpenStreetMap.jl for the underlying map. Plots.jl for the dots, lines and transparent heatmap. Perhaps Geodesy.jl if you need to project the coordinates.


It’s pretty hard to actually find where the code and data are.

EDIT: Seems the code is basically here

I know you can layer scatter plots on top of geographic data in Plotly, and I would think you could also do the same with a density plot. If that’s the case, then you can also do it in PlotlyJS.


You can use the Matplotlib Basemap module through PyCall and PyPlot.


@amellnik you are right on about this.

plotly.js can do it, so PlotlyJS.jl can also.

here are a couple examples from the PlotlyJS.jl docs

1 Like

Thanks @sglyon. Can this be done with arbitrary maps downloaded from some API, similar to get_map and ggmap() in R’s tidyverse? (In my case, I’m trying to plot the densities at the city level.)

As far as I can tell, the PlotlyJS.jl documentation examples use the built-in maps listed here (Plotly docs), which are limited to the enumerated options. Is that right?

There’s also scattermapbox which seems to work (see here for an example), but that requires interacting with the MapBox service via Plotly; that example code includes

  mapboxAccessToken: ...

and I don’t see a way to do this via PlotlyJS.jl or Plotly.jl.

Am I missing something obvious about how to plot on arbitrary maps with PlotlyJS.jl?

I don’t have any special code in PlotlyJS.jl that automates the creation of maps.

That being said, anything you’ve seen in any plotly library is possible in PlotlyJS.jl

The first example from the python mapbox docs would look like this in Julia:

mapbox_access_token = "pk.eyJ1IjoiY2hlbHNlYXBsb3RseSIsImEiOiJjaXFqeXVzdDkwMHFrZnRtOGtlMGtwcGs4In0.SLidkdBMEap9POJGIe1eGw"

data = scattermapbox(
    lat=[45.5017], lon=[-73.5673], text=["Montreal"],
    mode="markers", marker_size=14, 

layout = Layout(
    autosize=true, hovermode=closest,
        center_lat=45, center_lon=-73,

plot([data], layout)

I have tried to experiment with just doing it in Plots (which I often find easier as it acts as a general interface to many plotting packages), but I’m having some trouble, so it appears my response was too glib. This is probably a case where you need to use a specific package, like PlotlyJS or PyPlot, as suggested by others. Note that if are happy with using PyCall to call Python libraries you might instead consider using RCall and just do the visualisation with ggmap, if you are used to that. Otherwise, it’d be very cool to see what julia-native solution you could find with PlotlyJS.

To my mind map visualisations are many things - it could include everything from building maps from the bottom up with rasters and shapefiles (that’s what I usually do - see this question Overview of Geo tools for the current progress of this kind of functionality in julia), to an interface to google map’s API (which I don’t think exists right now), to simply plotting a heatmap and points on top of an image taken from the interwebs (that was what I tried). All of these approaches could lead to the nice map you posted.

1 Like

I have a google maps API wrapper flying around, I’m just not sure if I can
publish it. Google doesn’t seem to like people downloading it’s images. If
someone wants to take a look at their AGBs and assure me that it’s legal to
offer it as a package, please let me know!

This R package is GPL-3, it could be an option to drop him an email and hear if he investigated the licensing issues.

A small status update in case anybody from the future searches for map visualizations and finds this thread looking for advice:

  • sglyon is of course totally correct that the mapbox plots can be done via PlotlyJS.jl. Mapbox does have a free API tier, and with the scattermapbox trace you can make some really nice looking scatter plots on maps. I definitely prefer the result over Google maps. Heatmaps on top of maps is less obvious than just using scattermapbox (there’s not a heatmapmapbox), but the Plotly documentation does have sections on geo axes, so it’s probably possible.
  • The Mapbox docs show some heatmaps using mapbox directly, but I don’t think they look great.
  • ggmap and ggplot in R provide lots of functionality, but I haven’t been able to produce exactly what I need with them. By default the density estimation doesn’t allow weights on points, but you can do your own density estimation and provide the density surface yourself - a bit of hassle, but doable. Plotting the density surface on a map isn’t great though; as far as I can tell, you’re limited to the contour polygon geometries. These can be filled in with color, but it doesn’t look great. (For general heatmaps you can use tile geometries with many small tiles, but tiles and map projections are incompatible.)
  • Google maps has a visualization library you can use with a free API key (not sure about the licensing situation) which provides quite nice looking heatmaps. See here for an example. The code to generate those is in Javascript, so there is a hassle of going Julia data -> javascript code.
1 Like

It sounds like you’ve done a lot of looking into this. If this result is anything you can share a notebook or gist of, I think it would be pretty helpful for others who are interested in doing the same in the future!


Comment from a Julia newb:

I was previously using Python 3 & Folium on top of OpenStreetMaps to generate valid HTML for web-based mapping. Folium is a Python wrapper for the LeafletJS library, which is an excellent library for all sorts of visualisations: charts, graphs, vectors and maps.

Based on the information I have read in relation to the Julia project, the aim is not merely to be an “alternative” to Python for general computing. However, with an ever increasing Julia code base across networked and inter-networked devices, I believe that the concept of visualising data in context of it’s geolocation, is increasingly needed.

While the PlotlyJS solution is workable, it produces (AFAIK) static images with overlaid and contextualised data of pre-defined sections of a map.

Whereas the Python/Folium/OpenStreetMaps or Python/Leaflet/OpenStreetMaps solutions produce valid HTML for use in a web app, existing web server or can even output a static image.

It is not that the Python solutions are better per se but they do seem to offer flexability (Multiple and variable data layers & data-related attributes), easy modification and almost real-time updating whereas the Julia solution(s) currently do not.

I’m happy to try and use Julia to call Python & Folium as a workaround but perhaps this needs a real developer assessment to judge the merits of this thread and identify or at least indicate a sane direction of progress for Julia & Mapping.

1 Like

I believe all of these things are in development - check the JuliaGeo organization and e.g. this thread Overview of Geo tools

I had read that thread from your post (9 days ago) and it seems there is traction for change. So whom do we lobby for features? :sunglasses: I’m hands up for Alpha & Beta testing.

The current head of the real time mapping committee for Julia development
is a new community member named Justin Ant. I understand you know him…
please pass along congratulations on his nomination.

In all seriousness… don’t offer testing services. Build.


One of the nice things about PlotlyJS is that you can get the JSON source for the plot, which can be used in any web page via normal plotly.js. That’s how this works (although it’s using PlotlyJS via Plots.jl rather than directly).