digtize => surface => grdcontour

View: New views
4 Messages — Rating Filter:   Alert me  

digtize => surface => grdcontour

by Charlton Galvarino :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, list.

I have some very simple rasters that I am trying to digitize and turn into simple LINESTRING's (to be recognized by either a .shp or in PostGIS).

I have played around w/ GDAL's gdalcontour, but it only traces the outside of the thick lines (see attachment for a reduced original image that I might start w/).  And there is no easy way for me to collapse it or to find the midline of the linestrings.

So what I am playing w/ now is to:

* Read each pixel @ (x,y) via PerlMagick and see how many black pixels surround this (x,y).  Save this info in a CSV of the format (x,y,hits).

* Run this CSV through surface.

* grdcontour the new grid and spit out .txt for selected contours.

I think what I'm doing is essentially building up an elevation CSV since the pixels in the middle of the thick line will have a greater # of hits than those closer to the edge.  I realize it can get a bit garbled if two lines intersect, but I'm not worried about that (yet?).

I'm not really asking folks to solve my problem here -- I'm mainly asking for encouragement that this is not too boneheaded.  I am not ending up w/ exactly what I want.  If I surface w/ too coarse a grid, I end up w/ shapes that look nothing like what I started w/.  If I grdcontour w/ too few -C's selected, I don't see much.  I've even tried saving log10(hits) in my CSV since I really only care about the peaks.  I also tried only writing those hits to CSV that were the absolute peak # of hits, but I imagine this created points that were too far apart to be connected via surface.

Anyway, is this boneheaded, or am I on the right track?

Many thanks,

Charlton





Charlton Galvarino
1 (803) 233-6205 : voice
1 (803) 223-9579 :   fax
charlton@...

P.O. Box 50960
Columbia, SC 29250

To unsubscribe, send the message "signoff gmt-help" to listserv@...

Re: digtize => surface => grdcontour

by Joaquim Luis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Charlton,

What you are seeking falls into the image processing domain.
Digitizing a binary image always produce the two sides of a line. Even
if that line is only one pixel thick which, for what
I understand, is what you are after. What you need is to apply a
"skeletization" to your raster (after converting it to a
binary image) image before vectorizing.
GMT cannot be of great help with this. Matlab or Octave can.

Joaquim Luis

> Hi, list.
>
> I have some very simple rasters that I am trying to digitize and turn into simple LINESTRING's (to be recognized by either a .shp or in PostGIS).
>
> I have played around w/ GDAL's gdalcontour, but it only traces the outside of the thick lines (see attachment for a reduced original image that I might start w/).  And there is no easy way for me to collapse it or to find the midline of the linestrings.
>
> So what I am playing w/ now is to:
>
> * Read each pixel @ (x,y) via PerlMagick and see how many black pixels surround this (x,y).  Save this info in a CSV of the format (x,y,hits).
>
> * Run this CSV through surface.
>
> * grdcontour the new grid and spit out .txt for selected contours.
>
> I think what I'm doing is essentially building up an elevation CSV since the pixels in the middle of the thick line will have a greater # of hits than those closer to the edge.  I realize it can get a bit garbled if two lines intersect, but I'm not worried about that (yet?).
>
> I'm not really asking folks to solve my problem here -- I'm mainly asking for encouragement that this is not too boneheaded.  I am not ending up w/ exactly what I want.  If I surface w/ too coarse a grid, I end up w/ shapes that look nothing like what I started w/.  If I grdcontour w/ too few -C's selected, I don't see much.  I've even tried saving log10(hits) in my CSV since I really only care about the peaks.  I also tried only writing those hits to CSV that were the absolute peak # of hits, but I imagine this created points that were too far apart to be connected via surface.
>
> Anyway, is this boneheaded, or am I on the right track?
>
> Many thanks,
>
> Charlton
>
>
>
>
>
> Charlton Galvarino
> 1 (803) 233-6205 : voice
> 1 (803) 223-9579 :   fax
> charlton@...
>
> P.O. Box 50960
> Columbia, SC 29250
>
> To unsubscribe, send the message "signoff gmt-help" to listserv@...
>
>
>  

To unsubscribe, send the message "signoff gmt-help" to listserv@...

Re: digtize => surface => grdcontour

by Charlton Galvarino :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, Joaquim and Paul.

> GMT cannot be of great help with this. Matlab or Octave can.

Very interesting.  My head has been in the dirt for long enough never to have heard of Octave.  Thanks for steering me that direction.

> 3. Use gmtstitch to assemble continuous lines from these points.

I see a lot of payoff for other projects if I can get familiar enough w/ Octave, so I'll trudge down that path for a bit.

Thanks again,

Charlton

To unsubscribe, send the message "signoff gmt-help" to listserv@...

Re: digtize => surface => grdcontour

by Joaquim Luis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Charlton Galvarino wrote:
> Thanks, Joaquim and Paul.
>
>  
>> GMT cannot be of great help with this. Matlab or Octave can.
>>    
>
> Very interesting.  My head has been in the dirt for long enough never to have heard of Octave.  Thanks for steering me that direction.
>  

What you would like is this

http://vectormagic.com/home

I hate when those guys do it so perfectly (and I do not)

To unsubscribe, send the message "signoff gmt-help" to listserv@...