Re: [Qgis-user] Geometry generator - reduce line
I solved the second part (label) using geometries generator also in the location of the label using the same geometry of the line make_line( start_point( $geometry), translate( centroid( $geometry), $length/10, $length/10), end_point($geometry)) problem with REDUCE geometry still remains... Il giorno gio 17 giu 2021 alle ore 15:52 Dario C ha scritto: > Hi, > I'm trying to do an arc starting from a simple line. > > I'm using geometry generator with this code: > make_line( start_point( $geometry), translate( centroid( $geometry), > $length/10, $length/10), end_point($geometry)) > > and it is working well. > > I'd like to have shorter line, so I started considering extend function > with negative paramtere, but it does not work: > extend(make_line( start_point( $geometry), translate( centroid( > $geometry), $length/10, $length/10), end_point($geometry)),-100,-100) > (with positive parameter extension works) > > I have serached in the geometry category but I didn't find anything > similar to "reduce". > > > Other question, related to the same geometry. I want to have the label > curved and at the center of the arc and not of the line. > I tried with the expression: > translate( centroid( $geometry), $length/10, $length/10) > in the "label anchor", but nothing happen :( > > > Any suggestion? Thank you! > > > Cheers > ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
[Qgis-user] Geometry generator - reduce line
Hi, I'm trying to do an arc starting from a simple line. I'm using geometry generator with this code: make_line( start_point( $geometry), translate( centroid( $geometry), $length/10, $length/10), end_point($geometry)) and it is working well. I'd like to have shorter line, so I started considering extend function with negative paramtere, but it does not work: extend(make_line( start_point( $geometry), translate( centroid( $geometry), $length/10, $length/10), end_point($geometry)),-100,-100) (with positive parameter extension works) I have serached in the geometry category but I didn't find anything similar to "reduce". Other question, related to the same geometry. I want to have the label curved and at the center of the arc and not of the line. I tried with the expression: translate( centroid( $geometry), $length/10, $length/10) in the "label anchor", but nothing happen :( Any suggestion? Thank you! Cheers ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
[Qgis-user] Geometry Generator - Generating buffered points from polys
Hi, I am working through an exercise to figure out the best way to represent some wooded areas in a map that I am making. The current iteration uses geometry generators to create slightly randomized points to fill the polygons that represent wooded areas. I based it off of the great examples at https://impermanent.io/2017/05/05/generative-pseudo-random-polygon-fill-patterns-in-qgis/ And, it works great! After looking at it a while, I want to introduce some variability in the size of the point symbols too. I have two ideas on how to do that: The first one is to create and populate an attribute for each point feature, and then apply symbology rules based on that value. The challenge is that right now, my custom function is returning multi-point features, so all of the points within a forest poly would have the same attribute. I am currently pursuing the second one. That strategy is to use the same altered grid of points, and then buffer each point. I am having a hard time figuring out how to return a layer with several multi-polygon features created by buffering the points. In this example, "buffer" is not defined, so the expression is invalid. for xOff in range(countX+1): for yOff in range(countY+1): ptX = xMin + xOff*(xInterval) + rand * random.uniform(0,xInterval) ptY = yMin + yOff*(yInterval) + rand * random.uniform(0,xInterval) pt = QgsPointXY(ptX,ptY) point = QgsGeometry.fromPointXY(pt) if feature.geometry().contains(point): sym = buffer(point,200.0,10) #points.append(pt) bufs.append(sym) return collect_geometries(bufs) ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] geometry generator - unexpected results
Michel, Thank you for your response, and for putting some good geometry generator examples out for others to learn from. (If others on the list haven't seen them, they are at: https://gitlab.com/GIS-projects/qgis-geometry-generator-examples) Your suggestion worked for me. I am mapping in EPSG 26915 (UTM Z15N), and since both SRS are in meters, I thought that similar values would work. I had tried to change the params in the functions by an order of magnitude, but obviously needed to go farther. Thank you again for your help. David. On Fri, Apr 17, 2020 at 5:05 AM Michel Stuyts wrote: > The numbers you need to use in “rand(-10, 10), rand(-10, 10)” depend on the > CRS of your layer. I tested it with some demo data in EPSG:31370 and I got > a similar result as you. When I changed those numbers I got a better > result. After you changed those, you can play around with that 100 inside > the generate_series, to get the result you want. For me the following gave > a good result: > > > > make_line( > > array_foreach( > > generate_series( > > 0, length($geometry), 300 > > ), > > translate( > > line_interpolate_point($geometry, @element), > > rand(-0.5, 0.5), > > rand(-0.5, 0.5) > > ) > > ) > > ) > > > > > > Michel > > *Van:* Qgis-user *Namens *David > Fawcett > *Verzonden:* donderdag 16 april 2020 20:01 > *Aan:* qgis-user > *Onderwerp:* [Qgis-user] geometry generator - unexpected results > > > > I am trying to use a geometry generator to accomplish the "hand-drawn" > line style. > > > > Some great recent examples by: > > > > Klas Karlsson > > https://twitter.com/klaskarlsson/status/1249333750451879937 > > > > Hamish: > > https://polemic.nz/2019/11/18/foss4g-qgis-geometry-generators/ > > > > I am using the code below from the blog post by Hamish in QGIS 3.12: > > > > make_line( > > array_foreach( > > generate_series( > > 0, length($geometry), 100 > > ), > > translate( > > line_interpolate_point($geometry, @element), > > rand(-10, 10), > > rand(-10, 10) > > ) > > ) > > ) > > Here is an image of what the results look like: > https://github.com/fawcett/examples/blob/master/lines.png > > The line geometries are in blue, and the geometry generator output is in > black. > > Can anyone suggest what is going wrong? > > Thank you, > > David. > > > > > ___ > Qgis-user mailing list > Qgis-user@lists.osgeo.org > List info: https://lists.osgeo.org/mailman/listinfo/qgis-user > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] geometry generator - unexpected results
The numbers you need to use in “rand(-10, 10), rand(-10, 10)” depend on the CRS of your layer. I tested it with some demo data in EPSG:31370 and I got a similar result as you. When I changed those numbers I got a better result. After you changed those, you can play around with that 100 inside the generate_series, to get the result you want. For me the following gave a good result: make_line( array_foreach( generate_series( 0, length($geometry), 300 ), translate( line_interpolate_point($geometry, @element), rand(-0.5, 0.5), rand(-0.5, 0.5) ) ) ) Michel Van: Qgis-user Namens David Fawcett Verzonden: donderdag 16 april 2020 20:01 Aan: qgis-user Onderwerp: [Qgis-user] geometry generator - unexpected results I am trying to use a geometry generator to accomplish the "hand-drawn" line style. Some great recent examples by: Klas Karlsson https://twitter.com/klaskarlsson/status/1249333750451879937 Hamish: https://polemic.nz/2019/11/18/foss4g-qgis-geometry-generators/ I am using the code below from the blog post by Hamish in QGIS 3.12: make_line( array_foreach( generate_series( 0, length($geometry), 100 ), translate( line_interpolate_point($geometry, @element), rand(-10, 10), rand(-10, 10) ) ) ) Here is an image of what the results look like: https://github.com/fawcett/examples/blob/master/lines.png The line geometries are in blue, and the geometry generator output is in black. Can anyone suggest what is going wrong? Thank you, David. ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
[Qgis-user] geometry generator - unexpected results
I am trying to use a geometry generator to accomplish the "hand-drawn" line style. Some great recent examples by: Klas Karlsson https://twitter.com/klaskarlsson/status/1249333750451879937 Hamish: https://polemic.nz/2019/11/18/foss4g-qgis-geometry-generators/ I am using the code below from the blog post by Hamish in QGIS 3.12: make_line( array_foreach( generate_series( 0, length($geometry), 100 ), translate( line_interpolate_point($geometry, @element), rand(-10, 10), rand(-10, 10) ) ) ) Here is an image of what the results look like: https://github.com/fawcett/examples/blob/master/lines.png The line geometries are in blue, and the geometry generator output is in black. Can anyone suggest what is going wrong? Thank you, David. ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
[Qgis-user] Geometry generator styling in DXF Export
Hi all, has anyone experience with exporting geometry generator styling into DXF. I think it's no alternative to use DB views, SQL or virtual layers as I use dynamic parameters as scale and map extend in my python function. Thanks for your ideas! Regards Benjamin ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] Geometry Generator
This makes the rectangle; geom_from_wkt( 'POLYGON(('|| (x( centroid( $geometry) ) + (("length" /1000)/2))||' '||(y( centroid( $geometry) ) + (("width"/1000)/2))||','|| (x( centroid( $geometry) ) + (("length" /1000)/2))||' '||(y( centroid( $geometry) ) - (("width"/1000)/2))||','|| (x( centroid( $geometry) ) - (("length" /1000)/2))||' '||(y( centroid( $geometry) ) - (("width"/1000)/2))||','|| (x( centroid( $geometry) ) - (("length" /1000)/2))||' '||(y( centroid( $geometry) ) + (("width"/1000)/2))||','|| (x( centroid( $geometry) ) + (("length" /1000)/2))||' '||(y( centroid( $geometry) ) + (("width"/1000)/2))|| '))') What can I add to rotate it based on the rotation field? On Fri, Jan 27, 2017 at 2:06 PM, Tyler Veinot wrote: > I have been experimenting with the geometry generator in the symbology > engine and I got it to style line features as a buffer based on a width > field. What I am trying to take a point with a length width and rotation > field and draw a box with the specified length width and rotation of the > point, I am not sure where to start with the code for that, does anyone > have an example I can use to help me figure it out? > Thanks > ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
[Qgis-user] Geometry Generator
I have been experimenting with the geometry generator in the symbology engine and I got it to style line features as a buffer based on a width field. What I am trying to take a point with a length width and rotation field and draw a box with the specified length width and rotation of the point, I am not sure where to start with the code for that, does anyone have an example I can use to help me figure it out? Thanks ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
[Qgis-user] Geometry Generator Buffer with Flat Caps
Hi all, I would like to style a line geometry with geometry generated symbol buffer with flat caps. Means that I would like to get a box around the line that ends where the line ends. Buffer($geometry) always creates buffer with round caps. Meanwhile I solved it with st_buffer(the_geom,1,'endcap=flat') in PostGIS-request, but it would be more convenient to style it with geometry generated symbols Thanks for your ideas! Regards Benjamin Fünfer-Königstein ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user