19

I have a central point on a map, and I have other points in a separate layer (the location of a venue, and the origin cities of the venue visitors). Is there a plugin which would generate output similar to airline destination maps like this;

a example

They don't have to be "great circle" type of lines, just straight lines will do. This is for visual representation of point of origin for visitors of certain events.

Any tips or plugin recommendations?

4
  • 4
    I suspect underdark's blog post on the topic should answer your question, see VISUALIZING GLOBAL CONNECTIONS. Distance matrix is also probably not the best adjective, perhaps 'flow map' or 'origin-destination'. Here are two other examples on the site for reference, Representation of network flows and How to create arcs between two points in Python?. Perhaps retag with network instead of distance?
    – Andy W
    Commented Jun 12, 2012 at 12:14
  • Thanks for correcting me, you are right, I didn't know how to describe what I need. Underark has exactly made what I am after, but she doesn't really describe how this was done. If I have three points, how do I link two of them to the third? Say I have a table like this: "lat-origin,long-origin,lat-dst,lon-dest"
    – normis
    Commented Jun 12, 2012 at 12:30
  • 2
    I would say just edit your question to be explicit about how your data are currently set up, and it is likely underdark (or some other QGIS user) will come and give an answer for your particular situation.
    – Andy W
    Commented Jun 12, 2012 at 12:36
  • Duplicate question? Curved point-to-point “route maps” Commented Jun 13, 2012 at 14:38

5 Answers 5

11

If you are just looking to connect orgin/destination points and not needing the curved "great circle" lines, take a look at the QGIS plugin called "mmqgis". It has a Hub Lines tool that I think will create the visual that you are looking for.

"The hub lines tool creates hub and spoke diagrams with lines drawn from points on the "Spoke Point" layer to matching points in the "Hub Point" layer. Determination of which hub goes with each point is based on a match between the "Hub ID Attribute" on the hub points and the "Spoke Hub ID Attribute" on the spoke points."

6

For this to work, you will need a working PostGIS installation. Shapefiles can be loaded into PostGIS using the QGIS PostGIS Manager tool.

SQL queries can be executed in multiple tools from within QGIS (if it has connection to a PostGIS database), eg. RT SQL Layer plugin.

If you have only one destination point but multiple source points (table "source", the SQL query in http://underdark.wordpress.com/2011/08/20/visualizing-global-connections/ can be simplified to:

CREATE TABLE connections AS (
  source.id,
  SELECT ST_Transform(ST_Segmentize(ST_MakeLine(
    ST_Transform(ST_SetSRID(ST_Makepoint(--your lon lat here--),4326), 953027),
    ST_Transform(source.the_geom, 953027)
  ), 100000 ), 4326 ) AS the_geom
FROM source
);

Don't forget to first insert the CRS #953027 first.

3
  • ok, beginners question, where do I use this in QGIS? looks like a database command, but I have never used database sources in Qgis, nor do I know where to paste the above :) All my data sources are SHP or CSV files.
    – normis
    Commented Jun 13, 2012 at 8:11
  • 1
    In this case, I recommend looking into some PostGIS tutorials and the QGIS manual on working with databases.
    – underdark
    Commented Jun 13, 2012 at 8:56
  • Also without CRS# 953027 you can use the Geography feature in PostGIS: gisforthought.com/great-circle-flight-lines-in-postgis and gis.stackexchange.com/a/84583/16530 Commented Mar 7, 2017 at 9:18
5

You can depict flow maps via node-2-node flow mapping extension which is available from QGIS plugin repo;

http://plugins.qgis.org/plugins/FlowMapper/

there is also sample data and documentation within the zip file.

input node coordinates and interaction matrix should be in plane text format, white space delimited.

3

You could try to follow James Cheshire's instructions from the post Mapping the World’s Biggest Airlines to achieve that in R and ggplot2:

enter image description here

Some more general mapping tips in R are also described in Great Maps with ggplot2 post

1
1

Assuming your data is set up as;

ID Origin_X Origin_Y Dest_X Dest_Y

a freeware package CrimeStat can take as input a shapefile with the origin and destination locations and output a shapefile with the lines drawn. I'm pretty sure you just need to have a unique id listed in your shapefile to tell CrimeStat what lines to connect.

I'm sure you can do this more directly in QGIS though, but CrimeStat provides a gentle GUI interface to accomplish the task if need be. The prior questions on the site you want to browse are tagged .

Note you can use either projected coordinates or lat-lon in CrimeStat, but it will not produce great circle lines (which require splitting the lines into many smaller segments).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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