Comments (1)
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):
- convert your image to a bitmap image (black and white, no gray)
- 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. - threshold this image to again be black and white (no gray). The
outline should hopefully be smooth. - 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)
- gdal_trace_outline ignores alpha layer HOT 4
- Building the tool to work with GDAL 2.1.3 HOT 1
- calculate alpha channel directly in gdal_trace_outline HOT 1
- A bug of destructor of BboxBinarySpacePartition class? HOT 1
- Parameter --quiet HOT 1
- Error during installation HOT 2
- GDAL v3 breaking changes HOT 2
- gdal_trace_outline producing incorrect results HOT 1
- Some extra steps to install scripts on MacOS HOT 1
- Unknown conversion type character 'z' in format HOT 5
- Report invalid options in gdal_landsat_pansharp
- How to install it on a Linux instance of Amazon EC2? HOT 1
- Usage info for gdal_contrast_stretch HOT 1
- Serious bug in gdal_trace_outline (produces broken geometry) HOT 7
- request for gdal_trace_outline.cc HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dans-gdal-scripts.