New answers tagged

2

Try the code snippet below. After calling geometry(), we can string together calls to constGet() and vertices(), then traverse the vertex iterator (or use list comprehension to store the vertices in a list) and call x(), y() and z() on the vertex point objects to access the X, Y & Z values: layerT = QgsProject.instance().mapLayersByName('tPolygonLayer')[...


10

Or in a very simple way, you can use the polygon to block the labels of the polyline. Label polyline normally: After using the polygon as a blocking feature, the label will be shifted automatically outside the polygon:


12

You trying to call within on a string representing a layer, not its geometry. But it won't work that way anyway. This way it would label/not label whole feature, not segments. With within it would label feature with " " in case that whole line is in polygon. In case of intersects it will label feature that somehow interact with any polygon. Maybe there is ...


4

Your approach does not work because spatial joins over layers (not tests for the relations of single geometries) cannot be performed in expression dialog within is only true when a whole geometry falls entirely into another geometry, wich is not the fact in your case double quotes are for attribute names, for strings use single quotes All in all, I doubt ...


1

You could also use a data defined override for label rendering, but it requires splitting your line layer. From the processing toolbox, run the Clip tool to clip the line layer with the polygon layer. Run the Difference tool to extract the parts of the line feature which fall outside the polygon. Run the Merge vector layers tool on the clipped and ...


2

I believe the issue is in your feature collection. I can't access it as you don't have it shared, so can't investigate what is going on there. But I have tested the script with a random geometry placed on the map, and had no issues. Check that your feature collection doesn't have too many features to it. ================================== EDIT Thanks ...


1

An addition to the answer above: I found it pretty complicated to write the WKT using the boundary coordinates myself. If you have Postgres with Postgis extension (and possibly pgadmin) available (use the Docker version!), just execute the following: SELECT ST_AsEWKT(ST_MakeEnvelope ( 12.147653576, 50.978794549, --lng-lat bounding 13.216635542, 51....


11

I struggled a bit with the Geometry generator as @GSienko. For intersection part you can also use built-in function aggregate. Also I used segment_to_lines function which convert polygons to lines. difference( segments_to_lines($geometry), aggregate( layer:= 'line', aggregate:='collect', expression:= $geometry, ...


4

Try using refFunction plugin within geometry generator. Assumption. 2 layers - one lines as line, and polygons as polygon. Style polygon like that: difference(exterior_ring( $geometry ),geom_from_wkt(geomintersects('line','$geometry'))) geomintersect will make spatial query between polygon layer and line layer, and return geometry of intersection of two ...


3

How about adding a white line under the blue line in the other layer, that has the same width as the red line? If you place the blue line above the polygon layer the white line will obscure the red line. This of course assumes that you have a white background like in your example, and that you are ok with some of the crosshashes also being obscured. This ...


2

Disclaimer: This answer won't work if you have multiple polygons What you could do is find out which nodes form the four corners of the polygon that you wish to draw lines between, and then use those in MAKE_LINE() functions to draw the lines: To find which nodes you need: First add a geometry generator symbology Set the geometry type to Point/MultiPoint ...


0

1) Run the intersect tool with the shapefile as the only input. This new layer will have multiple features with identical geometries at each area of overlap (depending on how many features overlapped in the original shapefile) 2) Create a new field in the intersected layer that identifies identical geometries. This could be done a couple ways ... If you ...


0

I got an answer on the ArcGis Forum that told me to use Buffer, and told how to put variable width on Buffer. I quote: " I think you would find the Buffer tool can do this for you. https://pro.arcgis.com/en/pro-app/tool-reference/analysis/buffer.htm The Buffer tool has an option to get the required buffer distance for each feature from an attribute field. ...


0

First, convert your feature into graphics using Convert features into graphics in ArcGIS. It will take the symbolized line and make it into a drawing on in the map layout, thickness and all. Then, reverse the process using Convert graphics into feature in ArcGIS. Save the shapefile as a polygon instead of a line. The amount of land covered by the thick lines ...


0

Here's a C# version, ds is a OSGeo.OGR.Driver driver and layerIdX is the layer you want: OSGeo.OGR.Feature feature = null; OSGeo.OGR.Geometry geo = null, ring = null; double[] pointList = { 0, 0, 0 }; int layerIdX = 2; OSGeo.OGR.Layer layer = ds.GetLayerByIndex(layerIdX); if( geoType == "wkbMultiPolygon") { for( int i = 0; i < numberOfFeatures; ...


0

Just found online script that with with some adjustments work with qgis 3.5.x I lost the original post so cant credit the author. What you do is: create fill layer change it to "geometry generator" change "geometry type" to points for the expression click the "sigma" button right to the textfield in the "expression dialog" window change tab to the "...


1

You can use Zonal Statistics tool to calculate the average raster cells within polygon grid. Just search for Zonal Statistics and you will find it as in the image below.


1

Let's assume we have the following layers "borders" (line) and "ocean" (polygon), see image below. With the following geoalgorithm Vector > Geoprocessing Tools > Difference..., it is possible to delete edges of the polygons that border the ocean. The output new "borders" layer will look as following Keep on mind that this object is a MULTILINESTRING....


2

Pelias does not currently support directly returning polygon or polyline data. However, you can use a workaround until it does. A search or autocomplete request to pelias that returns Munich will have a feature in the response that looks something like this (with some data removed for conciseness): "properties": { "id": "101748479", "gid": "...


1

Use the Geometry checker (Vector > Geometry checker) and select the Line must not have dangles option. More information about how to use the Geometry checker tool in here: https://docs.qgis.org/latest/en/docs/user_manual/plugins/core_plugins/plugins_geometry_checker.html


4

max_area_polygon; max_area = 0 ; for(poly in (feature.geometry.coordinates)){ polygon = turf.polygon((feature.geometry.coordinates)[poly]) area = turf.area(polygon); if(area > max_area){ max_area = area max_area_polygon = polygon // polygon with the largest area } } center = turf....


2

Let's reproduce your sample data: charters=data.frame( school.name=c("oceanside","discovery"), school.id=c("008229","228881"), district.id=c("3400011","340020"), lat=c(39.3635, 40.7343), lon=c(-74.4350,-74.1745)) then make it a spatial points data frame: coordinates(charters)=~lon+lat assume the lat-long in charters is the same sort of lat-...


5

In QGIS 3.4, it is under Processing toolbox -> Vector geometry with a new name Eliminate Selected Polygons There is additional option is to eliminate based on the Smallest polygon area in addition to the previously available options which are Largest polygon area and Largest common boundary


Top 50 recent answers are included