Re: [QGIS-Developer] Updating a layer's datasource in python

2018-09-25 Thread Denis Rouzaud
Hi Olivier,

I have been playing with this and I think you should use the source on the
layer and not on the data provider.
Here is some code (which also modifies the style of the layer)
https://github.com/QGEP/customizer/blob/master/customizer.py#L129-L141

I was doing a layer.reload() after changing the source.

Hope that helps,
Denis

Le mar. 25 sept. 2018 à 19:02, Olivier Dalang  a
écrit :

> Dear List,
>
> As simple as it sounds, I'm struggling with changing the datasource of
> layers with python :
>
> layer1 = QgsVectorLayer('/path/to/a.shp')
> QgsProject.instance().addMapLayer(layer1)
> layer1.dataProvider().setDataSourceUri('/path/to/b.shp')
>
> The layer successfully changes on map redraw. However layer1.source()
> stays to the initial layer, so that the change does not persist across
> saves (save and reload, and you get a.shp again).
>
> The exact same code with a geopackage doesn't work at all (no changes on
> map redraw).
>
> layer1 = QgsVectorLayer('/path/to/db.gpkg|layer=a')
> QgsProject.instance().addMapLayer(layer1)
> layer1.dataProvider().setDataSourceUri ('/path/to/db.gpkg|layer=b')
>
> There is also an entry in the pyqgis cookbook (here
> ,
> scroll down) for QgsVectorLayer. The layer1.source() is correctly updated,
> but again, it works with shapefiles, but not geopackages. And this is for
> vectors only.
>
> layer1.setDataSource('/path/to/b.shp', "b", "ogr")
>
> Am I hitting a bug ? Or did I get confused somewhere ?
>
> As I feel this is a fairly common need, I'd be very grateful if someone
> could help me figure out the recommended way to achieve this, for both
> vectors or rasters. I'll update the pyqgis cookbook in return :-)
>
> Note that there are workarounds (like replacing with a new layer and
> copying styles over or writing directly to the .qgs file, but they are not
> straightforward and have limitations).
>
> Thanks !!
>
> Olivier
>
>
>
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

-- 

Denis Rouzaud
de...@opengis.ch  
+41 76 370 21 22
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] Updating a layer's datasource in python

2018-09-25 Thread Nyall Dawson
On Wed, 26 Sep 2018 at 09:02, Olivier Dalang  wrote:
>
> Dear List,
>
> As simple as it sounds, I'm struggling with changing the datasource of layers 
> with python :
>
> layer1 = QgsVectorLayer('/path/to/a.shp')
> QgsProject.instance().addMapLayer(layer1)
> layer1.dataProvider().setDataSourceUri('/path/to/b.shp')

This code won't work correctly -- you shouldn't be changing the data
source of the layer's provider, but rather set the layer's data source
and let it handle the required changes to the provider.

> There is also an entry in the pyqgis cookbook (here, scroll down) for 
> QgsVectorLayer. The layer1.source() is correctly updated, but again, it works 
> with shapefiles, but not geopackages. And this is for vectors only.

This should work for geopackage (as well as shp). Can you share your code?

And yes, there's unfortunately no equivalent for rasters yet.

Nyall
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[QGIS-Developer] Updating a layer's datasource in python

2018-09-25 Thread Olivier Dalang
Dear List,

As simple as it sounds, I'm struggling with changing the datasource of
layers with python :

layer1 = QgsVectorLayer('/path/to/a.shp')
QgsProject.instance().addMapLayer(layer1)
layer1.dataProvider().setDataSourceUri('/path/to/b.shp')

The layer successfully changes on map redraw. However layer1.source() stays
to the initial layer, so that the change does not persist across saves
(save and reload, and you get a.shp again).

The exact same code with a geopackage doesn't work at all (no changes on
map redraw).

layer1 = QgsVectorLayer('/path/to/db.gpkg|layer=a')
QgsProject.instance().addMapLayer(layer1)
layer1.dataProvider().setDataSourceUri ('/path/to/db.gpkg|layer=b')

There is also an entry in the pyqgis cookbook (here
,
scroll down) for QgsVectorLayer. The layer1.source() is correctly updated,
but again, it works with shapefiles, but not geopackages. And this is for
vectors only.

layer1.setDataSource('/path/to/b.shp', "b", "ogr")

Am I hitting a bug ? Or did I get confused somewhere ?

As I feel this is a fairly common need, I'd be very grateful if someone
could help me figure out the recommended way to achieve this, for both
vectors or rasters. I'll update the pyqgis cookbook in return :-)

Note that there are workarounds (like replacing with a new layer and
copying styles over or writing directly to the .qgs file, but they are not
straightforward and have limitations).

Thanks !!

Olivier
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] open atlas layout, using python

2018-09-25 Thread Nyall Dawson
On Tue, 25 Sep 2018 at 22:36, Raymond Nijssen  wrote:
>
> 1. Can I open a layout window with a python command?

designer = iface.openLayoutDesigner( layout )

> 2. Can I turn on "atlas preview" with a python command?

You'd have to do some fragile code to do this. Basically:

- get designer window from designer.view()'s parent window
- find the mActionAtlasPreview child action in the window
- manually toggle it on

This should work, but isn't stable API - so is likely to break ;)

A better approach is to (quickly, before 3.4 final!) file a PR
exposing the toggle atlas preview behavior to
QgsLayoutDesignerInterface. Then you'll be able to just do:

designer = iface.openLayoutDesigner( layout )
designer.toggleAtlasPreview( True )

Nyall


Hope anyone knows!
>
> Kind regards,
> Raymond
>
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] [Qgis-psc] Fwd: Documentation writing

2018-09-25 Thread matteo
Hi Harrissou,

thanks for reporting your ideas, probably nobody knows better than you
"black areas" of the docs.

What do other docs people think? I don't want to put too much wood in
the fire, but maybe if we all agree, we can think to add some priority
labels depending on the lack of documented (interested) features.

QGIS doc repo already has a lot (too much?!) labels, but maybe having a
kind of hierarchy could help.

Thanks

Matteo
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0

2018-09-25 Thread Helmut Kudrnovsky
>[...]
>Caris LOTS: 14.737 km^2
>ArcMap: 14.727,446 km^2
>MapInfo:14.727,352 km^2
>GeoMedia:   14.726,443 km^2
>Planimeter: 14.722,522 km^2
>QGIS 3.2:   14.652,181 km^2
>QGIS 2.8:   14.652,181 km^2
>[...]
>My suspicion is that the geodesic algorithm used by QGIS (and apparently
GRASS) is to blame here.

a quick check in GRASS 7.7.svn shows :-)

|m2|km2|
|14718097678,673|14.718,097679|



-
best regards
Helmut
--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[QGIS-Developer] Exporting from QGIS to CAD format - is it possible to offer DWG export

2018-09-25 Thread rjwillson
Hi, 

 

The CAD import and export functions for QGIS 3x are already extremely
impressive and in several ways exceed the import/export capability of ArcGIS
desktop 10.5/6. 

 

As mentioned in a previous post the only function that the QGIS import can't
handle yet is when the CAD file (dwg or dxf) is not georeferenced
beforehand. For that scenario I regrettably have to go back to ArcGIS
desktop.

 

My question pertains to the export. 

 

Is there a proprietary licensing reason that QGIS cannot export directly to
*.dwg file format rather than only to the dxf format?

 

I have a colleague that regularly espouses the view that QGIS is not up to
par when it comes to handling CAD files, as compared to ArcGIS desktop,
simply because of Q's inability to export directly to a dwg file format. Can
this capability be added?

 

Regards

Rob

 

___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[QGIS-Developer] Plugin [1491] GIS4WRF approval notification.

2018-09-25 Thread noreply

Plugin GIS4WRF approval by pcav.
The plugin version "[1491] GIS4WRF 0.12.0" is now approved
Link: http://plugins.qgis.org/plugins/gis4wrf/
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[QGIS-Developer] Plugin [1048] Another DXF Importer / DXF2Shape Converter approval notification.

2018-09-25 Thread noreply

Plugin Another DXF Importer / DXF2Shape Converter approval by pcav.
The plugin version "[1048] Another DXF Importer / DXF2Shape Converter 1.0.3" is 
now approved
Link: http://plugins.qgis.org/plugins/AnotherDXF2Shape/
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[QGIS-Developer] Plugin [578] Maps Printer approval notification.

2018-09-25 Thread noreply

Plugin Maps Printer approval by delazj.
The plugin version "[578] Maps Printer 0.5" is now approved
Link: http://plugins.qgis.org/plugins/MapsPrinter/
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0

2018-09-25 Thread Kristian Evers
Calvin,

I am quite sure that Charles Karney holds an undisputed claim of the Most 
Accurate Geodesic Algorithm™. At least I haven’t come across any papers 
offering better accuracy.

Google Earths figure of 14.672 km^2 is very similar to MapInfos spherical area 
calculation of 14.670 km^2, so for now I think we can assume that Google’s 
Earth is not subject to either rotation nor gravity :-)

Regarding including the gravity (geoid) models in GeographicLib I must admit 
that that is outside my knowledge of the library. If the library can calculate 
geodesics on the geoid that would be even more accurate, yes. Although you are 
at the mercy of the accuracy of the geoid models. For my particular application 
I wouldn’t use one since the global models mention in the docs you link to are 
not that well-fitting in this area. In theory I could produce a grid from a 
better geoid model. While an interesting problem to handle I think it is taking 
it just a step too far.

/Kristian

Fra: C Hamilton 
Sendt: 25. september 2018 16:27
Til: Kristian Evers 
Cc: Nyall Dawson ; qgis-developer 

Emne: Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0

Kristian,

Thanks for those calculations. Before this discussion I was contemplating doing 
a line and polygon measurement tool for Shape Tools by clicking on an existing 
shape and using geographiclib calculate the measurements, but if it is possible 
to replace the existing QGIS measuring functions and Vincinty with 
geographiclib, then I will hold off. Shape Tools uses geographiclib for all its 
calculations and I am pleased with it. In the last release I included a 
function to measure all geometry on a layer.

I don't know who has the most accurate algorithm. I just checked Google Earth 
and it measures your polygon at 14,672 km^2. I'm guessing Google Earth is not 
as accurate as some of those other applications. As far as I know geographiclib 
has the most accurate ellipsoid calculations. The only thing better would be to 
include elevation. I'm not an expert in this area, but would the gravity models 
provide more accuracy?

https://geographiclib.sourceforge.io/html/gravity.html#gravityinst

Calvin


On Tue, Sep 25, 2018 at 9:31 AM, Kristian Evers 
mailto:kr...@sdfe.dk>> wrote:
Right, here are the calculated areas as returned by a number of different GIS 
applications and the planimeter app of GeographicLib for reference:

Caris LOTS: 14.737 km^2
ArcMap: 14.727,446 km^2
MapInfo:14.727,352 km^2
GeoMedia:   14.726,443 km^2
Planimeter: 14.722,522 km^2
QGIS 3.2:   14.652,181 km^2
QGIS 2.8:   14.652,181 km^2

The polygon that I have used to get the numbers above can be found here: 
https://gist.github.com/kbevers/207b5bcb9be20e7554abe5f56742ec2c

I am quite confident that GeographicLib delivers the most accurate result (if 
you have doubts, this reference [0] should convince you). As can be seen from 
the table above all but QGIS come fairly close. I expect some variation in the 
results as these are numerical approximations, although I think QGIS is too far 
of the mark. My suspicion is that the geodesic algorithm used by QGIS (and 
apparently GRASS) is to blame here.

/Kristian

[0] https://arxiv.org/pdf/1102.1215.pdf

-Oprindelig meddelelse-
Fra: QGIS-Developer 
mailto:qgis-developer-boun...@lists.osgeo.org>>
 På vegne af Kristian Evers
Sendt: 25. september 2018 09:15
Til: Nyall Dawson mailto:nyall.daw...@gmail.com>>
Cc: qgis-developer 
mailto:qgis-developer@lists.osgeo.org>>
Emne: Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0

It's not a small area, that's why I have been nitpicking ellipsoid area 
calculation
algorithms!
I did end up doing the calculations with geographiblib to get a reference to 
judge
various other calculations by. It's a pain in the butt to extract the data from 
a
polygon shapefile (or whatever) and format it to suit the planimeter app of
geographiclib. It would be so much cooler if I could get the same results by
clicking info on a polygon in QGIS :-)

/Kristian


-Oprindelig meddelelse-
Fra: Nyall Dawson mailto:nyall.daw...@gmail.com>>
Sendt: 25. september 2018 09:07
Til: Kristian Evers mailto:kr...@sdfe.dk>>
Cc: Paolo Cavallini mailto:cavall...@faunalia.it>>; 
qgis-developer 
mailto:qgis-developer@lists.osgeo.org>>
Emne: Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0

On Tue, 25 Sep 2018 at 16:59, Kristian Evers 
mailto:kr...@sdfe.dk>> wrote:
>
> Hi Paolo,
>
> I have some rought notes that I can try to polish up a bit and share here.
> I'll see if I can find the time for that today. I didn't get to the bottom of
> the problem but I am leaning towards the issue being that QGIS uses an
> inferior algorithm to determine geodesics. Unfortunately I couldn't find out
> from either the source code or the documentation which algorithm is used.
> As far as I remember it differs from the otherwise popular algorithm by
> Vincenty. That may be because a different algorithm is 

Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0

2018-09-25 Thread C Hamilton
Kristian,

Thanks for those calculations. Before this discussion I was contemplating
doing a line and polygon measurement tool for Shape Tools by clicking on an
existing shape and using geographiclib calculate the measurements, but if
it is possible to replace the existing QGIS measuring functions and
Vincinty with geographiclib, then I will hold off. Shape Tools uses
geographiclib for all its calculations and I am pleased with it. In the
last release I included a function to measure all geometry on a layer.

I don't know who has the most accurate algorithm. I just checked Google
Earth and it measures your polygon at 14,672 km^2. I'm guessing Google
Earth is not as accurate as some of those other applications. As far as I
know geographiclib has the most accurate ellipsoid calculations. The only
thing better would be to include elevation. I'm not an expert in this area,
but would the gravity models provide more accuracy?

https://geographiclib.sourceforge.io/html/gravity.html#gravityinst

Calvin


On Tue, Sep 25, 2018 at 9:31 AM, Kristian Evers  wrote:

> Right, here are the calculated areas as returned by a number of different
> GIS applications and the planimeter app of GeographicLib for reference:
>
> Caris LOTS: 14.737 km^2
> ArcMap: 14.727,446 km^2
> MapInfo:14.727,352 km^2
> GeoMedia:   14.726,443 km^2
> Planimeter: 14.722,522 km^2
> QGIS 3.2:   14.652,181 km^2
> QGIS 2.8:   14.652,181 km^2
>
> The polygon that I have used to get the numbers above can be found here:
> https://gist.github.com/kbevers/207b5bcb9be20e7554abe5f56742ec2c
>
> I am quite confident that GeographicLib delivers the most accurate result
> (if you have doubts, this reference [0] should convince you). As can be
> seen from the table above all but QGIS come fairly close. I expect some
> variation in the results as these are numerical approximations, although I
> think QGIS is too far of the mark. My suspicion is that the geodesic
> algorithm used by QGIS (and apparently GRASS) is to blame here.
>
> /Kristian
>
> [0] https://arxiv.org/pdf/1102.1215.pdf
>
> -Oprindelig meddelelse-
> Fra: QGIS-Developer  På vegne af
> Kristian Evers
> Sendt: 25. september 2018 09:15
> Til: Nyall Dawson 
> Cc: qgis-developer 
> Emne: Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0
>
> It's not a small area, that's why I have been nitpicking ellipsoid area
> calculation
> algorithms!
> I did end up doing the calculations with geographiblib to get a reference
> to judge
> various other calculations by. It's a pain in the butt to extract the data
> from a
> polygon shapefile (or whatever) and format it to suit the planimeter app of
> geographiclib. It would be so much cooler if I could get the same results
> by
> clicking info on a polygon in QGIS :-)
>
> /Kristian
>
>
> -Oprindelig meddelelse-
> Fra: Nyall Dawson 
> Sendt: 25. september 2018 09:07
> Til: Kristian Evers 
> Cc: Paolo Cavallini ; qgis-developer <
> qgis-developer@lists.osgeo.org>
> Emne: Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0
>
> On Tue, 25 Sep 2018 at 16:59, Kristian Evers  wrote:
> >
> > Hi Paolo,
> >
> > I have some rought notes that I can try to polish up a bit and share
> here.
> > I'll see if I can find the time for that today. I didn't get to the
> bottom of
> > the problem but I am leaning towards the issue being that QGIS uses an
> > inferior algorithm to determine geodesics. Unfortunately I couldn't find
> out
> > from either the source code or the documentation which algorithm is used.
> > As far as I remember it differs from the otherwise popular algorithm by
> > Vincenty. That may be because a different algorithm is used or the
> > Implementation is wrong.
> >
> > I'll get back with a better write-up later and some test data and
> results.
>
> We use a direct port from GRASS:
>
> https://github.com/qgis/QGIS/blob/master/src/core/qgsdistancearea.cpp#L690
>
> vs GRASS upstream:
>
> https://trac.osgeo.org/grass/browser/grass/trunk/lib/gis/
> area_poly1.c?rev=71260
>
> It's not very stable for very small areas -- better to use cartesian
> calculations there. Or bring in geographiclib and punt the
> responsibility elsewhere ;)
>
> Nyall
>
>
>
> >
> > /Kristian
> >
> > -Oprindelig meddelelse-
> > Fra: QGIS-Developer  På vegne
> af Paolo Cavallini
> > Sendt: 25. september 2018 08:23
> > Til: qgis-developer@lists.osgeo.org
> > Emne: Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0
> >
> > Hi Kristian,
> >
> >
> > Il 09/25/2018 07:24 AM, Kristian Evers ha scritto:
> > >
> > >
> > > On a related note, I have been meaning to raise a similar issue based
> > > on QGIS’s not so accurate polygon-area-on-the-ellipsoid calculations.
> > > A colleague of mine came across some differences between QGIS and
> > > CARIS LOTS while doing area calculations in relation to a border
> > > dispute at sea. After that I tested several popular closed source GIS
> > > apps and they all performed better than QGIS.

Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0

2018-09-25 Thread Kristian Evers
Right, here are the calculated areas as returned by a number of different GIS 
applications and the planimeter app of GeographicLib for reference:

Caris LOTS: 14.737 km^2
ArcMap: 14.727,446 km^2
MapInfo:14.727,352 km^2
GeoMedia:   14.726,443 km^2
Planimeter: 14.722,522 km^2
QGIS 3.2:   14.652,181 km^2
QGIS 2.8:   14.652,181 km^2

The polygon that I have used to get the numbers above can be found here: 
https://gist.github.com/kbevers/207b5bcb9be20e7554abe5f56742ec2c

I am quite confident that GeographicLib delivers the most accurate result (if 
you have doubts, this reference [0] should convince you). As can be seen from 
the table above all but QGIS come fairly close. I expect some variation in the 
results as these are numerical approximations, although I think QGIS is too far 
of the mark. My suspicion is that the geodesic algorithm used by QGIS (and 
apparently GRASS) is to blame here.

/Kristian

[0] https://arxiv.org/pdf/1102.1215.pdf 

-Oprindelig meddelelse-
Fra: QGIS-Developer  På vegne af 
Kristian Evers
Sendt: 25. september 2018 09:15
Til: Nyall Dawson 
Cc: qgis-developer 
Emne: Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0

It's not a small area, that's why I have been nitpicking ellipsoid area 
calculation
algorithms!
I did end up doing the calculations with geographiblib to get a reference to 
judge
various other calculations by. It's a pain in the butt to extract the data from 
a
polygon shapefile (or whatever) and format it to suit the planimeter app of
geographiclib. It would be so much cooler if I could get the same results by
clicking info on a polygon in QGIS :-)

/Kristian


-Oprindelig meddelelse-
Fra: Nyall Dawson  
Sendt: 25. september 2018 09:07
Til: Kristian Evers 
Cc: Paolo Cavallini ; qgis-developer 

Emne: Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0

On Tue, 25 Sep 2018 at 16:59, Kristian Evers  wrote:
>
> Hi Paolo,
>
> I have some rought notes that I can try to polish up a bit and share here.
> I'll see if I can find the time for that today. I didn't get to the bottom of
> the problem but I am leaning towards the issue being that QGIS uses an
> inferior algorithm to determine geodesics. Unfortunately I couldn't find out
> from either the source code or the documentation which algorithm is used.
> As far as I remember it differs from the otherwise popular algorithm by
> Vincenty. That may be because a different algorithm is used or the
> Implementation is wrong.
>
> I'll get back with a better write-up later and some test data and results.

We use a direct port from GRASS:

https://github.com/qgis/QGIS/blob/master/src/core/qgsdistancearea.cpp#L690

vs GRASS upstream:

https://trac.osgeo.org/grass/browser/grass/trunk/lib/gis/area_poly1.c?rev=71260

It's not very stable for very small areas -- better to use cartesian
calculations there. Or bring in geographiclib and punt the
responsibility elsewhere ;)

Nyall



>
> /Kristian
>
> -Oprindelig meddelelse-
> Fra: QGIS-Developer  På vegne af 
> Paolo Cavallini
> Sendt: 25. september 2018 08:23
> Til: qgis-developer@lists.osgeo.org
> Emne: Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0
>
> Hi Kristian,
>
>
> Il 09/25/2018 07:24 AM, Kristian Evers ha scritto:
> >
> >
> > On a related note, I have been meaning to raise a similar issue based
> > on QGIS’s not so accurate polygon-area-on-the-ellipsoid calculations.
> > A colleague of mine came across some differences between QGIS and
> > CARIS LOTS while doing area calculations in relation to a border
> > dispute at sea. After that I tested several popular closed source GIS
> > apps and they all performed better than QGIS.
> this is worth exploring in detail. could you please be more specific? do
> you have a test case? could you share the results, or give us a way to
> replicate them?
> Thanks.
>
> --
> Paolo Cavallini - www.faunalia.eu
> QGIS.ORG Chair:
> http://planet.qgis.org/planet/user/28/tag/qgis%20board/
>
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[QGIS-Developer] open atlas layout, using python

2018-09-25 Thread Raymond Nijssen

1. Can I open a layout window with a python command?

2. Can I turn on "atlas preview" with a python command?

Hope anyone knows!

Kind regards,
Raymond

___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] [Qgis-psc] Fwd: Documentation writing

2018-09-25 Thread DelazJ
Hi all (sorry for the cross-posting but it's because the call was made if
I'm not wrong on all the three channels)

Thanks to those that already applied and happy to see that Documentation
repo will likely be lively in upcoming weeks.
If that can help to attract more people, these are some of the main areas I
feel the documentation is far behind (or the features I think would be
worth describing in priority in official manuals - not sorted):

* 3D formats and features: up to now no word has been written about
although I think this could be an attractive feature
* the user profiles behavior: another big change on the settings philosophy
that impact everybody and would deserve some literature
* the processing system and particularly "graphical modeler": The
algorithms, and particularly native ones, are well covered, But the
Processing options and more important the modelers are less behind imho
* the QGIS Server: can't really tell how the doc is in this area but there
are a lot of pending issues in the repo
* the print layout reporting
* attribute table and custom forms/widgets
* unfortunately as usual, the PyQGIS doc ...
* ... and the data source manager dialog (particularly some of the tabs at
the bottom of the dialog)
* and of course, any other area you think you know better...

Some ideas for those willing to apply and write docs.

Hope that helps,
Harrissou

Le mer. 19 sept. 2018 à 11:27, Paolo Cavallini  a
écrit :

> One more:
> Frank Sokolic  
> * I am interested in updating grammar and writing style as I am a native 
> English speaker
> * I can take responsibility for any part of the documentation that you 
> allocate to me
> * I am available for 20 hours to help with documentation.
>
>
> Il 09/19/2018 09:31 AM, Régis Haubourg ha scritto:
>
> Hi all,
>
> Paul Blottiere is also available to work on QGIS server documentation.
>
> Best regards
>
> Régis
>
> On 19/09/2018 07:26, Paolo Cavallini wrote:
>
> Hi all,
>
> this is what we have for now:
> Tim Sutton  
> available to do general documentation writing and English review of
> submitted documentation
>
> Tudor barascu  
> available to write and review documentation.
> At first I would like to focus and finish whatever is  left from the
> server side
>
> matteo  
> Both write and review.
>
> Yves Jacolin  
> review some PR
>
> Alexandre Neto  
> some surgical interventions instead and some reviews when possible
>
> David Forel  
> I am open to reviewing anyone's English text
>
> Not much in effect. Let's wait a few days and then we can start budgeting
> and assigning tasks.
> All the best.
>
>  Messaggio Inoltrato 
> Oggetto: [QGIS-Developer] Documentation writing
> Data: Mon, 17 Sep 2018 11:30:26 +0200
> Mittente: Paolo Cavallini  
> A: qgis-developer 
> 
>
> Hi all,
>
> as you know, next LTR (3.4) is coming soon. Its documentation is lagging
> behind, so the PSC decided to invest in updating it. Those of you who
> are interested in writing it please reply to this message stating;
>
> * which part of documentation you are interested in updating
>
> * if you can take the responsibility for completing it, or if it's just
> for a part of it
>
> * for how many hours (approx) you are available.
>
> This will allow us to correctly budget this task. We welcome anyone, and
> will give priority to those who already wrote substantial parts of the
> current docs.
>
> All the best, and thanks.
>
> --
> Paolo Cavallini - www.faunalia.euQGIS.ORG 
> Chair:http://planet.qgis.org/planet/user/28/tag/qgis%20board/
>
>
> ___
> QGIS-Developer mailing listqgis-develo...@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
>
> ___
> Qgis-psc mailing 
> listQgis-psc@lists.osgeo.orghttps://lists.osgeo.org/mailman/listinfo/qgis-psc
>
>
> --
> Open Source GIS Expert / Water management
>
> mail: regis.haubo...@oslandia.com
> tél: 0033 184 257 870
> -http://oslandia.com/
>
> OSLANDIA IS AN INNOVATIVE COMPANY SPECIALIZED IN GIS ARCHITECTURE. WE
> PROVIDE SERVICE ON OPEN SOURCE SOFTWARE FOR WHICH WE ARE EDITORS OR
> RECOGNIZED EXPERTS.
>
>
>
> ___
> Qgis-psc mailing 
> listQgis-psc@lists.osgeo.orghttps://lists.osgeo.org/mailman/listinfo/qgis-psc
>
>
> --
> Paolo Cavallini - www.faunalia.euQGIS.ORG 
> Chair:http://planet.qgis.org/planet/user/28/tag/qgis%20board/
>
> ___
> Qgis-psc mailing list
> qgis-...@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/qgis-psc
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[QGIS-Developer] Plugin [1410] ImportPhotos approval notification.

2018-09-25 Thread noreply

Plugin ImportPhotos approval by pcav.
The plugin version "[1410] ImportPhotos 1.4" is now approved
Link: http://plugins.qgis.org/plugins/ImportPhotos/
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0

2018-09-25 Thread Mark Johnson
>> We use a direct port from GRASS:
This may also be caused by:

/*
 *  From original rttopo documentation:
 *  Tested against:
 *   http://mascot.gdbc.gov.bc.ca/mascot/util1b.html
 *  and
 *   http://www.ga.gov.au/nmd/geodesy/datums/vincenty_direct.jsp
 */
QgsPointXY QgsDistanceArea::computeSpheroidProject(
  const QgsPointXY , double distance, double azimuth ) const

which is used in rtspheroid.c when GeographicLib is not avaliable.

Mark
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0

2018-09-25 Thread Kristian Evers
It's not a small area, that's why I have been nitpicking ellipsoid area 
calculation
algorithms!
I did end up doing the calculations with geographiblib to get a reference to 
judge
various other calculations by. It's a pain in the butt to extract the data from 
a
polygon shapefile (or whatever) and format it to suit the planimeter app of
geographiclib. It would be so much cooler if I could get the same results by
clicking info on a polygon in QGIS :-)

/Kristian


-Oprindelig meddelelse-
Fra: Nyall Dawson  
Sendt: 25. september 2018 09:07
Til: Kristian Evers 
Cc: Paolo Cavallini ; qgis-developer 

Emne: Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0

On Tue, 25 Sep 2018 at 16:59, Kristian Evers  wrote:
>
> Hi Paolo,
>
> I have some rought notes that I can try to polish up a bit and share here.
> I'll see if I can find the time for that today. I didn't get to the bottom of
> the problem but I am leaning towards the issue being that QGIS uses an
> inferior algorithm to determine geodesics. Unfortunately I couldn't find out
> from either the source code or the documentation which algorithm is used.
> As far as I remember it differs from the otherwise popular algorithm by
> Vincenty. That may be because a different algorithm is used or the
> Implementation is wrong.
>
> I'll get back with a better write-up later and some test data and results.

We use a direct port from GRASS:

https://github.com/qgis/QGIS/blob/master/src/core/qgsdistancearea.cpp#L690

vs GRASS upstream:

https://trac.osgeo.org/grass/browser/grass/trunk/lib/gis/area_poly1.c?rev=71260

It's not very stable for very small areas -- better to use cartesian
calculations there. Or bring in geographiclib and punt the
responsibility elsewhere ;)

Nyall



>
> /Kristian
>
> -Oprindelig meddelelse-
> Fra: QGIS-Developer  På vegne af 
> Paolo Cavallini
> Sendt: 25. september 2018 08:23
> Til: qgis-developer@lists.osgeo.org
> Emne: Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0
>
> Hi Kristian,
>
>
> Il 09/25/2018 07:24 AM, Kristian Evers ha scritto:
> >
> >
> > On a related note, I have been meaning to raise a similar issue based
> > on QGIS’s not so accurate polygon-area-on-the-ellipsoid calculations.
> > A colleague of mine came across some differences between QGIS and
> > CARIS LOTS while doing area calculations in relation to a border
> > dispute at sea. After that I tested several popular closed source GIS
> > apps and they all performed better than QGIS.
> this is worth exploring in detail. could you please be more specific? do
> you have a test case? could you share the results, or give us a way to
> replicate them?
> Thanks.
>
> --
> Paolo Cavallini - www.faunalia.eu
> QGIS.ORG Chair:
> http://planet.qgis.org/planet/user/28/tag/qgis%20board/
>
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0

2018-09-25 Thread Nyall Dawson
On Tue, 25 Sep 2018 at 16:59, Kristian Evers  wrote:
>
> Hi Paolo,
>
> I have some rought notes that I can try to polish up a bit and share here.
> I'll see if I can find the time for that today. I didn't get to the bottom of
> the problem but I am leaning towards the issue being that QGIS uses an
> inferior algorithm to determine geodesics. Unfortunately I couldn't find out
> from either the source code or the documentation which algorithm is used.
> As far as I remember it differs from the otherwise popular algorithm by
> Vincenty. That may be because a different algorithm is used or the
> Implementation is wrong.
>
> I'll get back with a better write-up later and some test data and results.

We use a direct port from GRASS:

https://github.com/qgis/QGIS/blob/master/src/core/qgsdistancearea.cpp#L690

vs GRASS upstream:

https://trac.osgeo.org/grass/browser/grass/trunk/lib/gis/area_poly1.c?rev=71260

It's not very stable for very small areas -- better to use cartesian
calculations there. Or bring in geographiclib and punt the
responsibility elsewhere ;)

Nyall



>
> /Kristian
>
> -Oprindelig meddelelse-
> Fra: QGIS-Developer  På vegne af 
> Paolo Cavallini
> Sendt: 25. september 2018 08:23
> Til: qgis-developer@lists.osgeo.org
> Emne: Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0
>
> Hi Kristian,
>
>
> Il 09/25/2018 07:24 AM, Kristian Evers ha scritto:
> >
> >
> > On a related note, I have been meaning to raise a similar issue based
> > on QGIS’s not so accurate polygon-area-on-the-ellipsoid calculations.
> > A colleague of mine came across some differences between QGIS and
> > CARIS LOTS while doing area calculations in relation to a border
> > dispute at sea. After that I tested several popular closed source GIS
> > apps and they all performed better than QGIS.
> this is worth exploring in detail. could you please be more specific? do
> you have a test case? could you share the results, or give us a way to
> replicate them?
> Thanks.
>
> --
> Paolo Cavallini - www.faunalia.eu
> QGIS.ORG Chair:
> http://planet.qgis.org/planet/user/28/tag/qgis%20board/
>
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] is_layer_active expression

2018-09-25 Thread Nyall Dawson
On Tue, 25 Sep 2018 at 16:43, Otto Dassau  wrote:
>
> thanks for the info Nyall!

Ok, PR opened. https://github.com/qgis/QGIS/pull/8016

But for reference -- I think what's going to be more useful for layout
use is the 3.4 @map_layers variable. As noted in the earlier reply,
some functions are context dependent, and is_layer_visible is one of
these. So in 3.4 it will work *within* a layout item map, it won't
allow you to e.g. have a label item outside the map change its content
based on is_layer_visible.

On the other hand, you *can* retrieve expression variables (not
functions!) from another layout item, using the item_variables
function! So you can build the expression:

   map_get( item_variables( 'Your_Map_ID' ), 'map_layers' )

To retrieve a list of map layers within the Your_Map_Id map item, and
this expression will work anywhere inside the layout! (i.e. labels,
data defined expressions, etc).

One intended use case for this is to allow labels with expressions like:

   array_to_string( array_foreach(map_get( item_variables(
'Your_Map_ID' ), 'map_layers' ), layer_property(@element, 'name')),
',' )

To get a nice comma separated list of all layers included in the map
item. (Admittedly, that expression is quite complex, but if you pick
it apart piece by piece you should be able to decipher it!).

Nyall




>
> Regards,
> Otto
>
> Am Tue, 25 Sep 2018 16:37:38 +1000
> schrieb Nyall Dawson :
>
> > On Mon, 24 Sep 2018 at 19:20, Otto Dassau  wrote:
> > >
> > > Dear Devs,
> > >
> > > in QGIS 3 I found the expression "is_layer_active" within the copyright
> > > decoration very useful. I would like to use this expression also within
> > > the print composer, but it seems to be not available there.
> >
> > Confirmed -- fix incoming!
> >
> > > Is this correct, are expressions not available all over QGIS within the
> > > expression builder?
> >
> > Some expression functions/variables are "context dependent". E.g.
> > is_layer_visible doesn't make any sense in expressions which aren't
> > directly associated with a map. So the function won't be available as
> > for expressions used as a field default value, or for a layout text
> > label (since the layout may have multiple maps, each with a different
> > layer set, and a label isn't linked to any map item in particular!).
> >
> > > And how can I get this expression working for the print composer as
> > > well?
> >
> > Wait for 3.4 ;)
> >
> > Nyall
>
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0

2018-09-25 Thread Kristian Evers
Hi Paolo,

I have some rought notes that I can try to polish up a bit and share here.
I'll see if I can find the time for that today. I didn't get to the bottom of
the problem but I am leaning towards the issue being that QGIS uses an
inferior algorithm to determine geodesics. Unfortunately I couldn't find out
from either the source code or the documentation which algorithm is used.
As far as I remember it differs from the otherwise popular algorithm by
Vincenty. That may be because a different algorithm is used or the
Implementation is wrong.

I'll get back with a better write-up later and some test data and results.

/Kristian

-Oprindelig meddelelse-
Fra: QGIS-Developer  På vegne af Paolo 
Cavallini
Sendt: 25. september 2018 08:23
Til: qgis-developer@lists.osgeo.org
Emne: Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0

Hi Kristian,


Il 09/25/2018 07:24 AM, Kristian Evers ha scritto:
>
>
> On a related note, I have been meaning to raise a similar issue based
> on QGIS’s not so accurate polygon-area-on-the-ellipsoid calculations.
> A colleague of mine came across some differences between QGIS and
> CARIS LOTS while doing area calculations in relation to a border
> dispute at sea. After that I tested several popular closed source GIS
> apps and they all performed better than QGIS.
this is worth exploring in detail. could you please be more specific? do
you have a test case? could you share the results, or give us a way to
replicate them?
Thanks.

-- 
Paolo Cavallini - www.faunalia.eu
QGIS.ORG Chair:
http://planet.qgis.org/planet/user/28/tag/qgis%20board/

___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] is_layer_active expression

2018-09-25 Thread Otto Dassau
thanks for the info Nyall!

Regards, 
Otto

Am Tue, 25 Sep 2018 16:37:38 +1000
schrieb Nyall Dawson :

> On Mon, 24 Sep 2018 at 19:20, Otto Dassau  wrote:
> >
> > Dear Devs,
> >
> > in QGIS 3 I found the expression "is_layer_active" within the copyright
> > decoration very useful. I would like to use this expression also within
> > the print composer, but it seems to be not available there.  
> 
> Confirmed -- fix incoming!
> 
> > Is this correct, are expressions not available all over QGIS within the
> > expression builder?  
> 
> Some expression functions/variables are "context dependent". E.g.
> is_layer_visible doesn't make any sense in expressions which aren't
> directly associated with a map. So the function won't be available as
> for expressions used as a field default value, or for a layout text
> label (since the layout may have multiple maps, each with a different
> layer set, and a label isn't linked to any map item in particular!).
> 
> > And how can I get this expression working for the print composer as
> > well?  
> 
> Wait for 3.4 ;)
> 
> Nyall

___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] is_layer_active expression

2018-09-25 Thread Nyall Dawson
On Mon, 24 Sep 2018 at 19:20, Otto Dassau  wrote:
>
> Dear Devs,
>
> in QGIS 3 I found the expression "is_layer_active" within the copyright
> decoration very useful. I would like to use this expression also within the
> print composer, but it seems to be not available there.

Confirmed -- fix incoming!

> Is this correct, are expressions not available all over QGIS within the
> expression builder?

Some expression functions/variables are "context dependent". E.g.
is_layer_visible doesn't make any sense in expressions which aren't
directly associated with a map. So the function won't be available as
for expressions used as a field default value, or for a layout text
label (since the layout may have multiple maps, each with a different
layer set, and a label isn't linked to any map item in particular!).

> And how can I get this expression working for the print composer as well?

Wait for 3.4 ;)

Nyall
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] [Qgis-user] New Features in Shape Tools 3.2.0

2018-09-25 Thread Paolo Cavallini
Hi Kristian,


Il 09/25/2018 07:24 AM, Kristian Evers ha scritto:
>
>
> On a related note, I have been meaning to raise a similar issue based
> on QGIS’s not so accurate polygon-area-on-the-ellipsoid calculations.
> A colleague of mine came across some differences between QGIS and
> CARIS LOTS while doing area calculations in relation to a border
> dispute at sea. After that I tested several popular closed source GIS
> apps and they all performed better than QGIS.
this is worth exploring in detail. could you please be more specific? do
you have a test case? could you share the results, or give us a way to
replicate them?
Thanks.

-- 
Paolo Cavallini - www.faunalia.eu
QGIS.ORG Chair:
http://planet.qgis.org/planet/user/28/tag/qgis%20board/

___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer