19

You can use this for PostgreSQL. 600 is 10 minutes in seconds. The idea is to convert timestamp to epoch, divide by interval desired in minutes then round to get the desired interval SELECT COUNT(*) cnt, to_timestamp(floor((extract('epoch' from timestamp_column) / 600 )) * 600) AT TIME ZONE 'UTC' as interval_alias FROM TABLE_NAME GROUP BY interval_alias


19

There's almost certainly nothing wrong with grouping by geometry in this case, since you're already grouping by a unique ID (nbhd_id). And, as you point out, it saves you a join and makes the query cleaner. It's important to know that a GROUP BY geom clause in PostGIS 2.3 and earlier actually groups rows based on bounding box equality, not geometric ...


11

you can try this (did this in QGIS 2.16) fixed distance buffer each point by 250m (this is half the required distance between points) then dissolve all on the result of that then use multipart to singlepart to split each cluster into its own feature add a field (using the expression @row_number) to assign a unique ID to each cluster. you then get ...


8

We have had quite a lot of success doing this in 6 Australian and two South African cities under the banner of GeoRabble. Its About page describes the process for how GeoRabble "self-organizes" and we would be happy to try and help you get one off the ground. Some things that have made GeoRabble successful are: The definition of a GIS Professional being ...


7

Before I get to how to in QGIS I feel I should mention that from table browser in QGIS you can select and copy the whole table and paste into your favorite spreadsheet software and calculate sums (or other) there. If you really want to do it in QGIS, the best way is to use SQL query for this. Meaning you need to work in some database (don't panic, it is ...


7

Use the following script. root = QgsProject.instance().layerTreeRoot() group = root.addGroup("group") for layer in root.children(): if layer.isVisible() and layer != group: _layer = layer.clone() group.addChildNode(_layer) Note: If there is another visible group layer including visible/invisible layers, that group layer is copied ...


6

You can group points using either the recursive query or PL/PLGSQL procedure described in the answers to this question. Just substitute ST_DWithin for ST_Intersects/ST_Touches, as appropriate. If you're comfortable trying something experimental, you could build PostGIS with purpose-built functions to solve this problem: see the ticket on trac (code ...


5

I recognize that a few of these have been covered in other posts, but they are worth re-iterating. Here are my keys to organizing a successful user group: Your professional network. The most important part of a user group is each individuals professional network. You need personal interaction on a professional & educational level. Get the word out ...


5

Change this line child.loadNamedStyle('*.qml') by: child.layer().loadNamedStyle('/some/real/path/to/a/file.qml') Your child object is of type QgsLayerTreeLayer, but you need to access layer() to get its correspondent QgsMapLayer, which has a loadNamedStyle() method.


5

Use Vector -> Research Tools -> Random Points Inside Polygons. Select the variable, which contains the number of people in each Block (=polygon) under expression. leave sampling strategy untouched at point counts.


4

Use a CASE statement and a sub-query: SELECT foo.category, SUM(ST_Length(foo.the_geom)) as length FROM (SELECT gid, year, the_geom, (CASE WHEN year BETWEEN 2005 AND 2014 THEN "1"; WHEN year BETWEEN 1995 AND 2004 THEN "2"; WHEN year BETWEEN 1985 AND 1994 THEN "3"; WHEN year BETWEEN 1975 AND 1984 THEN "4"; ... ...


4

You can create unique values but based on which polygon the point resides in. Add a unique attribute which is at least 10 times larger than the amount of points to your polygons, and the join this value to your points. Like in your example, the upper polygon would have 100. Join to your points and create unique values that is something like 101 and 102. ...


4

As your polygon example is not convex, I would rather use some "morphological math" tricks. You dilate your polygons so that closeby polygons will touch each others and fill the gaps of your streets, then you erode the block so that the contour is the same as the origin. In practice, you can do it with vectors using the buffer tool. After first positive ...


4

You could use the Sum Line Lengths tool from the toolbar: Vector > Analysis Tools > Sum Line Lengths You will receive a polygon output with the sum of all lines within each polygon. Alternatively, you could use the GroupStats plugin (which you can download/install from Plugins > Manage and Install Plugins). I wrote a somewhat similar answer here where ...


4

The rioja package provides functionality for constrained hierarchical clustering. For what your are thinking of as "spatially constrained" your would specify your cuts based on distance whereas for "regionalization" you could use k nearest neighbors. I would highly recommend projecting your data so it is in a distance based coordinate system. require(sp) ...


4

Unfortunately, you can't set dot density style in QGIS (for now, I hope) as easily as you can do in ArcGIS. You can do it by creating a new Point layer. Do not expect any hope from style window. You can follow instructions in Creating a statistical dot density map with QGIS


4

An alternative approach that keeps it in ModelBuilder is this simple model: My example input data is: My model is: Summary stats tool is set up as: The Calculate field is set up as shown below: The model generates the following output table:


4

Try the natively supported SpatiaLite SQL, either via Virtual Layer, or the DB Manager; run SELECT "AreaChar", ST_Centroid(ST_Collect(geometry)) AS geometry FROM <your_layer> GROUP BY "AreaChar" ; to simply get the centroid as geometry, or SELECT "AreaChar", ST_X(geometry) AS x, ST_Y(geometry) AS y, geometry FROM ...


4

Use a combination of the two fields like concat: "id" || "function" for the group_by part of the expression: sum("area","id"||"function")


4

There is also a possibility using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer... Let's assume there is a point layer called "test" with its attribute table, see image below. With the following query, it is possible to calculate the sum of the features only when these have the same "id" and the ...


3

I think I understand what you want to do. For each unique value in "Field", you want to find the most recent date in "Date" and set its value to "Y" in "Flagged_Field". I used your field naming conventions, but you need to avoid using keywords like Field and Date for your field names. import itertools def getGrouper(row): """Key function to retrieve ...


3

Intersect your building layer and grid layer (Vector > Geoprocessing Tools > Intersect). The result should be your buildings, cut up wherever they cross a grid line. Those pieces should have both the building id attribute and the grid cell id attribute. Open the attribute table use the Field Calculator to create a new field and calculate the area of each cut ...


3

As dmahr said, this isn't possible but there are workarounds. My normal one is to create a separate legend for those items and use the legend title for your text instead of the layer heading. The title can be centered above all the columns in the legend, unlike the layer name or layer heading. So in your example map, I'd create 3 legends: one for Fire Hazard ...


3

In PostGIS, use ST_Collect to collect your block geometries into one geometry. Then use ST_ConvexHull to get the convex hull, or try ST_ConcaveHull to get a better fit at the cost of more CPU.


3

I think there is more detail required in your question. But maybe you could select the shapes by using a rectangle or polygon, then use the Merge Shapes Tool. Maybe then also add a buffer before that step if you want the final shape to be more contiguous.


3

If you have an Advanced license, you could use the Aggregate Points tool. If you need to get the attributes from the original points tied back to these aggregated points, you can do a Spatial Join.


3

There is an easy way that needs two steps from the db-manager and two tables that can be deleted in the end(there is a way with virtual tables, but i don´t get them to work properly from the db-manager). go to db-manager and then to virtual layers and select your table with the trees; then start the sql-window Enter into the query field: SELECT distinct(...


3

This works for me: from PyQt4.QtGui import QGroupBox, QCheckBox, QDialog, QHBoxLayout d = QDialog() gb = QGroupBox("Groupbox") gb.setEnabled(False) cb = QCheckBox("Set active") l = QHBoxLayout(d) l.addWidget(gb) l.addWidget(cb) cb.stateChanged.connect(toggleGroupBox) def toggleGroupBox(state): if state > 0: gb.setEnabled(True) else: ...


3

You probably want to create clusters. You may start with Scipy Point Clustering plugin. Have a look first to this nice tutorial.


3

I'm going to take a general method you could use, should you need to start everything over from scratch, so others can use it also. Ths method ensures you don't move objects, delete objets and keep your source database intact. What we have : Physical georeferenced objects Geotagged pictures No mean to tell if a picture is related to the respective objects ...


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