[Qgis-user] Looking for a function or variable to retrieve canvas extent

DelazJ delazj at gmail.com
Thu Jun 22 05:37:43 PDT 2017


Actually the expression using a constructed polygon for the canvas extent
works;  I was messing with my polygon construction....

Looks like canvas related variables are not available from the attribute
table (using the select by expression or the field calculator) nor from the
main select by expression tool in toolbar.
I created a feature request at https://issues.qgis.org/issues/16744. Let's
see...

Thanks,
Harrissou

2017-06-21 18:31 GMT+02:00 DelazJ <delazj at gmail.com>:

> Unfortunately, this was also my conclusion.... And I'm not sure to
> understand why: is it a choice of design to not expose them or a missing
> feature (that i can open a report for)?
>
> I can do an ovelap check of the feature geometry and a static extent ie,
> something like
> within ($geometry, make_polygon(geom_from_wkt('LINESTRING(a closed
> rectangle based on canvas extent coordinates in status bar)')))
> and it seems to work once on two (not pretty sure of the result!) but it's
> STATIC!
>
> 2017-06-21 18:05 GMT+02:00 Alexandre Neto <senhor.neto at gmail.com>:
>
>> I guess those variables are simply not accessible from the attribute
>> table window. So there is no way you can use the map canvas for conditional
>> formatting.
>>
>> DelazJ <delazj at gmail.com> escreveu no dia quarta, 21/06/2017 às 16:34:
>>
>>> Thanks Alexandre, but it's too hot to have me doing some maths right now
>>> :-)
>>>
>>> Actually, what I want to do is to apply some conditional formatting in
>>> the attribute table using the canvas extent values but for some reason,
>>> those variables you mentioned are not exposed in that expression builder
>>> dialog.
>>> There's also a @map_extent variable in master which returns the geometry
>>> (for composer map only? or canvas also?) but like others, it's not exposed.
>>>
>>>
>>> 2017-06-21 17:10 GMT+02:00 Alexandre Neto <senhor.neto at gmail.com>:
>>>
>>>> How about using the map_extent_center, map_extent_height and
>>>> map_extent_width to create a geometry?
>>>>
>>>>
>>>> DelazJ <delazj at gmail.com> escreveu no dia quarta, 21/06/2017 às 14:53:
>>>>
>>>>> Hi,
>>>>>
>>>>> In the Expression dialog, is there a function or a variable that can
>>>>> return the current map canvas?
>>>>> I would like for example apply a value to all features that fall
>>>>> within the current map canvas but fail to find the right combination (if
>>>>> ever possible).
>>>>>
>>>>> Thanks for any hint,
>>>>> Harrissou
>>>>> _______________________________________________
>>>>> Qgis-user mailing list
>>>>> Qgis-user at lists.osgeo.org
>>>>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>>>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>>>
>>>> --
>>>> Alexandre Neto
>>>> ---------------------
>>>> @AlexNetoGeo
>>>> http://sigsemgrilhetas.wordpress.com
>>>> http://gisunchained.wordpress.com
>>>>
>>>
>>> --
>> Alexandre Neto
>> ---------------------
>> @AlexNetoGeo
>> http://sigsemgrilhetas.wordpress.com
>> http://gisunchained.wordpress.com
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20170622/db7dd1f7/attachment.html>


More information about the Qgis-user mailing list