Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now
5

Tested on QGIS 2.18 I can suggest using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer... Let's assume we have two layers, namely "lines_test" and "polygons" With using this query you may achieve the result you are looking for. SELECT * FROM polygons WHERE polygons.id NOT IN ( SELECT polygons.id FROM polygons, ...


4

Your question is a bit unclear. But you can construct a search distance in whatever way and from whatever source you want as long as it is formatted correctly. For example 100 wont work, but "100 Meters" will. Example of using a variable: distance = "100 Meters" arcpy.SelectLayerByLocation_management("AnglePoints_1","WITHIN_A_DISTANCE","AnglePoints",...


4

Take a look at some of the identity functions in rgeos such as gTouches, gIntersects, gContains, gRelate, gWithin, ect... At their most basic, these functions can return a Boolean that will allow you to perform the equivalent of a spatial select. To control output, take a close look at the function(s) arguments and experiment a bit with outputs from ...


3

There is an issue with this line: arcpy.SaveToLayerFile_management(temp_CSlyr, temp_CSlyr, "ABSOLUTE") Since no directory is specified the layer file is created in some unknown location - from all my abilities to discern it's created in memory somewhere. You then try to make a mapping layer by looking in a file geodatabase: addLayer = arcpy.mapping.Layer(...


3

With a bit of luck and suggestions from @Kazuhito, I ended up with SELECT ST_UNION(B.geometry), B."Are_Number", SUM(D."EWjeAdr") FROM "BereichBerechnung" AS B JOIN "EW_Data" AS D ON contains(B.geometry, D.geometry) GROUP BY B."Are_Number" In case if there is a necessity to preserve geometries for which there are no overlaps between polygons and points in ...


3

Duplicate the layer. In the processing toolbox use 'Join attributes by location (summary)'. Use the original and the duplicate layers for the input and join layers. Select 'equals' as the geometry predicate. Run. The attribute table of the resulting layer will have a field in it called "YourIDField_count". Where this is greater than 1 is where you have ...


3

In your Select By Location call, you can change the "Spatial Selection method" to are within (Clementini) the source latyer feature. This will select the vertices and not endpoints.


2

Use the geometry checker plugin to check for duplicates The Result tab will display a table of duplicate features. You can select features on the map by selecting them in the Result table. If you choose the option "Fix selected errors, prompt for resolution method" you get a popup like this that allows you to choose to remove duplicates or not.


2

You could modify the Delete duplicate geometries script from QGIS 2.18 where once duplicated features are found which have the exact same geometry, they are stored in a list along with the original feature. You could then select all these features: layer = iface.activeLayer() features = layer.getFeatures() geoms = dict() for current, f in enumerate(features)...


2

Try SELECT a.* FROM building AS a JOIN building AS b ON ST_Intersects(a.geom, b.geom) WHERE a.area <= 30 AND b.area > 30; Make sure you have a spatial index in place and run VACUUM ANALYZE building; prior to execution! If your buildings only almost share a border, i.e. don't actually intersect, use ... ST_DWithin(a.geom, b.geom, <...


2

Your objection to buffering only applies to the point. It would not be a problem if you buffer the polygon that you have just found. Also, instead on doing a buffer operation followed by and intersects, why not search in a single step with "touches" based on the red rectangle?


2

For QGIS 3.4 In the Processing Toolbox use the tool Join attributes by location (summary), make sure it's the summary tool and not the other one. For QGIS 2.18 In the Processing Toolbox use the tool Join attributes by location and change the Attribute summary option to Take summary of intersecting features. The Input layer should be the polygon and the ...


2

For only use selected feature use QgsProcessingFeatureSourceDefinition https://qgis.org/api/classQgsProcessingFeatureSourceDefinition.html your code,but the input is only selected features import processing input_vlayer = 'Some path' intersect_vlayer = 'Some path' input_vlayer = iface.addVectorLayer(input_vlayer, 'input_vlayer', 'ogr') intersect_vlayer ...


2

Use the SAGA tool Clip raster with polygon. This tool can be found in the Processing Toolbox. Click the round green arrow button next to the Polygons layer. This button toggles the option to Iterate over this layer, creating a separate output for every feature in the layer.


2

I suspect "InstallationID" isn't a field in your table. Double check the field name. >>> curs = arcpy.SearchCursor ("Meters_RandomSel_geocoded") >>> row = curs.next () >>> row.getValue ("fgfdgdfgfd") Runtime error Traceback (most recent call last): File "<string>", line 1, in <module> File "c:\program files (x86)\...


1

The tool to do this is Select Layer By Location which: Selects features in a layer based on a spatial relationship to features in another layer. Each feature in the Input Feature Layer is evaluated against the features in the Selecting Features layer or feature class; if the specified Relationship is met, the input feature is selected. Once ...


1

Always a good idea to make a simple test. Here's a 5x6 raster: > r = raster(matrix(runif(30),5,6)) which has these values: > r[] [1] 0.45825245 0.68935493 0.18918221 0.32181772 0.90459237 0.47537165 [7] 0.38745306 0.57012344 0.21467928 0.24150341 0.54005789 0.09430709 [13] 0.52352994 0.01489950 0.54890148 0.04762656 0.83931822 0.14997015 [19] 0....


1

Assuming I understand correctly, I would use a buffer instead using half the distance and dissolving adjacent buffers (if you buffer each polygon by half the distance when two or more polygons are near another the sum will equal the full distance). Then, use a spatial join on your buffer using the input polygons to get the count of the number of input ...


1

This answer is largely based on the comments by Micha, posted to the original question. These are reiterated here so that the question can be marked as answered. The problem seems to arise from computer rounding error that results in the lines being ever so slightly off the point. One work-around is creating a small buffer around the point and running v....


1

Use the Select Features by Expression tool, with this expression: within($geometry, layer_property( 'raster name', 'extent')) Notes: Substitute the name of your raster name where the expression says 'raster name' The two layers must be in the same coordinate reference system


1

You can add an if statement to check if any features are selected: if layerResult.selectedFeatures(): If there are selected features then run the second algorithm otherwise do something else. So your script could look like: indir = "C:/Infolder/" outdir = "C:/Outfolder/" os.chdir(indir) for fname in glob.glob("*.shp"): layerResult = ...


1

I achieved the desired output using a different tool. Instead of QgsVectorFileWriter.writeAsVectorFormat it worked with qgis:saveselectedfeatures. So the code got like this: # import processing # Load vector layers rio = QgsVectorLayer('/home/tiago/Documentos/PRIM_Mineracao/rio/mata/rio_doce.shp', 'rio_doce','ogr') drenagem = QgsVectorLayer('/home/tiago/...


1

I'm not entirely sure I've understood the question correctly. But if I do, then you need to use a different layer in your 'SelectLayerByLocation' that includes only the Timber_Type_Polygon of interest, and not all of those polygons. Eg: with arcpy.da.UpdateCursor(Timber_Type_Polygon, ['PLOTS', 'SomeFieldWithUniqueValues']) as cursor: ...


1

Per http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/select-layer-by-location.htm: The input must be a feature layer; it cannot be a feature class. Cruise_Plots is a shapefile, not a layer. Select by Location or Select by Attributes both need an input of layers, not feature classes. Use arcpy.MakeFeatureLayer_management(...


1

As Spacedman sujested, you should share with us more than that, almost a piece of your tibble data. In any case, and without knowledge about your data sources, projection, etc, you could find those "cells" where your points are just by searching the closest cell center. This is just valid (and logic) if you tibble represents a regular raster grid. As I said, ...


1

I solved this by iterating through my feature class and adding all the points to a MultiPoint. Then I casted this multipoint into IGeometry and sent it to the function. Code: (I already had a tracedJunct[] array of the points of FC2 in the code which got useful) Multipoint searchGeom_MultiPoint = new Multipoint(); for (int i = 0; i < juncCount; i++) ...


1

Solution: As indicated by Hornbydd, the layers had different coordinate systems. You can check this in ArcGIS Pro by going to Properties > Spatial Reference > Geographic Coordinate System. The solution was to take my parcel data and "Reproject it" using the project tool. Just make sure when you project it you are using the same coordinate system as your ...


1

The other answer appears to provide a solution, but if that works, then I think an easier syntax for ArcPy newcomers to learn uses just Python String Formatting instead: sql = "{0} = '{1}'".format("NAME_1", row[6]) I write lots of where clauses for use with ArcPy, and never use AddFieldDelimiters. ArcPy itself seems to now be able to cater for figuring ...


1

You can use the Topology Checker Panel and define the rule (your road layer should not have duplicates.) After defining your rule, you press Ok and you run. The Tool will give you their Feature ID and if you click to a particular line it will zoom to the layer, for further investigation.


1

You can use Join attributes by location tool to join point data with the catchment polygon using Intersects as geometric predicates: Target vector layer: Population points Join vector layer: Catchment polygon Geometric predicates: Intersects Run the tool You need to make sure the coordinates of both vector layers are same.


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