It seems the most common problem with these types of "flow maps" is that when many lines are included, they collide to such a great extent that it makes it difficult to discern any non-obvious pattern (when reciprocal flows are considered it happens to an even greater extent). Also the long lines tend to dominate the graphic, although it is quite possible ...
In the Python console:
you can use the Shapely module (as in How to create equidistant points in QGIS?) with the function
point = line.interpolate(currentdistance)
The new Python API of the master version (1.9) has an equivalent command (as in Generating chainage (distance) nodes in QGIS of Nathan Woodrow)
point = geom.interpolate(currentdistance)
You can accomplish this with a combination of QGIS and GRASS.
Import your vector layer into a GRASS mapset ( Grass | File > Import Vector Data )
Open your mapset in QGIS ( QGIS | Plugins > GRASS > Open mapset )
Add vector layer from your GRASS mapset to your QGIS project ( QGIS | Plugins > GRASS > Add GRASS vector layer )
Use v.clean.snap ( QGIS | Plugins > ...
This code will work on the lastest dev build of QGIS.
from qgis.utils import iface
from qgis.core import *
from PyQt4.QtCore import QVariant
# Create a new memory layer to store the points.
vl = QgsVectorLayer("Point", "distance nodes", "memory")
pr = vl.dataProvider()
You need to break the polyline at the +-180 degree meridian. This requires finding the latitude at which the polyline crosses that meridian. Your GIS probably has methods to do the breaking. If not, a simple solution can be derived from code shown in a related thread. Here are some details.
A polyline is represented as a sequence of vertices, each given ...
Quick answer: no! There's no tool like that to do that operation directly on the layer (the "Join Two Lines" plugin requires intersection).
You could do it for a very simple layer by turning the lines to points (extract nodes) then joining with points2one (line output) but this would be MUCH slower than just editing by hand:
Make sure you have snapping (...
I've written a script that changes the Sextante Densify geometries tool to accept a certain distance. It's called Densify geometries given an interval.
After running Densify, you can extract the points using Extract nodes tool.
You can get it from Github and install instructions are on my blog.
I assume you are wanting to join two line segments into one line.
This is how I did it ...
Turn on snapping ( Settings -> Snapping Options ... )
Select the node node tool.
Double click close to the end of one of the lines to add a node.
Drag the node at the end to snap onto the the end of the other line
Select both lines
Merge their ...
You don't say which software you're using, but the thing you're looking for is Voronoi polygons (AKA Theissen polygons). This is the set of polygons such that any point within a polygon is nearest to its seed point.
You will find that the polygons tessellate, which might be a problem if your offices have a maximum distance of responsibility. If that is the ...
GeographicLib has a python interface:
This can computer geodesics on an ellipsoid (set flattening to zero to get great circles) and can generate intermediate points on a geodesic (see the "Line" commands in the sample).
Here's how to print out points on the geodesic line from
JFK to Changi Airport (Singapore):
from geographiclib.geodesic import Geodesic
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 ...
pyproj has the Geod.npts function that will return an array of points along the path. Note that it doesn't include the terminal points in the array, so you need to take them into account:
# calculate distance between points
g = pyproj.Geod(ellps='WGS84')
(az12, az21, dist) = g.inv(startlong, startlat, endlong, endlat)
# calculate line string ...
We came up with this technique at work that uses geoprocessing tools to do the job:
First off, make sure your line segs have unique IDs.
Buffer "FLAT" in each direction of the line, add a new field of the same name to each and give them a direction ("L","R").
Merge the buffers together.
Buffer the original line again, this time "FULL".
Convert the FULL ...
Try ET Geowizards Generate (Import from Text) and use a Box type.
If new to this free (some tools only) ArcGIS addon, go to http://www.ian-ko.com.
For this you need to do a some simple formatting of your excel to be
id,xmin,ymin,xmax,ymax - formatting is explained in the tool help.
One approach is to convert this to raster and then extract contours
Another is to find the buffer for each point;Dissolve those buffers to get a narrow polygon;Find the center line of each dissolved polygon.
If you are not forced to use QGIS, another Open Source GIS software OpenJUMP http://openjump.org/ has a Planer Graph tool that may be exactly what you need.
Here you can find the tool.
If you need only the edges you can uncheck all extra options.
The result contains the common edges only once. With real data the result may not be perfect because adjacent ...
Following Nathan's answer, you can create a python action in the layer where you want to swap lines:
layer = QgsMapLayerRegistry.instance().mapLayer("_your_layer_id_")
r = QgsFeatureRequest([% $id %])
f = QgsFeature()
geom = f.geometry().asPolyline()
geom = QgsGeometry.fromPolyline(geom)
In Arc, they call these "Desire Lines" or "Spider Diagrams". There are a number of ArcGIS Toolbox tools that have already been created to to just this task:
Take a look at the ArcGIS Resource center for Geoprocessing under Model and Script Tool Gallery:
Spider Diagram Tool for ArcGIS 10.0
Spider Function For ArcGIS Desktop 10
To get point in order and link to orginal geometry use
SELECT (ST_DumpPoints(the_geom)).path as path, id, (ST_DumpPoints(the_geom)).geom FROM linestrings)
and remove dublicates from
remember that you need to have one unique id for dublicate removing, if you dont have one you need to create it
(Converting my comment to an answer)
If you already have bounding polygons created for all of your landform features, the vertices of those polygons should already be ordered consistently, assuming they are topologically valid. If so, you should be able to solve this using GP tools:
Use Feature Vertices to Points
to convert the polygons' vertices to
There's a nice procedure here, by our very own underdark.
Basically, the procedure goes like so:
- reproject the points you want the line to be between,
- get a straight line drawn between them,
- subdivide that line into x amount of pieces, and finally
- project the subdivided line back to your original projection.
I've kind of stopped using Arc because ...
Not to be meant as a serious complete answer, but rather just an idea to toss around - I wonder if Thiessen polygons could perhaps be of any use in this case.
Now, the trick is to find a reliable algorithm to identify those polygon boundary segments which form the centerline. Once you have the centerline, it is easy to decide on which side a point lies. Any ...
I see from your tags that you are running ArcGIS 10. I've used the following method for a similar task:
1) Use Multipart to Single Part
2) Use Unsplit
In order for this to work (i.e. so that you have the lines in the proper order) you may need to break the line into the constituent end points and then change the direction based on an attribute (e.g. 1 = ...
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", ...
Depending on how far you got in the process, you may want to skip to step six. I have however provided full steps for creating a layer below.
The basic process you would want to follow for creating a layer in QGIS is:
From the Layer Menu, choose New Shapefile Layer...
Specify the type. In your case, for a road you likely will want to specify the type as ...
Here is an illustration of the workflow I mentioned in the comment above, and although I don't know of any simple pre-canned routine to do this, I have attached an excel spreadsheet that one can import a set of origin-destination coordinates and the sheet then makes a set or circular line coordinates (spreadsheet here). It has formulas set up so it is pretty ...