[gdal-dev] Re: Open source API to convert raster to polygons?
Brent Fraser
bfraser at geoanalytic.com
Fri Jun 6 11:07:39 EDT 2008
Klokan,
I couldn't get Autotrace to give me what I wanted. In the end I wrote some code using GDAL and OGR for the raster and vector I/O.
Most raster-to-vector problems are far more difficult than mine; in those cases, the need is to re-constitute a scanned map (or drawing) to it's original "vector" format. For my simple problem, I just needed to connect adjacent pixels with line segments.
Thanks!
Brent
Klokan Petr Přidal wrote:
> Hi Brent,
>
> have you tried "autotrace"? It has the centerline functionality and
> several parameters to tweek the result.
> To a shapefile you will have to go trough DXF, probably. And you need
> to correctly handle conversion from raster coordinates to a map one.
>
> http://autotrace.sourceforge.net/
>
> Autotrace is open-source, are the algorithms interesting (and useful)
> for GIS tools as well?
>
> Another program, which came to my mind is "potrace". There is a list
> of "Similar Projects:" on the autotrace website.
> Can you later on post a note about the toolchain you have choosen?
>
> Klokan
>
> On Wed, Jun 4, 2008 at 11:17 PM, Brent Fraser <bfraser at geoanalytic.com> wrote:
>> Dan (and others),
>>
>> I've compiled your gdal_trace_outline code on Windows XP / VS2003.NET with
>> only a few minor problems (I can send details if you are interested).
>>
>> Unfortunately I've got a bunch (56) 1-bit tiff files generated from an image
>> segmentation process I want lines (ok, polygons) for. So I really want to
>> vectorize the centerline of the pixels, not their outlines. How hard would
>> it be to modify gdal_trace_outline to do this?
>>
>> To others interested: I've experimented with ras2vec
>> (http://www.xmailserver.org/davide.html) and had some success, but it misses
>> generating a few line segments where the "edge" pixels are adjacent. I've
>> been able to use OpenJump to polygonize the lines (after bumping up the
>> allocated memory on startup), so that part is ok.
>>
>> I plan on looking into Grass too...
>>
>> Thanks!
>> Brent Fraser
>> GeoAnalytic Inc.
More information about the gdal-dev
mailing list