Re: [Qgis-user] How do I pass parameters to grass7 algorithms with Processing.run?

2018-05-27 Thread Nyall Dawson
On 14 May 2018 at 19:30, Stephen  wrote:
>
> Automatically setting output paths to temporary files would be a
> sensible convenience, I think.
>
> In any event, I used processing.tools.system.getTempFilename() to set a
> filename and that gets me past the 'Incorrect parameter value for
> output' error.
>
> However, I am still getting "Unable to execute algorithm".
>
> In AlgorithmExecutor, line 55:
> results, ok = alg.run(parameters, context, feedback)
>
> returns ({}, False)
>
> parameters contains:
>
> {'GRASS_REGION_CELLSIZE_PARAMETER': 0.008333, 'use': 1,
> 'GRASS_REGION_PARAMETER':
> '33.91415594546105,41.91384412832699,-4.679722671256611,5.467319665842772',
> 'input': ,
> 'GRASS_MIN_AREA_PARAMETER': 0.0001, 'GRASS_SNAP_TOLERANCE_PARAMETER':
> -1, 'type': 0, 'output':
> '/tmp/processing_da49d2e8c1bd4e249d1a5c6d42680149/5af9540a0b2212'}
>
> context contains:
>
> 
>
> and feedback contains:
>
> 
>
> Without a useful error message, it's very difficult to troubleshoot this
> on my own.
>
> Do you have any idea what might be wrong here?

I had another look at this. I suspect what might be happening is that
'tmp/processing_da49d2e8c1bd4e249d1a5c6d42680149/5af9540a0b2212' does
not exist, which makes GRASS bomb out with a 'No such file or
directory' error.

Are you running this script from within QGIS itself? You should see
the detailed log, including all the output from grass, by opening the
log window and switching to the "Processing" tab (alternatively
running from a terminal window will also show this output on the
command line).

Nyall
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] Preserving geometry when batching joins

2018-05-27 Thread Nicolas Cadieux
Hi,
Once you have joined the geometry file to the matching attribute file, you 
should be able to save that as a shape file.  If you can’t figure it out, put a 
sample on the next email.
Nicolas

> Le 27 mai 2018 à 17:10, Samuel Williams  
> a écrit :
> 
> Hello,
> 
> I've hit a issue in Qgis that I'm struggling to resolve, and I'm hoping that 
> someone might be able to point me in the right direction.
> 
> I have 12 point geometry data sets and 12 csv files. Each csv file contain 
> the attributes for one of the point data sets - there are exactly the same 
> number of records in each point / csv pair:
> 
> Points1.shp:
> -- point 1 UID
> -- point 2 UID
> ..
> -- point 980 UID
> 
> Attributes1.csv:
> -- record 1 (Point 1 UID, blah, blah, whatever)
> -- record 2 (Point 2 UID, blah, blah, whatever)
> ...
> -- record 980 (Point 980 UID, blah, blah, whatever)
> 
> I've loaded them all into Qgis and was hoping that I could join them as a 
> batch process, so that I end up with 12 point geometry shapefiles, with each 
> point associated with the equivalent record from the matching csv file 
> I've had some success, in that the batch interface to join allows me to list 
> the input layers, fields for the joins and the output file names very easily, 
> but I can't work out how to preserve the geometry of the points. The only 
> file type listed that I can save are DBF / XLSX / CSV / ODS files, which will 
> only preserve the joined tables not the geometry.
> 
> Am I approaching this whole problem in the wrong way, or is there something 
> very obvious that I've missed?
> 
> I'm using:
> QGIS version
> 2.18.17
> QGIS code branch
> Release 2.18
> Compiled against Qt
> 4.8.7
> Running against Qt
> 4.8.7
> Compiled against GDAL/OGR
> 2.2.3
> Running against GDAL/OGR
> 2.2.3
> Compiled against GEOS
> 3.6.2-CAPI-1.10.2
> Running against GEOS
> 3.6.2-CAPI-1.10.2 4d2925d6
> PostgreSQL Client Version
> 10.2 (Ubuntu 10.2-1)
> SpatiaLite Version
> 4.3.0a
> QWT Version
> 6.1.3
> PROJ.4 Version
> 493
> QScintilla2 Version
> 2.10.2
> This particular workstation is running Ubuntu 18.04 on amd64 hardware.
> 
> Any suggestions welcomed - I know that for just 12 data sets I could probably 
> have done the joins manually in the time it has taken to type this out, but 
> I'm really curious as to whether there is a better way.
> 
> Cheers,
> 
> Sam
> 
> 
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] Contours generation problem.

2018-05-27 Thread Nyall Dawson
On 28 May 2018 at 06:32, Xero  wrote:
> Hello I have a problem when trying to generate a contour on a raster. Every
> time I start the processus I've got this error message :
> /Traitement de l'algorithme ...
> AlgorithmDialog
> Input parameters:
> { 'BAND' : 1, 'CREATE_3D' : False, 'FIELD_NAME' : 'ELEV', 'IGNORE_NODATA' :
> False, 'INPUT' : '/Users/arnomak/Desktop/RDB DEM/Agisoft/DEM.tif',
> 'INTERVAL' : 10, 'NODATA' : 0, 'OFFSET' : 0, 'OUTPUT' :
> '/var/folders/22/h094_46j6fs1y_hp6gf81r80gn/T/processing_5ac940d3667d4295b56d8931c0ec3a61/813de11bbc234ad792da768934852d05/OUTPUT.shp'
> }
>
> GDAL command:
> gdal_contour -b 1 -a ELEV -i 10.0 -snodata 0.0 -f "ESRI Shapefile"
> "/Users/arnomak/Desktop/RDB DEM/Agisoft/DEM.tif"
> "/var/folders/22/h094_46j6fs1y_hp6gf81r80gn/T/processing_5ac940d3667d4295b56d8931c0ec3a61/813de11bbc234ad792da768934852d05/OUTPUT.shp"
> GDAL command output:
> /bin/sh: gdal_contour: command not found

Here's the error ^^. QGIS can't run gdal_contour, so it's likely not
available on your workstation. Try running gdal_contour from a
terminal window and see if it works there. If not, I suspect you'r
missing a required gdal package.

Nyall
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

[Qgis-user] Preserving geometry when batching joins

2018-05-27 Thread Samuel Williams
Hello,

I've hit a issue in Qgis that I'm struggling to resolve, and I'm hoping that 
someone might be able to point me in the right direction.
I have 12 point geometry data sets and 12 csv files. Each csv file contain the 
attributes for one of the point data sets - there are exactly the same number 
of records in each point / csv pair:
Points1.shp:
-- point 1 UID
-- point 2 UID
..
-- point 980 UID

Attributes1.csv:
-- record 1 (Point 1 UID, blah, blah, whatever)
-- record 2 (Point 2 UID, blah, blah, whatever)
...
-- record 980 (Point 980 UID, blah, blah, whatever)

I've loaded them all into Qgis and was hoping that I could join them as a batch 
process, so that I end up with 12 point geometry shapefiles, with each point 
associated with the equivalent record from the matching csv file I've had 
some success, in that the batch interface to join allows me to list the input 
layers, fields for the joins and the output file names very easily, but I can't 
work out how to preserve the geometry of the points. The only file type listed 
that I can save are DBF / XLSX / CSV / ODS files, which will only preserve the 
joined tables not the geometry.
Am I approaching this whole problem in the wrong way, or is there something 
very obvious that I've missed?
I'm using:

QGIS version

2.18.17

QGIS code branch

Release 2.18 
(https://link.getmailspring.com/link/1527454204.local-f62ddf4d-2b7e-v1.2.1-7e744...@getmailspring.com/0?redirect=https%3A%2F%2Fgithub.com%2Fqgis%2FQGIS%2Ftree%2Frelease-2_18=cWdpcy11c2VyQGxpc3RzLm9zZ2VvLm9yZw%3D%3D)

Compiled against Qt

4.8.7

Running against Qt

4.8.7

Compiled against GDAL/OGR

2.2.3

Running against GDAL/OGR

2.2.3

Compiled against GEOS

3.6.2-CAPI-1.10.2

Running against GEOS

3.6.2-CAPI-1.10.2 4d2925d6

PostgreSQL Client Version

10.2 (Ubuntu 10.2-1)

SpatiaLite Version

4.3.0a

QWT Version

6.1.3

PROJ.4 Version

493

QScintilla2 Version

2.10.2

This particular workstation is running Ubuntu 18.04 on amd64 hardware.

Any suggestions welcomed - I know that for just 12 data sets I could probably 
have done the joins manually in the time it has taken to type this out, but I'm 
really curious as to whether there is a better way.
Cheers,
Sam
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

[Qgis-user] Contours generation problem.

2018-05-27 Thread Xero
Hello I have a problem when trying to generate a contour on a raster. Every
time I start the processus I've got this error message :
/Traitement de l'algorithme ...
AlgorithmDialog
Input parameters:
{ 'BAND' : 1, 'CREATE_3D' : False, 'FIELD_NAME' : 'ELEV', 'IGNORE_NODATA' :
False, 'INPUT' : '/Users/arnomak/Desktop/RDB DEM/Agisoft/DEM.tif',
'INTERVAL' : 10, 'NODATA' : 0, 'OFFSET' : 0, 'OUTPUT' :
'/var/folders/22/h094_46j6fs1y_hp6gf81r80gn/T/processing_5ac940d3667d4295b56d8931c0ec3a61/813de11bbc234ad792da768934852d05/OUTPUT.shp'
}

GDAL command:
gdal_contour -b 1 -a ELEV -i 10.0 -snodata 0.0 -f "ESRI Shapefile"
"/Users/arnomak/Desktop/RDB DEM/Agisoft/DEM.tif"
"/var/folders/22/h094_46j6fs1y_hp6gf81r80gn/T/processing_5ac940d3667d4295b56d8931c0ec3a61/813de11bbc234ad792da768934852d05/OUTPUT.shp"
GDAL command output:
/bin/sh: gdal_contour: command not found

Execution completed in 0.07 seconds
Results:
{'OUTPUT': }

Chargement des couches de résultat
Les couches suivantes n'ont pas été générées correctement *(translation :
following layers haven't been correctly generated)*
/var/folders/22/h094_46j6fs1y_hp6gf81r80gn/T/processing_5ac940d3667d4295b56d8931c0ec3a61/813de11bbc234ad792da768934852d05/OUTPUT.shp
Vous pouvez vérifier le Panel de messages du journal dans la fenêtre
principale de QGIS pour trouver plus d'informations à propos de l'exécution
de l'algorithme./
Anyone have a clue how to get contours??
Thanks



--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-User-f4125267.html
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] Problems to run grass7 for QGIS 2.18 in OSX

2018-05-27 Thread William Kyngesburye
If you are using the QGIS installer package (as opposed to compiling yourself 
or from Homebrew), Grass 7 is not included in the package, only Grass 6.  Also, 
the .grass7 in your home folder, if it exists, is not the Grass application, 
but user preferences and support files.

You may be able to use the Grass 7 app available from the Grass website, or 
Grass 7 from homebrew.  I have not tried either.

> On May 26, 2018, at 2:34 PM, José Carlos Guerrero Antúnez 
>  wrote:
> 
> Hi,
> 
> How to configure correctly grass7 in QGIS 2.18.15? I'm working in macOS High 
> Sierra 10.13.4.
> 
> I tried two possibilities in Customs paths in Grass Options:
> 
> a)  I changed to
> /Applications/QGIS.app/Contents/MacOS/grass7
> 
> And then, I got this error message
> 
> "Specified path does not exist:"
> 
> b) I changed to 
> /Users/joseca/.grass7
> 
> And then I got this error message
> "unsupported operand type(s) for +: 'NoneType' and 'str' See log for more 
> details"
> 
> What am I doing wrong?
> 
> Kind regards,
> 
> 
> 
> -- 
> José Carlos Guerrero
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

-
William Kyngesburye 
http://www.kyngchaos.com/

"I ache, therefore I am.  Or in my case - I am, therefore I ache."

- Marvin


___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] Plugins repository unavailable for 2.18? On MacOS

2018-05-27 Thread gene
Same result for me (MacOSX Yosemite) with QGIS 2.14.x, 2.16 and 2.18:

PyQt4.QtCore.QUrl(u'https://plugins.qgis.org/plugins/plugins.xml/?qgis=2.14')
PyQt4.QtCore.QUrl(u'https://plugins.qgis.org/plugins/plugins.xml/?qgis=2.16')
PyQt4.QtCore.QUrl(u'https://plugins.qgis.org/plugins/plugins.xml/?qgis=2.18')
None
None
6 



--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-User-f4125267.html
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] Programmatically export layout with georeferenced file

2018-05-27 Thread DelazJ
Hi Nyall

2018-05-25 1:58 GMT+02:00 Nyall Dawson :

> On 25 May 2018 at 03:02, DelazJ  wrote:
> > Hi all,
> >
> > I have a layout on which I checked the "save world file" option in Layout
> > --> Exports settings
> > When I export this layout to image, I'd expect it to generate a world
> file
> > next to it considering that the generateWorldFile is an attribute of the
> > ImageExportSettings class [0]. But no world file.
>
> The GUI setting isn't stored in the layout*  - you need to manually
> set generateWorldFile to true
> in your ImageExportSettings if you want the world file created.
>
>
> > mylayout=QgsProject.instance().layoutManager().layoutByName('Composeur
> 1')
> > exporter = QgsLayoutExporter(mylayout)
> > exporter.exportToImage(filePath, QgsLayoutExporter.ImageExportSettings)
>
> If you want the world file, this should be
>
> exporter = QgsLayoutExporter(mylayout)
> settings = QgsLayoutExporter.ImageExportSettings()
> settings.generateWorldFile = True
> exporter.exportToImage(filePath, settings)
>
> Unfortunately, in my real world use case, I don't know whether the world
file is desired. I'm updating my MapsPrinter plugin [0] which helps
exporting multiple layouts at once.. So I should catch the selection the
user made in the GUI. This leads me to use the customProperty:

exporter = QgsLayoutExporter(mylayout)
settings = QgsLayoutExporter.ImageExportSettings()
settings.generateWorldFile = mylayout.customProperty('exportWorldFile')

leading to this function [1] . It does seem to work but I realize that for
svg particularly, I cannot have access to properties like RDF metadata nor
layered SVG as they are proposed to the user only in the export process. I
understand that there's some unstability in layout(?) customProperty API
but would that be possible to have these options in the layout export
settings frame or what are the plans regarding them (if any)?

Side note on the plugin I'm working on:
1/ I'm trying to count the number of pages that are actually exportable and
use the following code:

page_number, pagesToExport = 0, 0
while page_number < layout.pageCollection().pageCount():
if layout.pageCollection().shouldExportPage(page_number):
pagesToExport += 1
print(pagesToExport)

It seems that layout.pageCollection().shouldExportPage(page_number) always
return true. In a two pages layout, I checked the "Exclude page from
export" option on one page and calling that returns true for both pages.
Exporting from GUI or code does however output only one page. Isn't that
the right property to check?

2/ The count of pages was intended to help me display a progress bar for
each processed page but while this is possible for simple export, it does
not look like there's a way to catch when a page/feature is output in a
atlas configuration. No signal emitted until the end of all the iterations,
right?

Again, thanks Nyall for the help and for having simplified (afaict) the
Python side of layout (despite all my questions - /me sunday Python learner)

Regards,
Harrissou

[0] https://github.com/DelazJ/MapsPrinter/tree/migration_to_v3
[1]
https://github.com/DelazJ/MapsPrinter/commit/1a1adbe6a8500abf5b738c4ec907ff7e02f364fb#diff-a5fa5f963eba950b6c361daae67e552fR670


> > ls=QgsProject.instance().layoutManager().layouts()
> > for elt in ls:
> >   exporter = QgsLayoutExporter(elt)
> >   imgSettings = exporter.ImageExportSettings()
> >   print(elt.name(), imgSettings.generateWorldFile)
> >
> > which returns False for any layout, including the one I checked the
> option
> > for. Btw, dpi returns -1.0, pages return an empty list... I guess I might
> > have missed something but...No idea.
>
> That's because imgSettings here is a default constructed
> ImageExportSettings - which defaults to no world file, and dpi of -1
> (as noted in the docs, the dpi in ImageExportSettings is an override
> ... if it's -1, then the layout's DPI will be used). An empty pages
> list means export all pages. You need to manually populate this
> ImageExportSettings as required for your export.
>
> Nyall
>
>
> * actually it is stored in a customProperty for the layout, but that's
> not part of stable API
>
> layout.customProperty('exportWorldFile')
>
>
> >
> > [0]
> > https://qgis.org/pyqgis/master/core/Layout/QgsLayoutExporter
> .html#qgis.core.QgsLayoutExporter.ImageExportSettings
> >
> > Thanks for your help,
> > Harrissou
> >
> > ___
> > Qgis-user mailing list
> > Qgis-user@lists.osgeo.org
> > List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user