[Qgis-user] creating vector layer from slope map with few classes

Shinoto, PD Dr. Maria maria.shinoto at zaw.uni-heidelberg.de
Wed Mar 30 17:57:31 PDT 2022


Hi, 

Thanks for your advice and offer to help. Yesterday, I had a QGIS crash, today, I restarted, and the problems with polygonize (GDAL and QGIS) were gone. Yesterday I could not create a virtual layer and no stored layer, today, both are no problems. Sorry for causing trouble -- but I have to say, that gave a lot of confidence. 

I still have some warnings, particularly with Python code involved (I do not yet use it myself directly). But I will solve these step by step, for the time being: Polygonize is not a problem any more. 

Cheers, and thanks as always, 
Maria


> Am 30.03.2022 um 19:54 schrieb Nicolas Cadieux <njacadieux.gitlab at gmail.com>:
> 
> Hi,
> 
> If you’re comfortable with python you can always follow the introduction here.
> 
> https://pcjericks.github.io/py-gdalogr-cookbook/raster_layers.html#polygonize-a-raster-band
> 
> You can also send me a link to the file and I could try on a windows box.  You could check bug reports to see if it’s been reported also.
> 
> Nicolas Cadieux
> https://gitlab.com/njacadieux
> 
>> Le 29 mars 2022 à 21:04, Shinoto, PD Dr. Maria <maria.shinoto at zaw.uni-heidelberg.de> a écrit :
>> 
>> Nicolas, 
>> 
>> Tried it once again, short names and reasonable paths do not work. I am on Mac, QGIS 3.24, will test some reasons for the failure tomorrow again and report. Thanks for your advice, 
>> 
>> Maria
>> 
>> 
>> 
>>> Am 30.03.2022 um 09:34 schrieb Nicolas Cadieux via Qgis-user <qgis-user at lists.osgeo.org>:
>>> 
>>> Hi,
>>> 
>>> "Polygonize" should work well to vectorize the raster classes. If you have problems with the file name, try simplifying the file name to the bare minimun like c:\temp\toto.shp if you're on Windows. Make sure you have no spaces or accents in the path (this includes the user path of your operation system).  Notice that there are two polygonize algorithm.  One is from QGIS and one is from GDAL.  Try both.   They are probably both based on GDAL but one (probably the QGIS one) may have an easier time with accents, spaces or special characters like '\n'.
>>> 
>>> Good luck
>>> 
>>> Nicolas
>>> 
>>> On 2022-03-29 7:51 p.m., Shinoto, PD Dr. Maria via Qgis-user wrote:
>>>> Hi Kirk,
>>>> 
>>>> that was helpful, thank you.
>>>> 
>>>> I am not yet where I need to be, but so far I could create two classes with the formula found in the docs (https://docs.qgis.org/3.10/en/docs/user_manual/working_with_raster/raster_analysis.html) along this line:
>>>> 
>>>>   `("slope at 1" < 50) * 1 + ("slope at 1" >= 50) * 2`
>>>> 
>>>> At this moment, my biggest problem is creating the vector file, the window claims that the file name is too long. This cannot be the case, and the directory itself should be OK. So now I am trying to get this done, and then I will test three classes, which I did not get working up to now either.
>>>> 
>>>> If there are easy answers to these two questions, I would be pleased, otherwise, I will try tomorrow.
>>>> 
>>>> Thanks a lot,
>>>> Maria
>>>> 
>>>> 
>>>> 
>>>>> Am 30.03.2022 um 07:14 schrieb kirk <kirk at nortekresources.com>:
>>>>> 
>>>>> Hi Maria.
>>>>> The symbology does not reclassify the underlying raster, it just changes the way it is displayed.  Use the raster calculator to generate a new raster with the Classes you require. The native qgis calculator works well. You can find it in the upper word menu under raster.  Once  you have your raster reclassified, you can then convert it to a vector format
>>>>> 
>>>>> Kirk Schmidt
>>>>> 
>>>>> 
>>>>> 
>>>>> Sent from my Galaxy
>>>>> 
>>>>> 
>>>>> -------- Original message --------
>>>>> From: "Shinoto, PD Dr. Maria via Qgis-user" <qgis-user at lists.osgeo.org>
>>>>> Date: 2022-03-29 6:32 p.m. (GMT-04:00)
>>>>> To: qgis forum <qgis-user at lists.osgeo.org>
>>>>> Subject: [Qgis-user] creating vector layer from slope map with few classes
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> I have created a slope map from a DTM.
>>>>> 
>>>>> I have limited the symbology to three meaningful classes and wish to create a vector layer with polygons of three classes from that. The conditions are One-Channel-Pseudocolor, Channel1 (Gray), interpolation discrete, modus "fortlaufend" -- not identical interval or quantile, 3 classes with values <=20, 20 - 40, > 40.
>>>>> 
>>>>> The classes show up in the layer design panel symbology tab, but the layer browser still (thankfully!) shows the greyscale ramp.
>>>>> 
>>>>> I wish to create a vector layer with polygons from the 3 classes.
>>>>> 
>>>>> All solutions I have looked up work under slightly different condition. After all I do not know how to get the data of the DTM into three classes like "Flat-Gentle-Steep"; I think the vectorization should work easily then.
>>>>> 
>>>>> Can anybody hint me to a solution?
>>>>> 
>>>>> 
>>>>> Thanks and best wishes,
>>>>> Maria
>>>>> _______________________________________________
>>>>> Qgis-user mailing list
>>>>> Qgis-user at 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 at lists.osgeo.org
>>>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>> 
>>> -- 
>>> Nicolas Cadieux
>>> https://gitlab.com/njacadieux
>>> 
>>> _______________________________________________
>>> Qgis-user mailing list
>>> Qgis-user at lists.osgeo.org
>>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> 



More information about the Qgis-user mailing list