Re: [Qgis-user] QGIS 3 Processing question

2018-07-01 Thread Rudi von Staden
Hi Frank,

On Fri, 29 Jun 2018 at 09:35, Frank Broniewski 
wrote:

> Anyway, my testing-algorithm-script is still not working. It runs through,
> but I do not get the expected result loaded into the layer tree. I suppose
> it runs through - the  output from the 'qgis:pointsalonglines' is a
> QgsVectorLayer - but after finishing I get nuthink back.
>
>
I had a similar problem. I think it's because the template defines the
output as a feature sink, so you assume you have to use the same. I think
if you change your definition from:

self.addParameter(
QgsProcessingParameterFeatureSink(
self.OUTPUT,
self.tr('Center line')
)
)


to:

self.addParameter(
QgsProcessingParameterVectorDestination(
self.OUTPUT,
self.tr('Center line')
)
)


and then in processAlgorithm you need to add output as a layer you can work
with:

output = self.parameterAsOutputLayer(parameters,self.OUTPUT,context)


Finally, in your `params` dict, change the value for OUTPUT from `memory:`
to `output`.

The new syntax is more complicated than it used to be, and it takes some
time to wrap your head around it. I do find that it gets easier once you've
got a couple of scripts under your belt.

Rudi
___
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] Getting file name from parameterAsFile

2018-06-28 Thread Rudi von Staden
On Thu, 28 Jun 2018 at 00:37, Nyall Dawson  wrote:

> If you swap to a QgsProcessingParameterFile then parameterAsFile
> should work as expected.


Thanks Nyall, that did the trick!

Kind regards,
Rudi
___
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] Getting file name from parameterAsFile

2018-06-27 Thread Rudi von Staden
Hi all,

I'm trying to get the file path for an input layer (which is a csv) in a
script in QGIS 3. I can see from the algorithm history that it is there in
the parameters (see below). However, it seems that when I use
`parameterAsFile`, it always returns an empty string. Is this a bug, or am
I using it incorrectly?

What I am looking for is a way to programatically access  "
C:/GIS/Projects/LizeSuitableHabitatModel/dummySpecies.txt".

Thanks,
Rudi

*Algorithm history:*

processing.run("script:suitablehabitatmodel",
{'SPECIES_LIST':'file:///C:/GIS/Projects/LizeSuitableHabitatModel/dummySpecies.txt?type=csv=none=no=no','SPECIES_POINTS':'file:///C:/GIS/Projects/LizeSuitableHabitatModel/dummyPoints.txt?type=csv=DDE=DDS=EPSG:4326=yes=no=no','MODEL_CRS':'USER:10','SPECIES_REPROJECT':'C:/Users/rudi_000/AppData/Local/Temp/processing_41d6b6ec7dd342f1bfd813b4b1c79dba/e89a5f992eb94e2291281d57f796e1b0/SPECIES_REPROJECT.shp'})


*Summarised script:*
def initAlgorithm(self, config=None):

self.addParameter(
QgsProcessingParameterFeatureSource(
self.SPECIES_POINTS,
self.tr('Species points'),
[QgsProcessing.TypeVectorPoint]
)
)

def processAlgorithm(self, parameters, context, feedback):

speciesPointsFile = self.parameterAsFile(parameters,
self.SPECIES_POINTS, context)  # always returns an empty string
genspec = '1031-125'# this would be set in a loop

# trying to apply a filter to the input file by changing the subset
parameter
uri =
f"file:///{speciesPointsFile}?type=csv=DDE=DDS=EPSG:4326=yes=no=no=%22Genspec%22%20%3D%20\'{genspec}\'"

filteredLayer =  QgsVectorLayer(uri, 'FILTERED_POINTS',
'delimitedtext')

pointsReprojected = processing.run("native:reprojectlayer", {
'INPUT': filteredLayer,
'TARGET_CRS': modelCrs.authid(),
'OUTPUT' : speciesReprojectOutput
}, context=context, feedback=feedback)['OUTPUT']
___
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] Raster Clipping

2013-04-06 Thread Rudi von Staden
Hi Khaled,

On Sat, Apr 6, 2013 at 4:43 PM, Khaled Ibrahimi ibrahimikha...@yahoo.comwrote:

 I would like to clip a raster (.jpg) using a vector layer. I used the Gdal
 clipper but I got an error msg: Cannot compute bounding box of cutline.
 Any suggestion?


I think the raster and vector layer both need to be in the same projection
(CRS). If that's already the case, you can try the suggestion at this link,
and see if it works for you:
http://gis.stackexchange.com/questions/32394/rasterfile-clipping-error-cannot-compute-bounding-box-of-cutline

Kind regards,
Rudi
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Raster Clipping

2013-04-06 Thread Rudi von Staden
Hi Khaled,

On Sat, Apr 6, 2013 at 9:18 PM, Khaled Ibrahimi ibrahimikha...@yahoo.comwrote:

 I still have the same problem. I tried the *Raster-Projections-Warp *on
 my Raster but I got the msg*: *ERROR 1: Unable to compute a
 transformation between pixel/line and georeferenced coordinates for.



It sounds like your raster may not be georeferenced. Does it display in
QGIS when you load it as a raster? Does it align with the vector you are
cutting it with? From the command line, you can use gdalinfo to see if
there's a coordinate system defined. If you run 'gdalinfo filename.jpg'
(from the same directory as the file), the resulting output should include
something like this if it's georeferenced:

Coordinate System is:
GEOGCS[WGS 84,
DATUM[WGS_1984,
SPHEROID[WGS 84,6378137,298.257223563,
AUTHORITY[EPSG,7030]],
AUTHORITY[EPSG,6326]],
PRIMEM[Greenwich,0],
UNIT[degree,0.0174532925199433],
AUTHORITY[EPSG,4326]]

if it isn't, you'll see something like this:

Coordinate System is `'

If it's not georeferenced, you can georeference it using the Georeferencer
plugin (there's a useful tutorial here:
http://glaikit.org/2011/03/27/image-georeferencing-with-qgis/).

Hope this helps,
Rudi
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] QGis for bird surveys

2013-04-03 Thread Rudi von Staden
Hi Sarah,

On Wed, Apr 3, 2013 at 5:25 PM, Lynkos lynkosm...@gmail.com wrote:

 I'd love to have the time to learn PostGIS and maybe I will one day,
 although perhaps its powerful performance would be excessive for such a
 small amount of data. My problem is that my job is something quite
 different and I just can't find the learning time necessary. I'm sure
 following the advice given here I'll be able to resolve the problem in the
  most appropriate way, Sarah


If this is the only application you have, and you only need to add data
periodically, it might be easiest to maintain the data in Excel and just
append the new records there. You can then import each time and recreate
the shapefile. If it's important to maintain a consistent layer style, you
can save the style as a qml file and then just load it again each time you
do a new import. Might be easier than select/copy/edit/paste each time, and
the data will probably be in a format you're more familiar with.

Anyway, there have been quite a few suggestions, so you can decide which
approach will work best for you!

Kind regards,
Rudi
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] How can I create a .prj file for the unprovided shp?

2013-03-22 Thread Rudi von Staden
On Fri, Mar 22, 2013 at 3:26 PM, Micha Silver mi...@arava.co.il wrote:

  On 03/22/2013 03:16 PM, Giulia Baldissera wrote:

  Good afternoon,

 I need to add layre from shapefile in google earth, but my shpfiles are
 not provided of .prj, how can I solve this problem? Is there any suggestion
 please?

 If you know what projection the shapefile is in, then go to
 spatialreference.org, and search for that projection. When you find it,
 there's a link to download the correct prj for that projection. Rename the
 downloaded file to the same name as the shapefile (except for the prj
 extension, of course) and that's it.

 If you do not know the projection of the original, then I'm afraid you
 are, as the expression says up a creek without a paddle


Although, if the shapefile has unprojected coordinates (decimal degrees),
then you're usually looking at EPSG:4326, which you'll find at
http://spatialreference.org/ref/epsg/4326/

From there you can download the .prj file and not only will you have a
paddle, but a good idea of which creek you're up!

Kind regards,
Rudi
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Qgis crashes on File dialog

2012-11-27 Thread Rudi von Staden
I've had a similar problem on ubuntu, which I managed to resolve by
removing package qt-at-spi (a screen reading app for accessibility). It
also affected Scribus. The solution was provided in the following bug
report:
https://bugs.launchpad.net/ubuntu/+source/qt-at-spi/+bug/973332


On Tue, Nov 27, 2012 at 8:43 AM, Tomáš Vrána tomas.vr...@cemotel.cz wrote:

 Dne 26.11.2012 23:12, Donovan Cameron napsal(a):

  I had a similar issue, but mine was because I had the wrong version of qt
 installed.

 One thing you could quickly check is the QGIS About window.
 It says what version of qt that QGIS was compiled against.

 Then use your distros package management software (apt?) to verify that
 the qt version you have installed matches the qgis compiled version.

 If the versions mismatch, you may have to install a matching version of
 qt.

  They match, 4.8.1 in both cases.


 --
 Tomas Vrana  tomas.vr...@cemotel.cz
 --**---
 Ceskomoravska telekomunikacni s.r.o.
 http://www.cemotel.cz/
 phone: +420 530 505 505

 __**_
 Qgis-user mailing list
 Qgis-user@lists.osgeo.org
 http://lists.osgeo.org/**mailman/listinfo/qgis-userhttp://lists.osgeo.org/mailman/listinfo/qgis-user

___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] ubuntu 12.10 issues

2012-10-27 Thread Rudi von Staden
Hi Nicholas,

It sounds like your repositories are in a bit of a mixed-up state if you
upgraded to 12.10 (quantal) and your sources.list has repos from 12.04
(precise). Also if your sources gui is broken, you might need to get ubuntu
to a stable state before looking at qgis. The first step is to check what
repositories and ppa's you have enabled.  Could you attach or paste your
full /etc/apt/sources.list file? Also the output of this command run from
the terminal:
cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list | grep ppa

Kind regards,
Rudi


On Sat, Oct 27, 2012 at 5:36 AM, Nicholas Efremov-Kendall 
n.e.kend...@gmail.com wrote:

 Hi Rudi,

 Yes, at this point I just want to go back to a stable version. i've
 changed my repos in etc/apt/sources.list to


  deb http://extras.ubuntu.com/ubuntu precise main
  deb-src http://extras.ubuntu.com/ubuntu precise main


 and I still get this as an error in terminal.


  qgis : Depends: qgis-providers (= 1.8.0-1~quantal1) but
 1.9.0+git20121014+2754df0~precise1 is to be installed
 Depends: qgis-common (= 1.8.0-1~quantal1) but
 1.9.0+git20121015+5afd739~precise-ubuntugis1 is to be installed


 So, how do I roll back to 1.8? Also, my software sources gui is broken.




 On Wed, Oct 24, 2012 at 12:20 AM, Rudi von Staden rud...@gmail.comwrote:

 Hi Nicholas,

 My guess would be that during the upgrade, some of your repositories were
 turned off. qgis (1.74+1.75~20120320-1.1) is the version in the 12.10
 ubuntu repository, but it looks like you previously installed qgis from the
 master repository (1.9.0+git20121015+5afd739~precise-ubuntugis1).

 If you still want to use the cutting-edge qgis version, check in your
 software sources (Ubuntu Software Center  Edit  Software Sources; then
 Other Software tab) for something with http://qgis.org/debian-nightly;
 in it. Check that it now reads http://qgis.org/debian-nightly quantal,
 and enable it. Then from the command line, run sudo apt-get update  sudo
 apt-get install qgis. If that still doesn't work, I'd remove qgis (sudo
 apt-get remove qgis), and then try to reinstall it (sudo apt-get install
 qgis).

 If you'd rather revert to a more stable and tested version of qgis, the
 instructions may be different...

 Kind regards,
 Rudi



 On Wed, Oct 24, 2012 at 11:38 AM, Nicholas Efremov-Kendall 
 n.e.kend...@gmail.com wrote:

 Hi All,

 Still having issues with my ubuntu install. I just upgraded to 12.10,
 but I was having problems before. It looks like the system is expecting 1.7
 dependencies, but tries to install 1.9 and fails.

 The following packages have unmet dependencies:
  qgis : Depends: qgis-providers (= 1.7.4+1.7.5~20120320-1.1) but
 1.9.0+git20121014+2754df0~precise1 is to be installed
 Depends: qgis-common (= 1.7.4+1.7.5~20120320-1.1) but
 1.9.0+git20121015+5afd739~precise-ubuntugis1 is to be installed
 Recommends: qgis-plugin-grass but it is not going to be installed
 E: Unable to correct problems, you have held broken packages.

 Any ideas?

 ___
 Qgis-user mailing list
 Qgis-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/qgis-user




___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] ubuntu 12.10 issues

2012-10-27 Thread Rudi von Staden
Okay, that doesn't look too bad, Nicholas. Definitely change the precise
to quantal in your http://extras.ubuntu.com/ubuntu repo (or disable it
entirely by putting a # in front of the deb and deb-src entries - you
shouldn't need anything there to get qgis working). You only have the one
ppa enabled, which is the right one if you want to install qgis 1.8.0.

What happens if you run the following commands?
sudo apt-get update
sudo apt-get remove qgis
sudo apt-get install qgis


On Sat, Oct 27, 2012 at 9:19 AM, Nicholas Efremov-Kendall 
n.e.kend...@gmail.com wrote:

 Hi Rudi,

 Thanks in advance and here you go:

 $ cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list | grep ppa
 # deb http://ppa.launchpad.net/olivier-berten/geo/ubuntu quantal main #
 disabled on upgrade to quantal
 # deb-src http://ppa.launchpad.net/olivier-berten/geo/ubuntu quantal main
 # disabled on upgrade to quantal
 # deb http://ppa.launchpad.net/sharpie/for-science/ubuntu quantal main #
 disabled on upgrade to quantal
 # deb-src http://ppa.launchpad.net/sharpie/for-science/ubuntu quantal
 main # disabled on upgrade to quantal
 # deb http://ppa.launchpad.net/sharpie/postgis-stable/ubuntu quantal main
 # disabled on upgrade to quantal
 # deb-src http://ppa.launchpad.net/sharpie/postgis-stable/ubuntu quantal
 main # disabled on upgrade to quantal
 deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu quantal
 main # disabled on upgrade to quantal
 deb-src http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntuquantal 
 main # disabled on upgrade to quantal


 and

 # deb cdrom:[Ubuntu 11.04 _Natty Narwhal_ - Release i386 (20110427.1)]/
 natty main restricted

 # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
 # newer versions of the distribution.
 deb http://ca.archive.ubuntu.com/ubuntu/ quantal main restricted
 deb-src http://ca.archive.ubuntu.com/ubuntu/ quantal main restricted

 ## Major bug fix updates produced after the final release of the
 ## distribution.
 deb http://ca.archive.ubuntu.com/ubuntu/ quantal-updates main restricted
 deb-src http://ca.archive.ubuntu.com/ubuntu/ quantal-updates main
 restricted

 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
 ## team. Also, please note that software in universe WILL NOT receive any
 ## review or updates from the Ubuntu security team.
 deb http://ca.archive.ubuntu.com/ubuntu/ quantal universe
 deb-src http://ca.archive.ubuntu.com/ubuntu/ quantal universe
 deb http://ca.archive.ubuntu.com/ubuntu/ quantal-updates universe
 deb-src http://ca.archive.ubuntu.com/ubuntu/ quantal-updates universe

 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the
 Ubuntu
 ## team, and may not be under a free licence. Please satisfy yourself as
 to
 ## your rights to use the software. Also, please note that software in
 ## multiverse WILL NOT receive any review or updates from the Ubuntu
 ## security team.
 deb http://ca.archive.ubuntu.com/ubuntu/ quantal multiverse
 deb-src http://ca.archive.ubuntu.com/ubuntu/ quantal multiverse
 deb http://ca.archive.ubuntu.com/ubuntu/ quantal-updates multiverse
 deb-src http://ca.archive.ubuntu.com/ubuntu/ quantal-updates multiverse

 ## Uncomment the following two lines to add software from the 'backports'
 ## repository.
 ## N.B. software from this repository may not have been tested as
 ## extensively as that contained in the main release, although it includes
 ## newer versions of some applications which may provide useful features.
 ## Also, please note that software in backports WILL NOT receive any review
 ## or updates from the Ubuntu security team.
 # deb http://ca.archive.ubuntu.com/ubuntu/ natty-backports main
 restricted universe multiverse
 # deb-src http://ca.archive.ubuntu.com/ubuntu/ natty-backports main
 restricted universe multiverse

 deb http://security.ubuntu.com/ubuntu quantal-security main restricted
 deb-src http://security.ubuntu.com/ubuntu quantal-security main restricted
 deb http://security.ubuntu.com/ubuntu quantal-security universe
 deb-src http://security.ubuntu.com/ubuntu quantal-security universe
 deb http://security.ubuntu.com/ubuntu quantal-security multiverse
 deb-src http://security.ubuntu.com/ubuntu quantal-security multiverse

 ## Uncomment the following two lines to add software from Canonical's
 ## 'partner' repository.
 ## This software is not part of Ubuntu, but is offered by Canonical and the
 ## respective vendors as a service to Ubuntu users.
 deb http://archive.canonical.com/ubuntu quantal partner
 # deb-src http://archive.canonical.com/ubuntu natty partner

 ## This software is not part of Ubuntu, but is offered by third-party
 ## developers who want to ship their latest software.
  deb http://extras.ubuntu.com/ubuntu precise main
  deb-src http://extras.ubuntu.com/ubuntu precise main



 On Fri, Oct 26, 2012 at 9:14 PM, Rudi von Staden rud...@gmail.com wrote:

 Hi Nicholas,

 It sounds like your repositories are in a bit of a mixed

Re: [Qgis-user] ubuntu 12.10 issues

2012-10-24 Thread Rudi von Staden
Hi Nicholas,

My guess would be that during the upgrade, some of your repositories were
turned off. qgis (1.74+1.75~20120320-1.1) is the version in the 12.10
ubuntu repository, but it looks like you previously installed qgis from the
master repository (1.9.0+git20121015+5afd739~precise-ubuntugis1).

If you still want to use the cutting-edge qgis version, check in your
software sources (Ubuntu Software Center  Edit  Software Sources; then
Other Software tab) for something with http://qgis.org/debian-nightly; in
it. Check that it now reads http://qgis.org/debian-nightly quantal, and
enable it. Then from the command line, run sudo apt-get update  sudo
apt-get install qgis. If that still doesn't work, I'd remove qgis (sudo
apt-get remove qgis), and then try to reinstall it (sudo apt-get install
qgis).

If you'd rather revert to a more stable and tested version of qgis, the
instructions may be different...

Kind regards,
Rudi



On Wed, Oct 24, 2012 at 11:38 AM, Nicholas Efremov-Kendall 
n.e.kend...@gmail.com wrote:

 Hi All,

 Still having issues with my ubuntu install. I just upgraded to 12.10, but
 I was having problems before. It looks like the system is expecting 1.7
 dependencies, but tries to install 1.9 and fails.

 The following packages have unmet dependencies:
  qgis : Depends: qgis-providers (= 1.7.4+1.7.5~20120320-1.1) but
 1.9.0+git20121014+2754df0~precise1 is to be installed
 Depends: qgis-common (= 1.7.4+1.7.5~20120320-1.1) but
 1.9.0+git20121015+5afd739~precise-ubuntugis1 is to be installed
 Recommends: qgis-plugin-grass but it is not going to be installed
 E: Unable to correct problems, you have held broken packages.

 Any ideas?

 ___
 Qgis-user mailing list
 Qgis-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/qgis-user


___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user