[Qgis-user] How to convert raster routes into vector format?

Håvard Tveite havard.tveite at nmbu.no
Wed Jul 29 13:34:26 PDT 2015


With QGIS 2.10, the following should work (probably also OK
for earlier versions).

Check the band values of your colour using the info button,
and use the values in the expression below (assuming the
name of your raster layer is yourraster) instead of 116, 20
and 31:

("yourraster at 1" = 116  AND "yourraster at 2" =  20 AND "yourraster at 3" = 31) * 1

This should give you a binary raster with 1 in the pixels
that have your colour and 0 in the pixels with other colours.

In the style dialogue you can use the following to see the
resulting binary image:
Colour gradient: "white to black"
Min: 0
Max: 1

You should be able to use r.thin on that image, but I am not
able to test this now, as I am on Ubuntu, and have not been
able to get GRASS to work through Processing on that platform
for QGIS 2.10.

Håvard

On 29. juli 2015 16:40, Nick Papadonis wrote:
> Hi Håvard,
>
> I found the raster calculator and read the online manual for it, however am still a bit lost.  I was also playing with the Style properties and color bands last night to try to accomplish this.  I was unable to get a single binary image with the single color (red in this case).  I think the understand the r.thin suggestion and that it will thin the single color thick lines for vectorization.  Appreciate if you can expand on obtaining a binary skeleton of the one color of the trails.
>
> Thanks again,
> Nick
>
>> On Jul 29, 2015, at 7:18 AM, Havard Tveite <havard.tveite at nmbu.no> wrote:
>>
>> If you are going to use GRASS r.to.vect (for instance through QGIS
>> Processing), you will need a binary skeleton image.
>> You could get one by using the raster calculator to extract
>> your single colour as a binary image, and then GRASS r.thin
>> (available in QGIS Processing) to get the skeleton.
>>
>> Håvard
>>
>> On 29/7/2015 8:36:AM, Nick Papadonis wrote:
>>> Hi Folks,
>>>
>>> I have a map with numerous trails in a single color and would like to vectorize these.  Is there a mode Qgis can be placed in such that a color can be selected for inclusion in the vectorization process?  I.e. to make converting these routes to vector format easier?
>>>
>>> Thanks again
>>> _______________________________________________
>>> Qgis-user mailing list
>>> Qgis-user at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>>
>



More information about the Qgis-user mailing list