Shape Tools creates geodesic shapes and includes a number of geodesic tools for QGIS including the XY to Line tool, geodesic densify tool, geodesic line break, geodesic measure tool, geodesic measurement layer, geodesic scale, rotate and translate tool, and digitize points at an azimuth & distance tools.
Clone or download
Latest commit cf2394d Nov 15, 2018
Permalink
Failed to load latest commit information.
doc Added geodesic transofmations tool Nov 14, 2018
ext-libs/geographiclib updated library to the latest version Oct 24, 2017
images Added geodesic transofmations tool Nov 14, 2018
svg Added geodesic transofmations tool Nov 14, 2018
ui Add additional historical ellipsoids Sep 17, 2018
LICENSE Initial commit Jun 3, 2016
Makefile Added geodesic transofmations tool Nov 14, 2018
__init__.py Changed to Geodesic math Mar 21, 2017
azDigitizer.py update to make more pythonic Oct 10, 2018
createArc.py remove some indentation Oct 10, 2018
createDonut.py moved code outside loop Nov 7, 2018
createEllipse.py Fixed ellipse code to be geodesic Nov 7, 2018
createEpicycloid.py added calculations from fields Aug 21, 2018
createHeart.py added calculations from fields Aug 21, 2018
createHypocycloid.py added calculations from fields Aug 21, 2018
createLob.py minor reporting improvements Aug 21, 2018
createPie.py bug fix release Aug 30, 2018
createPolyfoil.py added calculations from fields Aug 21, 2018
createPolygon.py bug fix release Aug 30, 2018
createRose.py added additonal shapes to processing Aug 16, 2018
createStar.py bug fix release Aug 30, 2018
geodesicDensify.py geodesic densifier enhancements Sep 28, 2018
geodesicLayerMeasure.py fix in label placement Nov 14, 2018
geodesicMeasureTool.py added more styling Sep 12, 2018
geodesicTransformation.py Added geodesic transofmations tool Nov 14, 2018
helphead.html Added help support. Mar 9, 2017
idlbreakline.py clean up code Aug 16, 2018
lineDigitizer.py added magnet declination Sep 14, 2018
metadata.txt update tags Nov 15, 2018
provider.py Added geodesic transofmations tool Nov 14, 2018
readme.md Added geodesic transofmations tool Nov 14, 2018
settings.py Add additional historical ellipsoids Sep 17, 2018
shapeTools.py Added geodesic transofmations tool Nov 14, 2018
utils.py consolidated code Nov 7, 2018
vector2Shape.py Fixed ellipse code to be geodesic Nov 7, 2018
xyToLine.py consolidated code Nov 7, 2018

readme.md

QGIS Shape Tools Plugin

Shape Tools has the following tools that are installed in the Vector menu, on the toolbar, or from the Processing Toolbox.

  • Create shapes Create shapes processes a point vector layer to create ellipses, lines of bearing, pie wedges, donuts, arc wedges, polygons, stars, ellipse roses, hypocyloids, polyfoils, epicyloids, and hearts based on the table's fields and parameters from the dialog box. All use geodesic math to calculate the shapes.
  • XY to Line XY to Line uses pairs of coordinates from each layer's records to create geodesic lines in between. Geodesic lines represent the shortest path along the Earth's surface between two points. The input can be a point vector layer or a table layer that contains pairs of coordinates.
  • Geodesic line break Geodesic line break at -180,180 breaks lines at the International Date Line at -180,180 degrees longitude for a more pleasing visual look.
  • Geodesic densifier Geodesic densifier densifies a line or polygon vector layer by adding geodesic points in between each line segment whenever the distance between vertices exceeds a certain threshold. This creates a geodesic path that gives it a nice smooth curved appearance. If the vector layer is a line, it can also draw a geodesic line just between the beginning and ending points.
  • Geodesic transfomations tool Geodesic transformations can geodesically scale, rotate, and translate points, lines and polygons. It retains the its shapes relative dimensions no matter what the projection is.
  • Geodesic measure tool Geodesic measure tool provides geodesic line measuring, similar to that implemented in Google Earth.
  • Geodesic measurement layer Geodesic measurement layer converts a polygon or line layer a new layer with all geometries measured and labeled.
  • Azimuth, distance digitizer Azimuth, distance digitizer creates a new point at a certain azimuth/bearing and distance or creates a geodesic line from the point clicked to a point in the azimuth direction located at a distance.
  • Azimuth distance sequence digitizer Azimuth distance sequence digitizer digitizes a sequence of azimuth/bearing, distance pairs to create a series of points, a line, or a polygon.

Contents

Create Shapes Create Shapes

Examples

All of these shapes are now available as processing algorithms.

Processing Shapes

Ellipses, lines of bearing, pie wedges, donuts, arc wedges, multi-sided polygons, stars, ellipse roses, hypocycloids, polyfoils, epicycloids, and hearts can be created from parameters in the layer data or from default parameters in the Create Shapes tool. Note that the layer created is a memory layer and will not be saved with the QGIS project. You need to manually save the layer or use the Memory Layer Saver plugin. If you run the algorithms from the processing toolbox, then you have the option to save them in various ways.

The following are details for creating each shape. All of the shapes are created centered about the point or from the point. Common elements are:

  • Input points layer - Select the desired points layer.
  • Output layer name - Select a name for the output layer that will be created in QGIS as a memory layer.
  • Output CRS - Specify the output layer's coordinate reference system (CRS). This can either be the same as that of the input layer, the same as the project CRS, or WGS 84. It defaults to the input layer's CRS.
  • Shape Type - Specify whether the shape should be drawn as a polygon or as a line.

Ellipse

Ellipse

Select a points vector layer and an output layer name or use the default name. Then select the specific ellipse parameters. The semi-major axis of the ellipse runs along the orientation axis. The orientation the axis is measured in degrees in a clockwise direction from the north line. Units of measure for semi-major, and semi-minor lengths are defined by Axis units of measure.

If a field in the layer represents the semi-major axis, semi-minor axis, or orientation of axis, then the field can be selected and the data from the layer will be used, otherwise the default values will be used.

Line of Bearing

Bearing is the angle measured in degrees, in a clockwise direction from the north line. A line of bearing is the line drawn from a starting point in the direction of the bearing or azimuth for the selected distance. The line of bearing uses geodesic math to find the shortest path and is accurate along the Earth's surface.

Pie Wedge

Depending on the Azimuth mode, if it is set to Use beginning and ending azimuths, then the pie wedge focal point starts at the point layer's geometry extending out to the specified radius. It starts at the Starting azimuth going in a clockwise direction to the Ending azimuth. If Azimuth mode is set to Use center azimuth and width, then a center azimuth is specified which becomes the center of the pie wedge with an arc length of Azimuth width. The pie wedge can either be defined from the point vector layer data fields or from the Default parameters. Drawing segments is the number of line segments that would be used to draw a full circle. A wedge will use a proportionally smaller number of segments. Making this larger will give smoother results, but will be slower rendering the shapes.

Donut

Create a donut shape. The inner and outer radius is specified either as default values or from the attribute table. If the inner radius is 0 then a solid circle is drawn. Number of drawing segments defines how many line segments it uses to create the circle. A larger value will produce a smoother circle, but will take more time to draw.

Arc wedge

In essence this takes a wedge of a donut shape. The parameters are similar to Pie wedge and Donut.

Polygon

Create an N-sided polygon centered on the vector point. The vertices of the polygon lie on a circle of the default radius.

Star

Create an N-pointed star with the outer vertices located on a circle defined by the outer radius. The inner vertices are located along the circle defined by the inner radius. One of the radius' can be negative which gives an interesting shape.

Ellipse Rose

Create an N-petal rose. The distance from the center to the outer petals are defined by the radius.

Hypocycloid

Create an N-pointed hypocycloid. A hypocycloid is defined as the curve traced by a point on the circumference of a circle that is rolling on the interior of another circle. The distance from the center to the outer cusps are defined by the radius.

Polyfoil

Create an N-leafed polyfoil. The distance from the center to the outer leafs are defined by the radius.

Epicycloid

Create an N-leafed epicycloid. The distance from the center to the outer edge is defined by the radius.

Heart

Create a mathematical heart which fits within the circle defined by its radius.

XY to Line XY to Line

This creates geodesic, great circle, or simple lines based on starting and ending coordinates in each table record. One of the coordinates can be from a point layer geometry or both can come from the attribute table data where each record has a starting x-coordinate, starting y-coordinate, and an ending x-coordinate and ending y-coordinate.

XY to Line

Input Layer - This can either be a point layer, a simple table, or any other vector data set that has two coordinates among its data fields. For example a CSV file containing starting and ending coordinates could be imported using Layer->Add Layer->Add Delimited Text Layer... located in the QGIS menu. From this dialog box the user can specify one of the coordinates for the layer's geometry or No Geometry can be used. Both types of layers will be visible to XY to Line.

Output point layer - Optional points layer that can be created in QGIS. It can contain the starting point, ending point, both points, or no points in which case it will not be created.

Output line layer - Output line layer file that is created in QGIS.

Input CRS for coordinates within the vector fields - CRS of the input coordinates within the table data fields.

Output layer CRS - CRS of the output line and point layers.

Line type - 1) Geodesic creates a highly accurate shortest path between two points. 2) Great Circle creates a Great Circle arc between the two points. 3) Simple Line creates a non-geodesic straight line between the two points.

Starting point - Specify whether to use the Layer's point geometry (not applicable for layers that don't have Point geometry) or to specify the Starting X Field (lon) and Starting Y Field (lat) from the layer's fields.

Ending Point - Specify whether to use the Layer's geometry (not applicable for layers that don't have Point geometry) or to specify the Ending X Field (lon) and Ending Y Field (lat) from the layer's fields.

Show starting point - If checked the output point layer will include an entry for the starting point if an Output point layer has been specified.

Show ending point - If checked the output point layer will include an entry for the ending point if an Output point layer has been specified.

Break lines at -180, 180 boundary for better rendering - Depending on the QGIS projection when lines cross the international date line, strange behavior may occur. Checking this box breaks the line at the -180, 180 boundary in a way that it displays properly.

This function can also be accessed from the Processing Toolbox.

Processing Toolbox

Geodesic Line Break at -180,180 Geodesic Line Break at -180,180

If you have ever created a geospatial masterpiece that has crossings across the International Date Line at a longitude of -180°/180° and it turned out like the image on the left, you are not alone.

Break lines

Geodesic line break will break lines at the -180°/180° boundary along a geodesic path which is the shortest distance along the earth's surface between two points. The algorithm is very simple with just an input and output layer. The resulting output is shown in the above right side image. Depending on your data you may find it useful to also run the Geodesic Densifier on the data prior to this routine.

Geodesic Line Break

Geodesic Densifier Geodesic Densifier

Densify a line or polygon vector layer by adding geodesic points in between individual line segments when its length is too great. This gives it a nice smooth curved appearance. For line vectors a geodesic line can be drawn between just the beginning and ending points.

Geodesic Densifier
  • Input Layer - Select an existing line or polygon layer.
  • Output Layer - Specifies the output layer that will be created in QGIS.
  • Discard inner vertices (lines only) - When this is checked only the beginning and ending points are used when drawing geodesic lines. This does not apply to polygons.
  • Maximum line segment length (in kilometers) - This is the maximum length of a line segment before a new vertex is added along the geodesic path. This value defaults to the length specified in the Settings menu.

The following shows the before and after results of running this function on a polygon layer.

Geodesic Polygon

This function can also be accessed from the Processing Toolbox.

Processing Toolbox

Geodesic Transformations Geodesic Transformations Tool

This tool provides the ability to geodesically transform a shape. It supports scaling, rotation and translation. The size and geometry of each shape will be retained regardless of the projection.

Geodesic Transformations
  • Input vector layer - Select an existing point, line, or polygon vector layer.
  • Selected features only - Checking this box will cause the algorithm to only transform the selected features.
  • Rotation angle about the centroid - Rotate the feature about its centroid. A positive angle rotates in a clockwise direction.
  • Scale factor about the centroid - Scale the shape about its centroid. A scale factor of 1 retains its same size.
  • Translation distance - Distance the shape will be moved along a geodesic path.
  • Translation azimuth - Azimuth or direction the shape will be moved along a geodesic path.
  • Translation distance units - Units of distance the shape will be move.
  • Output layer - The output layer that will be created in QGIS.

Geodesic Measure Tool Geodesic Measure Tool

This provides the ability to measure distances using geodesic (shortest path) algorithms. The results returned are similar to those used by Google Earth and makes for a nice baseline of distances. It also includes the heading from the first point to the second and a heading from the second point to the first. The units are in degrees. The units of distance can be meters, kilometers, feet, yards, miles, and nautical miles. Simply click on the Geodesic Measure Tool icon and start clicking on the map. Notice that the ellipsoid used to calculate measurements is listed in the lower left-hand corner. By default this is set to WGS 84, but it can be changed in the Settings menu.

Geodesic Measure Tool

The Save to Layer button will create a Measurement layer that contains the distance and by default the distance label will be displayed.

Geodesic Measure Tool

By right-mouse clicking on the Measurement layer and selecting Open Attribute Table, the following attributes are available for each measured line segment; label, value, units, heading_to, heading_from, and the total distance for all line segments.

Geodesic Measure Tool

Geodesic Measurement Layer Geodesic Measurement Layer

This take either a polygon or line layer and for each of the geometries calculates the geodesic distances of each feature. The user can choose whether each line segment is measured and output as a line measurement or whether the entire line/polygon geometry is measured. It outputs a new line layer of lines that contain attributes with all the measurements. If measuring individual line segments the attributes are a label, distance, units of measure, azimuth/bearing to the next point, and the total distance of the geometry. If measuring the entire geometry then the attributes are a label, distance, and units of measure. The input is either a line or polygon layer. Select whether you want to measure the entire line or polygon or each line segment within the line or polygon. Distance units can be kilometers, meters, nautical miles, miles, yards, or feet. Use automatic styling styles the QGIS layer with the label string in the attribute table and with the text and line colors found in Settings.

Geodesic Measurement Layer

Here is an example of running this on a polygon. Notice how it not only measures the outer boundary, but it also measures the inner boundary as well.

Measuring a polygon

Here is what the attributes table looks like.

Measurement Attributes

Azimuth, Distance Digitizer Azimuth, Distance Digitizer

This tool works on point and line vector layers and is enabled when they are selected and in edit mode. In either case the following dialog box is displayed when the tool is enabled and a point on the map is clicked on.

Azimuth, Distance Tool

Azimuth is in degrees and distance is in the selected Distance units of measure. The following is how it interacts on point and line layers.

  • Point Vector Layer - If an editable point vector layer is selected and the map is click on, the tool will create a point in the azimuth direction and at the specified distance. The point clicked on can be also included in the output layer.
  • Line Vector Layer - If an editable line vector layer is selected and the map is click on, the tool will create a geodesic line from the clicked point along the azimuth and distance path.

Azimuth Distance Sequence Digitizer Azimuth Distance Sequence Digitizer

Azimuth, Distance Sequence Digitizer

This is similar to the Azimuth, Distance Digitizer, but it provides the ability to click on the map as a starting point and then give a series of bearings and distances in the order of 'bearing 1, distance 1, bearing 2, distance 2, ... bearing N, distance N' and it will create a path. This is useful in some survey work. If older surveying used magnetic north, it can be compensated for by the Bearing / declination adjustment. Magnetic declination changes over time, but the NOAA Magnetic Field Calculator provides an easy interface to estimate the magnetic north declination at a certain latitude, longitude and time, all the way back to 1590. West declination will be a negative number and east declination is a positive number. If a polygon layer is selected then the resulting shape automatically closes the polygon such that the beginning and ending points are the same. If a line layer is selected then you have the option of automatically adding a line segment from the last point in the sequence to the first point. If a point layer is selected, then only the nodes will be added to the layer.

Settings

The settings dialog box can be accessed from the Shape Tools menu Vector->Shape Tools->Settings. The following are the parameters that can be configured.

Settings
  • Try to guess column names - By default the ellipse and line of bearing shapes will try to guess the vector fields that contain the appropriate parameters such as semi-major axis, semi-minor axis, axis orientation, bearing, and distance. If it finds one of the fields that has a name similar to these it will set the drop down menu to that item. If you do not want this behavior, then uncheck this box.
  • Geodesic Line Settings - These settings are used when drawing geodesic and great circle lines.
    • Maximum segment length before creating a new segment - In order to draw a smooth curved line, multiple line segments are required. This defines how far to travel before a new line segment is created. This parameter is in kilometers.
    • Maximum number of segments per line - This is the maximum number of line segments that will be created for any line even though the maximum segment length may be exceeded. This takes precedence.
  • Measure Tool Settings - These are settings for the Geodesic Measure Tool.
    • Azimuth Range - The azimuth is displayed from -180 to 180 degrees or from 0 to 360 degrees.
    • Rubber band color - Selects the rubber band line color used by the measure tool.
    • Measurement layer color - Vector line color when a measurement layer is created from the Geodesic measure tool or from the Geodesic measurement layer tool.
    • Measurement layer text - Color of the text when a measurement layer is created from the Geodesic measure tool or from the Geodesic measurement layer tool.
  • Ellipsoid Used for Measurements - Selects the ellipsoid used for calculating the geodesic distances within Shape Tools. By default this should normally be WGS 84
    • Ellipsoid group - Choose the default WGS 84 setting or enable System Ellipsoids or Historical Ellipsoids.
    • System Ellipsoids - This is enabled if Ellipsoid group is set to System Ellipsoids.
    • Historical Ellipsoids - This is enabled if Ellipsoid group is set to Historical Ellipsoids. Additional historical ellipsoids can be selected.