Re: [Qgis-user] Using aggregates functions to count intersected features from another layer

2016-10-19 Thread Matthias Kuhn
On 10/20/2016 12:33 AM, Nyall Dawson wrote:
> On 19 October 2016 at 22:22, Neumann, Andreas  wrote:
> - attributes from the parent feature are automatically available
> within the filter, UNLESS there's a duplicate field name from the
> child feature

I like this, e.g. PostgreSQL handles it the same way for joined fields.
But it warns in case of duplication and requires an explicit source
table statement in case of duplication. In the case where the child
feature suddenly gets a new field with the same name, the semantic of
the expression should not silently change but a warning be issued.

> - expose the parent feature via the variable @parent. This could be
> used with the functions geometry(@parent), attribute(@parent,
> "some_dup_field_name")

Based on above statement, there should also be a @child variable.
Or attributes could be exposed as parent.attr / child.attr.

> 
> Then you'd be able to write:
> 
> aggregate ('mypoint', 'count', "id", intersects ($geometry, 
> geometry(@parent)))

aggregate('mypoint', 'count', "id", mypoint.fk = @parent.id))

or

aggregate('mypoint', 'count', "id", attribute(@child, "id") =
attribute(@parent, "id"))

# Error in case both have a field "id"
aggregate('mypoint', 'count', "id", mypoint.fk = "id"))

> 
> The trickiest part in implementing this would be making sure the
> current aggregate value cache correctly handles use of parent feature
> attributes/geometry.
> 
> Re virtual layers: I've always seen these as a "heavier" (+ more
> powerful!) approach, which is OK for some use cases but for others (Eg
> data defined controls, composer labels, etc) it's preferable to have
> these calculations available directly within the expression engine.

I also think this needs to be fixed in expressions. I have a use-case
for it with default values at the moment.

Matthias
___
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

Re: [Qgis-user] QGIS build from source code Ubuntu 16.04 64-bit

2016-10-19 Thread Richard Duivenvoorde
On 20-10-16 00:03, gor...@shieldaig.com wrote:
> Anyone know what I am missing?  The info will be much appreciated.
> 
> qgis_core qgsvectorfilewriter.cpp -- warning
> 
> qgis_core qgsgml.cpp qgsogrutils.cpp qgsvectorfilewriter.cpp -- error
> 
> undefined reference to `OGR_G_ExportToIsoWkb'
> undefined reference to `OGR_F_SetFieldInteger64'
> 
> I can provide a more complete message but this is a user forum.
> 
> And where should I post these types of messages?

Try: de dev-list:
https://lists.osgeo.org/mailman/listinfo/qgis-developer

Looks like you build with other OGR/GDAL then you have installed? Or you
have several GDAL versions installed?

Regards,

Richard Duivenvoorde



___
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

[Qgis-user] Load values panel not visible in Select by Expression?

2016-10-19 Thread Oscar Jacobsson
Hello!
I have a problem concerning the use of Select by Expression in shape files with 
my version of QGIS 2.16.3. I can't find the Load values panel that should 
appear in the right side of the Select by Expression panel. Is this a bug, or 
is there any way to fix this? My colleague has the same problem.

Kind regards //
Oscar Jacobsson

B.A Archaeology: Gothenburg University
B.A Geography: Dalarna University (expected grad. 2016)
M.A. Historical Archaeology: Lund University  
Mail: oscarjacobs...@live.com
Phone: +46709788602


  ___
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

Re: [Qgis-user] Using aggregates functions to count intersected features from another layer

2016-10-19 Thread Nyall Dawson
On 19 October 2016 at 22:22, Neumann, Andreas  wrote:
> Well yes - but that is not a "live" point in polygon. It create separate
> layers which need to be kept up-to-date.
>
> Harrissou was after a "live" point in polygon, which is automatically kept
> up-to-date through a QGIS expression.
>
> Maybe Nyall knows how to write the correct aggregate expression for that?

It's not possible using aggregate expressions at the moment - the
aggregate filters only have access to the child feature's attributes +
geometry, not the parent's.

I've been thinking about how to address this, and I'm leaning toward:

- attributes from the parent feature are automatically available
within the filter, UNLESS there's a duplicate field name from the
child feature
- expose the parent feature via the variable @parent. This could be
used with the functions geometry(@parent), attribute(@parent,
"some_dup_field_name")

Then you'd be able to write:

aggregate ('mypoint', 'count', "id", intersects ($geometry, geometry(@parent)))

The trickiest part in implementing this would be making sure the
current aggregate value cache correctly handles use of parent feature
attributes/geometry.

Re virtual layers: I've always seen these as a "heavier" (+ more
powerful!) approach, which is OK for some use cases but for others (Eg
data defined controls, composer labels, etc) it's preferable to have
these calculations available directly within the expression engine.


Nyall



>
> Greetings,
>
> Andreas
>
> On 2016-10-19 14:11, Nicolas Cadieux wrote:
>
>
> Try this.
>
> http://www.qgistutorials.com/fr/docs/points_in_polygon.html
>
> Nicolas
>
> Le 19 oct. 2016 à 06:37, DelazJ [via OSGeo.org] <[hidden email]> a écrit :
>
> Hi,
>
> I have a polygon layer and a point one.
> I'd like to calculate for each polygon feature, the number of points that it
> covers. I thought the aggregates functions could help me find an easier and
> straight expression to perform this (without creating intermediate layers)
> but I fail to find any correct syntax.
>
> I tried aggregate ('mypoint', 'count', "id", intersects ($geometry,
> geometry($currentfeature)))
>
>  And many variants of the fourth option but It always return the total of
> points or an error. Actually this option is a filter and I wonder if i'm not
> missing a "group by" option in the aggregate function (which seems to be the
> appropriate one in my case). Is it possible?
> The work around I found is to populate an ad'hoc field in the point layer
> with overlapping polygon id, thanks to the SpatialJoin plugin, then I create
> a one-to-many relation in the project between the two layers in other to use
> relation_aggregate function.
> But I expected something more direct.
>
> Any hint, please?
>
> Thanks,
> Harrissou
>
> ___
> Qgis-user mailing list
> [hidden email]
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>
> 
> If you reply to this email, your message will be added to the discussion
> below:
> http://osgeo-org.1560.x6.nabble.com/Using-aggregates-functions-to-count-intersected-features-from-another-layer-tp5291420.html
> To start a new topic under Quantum GIS - User, email [hidden email]
> To unsubscribe from Quantum GIS - User, click here.
> NAML
>
>
> 
> View this message in context: Re: Using aggregates functions to count
> intersected features from another layer
> Sent from the Quantum GIS - User mailing list archive at Nabble.com.
>
> ___
> 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
>
>
>
>
>
> ___
> 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
___
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

Re: [Qgis-user] Split features using Geopackage layer?

2016-10-19 Thread Nyall Dawson
On 19 October 2016 at 22:55, Neumann, Andreas  wrote:
> As far as I know, Nyall Dawson is currently working on fixing this, as part
> of his work on unique value constraints (provider provided or qgis provided
> where the provider doesn't support it). But not sure about the details.
> Certainly, PostgreSQL and Geopackage are top priorities for that. And his
> work targets QGIS 3.x, not for 2.x

Yes, I'm currently working on this as part of a larger work in
auto-exposing provider side constraints (not null/unique) to QGIS's
form validation.

WIP is here: https://github.com/nyalldawson/QGIS/commits/constraints,
but so far it only handles the detection + translation of constraints
from provider -> QGIS. The form based/tool changes are still to come.

Nyall


>
> Greetings,
>
> Andreas
>
>
>
> On 2016-10-19 14:43, Even Rouault wrote:
>
> Le mercredi 19 octobre 2016 14:14:40, Chris Buckmaster a écrit :
>
> Hi
>
> I have a geopackage polygon layer and I am trying to split a simple feature
> within it.
>
> When I try to do it, I get an error message 'failed to insert, UNIQUE
> constraint failed'.
>
> Is this a known issue with splitting features using the geopackage format,
> it could it be how the layer is set up?
>
>
> No, it is due to the fact that when splitting the feature, the newly created
> feature receives the same 'fid' value (the first column in the attribute
> table)
> as the other part, and that when creating the feature, the fid, when set, is
> honoured. Hence given the duplication of fid, the failure. Before saving the
> edits, you can manually unset the fid.
>
> Although something should probably be done either in the splitting tool to
> unset the fid column of the new feature. Or perhaps the provider could be
> made
> more tolerant in the case of duplicated FID to assign a new one.
>
> This could happen for other formats handled by OGR like spatialite (if not
> going throug the QGIS spatialite provider), FileGDB, etc...
>
> Would probably deserve a ticket in the bug tracker.
>
> Even
>
>
>
>
>
> ___
> 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
___
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

[Qgis-user] QGIS build from source code Ubuntu 16.04 64-bit

2016-10-19 Thread gordon

Anyone know what I am missing?  The info will be much appreciated.

qgis_core qgsvectorfilewriter.cpp -- warning

qgis_core qgsgml.cpp qgsogrutils.cpp qgsvectorfilewriter.cpp -- error

undefined reference to `OGR_G_ExportToIsoWkb'
undefined reference to `OGR_F_SetFieldInteger64'

I can provide a more complete message but this is a user forum.

And where should I post these types of messages?

Thanking you in advance

Gordon
___
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

[Qgis-user] Build QGIS with GRASS - Mint 18/xenial

2016-10-19 Thread Mark Seibel
Hi all.

I have tried several ways to get QGIS with GRASS browser working. I had it
working at one point on Linux Mint 17/Trusty, but always with mixed results
(I could never get it working from the repos, but sometimes it would work
compiling from source). I did a fresh install of linux Mint 18, and I am
coming up with these results.

Repos:
Tried ubuntugis-unstable repo. Installed all qgis/grass related packages -
cant browse GRASS locations

Added repo from qgis.org for 2.16 debian builds. Installed all qgis/grass
related packages - cant browse GRASS locations

Source: (followed this page https://github.com/qgis/QGIS/blob/master/INSTALL
)
Compiled from source, and installed in home directory - cant browse GRASS
locations. I could see it linking the grass libraries during compilation
and it seems it built ok, but I dont know how to check and make sure.

Built .deb packages from source and installed (using above web link) - with
this one the GRASS browser plugin was working, but any attempt to load
other plugins resulted in an error (cant load module xyz). Building the
.deb packages had errors, but not sure how to address them.

Interestingly, when I compile from source, then go into the /output/bin
directory and run qgis from there, it launches and the GRASS browser works.
(?)

Since grass 7, I've always had hit and miss results with QGIS and the GRASS
browser. This is one feature I really enjoy and find great value in getting
QGIS and GRASS to work together.

Any suggestions on what I can do to see what I'm doing wrong?

Thanks,
Mark
___
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

Re: [Qgis-user] inconsistenty when calculating area depending on file type or projection?

2016-10-19 Thread Carlos Cerdán
> Under project properties, general tab - change "ellipsoid" to "None
/Planimetric".

Done, but calculated area is still... geodetic area?. I've tried ArcGIS
and, for my GEO layer, It gives me desired area (same as an UTM layer,
calculated with OTF off); so, it's me or QGIS, but I can't do this task in
one step on QGIS: first I've to reproject mi GEO layer into an UTM one;
disable OTF and finally calculate area (planar, as UTM is) in the new UTM
layer.


Carlos🤔




2016-10-18 19:58 GMT-05:00 Nyall Dawson :

> On 19 October 2016 at 02:22, Carlos Cerdán  wrote:
> > It was my fault. I was used to consider plane areas as "correct",
> forgetting
> > ellipsoidal areas. So, QGIS give us freedom to calculate planar or
> > ellipsoidal (geodetical) areas, but we must be careful about settings; Is
> > not it?. Sometimes, too much freedom is annoying!
> >
> > But, How can I calculate UTM (planar) area from a GEO layer in one step?
>
> Under project properties, general tab - change "ellipsoid" to "None /
> Planimetric".
>
> I keep meaning to split up the concept of ellipsoidal measurement from
> OTF reprojection. In my view these are two different concepts - one is
> just about display of data, the other relates to measurement. Ie, you
> should be able to perform ellipsoidal calculations even if OTF
> rendering is disabled.
>
> I just keep forgetting to do it early in a release cycle for extensive
> testing...
>
> Nyall
>
>
>
___
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

Re: [Qgis-user] Using aggregates functions to count intersected features from another layer

2016-10-19 Thread Matthias Kuhn
Hi,

The Expressions Plus plugin is there for sharing expressions that are of
broader interest but for whatever reason did not make it (yet) to core [1]

Would be great to push there whatever is interesting so we don't have to
install a bazillion different plugins.

Matthias

[1] https://plugins.qgis.org/plugins/qgsexpressionsplus/

On 19/10/16 21:42, DelazJ wrote:
> Hi all,
> Thank you all for your answers. This is really a great community! I
> already knew that but let me say it loudly. It also shows all the
> capabilities of QGIS to solve a problem.
>
> Nicolas, as Andreas said, I'm looking for something dynamic, live. 
>
> The virtual layer can indeed be an option despite the creation of an
> intermediate but somehow live layer. Would be nice to have Andreas
> questions documented in the user manual so that users are fully aware
> of any potential limitations of the feature or its great power.
>
> Another powerful feature I often neglect is the function editor. Maybe
> because there are so many functions in the list that I end up thinking
> that their combination would be enough. I think it's the way I will go
> as no intermediate layer is involved and despite your remarks (which
> are not far from Andreas questions about virtual layers). Thank you
> Germán for reminding me. 
> That makes me wonder: we have in QGIS, ways to share processing
> scripts and models, to share symbols, styles... What about something
> to share custom expression functions? Plugins somehow already do that
> but I think there are many people that have an operational code (that
> fills some small and common needs like mine) but don't have
> time/skills to create the Gui around. Does it sound
> reasonable/feasible? Maybe should I open a discussion in dev list (or
> a ticket)?
>
> Back to the approach I was following to solve the issue (combining
> default functions in expression) may I understand that it was endless?
> No way to group by when using aggregate function...?
>
> Greetings,
> Harrissou
>
> Envoyé depuis mon HTC
>
> - Reply message -
> De : "Germán Carrillo"  >
> Pour : "Neumann, Andreas"  >, "Harrissou 'DelazJ'"  >
> Cc : "Nathan Woodrow"  >, "qgis-user"  >, "Nicolas Cadieux"
> mailto:nicolas.cadi...@archeotec.ca>>
> Objet : [Qgis-user] Using aggregates functions to count intersected
> features from another layer
> Date : mer., oct. 19, 2016 18:04
>
> Hi All, 
>
>
> Harrissou, have a look at [1] for a very similar question and one
> possible solution using the Function Editor (of course, instead of sum
> you would use count).
>
> Do you other devs find that approach useful? Any hint for keeping the
> index up-to-date?
>
> Is there any interest in having this kind of functions available for
> QGIS expressions? I could help with that.
>
>
> Regards, 
>
> Germán
> --
> [1] http://gis.stackexchange.com/a/212762/4972
> 
>
>
> 2016-10-19 7:42 GMT-05:00 Neumann, Andreas  >:
>
> Good idea to use a virtual layer for that! It is probably also
> more efficient than a QGIS expression.
>
> Just to understand the virtual layers correctly:
>
> when is the query behind the virtual layer executed?
>
> - at every redraw?
>
> - once at creation?
>
> - at project reload?
>
> Aren't the virtual layers automatically updated, at least when the
> project reloads?
>
> Are the results cached or not?
>
> Would also make sense to add a "update" option for a virtual
> layer, if that doesn't exist yet.
>
> Greetings,
>
> Andreas
>
>  
>
> On 2016-10-19 14:32, Nathan Woodrow wrote:
>
>> Maybe using a virtual layer query via DB Manager will work.  You
>> have full SQL join support. Speed isn't always the best but gives
>> you the full power of SQL which is the correct way to do this IMO.
>>  
>> E.g SELECT LayerA.id, COUNT(*) FROM layerA 
>> JOIN layerB ON ST_WithIn(layerA.geometry, layerB.geometry)
>> GROUP BY layerA.type
>>  
>> Although you can't do an update but you can make a new layer with
>> the new counts.
>>  
>> - Nathan
>>
>> On Wed, Oct 19, 2016 at 10:22 PM, Neumann, Andreas
>> mailto:a.neum...@carto.net>> wrote:
>>
>> Well yes - but that is not a "live" point in polygon. It
>> create separate layers which need to be kept up-to-date.
>>
>> Harrissou was after a "live" point in polygon, which is
>> automatically kept up-to-date through a QGIS expression.
>>
>> Maybe Nyall knows how to write the correct aggregate
>> expression for that?
>>
>> Greetings,
>>
>> Andreas
>>
>> On 2016-10-19 14:11, Nicolas Cadieux wrote:
>>
>>  
>> Try this.
>>  
>> http://www.qgistutorials.com/fr/doc

Re: [Qgis-user] Using aggregates functions to count intersected features from another layer

2016-10-19 Thread DelazJ
 Hi all,
Thank you all for your answers. This is really a great community! I already
knew that but let me say it loudly. It also shows all the capabilities of
QGIS to solve a problem.

Nicolas, as Andreas said, I'm looking for something dynamic, live.

The virtual layer can indeed be an option despite the creation of an
intermediate but somehow live layer. Would be nice to have Andreas
questions documented in the user manual so that users are fully aware of
any potential limitations of the feature or its great power.

Another powerful feature I often neglect is the function editor. Maybe
because there are so many functions in the list that I end up thinking that
their combination would be enough. I think it's the way I will go as no
intermediate layer is involved and despite your remarks (which are not far
from Andreas questions about virtual layers). Thank you Germán for
reminding me.
That makes me wonder: we have in QGIS, ways to share processing scripts and
models, to share symbols, styles... What about something to share custom
expression functions? Plugins somehow already do that but I think there are
many people that have an operational code (that fills some small and common
needs like mine) but don't have time/skills to create the Gui around. Does
it sound reasonable/feasible? Maybe should I open a discussion in dev list
(or a ticket)?

Back to the approach I was following to solve the issue (combining default
functions in expression) may I understand that it was endless? No way to
group by when using aggregate function...?

Greetings,
Harrissou

Envoyé depuis mon HTC

- Reply message -
De : "Germán Carrillo" 
Pour : "Neumann, Andreas" , "Harrissou 'DelazJ'" <
del...@gmail.com>
Cc : "Nathan Woodrow" , "qgis-user" <
qgis-user@lists.osgeo.org>, "Nicolas Cadieux" 
Objet : [Qgis-user] Using aggregates functions to count intersected
features from another layer
Date : mer., oct. 19, 2016 18:04

Hi All,


Harrissou, have a look at [1] for a very similar question and one possible
solution using the Function Editor (of course, instead of sum you would use
count).

Do you other devs find that approach useful? Any hint for keeping the index
up-to-date?

Is there any interest in having this kind of functions available for QGIS
expressions? I could help with that.


Regards,

Germán
--
[1] http://gis.stackexchange.com/a/212762/4972


2016-10-19 7:42 GMT-05:00 Neumann, Andreas :

> Good idea to use a virtual layer for that! It is probably also more
> efficient than a QGIS expression.
>
> Just to understand the virtual layers correctly:
>
> when is the query behind the virtual layer executed?
>
> - at every redraw?
>
> - once at creation?
>
> - at project reload?
>
> Aren't the virtual layers automatically updated, at least when the project
> reloads?
>
> Are the results cached or not?
>
> Would also make sense to add a "update" option for a virtual layer, if
> that doesn't exist yet.
>
> Greetings,
>
> Andreas
>
>
>
> On 2016-10-19 14:32, Nathan Woodrow wrote:
>
> Maybe using a virtual layer query via DB Manager will work.  You have full
> SQL join support. Speed isn't always the best but gives you the full power
> of SQL which is the correct way to do this IMO.
>
> E.g SELECT LayerA.id, COUNT(*) FROM layerA
> JOIN layerB ON ST_WithIn(layerA.geometry, layerB.geometry)
> GROUP BY layerA.type
>
> Although you can't do an update but you can make a new layer with the new
> counts.
>
> - Nathan
>
> On Wed, Oct 19, 2016 at 10:22 PM, Neumann, Andreas 
> wrote:
>
>> Well yes - but that is not a "live" point in polygon. It create separate
>> layers which need to be kept up-to-date.
>>
>> Harrissou was after a "live" point in polygon, which is automatically
>> kept up-to-date through a QGIS expression.
>>
>> Maybe Nyall knows how to write the correct aggregate expression for that?
>>
>> Greetings,
>>
>> Andreas
>>
>> On 2016-10-19 14:11, Nicolas Cadieux wrote:
>>
>>
>> Try this.
>>
>> http://www.qgistutorials.com/fr/docs/points_in_polygon.html
>>
>> Nicolas
>>
>> Le 19 oct. 2016 à 06:37, DelazJ [via OSGeo.org] <[hidden email]> a
>> écrit :
>>
>> Hi,
>>
>> I have a polygon layer and a point one.
>> I'd like to calculate for each polygon feature, the number of points that
>> it covers. I thought the aggregates functions could help me find an easier
>> and straight expression to perform this (without creating intermediate
>> layers) but I fail to find any correct syntax.
>>
>> I tried aggregate ('mypoint', 'count', "id", intersects ($geometry,
>> geometry($currentfeature)))
>>
>>  And many variants of the fourth option but It always return the total of
>> points or an error. Actually this option is a filter and I wonder if i'm
>> not missing a "group by" option in the aggregate function (which seems to
>> be the appropriate one in my case). Is it possible?
>> The work around I found is to populate an ad'hoc field in the point layer
>> with overlapping polygon id, thanks to the SpatialJoin plugin, then I
>> create a on

Re: [Qgis-user] Using aggregates functions to count intersected features from another layer

2016-10-19 Thread Germán Carrillo
Hi All,


Harrissou, have a look at [1] for a very similar question and one possible
solution using the Function Editor (of course, instead of sum you would use
count).

Do you other devs find that approach useful? Any hint for keeping the index
up-to-date?

Is there any interest in having this kind of functions available for QGIS
expressions? I could help with that.


Regards,

Germán
--
[1] http://gis.stackexchange.com/a/212762/4972


2016-10-19 7:42 GMT-05:00 Neumann, Andreas :

> Good idea to use a virtual layer for that! It is probably also more
> efficient than a QGIS expression.
>
> Just to understand the virtual layers correctly:
>
> when is the query behind the virtual layer executed?
>
> - at every redraw?
>
> - once at creation?
>
> - at project reload?
>
> Aren't the virtual layers automatically updated, at least when the project
> reloads?
>
> Are the results cached or not?
>
> Would also make sense to add a "update" option for a virtual layer, if
> that doesn't exist yet.
>
> Greetings,
>
> Andreas
>
>
>
> On 2016-10-19 14:32, Nathan Woodrow wrote:
>
> Maybe using a virtual layer query via DB Manager will work.  You have full
> SQL join support. Speed isn't always the best but gives you the full power
> of SQL which is the correct way to do this IMO.
>
> E.g SELECT LayerA.id, COUNT(*) FROM layerA
> JOIN layerB ON ST_WithIn(layerA.geometry, layerB.geometry)
> GROUP BY layerA.type
>
> Although you can't do an update but you can make a new layer with the new
> counts.
>
> - Nathan
>
> On Wed, Oct 19, 2016 at 10:22 PM, Neumann, Andreas 
> wrote:
>
>> Well yes - but that is not a "live" point in polygon. It create separate
>> layers which need to be kept up-to-date.
>>
>> Harrissou was after a "live" point in polygon, which is automatically
>> kept up-to-date through a QGIS expression.
>>
>> Maybe Nyall knows how to write the correct aggregate expression for that?
>>
>> Greetings,
>>
>> Andreas
>>
>> On 2016-10-19 14:11, Nicolas Cadieux wrote:
>>
>>
>> Try this.
>>
>> http://www.qgistutorials.com/fr/docs/points_in_polygon.html
>>
>> Nicolas
>>
>> Le 19 oct. 2016 à 06:37, DelazJ [via OSGeo.org] <[hidden email]> a
>> écrit :
>>
>> Hi,
>>
>> I have a polygon layer and a point one.
>> I'd like to calculate for each polygon feature, the number of points that
>> it covers. I thought the aggregates functions could help me find an easier
>> and straight expression to perform this (without creating intermediate
>> layers) but I fail to find any correct syntax.
>>
>> I tried aggregate ('mypoint', 'count', "id", intersects ($geometry,
>> geometry($currentfeature)))
>>
>>  And many variants of the fourth option but It always return the total of
>> points or an error. Actually this option is a filter and I wonder if i'm
>> not missing a "group by" option in the aggregate function (which seems to
>> be the appropriate one in my case). Is it possible?
>> The work around I found is to populate an ad'hoc field in the point layer
>> with overlapping polygon id, thanks to the SpatialJoin plugin, then I
>> create a one-to-many relation in the project between the two layers in
>> other to use relation_aggregate function.
>> But I expected something more direct.
>>
>> Any hint, please?
>>
>> Thanks,
>> Harrissou
>>
>> ___
>> Qgis-user mailing list
>> [hidden email]
>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>>
>> --
>> If you reply to this email, your message will be added to the discussion
>> below:
>> http://osgeo-org.1560.x6.nabble.com/Using-aggregates-functio
>> ns-to-count-intersected-features-from-another-layer-tp5291420.html
>> To start a new topic under Quantum GIS - User, email [hidden email]
>> To unsubscribe from Quantum GIS - User, click here.
>> NAML
>> 
>>
>>
>> --
>> View this message in context: Re: Using aggregates functions to count
>> intersected features from another layer
>> 
>> Sent from the Quantum GIS - User mailing list archive
>>  at
>> Nabble.com.
>>
>> ___
>> 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
>>
>>
>>
>>
>> ___

[Qgis-user] QGIS crashes when loading / unloading raster layers using Python

2016-10-19 Thread Hollis, Dan
Hi,

I'm really hoping someone can help me with this.

I'm trying to write a Python script to batch process the loading of rasters 
into QGIS. This script will be run in the Python Console. The rasters are 
geotiffs created using some separate software that we have been developing. As 
far as I can tell there are no problems with the rasters themselves i.e. I can 
load and unload them using the standard buttons in the QGIS interface without 
running into problems.

The rasters contain temperature data. There are two rasters for each day - one 
containing actual values and one containing anomalies from the long-term 
average. The aim is to load all of the data for one month such that there is a 
separate group for each day in the Layers Panel (table of contents). In the 
full version of my script each group contains the two rasters for that day, 
plus some vector layers overlaid on top (point temperature data, coastline 
etc). I don't think the vector data are the cause of the problems I'm 
encountering so I'm ignoring these in the rest of this posting.

I'm working on Windows 7. Until recently I was using QGIS 2.4 Chugiak. My 
script worked well enough in that it would load all the layers as required and 
the user could mostly interact with them without generating any errors i.e. 
they could pan, zoom, identify, switch layers on/off, expand/contract groups. 
However when the user tried to close down QGIS, or if they tried to remove the 
layers prior to loading a different set of data, then the software would always 
crash ("qgis-bin.exe has stopped working", "Crash dumped - minidump written to 
C:" etc). This only happened when the layers had been loaded using my script.

The obvious conclusion was that there was something wrong / incomplete about 
how my script loaded the layers. I've recently had QGIS 2.14 Essen installed so 
I thought I'd take another look and see if I could work out what was wrong but 
so far I've not had much success. The full version of my script now crashes 
QGIS as the layers are loaded (a step backwards!). The strangest thing is that 
it doesn't always fail in the same place - often it's while loading the layers 
for the first group, but occasionally it loads up 2 or 3 groups before 
crashing. There are no useful error messages or trace back to go on, only 
"stopped working" and "minidump" messages. If I load only the vector layers 
then it works, but as soon as I include the raster layers then things start 
failing. I've added numerous print statements and done all sorts of refactoring 
but to no avail.

I've now tried to come at this from a different angle - starting with the 
simplest possible script and building it up until it fails. The code pasted 
below shows where I've got to. The various functions reflect the structure of 
my full script. I _think_ the problem must be something to do with the 
functions - objects are possibly getting destroyed or corrupted as a result of 
passing them around - but I just cannot work it out.

NB I started out with the simplest possible code i.e. no functions or loops of 
any kind - just a sequential series of instructions. This works! I then 
introduced the add_grid() function and it still worked, then add_layers() and 
it also still worked. Finally I introduced add_groups() - it still loaded the 
layers without crashing, but then I was back to the situation where QGIS would 
crash when I remove the layers added by the script. This is different to my 
full script (which crashes as the layers are loaded) despite one being a 
simplified version of the other. I then reverted the last change (getting rid 
of add_groups()) and it's crashing again i.e. what was working is no longer 
working! Aaaaggghhh!!

If anyone can shed any light at all on this I would be very grateful. I have 
spent many hours trying to unpick this without success. The most frustrating 
thing is the lack of any useful error messages and the fact that the crashes 
seem somewhat random (clearly connected with my script, but not entirely 
reproducible).

Thanks,

Dan


import os

def add_grid(layer_path, layer_name, grp):
rlayer = QgsRasterLayer(layer_path, layer_name)
QgsMapLayerRegistry.instance().addMapLayer(rlayer, False)
grp.addLayer(rlayer)

def add_layers(grp, data_folder, date, short_name):

# Add first layer
type = 'anomaly'

fn = '_'.join((date, short_name, type)) + '.tiff'
layer_path = os.path.join(data_folder, fn)
layer_name = ' '.join((short_name, type))

add_grid(layer_path, layer_name, grp)

# Add second layer
type = 'actual'

fn = '_'.join((date, short_name, type)) + '.tiff'
layer_path = os.path.join(data_folder, fn)
layer_name = ' '.join((short_name, type))

add_grid(layer_path, layer_name, grp)

def add_groups(data_folder, dates, short_name):
root = QgsProject.instance().layerTreeRoot()
for date in dates:
group_name = date + ' ' + short_name
grp = root.addGroup(group_name)
   

Re: [Qgis-user] mouse position display in different units

2016-10-19 Thread McDonaldR
Thanks Håvard,

Worked perfectly!

Ross

-Original Message-
From: Qgis-user [mailto:qgis-user-boun...@lists.osgeo.org] On Behalf Of Havard 
Tveite
Sent: 17 October 2016 12:13
To: qgis-user@lists.osgeo.org
Subject: Re: [Qgis-user] mouse position display in different units

In recent versions you can change this in Project properties, General, 
Coordinate display.

Håvard

On 17. okt. 2016 12:43, McDonaldR wrote:
> Hello list
>
>
>
> I have user with a project with a number of layers (both shapefile and
> PostGIS). Project CRS is EPSG:27700 and layer CRS is EPSG:27700
> (British National Grid).  Normally, the mouse position box in the
> bottom panel shows coordinates in metres (easting and northing) but
> for some reason it is now displaying lon and lat instead.  Has the
> user added a layer with CRS EPSG:4326 which QGIS has then reprojected
> on the fly to EPSG:27700? Possibly.  But why has the mouse display box
> switched to lon/lat?  Is there any way to get that back to easting/northing 
> metres?
> Am I missing something obvious?
>
>
>
> The user has a number of points with coordinates in metres and wants
> to move them to the correct location but can’t as the project is
> working in decimal degrees.
>
>
>
> Windows 7 64bit, QGIS 2.14.3 64bit, Postgresql 9.2, PostGIS 2.2
>
>
>
> Thanks in advance
>
>
>
> Ross
>
>
>
>
>
>
>
> *Ross McDonald | *GIS Data Coordinator | Angus Council | Angus House,
> Orchardbank Business Park, Sylvie Way, Forfar DD8 1AT*| t: 01307
> 476419*
>
>
>
>
>
> This message is strictly confidential. If you have received this in
> error, please inform the sender and remove it from your system. If
> received in error you may not copy, print, forward or use it or any
> attachment in any way. This message is not capable of creating a legal
> contract or a binding representation and does not represent the views
> of Angus Council. Emails may be monitored for security and network
> management reasons.Messages containing inappropriate content may be
> intercepted. Angus Council does not accept any liability for any harm
> that may be caused to the recipient system or data on it by this
> message or any attachment.
>
>
>
> ___
> 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
>

___
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

This message is strictly confidential. If you have received this in error, 
please inform the sender and remove it from your system. If received in error 
you may not copy, print, forward or use it or any attachment in any way. This 
message is not capable of creating a legal contract or a binding representation 
and does not represent the views of Angus Council. Emails may be monitored for 
security and network management reasons. Messages containing inappropriate 
content may be intercepted. Angus Council does not accept any liability for any 
harm that may be caused to the recipient system or data on it by this message 
or any attachment.
___
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

Re: [Qgis-user] Split features using Geopackage layer?

2016-10-19 Thread Neumann, Andreas
As far as I know, Nyall Dawson is currently working on fixing this, as
part of his work on unique value constraints (provider provided or qgis
provided where the provider doesn't support it). But not sure about the
details. Certainly, PostgreSQL and Geopackage are top priorities for
that. And his work targets QGIS 3.x, not for 2.x 

Greetings, 

Andreas 

On 2016-10-19 14:43, Even Rouault wrote:

> Le mercredi 19 octobre 2016 14:14:40, Chris Buckmaster a écrit : 
> 
>> Hi
>> 
>> I have a geopackage polygon layer and I am trying to split a simple feature
>> within it.
>> 
>> When I try to do it, I get an error message 'failed to insert, UNIQUE
>> constraint failed'.
>> 
>> Is this a known issue with splitting features using the geopackage format,
>> it could it be how the layer is set up?
> 
> No, it is due to the fact that when splitting the feature, the newly created 
> feature receives the same 'fid' value (the first column in the attribute 
> table) 
> as the other part, and that when creating the feature, the fid, when set, is 
> honoured. Hence given the duplication of fid, the failure. Before saving the 
> edits, you can manually unset the fid.
> 
> Although something should probably be done either in the splitting tool to 
> unset the fid column of the new feature. Or perhaps the provider could be 
> made 
> more tolerant in the case of duplicated FID to assign a new one.
> 
> This could happen for other formats handled by OGR like spatialite (if not 
> going throug the QGIS spatialite provider), FileGDB, etc...
> 
> Would probably deserve a ticket in the bug tracker.
> 
> Even

  ___
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

Re: [Qgis-user] Split features using Geopackage layer?

2016-10-19 Thread Even Rouault
Le mercredi 19 octobre 2016 14:14:40, Chris Buckmaster a écrit :
> Hi
> 
> I have a geopackage polygon layer and I am trying to split a simple feature
> within it.
> 
> When I try to do it, I get an error message 'failed to insert, UNIQUE
> constraint failed'.
> 
> Is this a known issue with splitting features using the geopackage format,
> it could it be how the layer is set up?

No, it is due to the fact that when splitting the feature, the newly created 
feature receives the same 'fid' value (the first column in the attribute table) 
as the other part, and that when creating the feature, the fid, when set, is 
honoured. Hence given the duplication of fid, the failure. Before saving the 
edits, you can manually unset the fid.

Although something should probably be done either in the splitting tool to 
unset the fid column of the new feature. Or perhaps the provider could be made 
more tolerant in the case of duplicated FID to assign a new one.

This could happen for other formats handled by OGR like spatialite (if not 
going throug the QGIS spatialite provider), FileGDB, etc...

Would probably deserve a ticket in the bug tracker.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
___
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

Re: [Qgis-user] Using aggregates functions to count intersected features from another layer

2016-10-19 Thread Neumann, Andreas
Good idea to use a virtual layer for that! It is probably also more
efficient than a QGIS expression. 

Just to understand the virtual layers correctly: 

when is the query behind the virtual layer executed? 

- at every redraw? 

- once at creation? 

- at project reload? 

Aren't the virtual layers automatically updated, at least when the
project reloads? 

Are the results cached or not? 

Would also make sense to add a "update" option for a virtual layer, if
that doesn't exist yet. 

Greetings, 

Andreas 

On 2016-10-19 14:32, Nathan Woodrow wrote:

> Maybe using a virtual layer query via DB Manager will work.  You have full 
> SQL join support. Speed isn't always the best but gives you the full power of 
> SQL which is the correct way to do this IMO. 
> 
> E.g SELECT LayerA.id, COUNT(*) FROM layerA  
> JOIN layerB ON ST_WithIn(layerA.geometry, layerB.geometry) 
> GROUP BY layerA.type 
> 
> Although you can't do an update but you can make a new layer with the new 
> counts.
> 
> - Nathan 
> 
> On Wed, Oct 19, 2016 at 10:22 PM, Neumann, Andreas  
> wrote:
> 
> Well yes - but that is not a "live" point in polygon. It create separate 
> layers which need to be kept up-to-date. 
> 
> Harrissou was after a "live" point in polygon, which is automatically kept 
> up-to-date through a QGIS expression. 
> 
> Maybe Nyall knows how to write the correct aggregate expression for that? 
> 
> Greetings, 
> 
> Andreas
> 
> On 2016-10-19 14:11, Nicolas Cadieux wrote: 
> 
> Try this. 
> 
> http://www.qgistutorials.com/fr/docs/points_in_polygon.html [1] 
> 
> Nicolas 
> 
> Le 19 oct. 2016 à 06:37, DelazJ [via OSGeo.org [2]] <[hidden email]> a écrit :
> 
> Hi,
> 
> I have a polygon layer and a point one. I'd like to calculate for each 
> polygon feature, the number of points that it covers. I thought the 
> aggregates functions could help me find an easier and straight expression to 
> perform this (without creating intermediate layers) but I fail to find any 
> correct syntax. 
> 
> I tried aggregate ('mypoint', 'count', "id", intersects ($geometry, 
> geometry($currentfeature)))
> 
> And many variants of the fourth option but It always return the total of 
> points or an error. Actually this option is a filter and I wonder if i'm not 
> missing a "group by" option in the aggregate function (which seems to be the 
> appropriate one in my case). Is it possible? 
> The work around I found is to populate an ad'hoc field in the point layer 
> with overlapping polygon id, thanks to the SpatialJoin plugin, then I create 
> a one-to-many relation in the project between the two layers in other to use 
> relation_aggregate function. 
> But I expected something more direct. 
> 
> Any hint, please?
> 
> Thanks, Harrissou 
> ___ 
> Qgis-user mailing list 
> [hidden email] 
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user [3]
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user [3] 
> 
> -
> 
> If you reply to this email, your message will be added to the discussion 
> below: 
> http://osgeo-org.1560.x6.nabble.com/Using-aggregates-functions-to-count-intersected-features-from-another-layer-tp5291420.html
>  [4] 
> To start a new topic under Quantum GIS - User, email [hidden email] 
> To unsubscribe from Quantum GIS - User, click here.
> NAML [5] 
> 
> -
> View this message in context: Re: Using aggregates functions to count 
> intersected features from another layer [6]
> Sent from the Quantum GIS - User mailing list archive [7] at Nabble.com.
> 
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user [3]
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user [3]

___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user [3]
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user [3] 

  

Links:
--
[1] http://www.qgistutorials.com/fr/docs/points_in_polygon.html
[2] http://OSGeo.org
[3] http://lists.osgeo.org/mailman/listinfo/qgis-user
[4]
http://osgeo-org.1560.x6.nabble.com/Using-aggregates-functions-to-count-intersected-features-from-another-layer-tp5291420.html
[5]
http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
[6]
http://osgeo-org.1560.x6.nabble.com/Using-aggregates-functions-to-count-intersected-features-from-another-layer-tp5291420p5291443.html
[7] http://osgeo-org.1560.x6.nabble.com/Quantum-GIS-User-f4125267.html
___
Qgis-us

Re: [Qgis-user] Using aggregates functions to count intersected features from another layer

2016-10-19 Thread Nathan Woodrow
Maybe using a virtual layer query via DB Manager will work.  You have full
SQL join support. Speed isn't always the best but gives you the full power
of SQL which is the correct way to do this IMO.

E.g SELECT LayerA.id, COUNT(*) FROM layerA
JOIN layerB ON ST_WithIn(layerA.geometry, layerB.geometry)
GROUP BY layerA.type

Although you can't do an update but you can make a new layer with the new
counts.

- Nathan

On Wed, Oct 19, 2016 at 10:22 PM, Neumann, Andreas 
wrote:

> Well yes - but that is not a "live" point in polygon. It create separate
> layers which need to be kept up-to-date.
>
> Harrissou was after a "live" point in polygon, which is automatically kept
> up-to-date through a QGIS expression.
>
> Maybe Nyall knows how to write the correct aggregate expression for that?
>
> Greetings,
>
> Andreas
>
> On 2016-10-19 14:11, Nicolas Cadieux wrote:
>
>
> Try this.
>
> http://www.qgistutorials.com/fr/docs/points_in_polygon.html
>
> Nicolas
>
> Le 19 oct. 2016 à 06:37, DelazJ [via OSGeo.org] <[hidden email]> a écrit :
>
> Hi,
>
> I have a polygon layer and a point one.
> I'd like to calculate for each polygon feature, the number of points that
> it covers. I thought the aggregates functions could help me find an easier
> and straight expression to perform this (without creating intermediate
> layers) but I fail to find any correct syntax.
>
> I tried aggregate ('mypoint', 'count', "id", intersects ($geometry,
> geometry($currentfeature)))
>
>  And many variants of the fourth option but It always return the total of
> points or an error. Actually this option is a filter and I wonder if i'm
> not missing a "group by" option in the aggregate function (which seems to
> be the appropriate one in my case). Is it possible?
> The work around I found is to populate an ad'hoc field in the point layer
> with overlapping polygon id, thanks to the SpatialJoin plugin, then I
> create a one-to-many relation in the project between the two layers in
> other to use relation_aggregate function.
> But I expected something more direct.
>
> Any hint, please?
>
> Thanks,
> Harrissou
>
> ___
> Qgis-user mailing list
> [hidden email]
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
> http://osgeo-org.1560.x6.nabble.com/Using-aggregates-functions-to-count-
> intersected-features-from-another-layer-tp5291420.html
> To start a new topic under Quantum GIS - User, email [hidden email]
> To unsubscribe from Quantum GIS - User, click here.
> NAML
> 
>
>
> --
> View this message in context: Re: Using aggregates functions to count
> intersected features from another layer
> 
> Sent from the Quantum GIS - User mailing list archive
>  at
> Nabble.com.
>
> ___
> 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
>
>
>
>
> ___
> 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
>
___
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

Re: [Qgis-user] Qgis2web help needed

2016-10-19 Thread boesiii
Joris,


It is best to post problems with qgis2web at

https://github.com/tomchadwin/qgis2web/issues




--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Qgis2web-help-needed-tp5291130p5291453.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.
___
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

Re: [Qgis-user] Using aggregates functions to count intersected features from another layer

2016-10-19 Thread Neumann, Andreas
Well yes - but that is not a "live" point in polygon. It create separate
layers which need to be kept up-to-date. 

Harrissou was after a "live" point in polygon, which is automatically
kept up-to-date through a QGIS expression. 

Maybe Nyall knows how to write the correct aggregate expression for
that? 

Greetings, 

Andreas 

On 2016-10-19 14:11, Nicolas Cadieux wrote:

> Try this. 
> 
> http://www.qgistutorials.com/fr/docs/points_in_polygon.html 
> 
> Nicolas 
> 
> Le 19 oct. 2016 à 06:37, DelazJ [via OSGeo.org [2]] <[hidden email]> a écrit :
> 
>> Hi,
>> 
>> I have a polygon layer and a point one. I'd like to calculate for each 
>> polygon feature, the number of points that it covers. I thought the 
>> aggregates functions could help me find an easier and straight expression to 
>> perform this (without creating intermediate layers) but I fail to find any 
>> correct syntax. 
>> 
>> I tried aggregate ('mypoint', 'count', "id", intersects ($geometry, 
>> geometry($currentfeature)))
>> 
>> And many variants of the fourth option but It always return the total of 
>> points or an error. Actually this option is a filter and I wonder if i'm not 
>> missing a "group by" option in the aggregate function (which seems to be the 
>> appropriate one in my case). Is it possible? 
>> The work around I found is to populate an ad'hoc field in the point layer 
>> with overlapping polygon id, thanks to the SpatialJoin plugin, then I create 
>> a one-to-many relation in the project between the two layers in other to use 
>> relation_aggregate function. 
>> But I expected something more direct. 
>> 
>> Any hint, please?
>> 
>> Thanks, Harrissou 
>> ___ 
>> Qgis-user mailing list 
>> [hidden email] 
>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user 
>> 
>> -
>> 
>> If you reply to this email, your message will be added to the discussion 
>> below: 
>> http://osgeo-org.1560.x6.nabble.com/Using-aggregates-functions-to-count-intersected-features-from-another-layer-tp5291420.html
>>  
>> To start a new topic under Quantum GIS - User, email [hidden email] 
>> To unsubscribe from Quantum GIS - User, click here.
>> NAML [1]
> 
> -
> View this message in context: Re: Using aggregates functions to count 
> intersected features from another layer [3]
> Sent from the Quantum GIS - User mailing list archive [4] at Nabble.com.
> 
> ___
> 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

  

Links:
--
[1]
http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
[2] http://OSGeo.org
[3]
http://osgeo-org.1560.x6.nabble.com/Using-aggregates-functions-to-count-intersected-features-from-another-layer-tp5291420p5291443.html
[4] http://osgeo-org.1560.x6.nabble.com/Quantum-GIS-User-f4125267.html
___
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

[Qgis-user] Split features using Geopackage layer?

2016-10-19 Thread Chris Buckmaster
Hi

I have a geopackage polygon layer and I am trying to split a simple feature 
within it.

When I try to do it, I get an error message 'failed to insert, UNIQUE 
constraint failed'.

Is this a known issue with splitting features using the geopackage format, it 
could it be how the layer is set up?

Thanks, Chris


___
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

Re: [Qgis-user] Using aggregates functions to count intersected features from another layer

2016-10-19 Thread Nicolas Cadieux
Try this.

http://www.qgistutorials.com/fr/docs/points_in_polygon.html

Nicolas

> Le 19 oct. 2016 à 06:37, DelazJ [via OSGeo.org] 
>  a écrit :
> 
> Hi,
> 
> I have a polygon layer and a point one.
> I'd like to calculate for each polygon feature, the number of points that it 
> covers. I thought the aggregates functions could help me find an easier and 
> straight expression to perform this (without creating intermediate layers) 
> but I fail to find any correct syntax. 
> 
> I tried aggregate ('mypoint', 'count', "id", intersects ($geometry, 
> geometry($currentfeature)))
> 
>  And many variants of the fourth option but It always return the total of 
> points or an error. Actually this option is a filter and I wonder if i'm not 
> missing a "group by" option in the aggregate function (which seems to be the 
> appropriate one in my case). Is it possible?
> 
> The work around I found is to populate an ad'hoc field in the point layer 
> with overlapping polygon id, thanks to the SpatialJoin plugin, then I create 
> a one-to-many relation in the project between the two layers in other to use 
> relation_aggregate function.
> But I expected something more direct.
> 
> Any hint, please?
> 
> Thanks,
> Harrissou
> 
> ___ 
> Qgis-user mailing list 
> [hidden email] 
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user 
> 
> If you reply to this email, your message will be added to the discussion 
> below:
> http://osgeo-org.1560.x6.nabble.com/Using-aggregates-functions-to-count-intersected-features-from-another-layer-tp5291420.html
> To start a new topic under Quantum GIS - User, email 
> ml-node+s1560n4125267...@n6.nabble.com 
> To unsubscribe from Quantum GIS - User, click here.
> NAML




--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Using-aggregates-functions-to-count-intersected-features-from-another-layer-tp5291420p5291443.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.___
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

[Qgis-user] Using aggregates functions to count intersected features from another layer

2016-10-19 Thread DelazJ
Hi,

I have a polygon layer and a point one.
I'd like to calculate for each polygon feature, the number of points that
it covers. I thought the aggregates functions could help me find an easier
and straight expression to perform this (without creating intermediate
layers) but I fail to find any correct syntax.

I tried aggregate ('mypoint', 'count', "id", intersects ($geometry,
geometry($currentfeature)))

 And many variants of the fourth option but It always return the total of
points or an error. Actually this option is a filter and I wonder if i'm
not missing a "group by" option in the aggregate function (which seems to
be the appropriate one in my case). Is it possible?

The work around I found is to populate an ad'hoc field in the point layer
with overlapping polygon id, thanks to the SpatialJoin plugin, then I
create a one-to-many relation in the project between the two layers in
other to use relation_aggregate function.
But I expected something more direct.

Any hint, please?

Thanks,
Harrissou
___
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

Re: [Qgis-user] inconsistenty when calculating area depending on file type or projection?

2016-10-19 Thread Blumentrath, Stefan
Hi Nyall,

Splitting up ellipsoidal measurement from OTF reprojection would be nice.
I would love to be able to define the default measurement type (e.g. in general 
settings).
Possible to get it in QGIS 3.0?

Cheers
Stefan


-Original Message-
From: Qgis-user [mailto:qgis-user-boun...@lists.osgeo.org] On Behalf Of Nyall 
Dawson
Sent: 19. oktober 2016 02:59
To: Carlos Cerdán 
Cc: qgis-user 
Subject: Re: [Qgis-user] inconsistenty when calculating area depending on file 
type or projection?

On 19 October 2016 at 02:22, Carlos Cerdán  wrote:
> It was my fault. I was used to consider plane areas as "correct", 
> forgetting ellipsoidal areas. So, QGIS give us freedom to calculate 
> planar or ellipsoidal (geodetical) areas, but we must be careful about 
> settings; Is not it?. Sometimes, too much freedom is annoying!
>
> But, How can I calculate UTM (planar) area from a GEO layer in one step?

Under project properties, general tab - change "ellipsoid" to "None / 
Planimetric".

I keep meaning to split up the concept of ellipsoidal measurement from OTF 
reprojection. In my view these are two different concepts - one is just about 
display of data, the other relates to measurement. Ie, you should be able to 
perform ellipsoidal calculations even if OTF rendering is disabled.

I just keep forgetting to do it early in a release cycle for extensive 
testing...

Nyall



>
> Thank you very much for your time and so sorry if I'm doing basic questions.
>
> Carlos
>
>
>
> 2016-10-16 17:59 GMT-05:00 Nyall Dawson :
>>
>> On 16 October 2016 at 05:20, Carlos Cerdán  wrote:
>> > Hi Nyall (and list)
>> >
>> > A small projecto with UTM and GEO layers can be downloaded from dropbox:
>> >
>> > https://www.dropbox.com/s/c4cfb48r5326vrk/Cajamarca.zip?dl=0
>> >
>> > Attribute table has the correct area in AreaKm2 field (and in these 
>> > unities). "AreaOTFoff" is the area given by field calculator when 
>> > "On The Fly transformation" is deactivated. "AreaOTF_on" is the 
>> > area with it activated.
>> >
>> > So: when I have a GEO layer, I can't calculate correct area 
>> > directly in that
>> > layer: I've to reproject to UTM and deactivate automatic 
>> > transformation of SRCs, to use field calculator expecting correct 
>> > values.
>> >
>> > OS : Ubuntu 16.04
>> > QGIS : 2.16.3
>> > SRC settings: by default (ellipsoide WGS84 for measures)
>>
>> Thanks for sending this through, but again - I can't find any issue here.
>>
>> The different area calculations come from the difference between 
>> measuring the area using a flat plane (OTF off, no ellipsoid set) vs 
>> measuring the area using an ellipsoid (OTF on, ellipsoid set under 
>> the project "general" settings). When OTF is on QGIS calculates the 
>> same area regardless of whether the geographic or projected source 
>> layer is used.
>>
>> Hope that clarifies!
>>
>> Nyall
>>
>>
>>
>> >
>> > Thank you for your interest
>> >
>> > Carlos Cerdán
>> >
>> >
>> > 2016-10-14 15:14 GMT-05:00 Nyall Dawson :
>> >>
>> >> On 15 Oct 2016 12:51 AM, "Carlos Cerdán"  wrote:
>> >> >
>> >> > Hi Nyall
>> >> >
>> >> > I'm afraid that 2.16 has still this issue. I've loaded an UTM-17 
>> >> > south layer (my zone) and a Lat-long layer and:
>> >> >
>> >> > 1. SRC was seted in UTM
>> >> >
>> >> > 2. In UTM layer, if OTF SRC transformation is active, I get 
>> >> > different area than if it's deactivated. Correct value is the last one.
>> >> >
>> >> > 3. In Lat-long layer, if OTF SRC transformation is active, 
>> >> > calculated area is same as the wrong value of first layer. I 
>> >> > can't get the correct value in this layer, so I have to 
>> >> > reproject into a new one and do step 2 (with OTF deactivated).
>> >> >
>> >> > What about a general option to set the prefered SRC to calculate 
>> >> > areas and lengths with OTF active?
>> >>
>> >> Hi Carlos,
>> >>
>> >> Can you please share your file? Cut it down to just a few polygons 
>> >> and let me know what area you expect to see. Email direct to 
>> >> myself.
>> >>
>> >> Thanks!
>> >>
>> >> Nyall
>> >>
>> >>
>> >> >
>> >> > Regards from Peru
>> >> >
>> >> > Carlos
>> >> >
>> >> >
>> >> >
>> >> > 2016-10-12 18:06 GMT-05:00 Nyall Dawson :
>> >> >>
>> >> >> On 12 Oct 2016 11:56 PM, "Carlos Cerdán" 
>> >> >> wrote:
>> >> >> >
>> >> >> > AFAIK, It also is needed to turn off "on the fly SRC 
>> >> >> > transformation"
>> >> >> > to get correct area values Or QGIS has fixed this point?
>> >> >>
>> >> >> Everything should be fixed in recent versions, and I very 
>> >> >> (VERY) much want to know if any issues are still encountered.
>> >> >>
>> >> >> Calculating area/length is a core task for a GIS and we need to 
>> >> >> make sure it's rock solid. (Which it should be since 2.16!)
>> >> >>
>> >> >> Nyall
>> >> >>
>> >> >>
>> >> >> >
>> >> >> > If you can't get correct area values, check out about it
>> >> >> >
>> >> >> >
>> >> >> > 2016-10-12 7:40 GMT-05:00 DelazJ :
>> >> >> >>
>> >> >> >> Hi,
>> >> >> >> To complete Nicolas answer,

Re: [Qgis-user] Issues with Spatial Bookmarks

2016-10-19 Thread Luigi Pirelli
first idea is creating an issue in qgis tracker... otherwise the
problem  will be lost in the mailing list. Seems you are talking about
a regression that have a great priority. btw I suggest you to test
with current master_2 branch (next 2.18) if the problem has been
solved... and obviously check if problem was already reported in the
issues list.

regards
Luigi Pirelli

**
* Boundless QGIS Support/Development: lpirelli AT boundlessgeo DOT com
* LinkedIn: https://www.linkedin.com/in/luigipirelli
* Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
* GitHub: https://github.com/luipir
* Mastering QGIS 2nd Edition:
* 
https://www.packtpub.com/big-data-and-business-intelligence/mastering-qgis-second-edition
**


On 18 October 2016 at 23:49, Christian Pschierer
 wrote:
> Hi,
>
> I have observed two issues with spatial bookmarks in 2.16:
> - Sorting existing bookmarks by clicking on the column headers has no
> effect. It was fine in 2.14.
> - I tried to export the bookmarks into a file and sort them externally. This
> fails with an application crash. I have uploaded the crash dump to
> https://drive.google.com/file/d/0B_ZFrVxj-nPsM24wa2dvUkdCcjg/view?usp=sharing
> - Version: 2.16.3 on Windows 7, 64 bit
>
> Any ideas how to fix this? I though it may be related to the new feature of
> storing bookmarks in projects, but moving them from system wide to project
> bookmarks also did not fix the first issue.
>
> Christian
>
> ___
> 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
___
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