Plotting trajectory points on maps in python

Plotting trajectory points on maps in python

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 thebasemappackage 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 usingNumpyarrays.

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 calldf.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.