Re: [Qgis-user] Get the translation of a core string in Python

2023-10-11 Thread Michel Stuyts via QGIS-User
Hi Jürgen

That's what I needed. Thank you very much.


Michel


-Oorspronkelijk bericht-
Van: QGIS-User  Namens Jürgen E. Fischer via 
QGIS-User
Verzonden: donderdag 5 oktober 2023 18:52
Aan: qgis-user@lists.osgeo.org
Onderwerp: Re: [Qgis-user] Get the translation of a core string in Python

Moin Michel,

On Tue, 03. Oct 2023 at 11:04:26 +, Michel Stuyts via QGIS-User wrote:
> In for example the file "qgis_nl.ts" I found the translated value for 
> "Loading Plugins":

You also need to know the context of the translation, ie.:

  
  QObject
  …
> 
> 
> Loading Plugins
> Plug-ins laden
> 
> 
> But I want to use that translation in a Python plugin.  Does anybody know 
> what the way is to get the translation of a core string using Python?

>>> QCoreApplication.translate("QObject", "Loading Plugins")
'Plug-ins laden'


Jürgen

-- 
Jürgen E. Fischer   norBIT GmbH Tel. +49-4931-918175-31
Dipl.-Inf. (FH) Rheinstraße 13  Fax. +49-4931-918175-50
Software Engineer   D-26506 Nordenhttps://www.norbit.de
QGIS release manager (PSC)  Germany IRC: jef on Libera|OFTC
___
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] Get the translation of a core string in Python

2023-10-03 Thread Michel Stuyts via QGIS-User
I am looking for a way in Python to get the translation of a string that is 
translated in QGIS core.  I know how to create and use my own translation files 
in a QGIS plugin.  But now I want to use a string that is already translated in 
QGIS core.

In for example the file "qgis_nl.ts" I found the translated value for "Loading 
Plugins":



Loading Plugins
Plug-ins laden


But I want to use that translation in a Python plugin.  Does anybody know what 
the way is to get the translation of a core string using Python?


Michel Stuyts
___
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] geometry generator - unexpected results

2020-04-17 Thread Michel Stuyts
The numbers you need to use in “rand(-10, 10), rand(-10, 10)” depend on the CRS 
of your layer. I tested it with some demo data in EPSG:31370 and I got a 
similar result as you.  When I changed those numbers I got a better result.  
After you changed those, you can play around with that 100 inside the 
generate_series, to get the result you want. For me the following gave a good 
result:

make_line(
array_foreach(
generate_series(
0, length($geometry), 300
),
translate(
line_interpolate_point($geometry, @element),
rand(-0.5, 0.5),
rand(-0.5, 0.5)
)
)
)


Michel

Van: Qgis-user  Namens David Fawcett
Verzonden: donderdag 16 april 2020 20:01
Aan: qgis-user 
Onderwerp: [Qgis-user] geometry generator - unexpected results

I am trying to use a geometry generator to accomplish the "hand-drawn" line 
style.

Some great recent examples by:

Klas Karlsson
https://twitter.com/klaskarlsson/status/1249333750451879937

Hamish:
https://polemic.nz/2019/11/18/foss4g-qgis-geometry-generators/

I am using the code below from the blog post by Hamish in QGIS 3.12:


make_line(

array_foreach(

generate_series(

0, length($geometry), 100

),

translate(

line_interpolate_point($geometry, @element),

rand(-10, 10),

rand(-10, 10)

)

)

)

Here is an image of what the results look like: 
https://github.com/fawcett/examples/blob/master/lines.png

The line geometries are in blue, and the geometry generator output is in black.

Can anyone suggest what is going wrong?

Thank you,

David.


___
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] python qgis 3 adding features fails partly

2019-02-28 Thread Michel Stuyts
You can add an empty table to QGIS but it depends on the definition of your 
geometry column.

This table can be added:
CREATE TABLE public.test
(
id oid NOT NULL,
naam text COLLATE pg_catalog."default" NOT NULL,
geom geometry(Point,31370),
CONSTRAINT test_pkey PRIMARY KEY (id)
)


This table cannot be added:
CREATE TABLE public.test
(
id oid NOT NULL,
naam text COLLATE pg_catalog."default" NOT NULL,
geom geometry(Geometry,31370),
CONSTRAINT test_pkey PRIMARY KEY (id)
)

The easiest way to create the new table is to use the DB Manager.

Michel

-Oorspronkelijk bericht-
Van: Qgis-user  Namens Reginald
Verzonden: donderdag 28 februari 2019 9:22
Aan: qgis-user@lists.osgeo.org
Onderwerp: Re: [Qgis-user] python qgis 3 adding features fails partly

Hi,

I'm still scratching my head over this one.
As a test I created a table 'test' in postgis:
id: pkey type oid
naam: type text
geom: type geometry

select updateGeometrySrid('test','geom',31370) # assigning projected CRS to 
geometry

When I try to add this table to qgis using the database explorer I get an error 
because there is no geometry in the table.
So I was wondering if it is impossible to add an empty postgis table to qgis?

Regards,



--
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
___
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] QGIS 3.4.3 becoming unusable for me on Windows 10

2019-01-11 Thread Michel Stuyts
You can use the Python variable qgis.utils.plugin_times to find out how long 
each plugin takes to load at startup of QGIS. For end users I created a plugin 
that shows the information of that Python variable with a pie chart and a list 
of all plugins.  This plugin is called "Plugin Load Times" and it can be found 
in the QGIS Plugin Repository 
(https://plugins.qgis.org/plugins/PluginLoadTimes/), so you can install it from 
within QGIS. It works in QGIS 2.x and 3.x.

With the information from this plugin you can see which of the installed 
plugins takes a long time to load at startup. If those are plugins you don't 
use every day, you can disable them and only enable them when you occasionally 
use them.  On my computer I have many plugins installed, but only a few are 
enabled.  It makes a big difference.

Michel

-Oorspronkelijk bericht-
Van: Qgis-user [mailto:qgis-user-boun...@lists.osgeo.org] Namens David Addy
Verzonden: woensdag 9 januari 2019 17:21
Aan: qgis-user@lists.osgeo.org
Onderwerp: Re: [Qgis-user] QGIS 3.4.3 becoming unusable for me on Windows 10

Thanks for the advice fellas.
Unfortunately being an end user, I never usually delve into the guts of QGIS.
Advice received is : "Can you try to start QGIS with the following options: 

qgis --noversioncheck --noplugins --hide-browser "

I have discovered the option to 'Check version no on startup' and unchecked it.
But how do I stop all the plug ins from Loading? I cannot find any 'disable all 
plugins' button.
Neither can I see how to hide the browser.
Any advice on where to find these options would be welcome.
Sorry if this is very basic stuff but I have never had to worry about these 
options in versions of 3.4.0 and earlier.




--
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
___
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] WMTS fail on loading - QGIS 3.4

2018-11-16 Thread Michel Stuyts
Did you set your own API token, because the word YOUR_API_TOKEN in the uri in 
the error suggests you didn't.


Michel

Van: Qgis-user [mailto:qgis-user-boun...@lists.osgeo.org] Namens Ian Reese
Verzonden: vrijdag 16 november 2018 0:30
Aan: qgis-user@lists.osgeo.org
Onderwerp: [Qgis-user] WMTS fail on loading - QGIS 3.4

Hi QGIS

I'm currently using QGIS 3.4, on Windows 7.

I am getting an error when I try to connect to a WMTS layer:

Invalid Layer: Raster layer Provider is not valid (provider: wms, URI: 
SmoothPixmapTransform=1=0=EPSG:2193=7=10=image/png=set-4702=style%3Dauto=EPSG:2193=https://data.linz.govt.nz/
 services;key=YOUR_API_TOKEN/wmts/1.0.0/set/4702/WMTSCapabilities.xml

The sample WMTS can be accessed here:
https://data.linz.govt.nz/set/4702-nz-aerial-imagery/webservices/

I tested the same WMTS connection using QGIS 2.18, 2.6 and ArcMap also and 
received no error.

The WMTS connection shows an error no matter what layer I try to access from 
our data service.

If I use an a connection from outside our data service: 
https://tiles.maps.linz.io/nz_colour_basemap/WMTSCapabilities.xml, everything 
works fine

Cheers,

Ian C Reese
Senior Spatial Analyst
Location Information Data Services

E  ire...@linz.govt.nz | DDI 04 6504

Wellington Office, Level 7, Radio New Zealand House, 155 The Terrace
PO Box 5501, Wellington 6145, New Zealand | T 04 460 0110
W  www.linz.govt.nz | 
www.landonline.govt.nz | 
data.linz.govt.nz




This message contains information, which may be in confidence and may be 
subject to legal privilege. If you are not the intended recipient, you must not 
peruse, use, disseminate, distribute or copy this message. If you have received 
this message in error, please notify us immediately (Phone 0800 665 463 or 
i...@linz.govt.nz) and destroy the original message. 
LINZ accepts no responsibility for changes to this email, or for any 
attachments, after its transmission from LINZ. Thank You.
___
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] qgz format and non-ascii project names

2018-07-19 Thread Michel Stuyts
If I create a file called test.qgz in QGIS, rename it to tëst.qgz in Windows 
Explorer, and load that file in QGIS everything is loaded correct.

If I create a file called tëst.qgz in QGIS, rename it to test.qgz in Windows 
Explorer, and load that file in QGIS, no layers are loaded.

So the problem originates when saving the project file, not when loading it.


Michel

Van: Qgis-user [mailto:qgis-user-boun...@lists.osgeo.org] Namens Michel Stuyts
Verzonden: donderdag 19 juli 2018 15:23
Aan: Qgis-user@lists.osgeo.org
Onderwerp: Re: [Qgis-user] qgz format and non-ascii project names

Confirmed on Win10.  When loading a qgz-file with special characters, the name 
of the project is shown in the title bar, but no layers are loaded.

Michel

Van: Qgis-user [mailto:qgis-user-boun...@lists.osgeo.org] Namens Micha Silver
Verzonden: donderdag 19 juli 2018 13:55
Aan: Qgis-user@lists.osgeo.org<mailto:Qgis-user@lists.osgeo.org>
Onderwerp: [Qgis-user] qgz format and non-ascii project names

I just noticed that a QGZ project file with non-ascii characters in the name 
will not open. No error message, it just doesn't open. The same project, saved 
as QGS opens fine, and if I save project as QGZ with only ascii characters, it 
also opens fine.
Can anyone confirm?
Thanks,

--

Micha Silver

Ben Gurion Univ.

Sde Boker, Remote Sensing Lab

+972-523-665918
___
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] XYZ Connection Referer

2018-07-04 Thread Michel Stuyts
In the settings of a XYZ Tiles Connection there is a setting called "Referer". 
What is it used for?


Michel
___
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] click on raster outline to make it visible

2018-05-25 Thread Michel Stuyts
I tried the following in the Python console:
 test="F:\Ingelmunster\riolering\infraxscans\tif2/331-Meulebekestraat_Leon_Bekaertstraat_Mandesweg_GP_deel2.tif"
 print(test)
F:\Ingelmunster
iolering\infraxscans
if2/331-Meulebekestraat_Leon_Bekaertstraat_Mandesweg_GP_deel2.tif
 testraw = "%r"%test
 print(testraw)

'F:\\Ingelmunster\riolering\\infraxscans\tif2/331-Meulebekestraat_Leon_Bekaertstraat_Mandesweg_GP_deel2.tif'

Would this be a solution?

Michel



-Oorspronkelijk bericht-
Van: Qgis-user [mailto:qgis-user-boun...@lists.osgeo.org] Namens Reginald
Verzonden: vrijdag 25 mei 2018 10:31
Aan: qgis-user@lists.osgeo.org
Onderwerp: Re: [Qgis-user] click on raster outline to make it visible

Hi Michel,

It would be a solution to escape all the suspicous characters, but I would 
prefer it if the string could be treated as a raw string. I tried placing r in 
front of it but that didn't work. I guess it is the way that the actions are 
implemented that creates this problem.
The location path was the result of the raster> Index tiles algorithm.

Regards,



--
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
___
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] click on raster outline to make it visible

2018-05-25 Thread Michel Stuyts
It looks like the \r in the path is interpreted as a carriage return and the \t 
as a tab and so a part of the path is missing for GDAL. Maybe you can try to 
replace the \ by \\.  

Info on Escape Sequences: 
- 
http://python-reference.readthedocs.io/en/latest/docs/str/escapes.html 
- http://en.cppreference.com/w/cpp/language/escape

I also notice a mix of \ and / in the paths. I don't know if that can cause 
problems.

Michel

-Oorspronkelijk bericht-
Van: Qgis-user [mailto:qgis-user-boun...@lists.osgeo.org] Namens Reginald
Verzonden: vrijdag 25 mei 2018 10:02
Aan: qgis-user@lists.osgeo.org
Onderwerp: Re: [Qgis-user] click on raster outline to make it visible

Hello,

I have defined an action with the following python code:

from PyQt4.QtCore import QFileInfo
fileName ="[%"Locatie"%]";
fileInfo = QFileInfo(fileName);
baseName = fileInfo.baseName();
qgis.utils.iface.addRasterLayer(fileName, baseName);

The problem that I’m having is that the string stored in the Locatie field gets 
interpreted.
In a path name like
F:\Ingelmunster\riolering\infraxscans\tif2/331-Meulebekestraat_Leon_Bekaertstraat_Mandesweg_GP_deel2.tif
\t creates a tab spacing and \r removes a character.

Ongeldige Laag: GDAL provider Cannot open GDAL dataset F:\Ingelmunster 
iolering\infraxscans
if2/335-Meulebekestraat_Lammekensknokstraat_Bollewerpstraat_Bekaertstraat_Ringlaan_GP_deel3.tif:
`F:\Ingelmunster iolering\infraxscans
if2/335-Meulebekestraat_Lammekensknokstraat_Bollewerpstraat_Bekaertstraat_Ringlaan_GP_deel3.tif'
does not exist in the file system, and is not recognized as a supported dataset 
name.

How can I load the rasterfile with the filename that is stored in the Locatie 
field into qgis?
Is there any comprehensive tutorial on actions?

Regards,




--
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
___
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] results Measure Tool vs. length()

2018-05-23 Thread Michel Stuyts
I have tested both functions and as far as I can tell there is no difference 
between length($geometry) and $length. I did the following test:

· I created 3 layers (1 in EPSG:3857, 1 in EPSG:31370 and 1 in 
EPSG:2154)

· In each of the files I added 1 simple line with approximately the 
same length.

· To each layer I added the same label definition: 
concat(length($geometry),'-',$length)

· I measured the approximate length of the lines with the Measure Tool.



I made a print screen image that shows the results and uploaded it to Dropbox: 
https://www.dropbox.com/s/plza9bwkh4wfd29/length_tests.jpg?dl=0



The results:

· As expected there is a big difference between the layer in EPSG:3857 
and the other 2 layers.

· As expected the results of the Measure Tool are very close to the 
results of the layers in EPSG:31370 and in EPSG:2154.

· As expected changing the project CRS, changes the direction of the 
lines and their placement.

· But the labels always stay the same no matter what project CRS I use

· And the results for $length and length($geometry) are in all cases 
the same per line.  So I don’t see a difference between length($geometry) and 
$length.



I tested it both in QGIS 3.0.3 and QGIS 2.18.20 and they gave similar results.



I don’t think using $length solves my problem, or did I do something wrong?





Michel









-Oorspronkelijk bericht-
Van: Goyo [mailto:goyod...@gmail.com]
Verzonden: dinsdag 22 mei 2018 23:37
Aan: Michel Stuyts <michel.stu...@edegem.be>
CC: Micha Silver <tsvi...@gmail.com>; qgis-user <qgis-user@lists.osgeo.org>
Onderwerp: Re: [Qgis-user] results Measure Tool vs. length()



The measure tool measures elipsoidal distances (configurable in the project 
properties).



The function length(geometry) returns the length of the argument

(linestring) measured in the plane.



The function $length() returns the length of the current geometry

(linestring) measured in the elipsoid and should be consistent with the measure 
tool (same configuration).



You do not want to use length(geometry) unless you are using a local projection.





2018-05-22 11:57 GMT+02:00 Michel Stuyts 
<michel.stu...@edegem.be<mailto:michel.stu...@edegem.be>>:

> I understand that every projection has a distortion, but I was wondering how 
> the QGIS Measure Tool manages to give results very close to local projections 
> anywhere in the world no matter what project CRS is set, but the length() 
> function can't.

>

> Michel

>

>

> 

> Van: Micha Silver [tsvi...@gmail.com]

> Verzonden: vrijdag 18 mei 2018 17:41

> Aan: Michel Stuyts; qgis-user

> Onderwerp: Re: [Qgis-user] results Measure Tool vs. length()

>

> Maybe I misunderstood your question, but you *should* expect different 
> length, area and direction calculations when converting from one projection 
> to another. Every projection distorts. Either distance, area, or direction, 
> or some combination. A local projection is designed to minimize distortion 
> for some small section of the planet. So survey measurements in that region 
> will closely match map calculations. But trying to calculate from a layer 
> that's projected to some other projection will always give different results.

>

> (If you already understand the above, I apologize for restating the

> obvious...)

>
___
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] results Measure Tool vs. length()

2018-05-22 Thread Michel Stuyts
I understand that every projection has a distortion, but I was wondering how 
the QGIS Measure Tool manages to give results very close to local projections 
anywhere in the world no matter what project CRS is set, but the length() 
function can't.

Michel



Van: Micha Silver [tsvi...@gmail.com]
Verzonden: vrijdag 18 mei 2018 17:41
Aan: Michel Stuyts; qgis-user
Onderwerp: Re: [Qgis-user] results Measure Tool vs. length()

Maybe I misunderstood your question, but you *should* expect different length, 
area and direction calculations when converting from one projection to another. 
Every projection distorts. Either distance, area, or direction, or some 
combination. A local projection is designed to minimize distortion for some 
small section of the planet. So survey measurements in that region will closely 
match map calculations. But trying to calculate from a layer that's projected 
to some other projection will always give different results.

(If you already understand the above, I apologize for restating the obvious...)

On 05/18/2018 01:14 PM, Michel Stuyts wrote:
Thank you very much for the explanation.

When I use 
length(transform($geometry,layer_property(@layer_id,'crs'),'EPSG:31370')) in 
Belgium the results are very similar to the result of the Measure Tool, but if 
use this expression in New York the result is different from the result of the 
Measure Tool.  It is the other way around if I use 
length(transform($geometry,layer_property(@layer_id,'crs'),'EPSG:102316')). 
What kind of projection does the Measure Tool use to calculate a length? 
Because the results of the Measure Tool seem to be very similar to local 
projections.


Michel





Van: Julien Guilloux [mailto:julien.guill...@ecrins-parcnational.fr]
Verzonden: vrijdag 18 mei 2018 11:01
Aan: Michel Stuyts <michel.stu...@edegem.be><mailto:michel.stu...@edegem.be>; 
Springfield Harrison <stellar...@gmail.com><mailto:stellar...@gmail.com>; 
qgis-user <qgis-user@lists.osgeo.org><mailto:qgis-user@lists.osgeo.org>
Onderwerp: Re: [Qgis-user] results Measure Tool vs. length()

Hi Michel,

Never use epsg 3857 for measurement beacuse it is not a "projection"...
this "pseudo projection mercator" 3857, called often "Popular Visualisation"  
is pseudo Because only use for visualization applications.

example in France :  3200 km for a road for example, instead of 2100 km in a 
real projection (as local zone UTM or a Lambert projection)


So, you can use qgis, esri, postgis etc... the measurment with 3857 will be 
always bad, due to a "false" calcul from origine 0,0 (equateur cross greenwich) 
and "false" ellipoide etc

best regards,
Julien

have a look on :
http://spatialreference.org/ref/sr-org/6864/


[Afbeelding verwijderd door afzender.]

  [Afbeelding verwijderd door afzender.]

Julien-Pierre GUILLOUX
Chargé de mission Eau, Forêt, Natura 2000, coordinateur des 
porter-à-connaissance

Parc national des Écrins
04 92 40 20 56 / 06 99 77 38 26
www.ecrins-parcnational.fr<http://www.ecrins-parcnational.fr/>





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


--
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918
___
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] results Measure Tool vs. length()

2018-05-18 Thread Michel Stuyts
Thank you very much for the explanation.

When I use 
length(transform($geometry,layer_property(@layer_id,'crs'),'EPSG:31370')) in 
Belgium the results are very similar to the result of the Measure Tool, but if 
use this expression in New York the result is different from the result of the 
Measure Tool.  It is the other way around if I use 
length(transform($geometry,layer_property(@layer_id,'crs'),'EPSG:102316')). 
What kind of projection does the Measure Tool use to calculate a length? 
Because the results of the Measure Tool seem to be very similar to local 
projections.


Michel





Van: Julien Guilloux [mailto:julien.guill...@ecrins-parcnational.fr]
Verzonden: vrijdag 18 mei 2018 11:01
Aan: Michel Stuyts <michel.stu...@edegem.be>; Springfield Harrison 
<stellar...@gmail.com>; qgis-user <qgis-user@lists.osgeo.org>
Onderwerp: Re: [Qgis-user] results Measure Tool vs. length()

Hi Michel,

Never use epsg 3857 for measurement beacuse it is not a "projection"...
this "pseudo projection mercator" 3857, called often "Popular Visualisation"  
is pseudo Because only use for visualization applications.

example in France :  3200 km for a road for example, instead of 2100 km in a 
real projection (as local zone UTM or a Lambert projection)


So, you can use qgis, esri, postgis etc... the measurment with 3857 will be 
always bad, due to a "false" calcul from origine 0,0 (equateur cross greenwich) 
and "false" ellipoide etc

best regards,
Julien

have a look on :
http://spatialreference.org/ref/sr-org/6864/


[Afbeelding verwijderd door afzender.]

  [Afbeelding verwijderd door afzender.]

Julien-Pierre GUILLOUX
Chargé de mission Eau, Forêt, Natura 2000, coordinateur des 
porter-à-connaissance

Parc national des Écrins
04 92 40 20 56 / 06 99 77 38 26
www.ecrins-parcnational.fr<http://www.ecrins-parcnational.fr/>


___
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] results Measure Tool vs. length()

2018-05-18 Thread Michel Stuyts
$length gives the same result as length($geometry)


Michel

Van: Springfield Harrison [mailto:stellar...@gmail.com]
Verzonden: vrijdag 18 mei 2018 2:52
Aan: Michel Stuyts <michel.stu...@edegem.be>
CC: qgis-user <qgis-user@lists.osgeo.org>
Onderwerp: Re: [Qgis-user] results Measure Tool vs. length()


Interesting and alarming observation.

And how do those results compare with output from the $length variable?

Cheers . . . . .   Springfield
Samsung Tab 4
On May 17, 2018 5:26 AM, "Michel Stuyts" 
<michel.stu...@edegem.be<mailto:michel.stu...@edegem.be>> wrote:
In the length() function QGIS uses the CRS unit of the layer to calculate the 
result. When I use for example a layer in a local CRS like EPSG:31370 or 
EPSG:5439 and a layer in EPSG:3857 (that all use meters as unit) the results 
are very different (+40% difference). Changing the project CRS makes no 
difference. When I check the length using the Measure Tool the results are very 
similar to the local CRS.

How can I measure the length of a line and use it as a label independent from 
the layer CRS and get results similar to the results of the Measure Tool?

Michel

___
Qgis-user mailing list
Qgis-user@lists.osgeo.org<mailto: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

[Qgis-user] results Measure Tool vs. length()

2018-05-17 Thread Michel Stuyts
In the length() function QGIS uses the CRS unit of the layer to calculate the 
result. When I use for example a layer in a local CRS like EPSG:31370 or 
EPSG:5439 and a layer in EPSG:3857 (that all use meters as unit) the results 
are very different (+40% difference). Changing the project CRS makes no 
difference. When I check the length using the Measure Tool the results are very 
similar to the local CRS.

How can I measure the length of a line and use it as a label independent from 
the layer CRS and get results similar to the results of the Measure Tool?

Michel
___
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] Adding an OpenWeatherMap WMS layer using PyQGIS

2018-04-24 Thread Michel Stuyts
OpenWeatherMap deprecated WMS support. You should use their XYZ tiles Service: 
https://tile.openweathermap.org/map/{layer}/{z}/{x}/{y}.png?appid={api_key}

More info on: https://openweathermap.org/api/weathermaps

Michel

On 23 April 2018 at 21:28, Xristos Xristoou 
> wrote:

I would like to add in QGIS real time weather data.

I found this 
link
 and this 
link
 and I tried to follow the example, but without any success.

I've added a WMS weather data layer for precipitation to the QGIS map, as 
follows:

First, the parameters for the service:

service = 
'crs=EPSG:900913=7=10=image/png=precipitation==http://wms.openweathermap.org/service'

Next, create the raster layer, specifying WMS as the type:

rlayer = QgsRasterLayer(service, "precip", "wms")

Finally, add the precipitation layer to the map:

QgsMapLayerRegistry.instance().addMapLayers([rlayer])

the example didn't show any error in the code and no data was added to the 
weather layer either, I'm not sure why?


___
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

[Qgis-user] segments_to_lines & @geometry_part_num in QGIS 2.99 & 3.0

2018-03-06 Thread Michel Stuyts
When creating a style for a polygon layer I noticed a difference between QGIS 
2.99 (Windows standalone installer) and QGIS 3.0 (OSGeo4W) when I use 
segments_to_lines & @geometry_part_num.


  *   I created a polygon layer and added some polygons.

  *   Then I started editing the layer style:
 *   I added a Geometry generator as symbol layer to create a Linestring 
type that contains  segments_to_lines($geometry)
 *   Then I changed the line type of the result to a "Marker line"
 *   Then I changed the Symbol layer type of this "Marker line" to "Font 
marker"
 *   Then I changed the "Data defined override" of the content of this font 
marker to @geometry_part_num
 *   Then I changed the font size of the font marker

The results are different in QGIS 2.99 and 3.0 (see images below). Is this a 
bug in 3.0 or is it an intentional change? The result in QGIS 2.18 is the same 
as in 2.99. The result in QGIS 3.1 is the same as in 3.0.

Michel




[cid:9e09fb1c-f472-4353-b069-499f66047698]


[cid:b7308b13-c417-4105-8b0c-9536789f1ed7]




segments.qml
Description: segments.qml
___
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] Polygon Dimensioning in QGIS

2018-02-08 Thread Michel Stuyts
Paolo,

I used your example as a starting point to create a qml style file that adds 
dimensions to all segments of the border of simple polygons, without an extra 
line layer. I used the geometry generator to create some marker lines and 
arrows. I also added the area in the center of the polygons. For some reason 
the labels with the lengths of the segments (that are Font Marker Lines) look 
more bold than the labels that show the areas (that are real labels), even 
though in QGIS 2.99 they have the same size and units. I QGIS 2.18 I tried to 
give them both about the same size in pixel and point units.

I uploaded 2 qml-files (1 for QGIS 2.18 and 1 for QGIS 2.99) and an example 
result png-file to Dropbox: 
https://www.dropbox.com/sh/2d1eaia7miy2v3b/AAB6H5ovouKEMoMmUSwf3pnza?dl=0

How to use the style:
1. open or create a polygon layer
2. add some simple polygons
3. apply the qml-file for your QGIS version (2.18 or 2.99)


Michel

-Oorspronkelijk bericht-
Van: Qgis-user [mailto:qgis-user-boun...@lists.osgeo.org] Namens Paolo Cavallini
Verzonden: vrijdag 2 februari 2018 18:44
Aan: qgis-user@lists.osgeo.org
Onderwerp: Re: [Qgis-user] Polygon Dimensioning in QGIS

Il 02/02/2018 17:35, Fernando M. Roxo da Motta ha scritto:

>   This is really amazing!
...
>   I think that if the label were attached in someway to the 
> dimensioning line, this could be an useful feature.

thanks for this note. As said, it was just a quick exercise, there is much room 
for improvements.
Feel free to submit pull requests to:
https://github.com/pcav/qgis_styles
All the best.

--
Paolo Cavallini - www.faunalia.eu
QGIS & PostGIS courses: http://www.faunalia.eu/training.html
https://www.google.com/trends/explore?date=all=IT=qgis,arcgis
___
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] Generating black white from RGB landsat using Raster Map calculator?

2018-01-17 Thread Michel Stuyts
Chas,

If I have a color GEOTIFF and I want to show or save it as a grayscale GEOTIFF, 
I use one of these 2 solutions. Depending on the control you want on the color 
to grayscale conversion it might also be a solution for you.


Solution 1:
If the only thing you want to do is show a colour geotiff in grayscale, you can 
just change the properties of the layer. In the layer properties you go to the 
tab “Style”. Under “Color rendering” you will find the option “Grayscale”. By 
default the option will be set to “Off”, but you can change it to turn 
grayscale on. Try one of the three options to see what fits your image best.  
After that you can also change the values of “Brightness” or “Contrast” to get 
the best result.

This way you won’t change anything in your source file and it won’t save a 
grayscale tiff, but it will just show your raster file as grayscale in QGIS.

Solution 2:
If you want to end up with a geotiff file that has the same information in 
grayscale I usually use some graphical software in the process, but for that 
you can’t use a GeoTiff, because you would loose the georeference information 
of the file. Therefore I use the following steps:

1.   Save your geotiff file as TIFF-file with a TFW file:

a.   Right click on your source geotiff file in the layers panel.

b.   Select Save As…

c.   Select Rendered image as Output Mode

d.   Select Gtiff as format

e.   Deselect “Add saved file to map”

f.Under “Create Options”  click on the + button to add an option. For 
the newly added option you have to type TFW as “Name” and YES as “Value” 
(double click in the newly created Option cell to type in it).

g.   Click on the “Browse…” button to select a name and location for your 
grayscale TIFF file.

h.   Click on the “OK” button

2.   Open the newly created TIFF file in graphical software like XnView, 
IrfanView or GIMP. Change the image in that software to grayscale and save the 
file.

3.   Add the newly created TIFF file back to QGIS

4.   Save your newly created TIFF file as a GeoTIFF file:

a.   Right click on your newly created TIFF file in the layers panel.

b.   Select Save As…

c.   Select Rendered image as Output Mode

d.   Select Gtiff as format

e.   Click on the “Browse…” button to select a name and location for your 
grayscale GEOTIFF file.

f.Click on the “OK” button

Michel




Van: Qgis-user [mailto:qgis-user-boun...@lists.osgeo.org] Namens Chas Sheen
Verzonden: woensdag 17 januari 2018 14:33
Aan: 'Micha Silver' ; qgis-user@lists.osgeo.org
Onderwerp: Re: [Qgis-user] Generating black white from RGB landsat using Raster 
Map calculator?

Mike,
So everything in the capture below of the Raster calculator should work? I 
cannot find any output.
I’m in Perth, Australia so home now and away from the office and QGIS, but 
would like to get it working tomorrow.
How do apply a grayscale to a raster? As I said, I’m new to QGIS
Chas Sheen

From: Micha Silver [mailto:tsvi...@gmail.com]
Sent: Wednesday, January 17, 2018 8:39 PM
To: Chas Sheen ; qgis-user@lists.osgeo.org
Subject: Re: [Qgis-user] Generating black white from RGB landsat using Raster 
Map calculator?

Hello Chas
On 01/17/2018 01:52 PM, Chas Sheen wrote:
Richard,

I should have made my initial query clearer.
I am trying to output a black and white geotiff.
It's still not clear what you are asking. AFAIK, there's no such thing as a 
"black and white geotiff". You can apply any color table you want to any 
raster. You can apply a gray scale to any of the landsat bands.

If you are trying to create a new raster from the three RGB bands using some 
expression, that should work. You can use either of three tools: the built in 
QGIS raster calculator, or thru the Processing toolbox there's SAGA Raster 
calculus and the GRASS module r.mapcalculator.

Again, none of this has anything to do with coloring. After running the raster 
calculator, you can color the result with a gray scale color table, a red color 
table, or any other color ramp you choose.


Have split the original (landsat) image into RGB images.
When I apply the expression in the capture below, and hit run, nothing is saved 
to the results directory.
I’m assuming that my expression or something else in the raster calculator is 
wrong?
The final product that I’m after is a xyz grid where z is the black-white 
amplitude…which I think should be relatively easy (?) once I have the 
black-white image.
After you running the calculator expression, then you can save the result in 
many formats, including gridded XYZ, ArcINFO ASCII, or many others, using the 
gdal_translate tool. This is under the Raster->Conversion menu.


Chas Sheen
0448017282

From: Richard McDonnell [mailto:richard.mcdonn...@opw.ie]
Sent: Wednesday, January 17, 2018 7:13 PM
To: Chas Sheen ;