Giter VIP home page Giter VIP logo

Comments (1)

dstahlke avatar dstahlke commented on July 26, 2024

Richard,

Is the ugliness only apparent when you zoom in to the scale of
individual pixels? It is my guess that this is the case. There is
currently no option in gdal_trace_outline to do this directly. If your
goal is to have a polygon that looks nice at this level of detail, then
here is a proposed solution (untested):

  1. convert your image to a bitmap image (black and white, no gray)
  2. expand the resolution of this image by a factor of 10 or more (if
    this will fit in memory!) using your favorite type of interpolation
    (probably cubic or lanczos, definitely not nearest neighbor or linear).
    This can be done using gdalwarp, or your favorite image editor
    application. Optionally hit it with a Gaussian blur.
  3. threshold this image to again be black and white (no gray). The
    outline should hopefully be smooth.
  4. run gdal_trace_outline, trying various settings for the "-dp-toler"
    flag. Maybe set dp-toler to be equal to the amount you expanded the
    resolution by, or perhaps twice this amount.

If the ugliness is apparent at larger scales (not just at the scale of a
couple of pixels) then something is wrong and you should send me a
portion of your image that reproduces the problem.

There is a program called "potrace" (http://potrace.sourceforge.net/)
that creates artistically nice looking vector images from bitmaps. I
have never used it, but there is a possibility that it may work well for
your purposes.

  • Dan

On 07/15/2013 10:28 AM, Richard Fairhurst wrote:

gdal_trace_outline is a godsend but tends to produce very jagged edges
from SRTM data. Applying the Douglas-Peucker simplification results in
sharp bends at corners and unnatural-looking shapes. Turning this off
produces sawtooth edges.

It would be good to have more 'natural'-looking smoothing, similar to
the output produced (in raster form) by gdaldem.

There are some ideas in this thread
http://osgeo-org.1560.x6.nabble.com/gdal-dev-gdal-polygonize-and-polygon-edges-td5035292.html
(which is how I found gdal_trace_outline!). Right now I'm using a
combination of ogr2ogr and Mapnik's line-smooth, which produces
reasonable results, but it would be better to have it in
gdal_trace_outline.


Reply to this email directly or view it on GitHub
#2.

from dans-gdal-scripts.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.