Hot answers tagged

7

The geometry is defined as an array of coordinates, not collections of Polygons and LinearRings, so what is returned by getPolygons() and getLinearRings() should be treated as clones and you will need to rebuild the geometry from coordinates var geom = source_g.getFeatures()[0].getGeometry(); var geomCoords = []; geom.getPolygons().forEach(function(poly){ ...


5

You have the general idea in place already -- just move your print of the list into the loop, and remove the print for each vertex. import arcpy fc=r'D:\GIS Data\TOOLS\EV calc in Python\Data.gdb\PolyWGS84' with arcpy.da.SearchCursor(fc,['OID@','SHAPE@']) as cursor: for row in cursor: myList = [] array1=row[1].getPart() for ...


5

Given two sets of features A and B coloured red and blue: Then select only those from A that don't overlap any B and vice versa: > Adash = A[lengths(st_intersects(A,B))==0,] > Bdash = B[lengths(st_intersects(B,A))==0,] this works by virtue of the element of the intersection list having zero-length when a feature has no intersections. When plotted:


4

I think you can do this with sneaky masking tricks, although it will be slow on very large rasters. Using your demo data, library(raster) library(sf) setwd('C:/data/glaciers') DEM <- raster("Glacier_Clip1.tif") glaciers <- read_sf("Glacier_Clip_Polygon.shp") glaciers_comb <- st_union(glaciers) glaciers_comb <- st_cast(glaciers_comb, "POLYGON")...


3

The link you included in your question should do exactly what you're looking for (once max is swapped for min). The first part will make a raster layer with the min value within each polygon. The second part will compare this min layer with the original DEM to find all the pixels where they are the same (it should be one per polygon), and then set everything ...


3

You have two options I can think of off hand. 1 You could use the select by location tool, and select all polygons that intersect the points. Then reverse the selection in the attribute table, thereby switching the selection from those that have points within them, to those that do not interact with the points at all. 2 You could run the spatial join ...


2

Because in this: for(i in 1:length(area_cutoff)){ if(area_cutoff[i]>1) glaciers_comb[i] <- glaciers_comb[i] } If the if condition is true you are replacing element i with element i - which is no replacement. And when the if condition isn't true then element i is unchanged. So nothing changes. You can do what you want with a one-liner: ...


2

Duplicating a layer is not the same as making a copy of the source data. Duplicating a layer When you duplicate a layer, QGIS creates a second link to the same source file. Any edits you make to the duplicate layer are made to the source file. Any layers that link to that same source file will also have those changes. To duplicate a layer, right click on ...


2

Option 1: Use join attributes by location. Option 2: Use the field calculator with the following code (adaption needed) aggregate(layer:='large layer',aggregate:='max',expression:="Name",filter:=intersects) Please note: Make sure, the field type you are creating fits the source field. Furthermore, you need to use the layer name provided by the field ...


2

I believe the best way would be rasterizing your polygon and calculating the best cost-effective route, as proposed here: Create an optimised path between nodes avoiding polygons entities


2

Try enforcing closed LineStrings by adding their ST_StartPoint to the end of the them: SELECT ST_MakePolygon( ST_MakeValid( ST_AddPoint( shape. ST_StartPoint( shape ) ) ) ) AS shape FROM asia_waterway_line WHERE waterway ='riverbank' ; If you want to make sure you are not duplicating points for when a LineString is already closed, run: SELECT ...


1

Install the RefFunctions plugin. This gives you additional functions to use in the Field Calculator. These new functions are simpler to use than the built-in aggregate functions. Use the Field Calculator to add a new field to the building layer, with this expression: geomintersects('block layer', 'ID') Substitute the actual names of your block layer and ...


1

This can certainly be done with KML. I am not aware of any tools that make it easy, like a user interface where you can draw a flat shape and then rotate it in 3D space. But if you can manually (or programatically) generate the KML polygon and give its coordinates the correct altitudes, then you can make a polygon that rises up vertically. Below is a very ...


1

Here is a suggestion for a framework. I assume it could be done more effectively and I might have misunderstood some aspects of your question. A couple of things to note is the case where the 0.3 ratio of marginal cells exceeds the number of inner cells, where I have simply defined all inner raster cells as the sample. There are also a couple of polygons ...


1

I know this is forever after you asked, but I found your question when I attempted to do the same thing. At least in QGIS Version 3.8.0, this has been made incredibly easy. Layer Properties -> Symbology Fill Add an Outline: Marker Line Make sure the points are on every vertex. Add a Font Marker as a child of the Marker Line created above. For the ...


1

You can try the chull function, which calculates the convex hull of the coordinates of your polygon(s). Try cv.id <- chull(gmat) cv.id <- c(cv.id, cv.id[1]) plot(gmat, cex = 0) lines(gmat[cv.id, ])


1

You should find what you want there : Processing toolbox / QGIS geoalgorithms / Vector general tools / Polygon from layer extent


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