[Qgis-user] Raster to Vector without losing the symbology

Andy Harfoot ajph at geodata.soton.ac.uk
Tue Jul 20 02:40:27 PDT 2021


Hi Krishna,

It's hard to say what might be happening without seeing the data, but 
the issues with the union output may be due to invalid geometries being 
created by the polygonise. Check that the polygonise outputs are 
correctly capturing the band values and run them through the 'Check 
validity' tool.

If there are a lot of invalid polygons, then it will probably be easier 
to follow a raster approach such as outlined by Nicolas Cadieux, ie 
Raster Calculator: R * 1000000 + G * 1000 + B, followed by polygonise 
and then use an expression to extract the colour components again to 
colour the polygons.

Cheers,

Andy

On 19/07/2021 21:09, krishna Ayyala wrote:
> *CAUTION:* This e-mail originated outside the University of Southampton.
> Dear Andy,
> Thanks for your reply. I did extract the image into three separate 
> vectors using the Polygonize (Raster to vector) tool. I got three 
> vector files which I named as Band1, Band2 and Band3. I did the union 
> of Band1 and Band2 the result of which I named as "Band1_and_Band2". 
> Again ran union tool with "Band1_and_Band2" and Band3. I named the 
> result as Band1_and_Band2_and_Band3". This resultant vector file is 
> not showing the entire area of the image. It is showing only part of 
> the image. Lot of DN values for each band show null values.
>
> Regards.
>
> On Mon, Jul 19, 2021 at 7:40 AM Andy Harfoot <ajph at geodata.soton.ac.uk 
> <mailto:ajph at geodata.soton.ac.uk>> wrote:
>
>     Or extract the three bands into three separate vector files and
>     then union the three together to get the unique combinations of
>     RGB values.
>
>     Cheers,
>
>     Andy
>
>     On 18/07/2021 19:56, Nicolas Cadieux wrote:
>>     *CAUTION:* This e-mail originated outside the University of
>>     Southampton.
>>     Hi,
>>     You could create a style that could apply to both raster and
>>     vector layers but that would not help much here.  The problem is
>>     that you need to create the vector based on one of the raster
>>     Bands and not all three.  One way could be to combine all three
>>     fields into one.  If your RGB is 155 025 255, make this a raster
>>     band with 155025255. Then, I guess you could use that 4th band to
>>     make the vector layer, then resplit the data into 3 fields and
>>     use that to create the colour profile.
>>
>>     Nicolas Cadieux
>>     https://gitlab.com/njacadieux
>>     <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.com%2Fnjacadieux&data=04%7C01%7Cajph%40geodata.soton.ac.uk%7C726a39561c5d442ecdba08d94af134d3%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637623222094924014%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=fAzESIlmgUW0MGxRs99ZXaj9jDFTjwuQx0wTmKKTudk%3D&reserved=0>
>>
>>>     Le 18 juill. 2021 à 12:51, krishna Ayyala
>>>     <ayyalakrishna at gmail.com> <mailto:ayyalakrishna at gmail.com> a écrit :
>>>
>>>     
>>>     I have an image on my qgis map that has 3 bands. Band1 (red),
>>>     Band2(green) and Band3(blue). This image has different colors.Is
>>>     it possible to convert this image into a vector which should
>>>     look exactly like the image.
>>>
>>>     That means; Is it possible to have the vector file that
>>>     should have the same colors as that of the image.
>>>
>>>     Regards.
>>>     _______________________________________________
>>>     Qgis-user mailing list
>>>     Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
>>>     List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>>     <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fqgis-user&data=04%7C01%7Cajph%40geodata.soton.ac.uk%7C726a39561c5d442ecdba08d94af134d3%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637623222094933971%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=5zETbH9pq2QgyqsDmPSfqcu67JS38UW6Xem02PLblGk%3D&reserved=0>
>>>     Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>>     <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fqgis-user&data=04%7C01%7Cajph%40geodata.soton.ac.uk%7C726a39561c5d442ecdba08d94af134d3%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637623222094933971%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=5zETbH9pq2QgyqsDmPSfqcu67JS38UW6Xem02PLblGk%3D&reserved=0>
>>
>>     _______________________________________________
>>     Qgis-user mailing list
>>     Qgis-user at lists.osgeo.org  <mailto:Qgis-user at lists.osgeo.org>
>>     List info:https://lists.osgeo.org/mailman/listinfo/qgis-user  <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fqgis-user&data=04%7C01%7Cajph%40geodata.soton.ac.uk%7C726a39561c5d442ecdba08d94af134d3%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637623222094943924%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=wN1kWD1H72DaxoWa%2FwLEu6pLnw4PiWDQhls0AJCRns4%3D&reserved=0>
>>     Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-user  <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fqgis-user&data=04%7C01%7Cajph%40geodata.soton.ac.uk%7C726a39561c5d442ecdba08d94af134d3%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637623222094943924%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=wN1kWD1H72DaxoWa%2FwLEu6pLnw4PiWDQhls0AJCRns4%3D&reserved=0>
>
>     -- 
>     Andy Harfoot
>
>     Skype: gdi_ajph
>     Teams:ajph at soton.ac.uk  <mailto:ajph at soton.ac.uk>
>
>     GeoData Institute
>     University of Southampton
>     Southampton
>     SO17 1BJ
>
>     www.geodata.soton.ac.uk  <http://www.geodata.soton.ac.uk>
>
>     _______________________________________________
>     Qgis-user mailing list
>     Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
>     List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>     <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fqgis-user&data=04%7C01%7Cajph%40geodata.soton.ac.uk%7C726a39561c5d442ecdba08d94af134d3%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637623222094953881%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=is3mNJfvuNshxwSmrU4MGXV8DQU%2Fehvast5R9XqYf9c%3D&reserved=0>
>     Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>     <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fqgis-user&data=04%7C01%7Cajph%40geodata.soton.ac.uk%7C726a39561c5d442ecdba08d94af134d3%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637623222094953881%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=is3mNJfvuNshxwSmrU4MGXV8DQU%2Fehvast5R9XqYf9c%3D&reserved=0>
>
-- 
Andy Harfoot

Skype: gdi_ajph
Teams: ajph at soton.ac.uk

GeoData Institute
University of Southampton
Southampton
SO17 1BJ

www.geodata.soton.ac.uk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210720/a6102aeb/attachment-0001.html>


More information about the Qgis-user mailing list