When I read the paper Characterizing Urban Landscapes using Geolocated Tweets, I'm attracted by the figures illustrated in it, like this:




How do I plot these figures for my own data?

Which software or package could be used to achieve this?

It seems like the basemap package in python doesn't contain the POI layer.

My working language is python and OS is Linux, while the data(containing ID, Lng, Lat, timestamp) is represented using Numpy arrays.

  • Shapely is a python package that works closely with numpy arrays. You could use it to transform your data into spatial layers Jan 22, 2015 at 14:32
  • @BelowtheRadar Thanks for suggestion~ If I transform my data into spatial layers, can I merge it with other layers like poi or road network together to achieve the effect like the figure above? Jan 22, 2015 at 15:05
  • Maps like those are made by supperpositions of layers, do you aim to create a dynamic or a static map? Jan 22, 2015 at 15:06
  • @BelowtheRadar static map, just like the figures for illustration. I gathered some GPS trajectory data as well as some POI data, and I want to do some clustering on both to check whether there exists some correlation between trajectories and POIs. So I want to visualize the result for better understanding Jan 22, 2015 at 15:36

2 Answers 2


I should add that Shapely alone is probably not enough to create your layers, you should use Fiona package to export your Shapely objects to geojson file that could be used in a GIS such QGIS.


You could also export your data into a csv or json file and use QGIS to create your spatial layers from the x and y fields. You can give any style to your layers or create thematics on it with QGIS.

For the base layers made of aerial photos, you can use Bing Map from within QGIS.

Finally, you can export from QGIS to pdf or any image format you like.

For POI: How to add csv file in QGIS 2.0 using Delimited Text Layer Plugin?

For polylines or polygon: Import polylines and polygons into QGIS from CSV


Some notes on a pure python way to do this (I prefer this to working in QGIS, when possible):

For managing your own data, I would recommend using the geopandas package. You can read GeoJSON or Shapefiles in directly, or else convert your own data from CSV or a Pandas Dataframe, which is easy to construct from a Numpy array.

Once you have a geopandas dataframe, you can call df.plot() to produce a plot. This is built off of Matplotlib, which takes a layered approach that allows you to put different datasets on top of each other.

In order to get a nice basemap, I recommend using the contextily package for the bottom layer. An example is shown on the package's Github. There is also an plugin for Jupyter notebook called gmaps but I found the syntax harder to grasp.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.