Re: [Qgis-developer] [Bulk] Re: [Qgis-user] Retrieve value from another layer related to its localisation
Ok, this is somehow what I did. With QChainage plugin, no need to create new fields and csv table. It directly creates the point geometry layer corresponding to xat(0)/yat(0) and xat(-1)/yat(-1) with $id field, when well setting. I also assume that what I was trying to do directly within the line layer field calculator is not (yet) possible. Thanks. 2015-01-15 15:54 GMT+01:00 Enrico Ferreguti enrico...@gmail.com: Ok. so i would proceed degrading line geometry to point geometry creating two X and Y fields in the original table with xat(0) and yat(0) functions. I would add a featureid field with $id function for a following join. Then I would export everything in cvs and import back with Add Delimited Text Layer creatin geometry from X and Y fields. From the the degraded new table is now possible to apply geomnearest function joining the added fields with featureid field. ...a bit tricky but it should work. Regards 2015-01-15 14:25 GMT+01:00 Junior Delaz del...@gmail.com: Thanks Enrico for your reply and for the plugin. I was aware of RefFunctions and has already used it for relational questions. And I agree with Jean that such functions (and others of your plugins) might be core functions. I've moreover reported a feature request to improve usability of all this #11680 https://hub.qgis.org/issues/11680. And I tried it again this time. but the main problem is I don't want to retrieve field value of the nearest point to my line geometry. I want to retrieve field value of the nearest point *to the first vertex* of my line geometry. While using just geomnearest, i'll get only the nearest point to the whole line. It may be the point at the beginning or the one at the end of the line, I can't know. What I did is to create a point file containing my vertices and then use refFunctions to get the nearest station ID. But, isn't it possible to do the request without the step of creating new point file? Using in the condition being nearest to the geomfromWKT('POINT (xat(0) yat(0)) ') of line feature? How can I write in the field calculator of a line layer such function : dbquery ('mypointlayer', 'pointID', 'the condition is to be the nearest point to the first vertex of the line')? Or dbvalue? Is it possible to combine reference functions with others? And more generally, are Reference functions conditions intended to be only internal to the target layer or can I use values/fields from the source layer? If latter, how can I refer to the source layer in the expression? Thanks 2015-01-15 12:05 GMT+01:00 Tijan49 tija...@yahoo.fr: Hi, I knew about those functions a few weeks ago, and I was really happy about that, because it is a lack in the basic function. For I, those new functions should really be in the core project in the next release ... Thanks to all the programmers. Jean Le 15/01/2015 11:59, Enrico Ferreguti a écrit : You can use refFunctions ( http://plugins.qgis.org/plugins/refFunctions/) plugin that extends Field Calculator with a new Reference group. Within this group you will find a geomnearest and a geomdistance function that can help you. copy and paste from helper screen: geomnearest function Retrieve target field value from the nearest target feature in target layer Syntax geomnearest(targetLayer,targetField) Arguments targetLayer → the name of a currently loaded layer, for example 'myLayer'. targetField → a field in target layer we want as result when source feature is within target feature, for example 'myField'. If targetField is equal to '$geometry' The WKT geometry of targetFeature willbe retrieved. If otherwise is equal to '$distance' the calculated distance between source and target features will be returned Number of feature tested is limited to 10 to avoid time wasting loops Example geomnearest('targetLayer','TargetField') geomnearest('targetLayer','$geometry') geomnearest('targetLayer','$distance') 2015-01-15 11:19 GMT+01:00 Junior Delaz del...@gmail.com: Hi all, I have two shapefiles : a line one (called section) and a point one (called station) shapefiles. The line shapefiles has fields like ID_section, ID_first, ID_last The point file has an ID_station. All these define a kind of network where a section begins on a station and ends up at another station. What I need to do is to fill : - section ID_first field with the ID_station of the station that is the closest to the beginning of the section - and section ID_last field with the ID_station of the closest station to the end of the line. I can obtain this result while combining many analysis tools and plugins (QChainage, Spatial_Join...). I know how I can do it. There might be a way with processing tools and if somebody has an idea, I'll be glad to know it however. But what I'm really wondering is if it isn't directly possible to fill these fields in the Field calculator using all the nice functions we
Re: [Qgis-developer] Rotation status and PSC meeting
Il 15/01/2015 15:59, Sandro Santilli ha scritto: Leftover issues (open for funding): - Plugin layers (#11900) -- needs feedback - Overview map (#11862) -- minor, IMHO - Composer support (#11912) -- wish ? - Atlas doesn't consider map rotation when setting scale (#11954) IMHO none of these are blockers At what time do you plan to meet ? 16 CET thanks Sandro, and to the donors. All the best. -- Paolo Cavallini - www.faunalia.eu QGIS PostGIS courses: http://www.faunalia.eu/training.html ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
[Qgis-developer] Rotation status and PSC meeting
I've spent more time on rotation (only partially funded), fixing: - Label pre-rotation (#11814) - North Arrow Decoration (#11818) - Grid decoration (#11817) Leftover issues (open for funding): - Plugin layers (#11900) -- needs feedback - Overview map (#11862) -- minor, IMHO - Composer support (#11912) -- wish ? - Atlas doesn't consider map rotation when setting scale (#11954) Please report any other issue that might arise with rotation enabled and properly tag it with the rotation label. I'd like to partecipate to the PSC meeting tomorrow but it is only possible for me before 18:00 CET. I hadn't found the schedule here: http://hub.qgis.org/wiki/17/PSC_Meeting_16_January_2015 At what time do you plan to meet ? --strk; () Free GIS Flash consultant/developer /\ http://strk.keybit.net/services.html ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
[Qgis-developer] (no subject)
Enviado desde mi iPhone r ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
[Qgis-developer] (no subject)
Enviado desde mi iPhone r ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] Rotation status and PSC meeting
Sandro, Nyall, Discussing this with Martin earlier today, he came up with a test patch to see what would happen if the code was blindly modified to use QgsMapSettings' setRotation() function. The result is interesting, it actually _mostly_ works (see attached patch): - before the patch, rotating the map composer of 45 degrees looked like this: http://i.imgur.com/8e88VZf.png - applying the patch, rotating the map composer of 45 degrees now looks like this: http://i.imgur.com/VudbYrn.png The map rotation without the patch shows the current limitations, namely undesired rotated label, undesired rotated symbology, etc. With the patch applied, the label is horizontal, and my centroid triangle symbology's orientation is respected. There is however an issue with the calculation of the rotated map extend leading to a slightly misplaced map overview polygon on the larger map as well as a slight misalignment of the grid. Regarding the map overview issue, this got me to think that instead of having a map visibility extend calculation code in the composer map item, the QgsMapSettings object should have a function that returns a visible extend polygon (in WKT string, or whatever). That would simplify and bulletproof the code in many places beyond the composer map item. Food for thoughts. Math On Fri, Jan 16, 2015 at 9:00 AM, Mathieu Pellerin nirvn.a...@gmail.com wrote: Sandro, The last few weeks has been a nice leap forward when it comes to your rotation feature, congratulation on that. IMO, based on the improvements, it's worth considering _removing the activation option altogether_ from the preference window. I can't see any stability and usability issue that would warrant disabling it. That said, in my view, a basic composer support (i.e. map item's rotation feature) should be moved at the top of your priority list. Right now, the benefits of your rotation work _cannot_ be exported outside of the QGIS canvas, which IMO is a serious limitation. In most of my QGIS workflows, the final cartographic products are exported through the composer to obtain an high resolution file that can be printed out (i.e. I can't just go save the canvas as an image :) ). Not having map items make use of your rotation feature is a significant restriction. Cheers, and thanks again for the work, Math On Thu, Jan 15, 2015 at 9:59 PM, Sandro Santilli s...@keybit.net wrote: I've spent more time on rotation (only partially funded), fixing: - Label pre-rotation (#11814) - North Arrow Decoration (#11818) - Grid decoration (#11817) Leftover issues (open for funding): - Plugin layers (#11900) -- needs feedback - Overview map (#11862) -- minor, IMHO - Composer support (#11912) -- wish ? - Atlas doesn't consider map rotation when setting scale (#11954) Please report any other issue that might arise with rotation enabled and properly tag it with the rotation label. I'd like to partecipate to the PSC meeting tomorrow but it is only possible for me before 18:00 CET. I hadn't found the schedule here: http://hub.qgis.org/wiki/17/PSC_Meeting_16_January_2015 At what time do you plan to meet ? --strk; () Free GIS Flash consultant/developer /\ http://strk.keybit.net/services.html ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer diff --git a/src/core/composer/qgscomposermap.cpp b/src/core/composer/qgscomposermap.cpp index 3f0a29f..a811a02 100644 --- a/src/core/composer/qgscomposermap.cpp +++ b/src/core/composer/qgscomposermap.cpp @@ -202,6 +202,7 @@ QgsMapSettings QgsComposerMap::mapSettings( const QgsRectangle extent, const QS jobMapSettings.setMapUnits( ms.mapUnits() ); jobMapSettings.setBackgroundColor( Qt::transparent ); jobMapSettings.setOutputImageFormat( ms.outputImageFormat() ); + jobMapSettings.setRotation( mEvaluatedMapRotation ); //set layers to render QStringList theLayerSet = layersToRender(); @@ -362,9 +363,9 @@ void QgsComposerMap::paint( QPainter* painter, const QStyleOptionGraphicsItem* i painter-save(); painter-translate( mXOffset, mYOffset ); -painter-translate( xTopLeftShift, yTopLeftShift ); -painter-rotate( mEvaluatedMapRotation ); -painter-translate( xShiftMM, -yShiftMM ); +//painter-translate( xTopLeftShift, yTopLeftShift ); +//painter-rotate( mEvaluatedMapRotation ); +//painter-translate( xShiftMM, -yShiftMM ); painter-scale( scale, scale ); painter-drawImage( 0, 0, mCacheImage ); @@ -413,9 +414,9 @@ void QgsComposerMap::paint( QPainter* painter, const QStyleOptionGraphicsItem* i double yTopLeftShift = ( cExtent.yMaximum() - rotationPoint.y() ) * mapUnitsToMM(); painter-save(); painter-translate( mXOffset, mYOffset ); -painter-translate( xTopLeftShift, yTopLeftShift ); -painter-rotate( mEvaluatedMapRotation ); -
Re: [Qgis-developer] Rotation status and PSC meeting
On 16 Jan 2015 2:00 am, Sandro Santilli s...@keybit.net wrote: - Atlas doesn't consider map rotation when setting scale (#11954) Don't worry about this one - it's been around as long as atlas has existed and wasn't introduced by your work. I plan on tackling it as part of the layout refactor work. The new method for rotating geometries will help a lot with this -- thank you! Nyall ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] Rotation status and PSC meeting
Sandro, The last few weeks has been a nice leap forward when it comes to your rotation feature, congratulation on that. IMO, based on the improvements, it's worth considering _removing the activation option altogether_ from the preference window. I can't see any stability and usability issue that would warrant disabling it. That said, in my view, a basic composer support (i.e. map item's rotation feature) should be moved at the top of your priority list. Right now, the benefits of your rotation work _cannot_ be exported outside of the QGIS canvas, which IMO is a serious limitation. In most of my QGIS workflows, the final cartographic products are exported through the composer to obtain an high resolution file that can be printed out (i.e. I can't just go save the canvas as an image :) ). Not having map items make use of your rotation feature is a significant restriction. Cheers, and thanks again for the work, Math On Thu, Jan 15, 2015 at 9:59 PM, Sandro Santilli s...@keybit.net wrote: I've spent more time on rotation (only partially funded), fixing: - Label pre-rotation (#11814) - North Arrow Decoration (#11818) - Grid decoration (#11817) Leftover issues (open for funding): - Plugin layers (#11900) -- needs feedback - Overview map (#11862) -- minor, IMHO - Composer support (#11912) -- wish ? - Atlas doesn't consider map rotation when setting scale (#11954) Please report any other issue that might arise with rotation enabled and properly tag it with the rotation label. I'd like to partecipate to the PSC meeting tomorrow but it is only possible for me before 18:00 CET. I hadn't found the schedule here: http://hub.qgis.org/wiki/17/PSC_Meeting_16_January_2015 At what time do you plan to meet ? --strk; () Free GIS Flash consultant/developer /\ http://strk.keybit.net/services.html ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
[Qgis-developer] Retrieve value from another layer related to its localisation
Hi all, I have two shapefiles : a line one (called section) and a point one (called station) shapefiles. The line shapefiles has fields like ID_section, ID_first, ID_last The point file has an ID_station. All these define a kind of network where a section begins on a station and ends up at another station. What I need to do is to fill : - section ID_first field with the ID_station of the station that is the closest to the beginning of the section - and section ID_last field with the ID_station of the closest station to the end of the line. I can obtain this result while combining many analysis tools and plugins (QChainage, Spatial_Join...). I know how I can do it. There might be a way with processing tools and if somebody has an idea, I'll be glad to know it however. But what I'm really wondering is if it isn't directly possible to fill these fields in the Field calculator using all the nice functions we have. Indeed, QGIS 2.6 and RefFunctions plugin give relational fonctions to retrieve values on a specific layer according to its fields, features values or localisation. I tried many combinations with db_query, geomnearest, geomRedef, xat/yat, buffer, geometry, within , attribute (not all at the same time :) ) I'm pretty sure it's possible but I can't find. And I don't want to lose all my hair... Does anybody know how I can retrieve in a line shapefile's field the value of the point feature that is the closest to the first vertex of this line, within the field calculator? Thanks ... ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] [Bulk] Re: [Qgis-user] Retrieve value from another layer related to its localisation
Thanks Enrico for your reply and for the plugin. I was aware of RefFunctions and has already used it for relational questions. And I agree with Jean that such functions (and others of your plugins) might be core functions. I've moreover reported a feature request to improve usability of all this #11680 https://hub.qgis.org/issues/11680. And I tried it again this time. but the main problem is I don't want to retrieve field value of the nearest point to my line geometry. I want to retrieve field value of the nearest point *to the first vertex* of my line geometry. While using just geomnearest, i'll get only the nearest point to the whole line. It may be the point at the beginning or the one at the end of the line, I can't know. What I did is to create a point file containing my vertices and then use refFunctions to get the nearest station ID. But, isn't it possible to do the request without the step of creating new point file? Using in the condition being nearest to the geomfromWKT('POINT (xat(0) yat(0)) ') of line feature? How can I write in the field calculator of a line layer such function : dbquery ('mypointlayer', 'pointID', 'the condition is to be the nearest point to the first vertex of the line')? Or dbvalue? Is it possible to combine reference functions with others? And more generally, are Reference functions conditions intended to be only internal to the target layer or can I use values/fields from the source layer? If latter, how can I refer to the source layer in the expression? Thanks 2015-01-15 12:05 GMT+01:00 Tijan49 tija...@yahoo.fr: Hi, I knew about those functions a few weeks ago, and I was really happy about that, because it is a lack in the basic function. For I, those new functions should really be in the core project in the next release ... Thanks to all the programmers. Jean Le 15/01/2015 11:59, Enrico Ferreguti a écrit : You can use refFunctions (http://plugins.qgis.org/plugins/refFunctions/) plugin that extends Field Calculator with a new Reference group. Within this group you will find a geomnearest and a geomdistance function that can help you. copy and paste from helper screen: geomnearest function Retrieve target field value from the nearest target feature in target layer Syntax geomnearest(targetLayer,targetField) Arguments targetLayer → the name of a currently loaded layer, for example 'myLayer'. targetField → a field in target layer we want as result when source feature is within target feature, for example 'myField'. If targetField is equal to '$geometry' The WKT geometry of targetFeature willbe retrieved. If otherwise is equal to '$distance' the calculated distance between source and target features will be returned Number of feature tested is limited to 10 to avoid time wasting loops Example geomnearest('targetLayer','TargetField') geomnearest('targetLayer','$geometry') geomnearest('targetLayer','$distance') 2015-01-15 11:19 GMT+01:00 Junior Delaz del...@gmail.com: Hi all, I have two shapefiles : a line one (called section) and a point one (called station) shapefiles. The line shapefiles has fields like ID_section, ID_first, ID_last The point file has an ID_station. All these define a kind of network where a section begins on a station and ends up at another station. What I need to do is to fill : - section ID_first field with the ID_station of the station that is the closest to the beginning of the section - and section ID_last field with the ID_station of the closest station to the end of the line. I can obtain this result while combining many analysis tools and plugins (QChainage, Spatial_Join...). I know how I can do it. There might be a way with processing tools and if somebody has an idea, I'll be glad to know it however. But what I'm really wondering is if it isn't directly possible to fill these fields in the Field calculator using all the nice functions we have. Indeed, QGIS 2.6 and RefFunctions plugin give relational fonctions to retrieve values on a specific layer according to its fields, features values or localisation. I tried many combinations with db_query, geomnearest, geomRedef, xat/yat, buffer, geometry, within , attribute (not all at the same time :) ) I'm pretty sure it's possible but I can't find. And I don't want to lose all my hair... Does anybody know how I can retrieve in a line shapefile's field the value of the point feature that is the closest to the first vertex of this line, within the field calculator? Thanks ... ___ Qgis-user mailing listQgis-user@lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/qgis-user ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer