Hot answers tagged

33

You can do polygon to centroid in QGIS using: Vector - Geometry Tools - Polygon Centroids


30

Use plugin Numerical Vertex Edit (https://plugins.qgis.org/plugins/numericalVertexEdit/). Or create table with Lat/Lon/Name and save in csv, then load csv table in QGIS (Add Delimited text layer) (info gis-lab.info)


26

Using "Distance Matrix" you can calculate the nearest point. Make sure that both layers are in the same CRS! Then, you can load the results and use them to join table A and B. In "Distance matrix" chose: "Linear distance matrix" and "use only the nearest k target points: 1" Load the CSV using "Add Vector Layer" and join the layers in Layer A's layer ...


26

You need to reference your table twice, giving it different aliases: SELECT ST_Distance(a.geom, b.geom) FROM points_table a, points_table b WHERE a.id='x' AND b.id='y';


26

Try the 'mmqgis'-plugin. There, go to Modify -> delete duplicate geometries and select your layer.


24

The simplest way is to use the points to create the line. To do this in QGIS use the Points2One plugin. Install this plugin (available via Plugins->Manage and install plugins) and follow the dialog to create a line from your points. If you have multiple lines, then make sure your points data has a suitable ID field to identify the lines they belong to....


22

We need to bear in mind that these data are samples of discrete lithologic domains. Often, the boundary between two such domains cannot be identified in the field and so it's not valid to expect that many of the sample locations will lie precisely along boundaries. A correct solution will be a partition of the study area and each polygon within that ...


22

First, rasterize your vector layer. You can do it using Rasterize under Raster menu. Before rasterizing, I'd recommend to create an additional field and fill it with '1' and then select this field when rasterizing. Second, Raster\Analysis\Proximity Note that you should have GDALTools turned on in plugins.


22

I found a way using purely Python to get the coordinates for tweets using a word filter. It doesn't seem like many people include location with their tweets. This might not be what you're after either because this is live streaming data. You can test it by putting a unique filter word and then tweeting that word from your Twitter account. You will see your ...


22

Populated Places 1:10m (Natural Earth) Shapefile 7343 Cities Download from http://www.naturalearthdata.com/downloads/10m-cultural-vectors/ (Populated Places) Terms of Use http://www.naturalearthdata.com/about/terms-of-use/ No permission is needed to use Natural Earth. Crediting the authors is unnecessary. However, if you wish to cite the map ...


21

You can do polygon to border nodes in QGIS using: Vector - Geometry Tools - Nodes extraction


21

It seems like you're working with Ordnance Survey Code-Point data, which is a dataset of the postal code areas in Great Britain and Northern Ireland. The "points" you're referring to are small square polygons that represent so-called "vertical streets": stacks of more than one post code, which can't be represented using "conventional" polygons (see Andy ...


21

I would go the complicated way: Two Tables in a 1:n relation one table with the point location of the graves another table with the Grave-ID and person data You can build a relation between the two tables so that selecting a grave will select all person records in the person-table. The idea of having tables with fields like Person1, Person2... is ...


20

It is simple in the attribute calculator you may use $x and $y to calculate your coordinates into a new attribute.


20

Try Intersect tool in the analyses toolbox if you are on ArcGIS. Set output to point.


20

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) or ...


17

I know this is old but I was looking for the same as I don't have ArcInfo for the FeatureVerticesToPoints tools. After using Search cursor solution above I went forward to simplify the code and found that using NumPy Arrays in the Data Access Module a simple and very quick script could be produced. I'm using this as a script tool. Note: The key is the ...


17

This query should do the trick: WITH line AS (SELECT your_polylinestring_id, (ST_Dump(geom)).geom AS geom FROM your_polylinestring_table), linemeasure AS (SELECT ST_AddMeasure(line.geom, 0, ST_Length(line.geom)) AS linem, generate_series(0, ST_Length(line.geom)::int, 10) AS i FROM line), geometries AS ( ...


16

If you do not care about whether the point is a centroid or not, just use Vector -> ResearchTools -> Random Points. You may define to place a single point per each polygon in a layer. Also you may create centroids for initial polygons, delete points that do not intersect any polygon, save polygons without points as a separate layer, create random points for ...


16

No Plugin Required This is possible with QGIS without extra plugins using the Advanced Digitizing panel. This tool allows entering exact coordinate values as well as constructing points at given distance and angle from other points. Note: The advanced digitizing tools are not available in geographic coordinates. Pictures taken from this excellent answer ...


16

Maybe I'm not understanding, but you seem to be entering Longitude Latitude coordinates (-97, 21) in degrees,into a CRS that is UTM based, and uses meters. If you're declaring this as SRID 26918, then the long/lat values must be in that CRS. If the Long/Lat values are in degrees then you will need to create the geometry as ST_SetSRID(MakePoint(...),4326) ...


16

There is now a plugin called QChainage that does exactly what you want. You specify an interval distance and the plugin creates points along your line at the specified interval.


15

The process for this seems to have changed between ArcGIS 10.0 and 10.1. I will include a sample for both. Here is the help document on reading geometries in 10.1 using arcpy: Reading Geometries 10.1 This document discusses the parameters for a Polyline geometry type: Polyline (arcpy) 10.1 import arcpy infc = arcpy.GetParameterAsText(0) # Enter for ...


15

In ArcGIS you can use Hawth's Tools to generate your points or in QGIS you can use Vector->Research Tools->Random Points or Regular Points. However, you say the points will represent windmill bases and you want to maximise production. So, personally, I would not use either of these methods. Maximising windfarm production is dependent on much more than ...


14

Note: the following was edited following whuber's comment You might want to adopt a Monte Carlo approach. Here's a simple example. Assume you want to determine if the distribution of crime events A is statistically similar to that of B, you could compare the statistic between A and B events to an empirical distribution of such measure for randomly ...


14

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 import random def createRandomPoints(count): # Create a new memory layer to store the points. vl = QgsVectorLayer("Point", "distance nodes", "memory") pr = vl.dataProvider() pr.addAttributes( ...


14

As an alternative, you could: Use the Convert Lines to Points tool from: Processing Toolbox > SAGA > Shapes - Points > Convert Lines to Points (Add points over small distances. E.g. add a point every 1m if the overall line is 100m) Use the Distance to nearest hub from: Processing Toolbox > QGIS geoalgorithms > Vector analysis tools > Distance to nearest ...


13

There are several ways you can tackle this in R, including spDists in sp and gDistance in rgeos. An efficient way, that is expandable to multiple kNN ID's and distances, is to use spdep. require(spdep) data(meuse) coordinates(meuse) = ~x+y meuse <- meuse[1:10,] meuse@data$IDS <- 1:10 # Neighbor row indices and add neighbor attribute ID's ( ...


13

One possible tool is Geometry by expression in the Processing Toolbox > Vector geometry. A Geometry expression to create lines (length= 100 m) is as below: make_line(project($geometry, 50, radians("angle")), project($geometry, 50, radians("angle"+180))) project($geometry, 50, radians("angle")) part creates a new point by moving your points to "angle" ...


12

The NNJoin Plugin should do the job. For each feature of the input layer it adds all the attributes of the nearest feature in the join layer and also adds a distance attribute with the distance to this feature.


Only top voted, non community-wiki answers of a minimum length are eligible