discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

concave-hull (topography)

JB
Jordan Brown
Sat, Aug 27, 2022 6:47 AM

On 8/26/2022 6:26 PM, Jordan Brown wrote:

I keep thinking about doing something with USGS 3D Elevation Program
files.

I found a much more convenient source for the data, that will let you
extract whatever chunk you want.
https://portal.opentopography.org/dataCatalog?group=global
They also have some world-wide data.

That came from this guy, who was trying to do something different with
the elevation data:
https://shallowsky.com/blog/2019/Jul/

Here's a snippet extracted from the 1/3 arc-second / 10m data.

Notes:

  • I haven't tried to do anything to get the vertical scale right.  The
    original ends up basically black; I used GIMP Colors/Auto/Stretch
    Contrast to get it to have some visible contrast.  A final toolchain
    would need to do a better job of doing something controlled with the
    vertical scale.
  • I believe that the pixels are 1/3 arc second in each dimension,
    which means that they are taller than they are wide.  I correct for
    that by scaling X by cos(latitude).
  • My first thought was that the scalloping was a contouring artifact,
    but now I suspect that it's real, that it represents areas flattened
    out for lines of houses.

What I did:

  • https://portal.opentopography.org/raster?opentopoID=OTNED.012021.4269.1

  • Use map to select area.
    o Uncheck "generate hillside" if you like.
    o Enter an e-mail address
    o [SUBMIT]

  • Wait just a moment (10-20 sec for small areas) for page to refresh
    with results.

  • Download data (in .tar.gz form, sigh)

  • 7zip to expand the .gz, then expand the .tar, to get a .tif

  • GIMP
    o Colors/Auto/Stretch Contrast
    o crop when it was too big for OpenSCAD
    o Export as PNG

  • OpenSCAD
    o

    scale([cos(latitude),1]) {
        surface("output_USGS10m.png");
    }
    
On 8/26/2022 6:26 PM, Jordan Brown wrote: > I keep thinking about doing something with USGS 3D Elevation Program > files. I found a much more convenient source for the data, that will let you extract whatever chunk you want. https://portal.opentopography.org/dataCatalog?group=global They also have some world-wide data. That came from this guy, who was trying to do something different with the elevation data: https://shallowsky.com/blog/2019/Jul/ Here's a snippet extracted from the 1/3 arc-second / 10m data. Notes: * I haven't tried to do anything to get the vertical scale right.  The original ends up basically black; I used GIMP Colors/Auto/Stretch Contrast to get it to have some visible contrast.  A final toolchain would need to do a better job of doing something controlled with the vertical scale. * I believe that the pixels are 1/3 arc second in each dimension, which means that they are taller than they are wide.  I correct for that by scaling X by cos(latitude). * My first thought was that the scalloping was a contouring artifact, but now I suspect that it's real, that it represents areas flattened out for lines of houses. What I did: * https://portal.opentopography.org/raster?opentopoID=OTNED.012021.4269.1 * Use map to select area. o Uncheck "generate hillside" if you like. o Enter an e-mail address o [SUBMIT] * Wait just a moment (10-20 sec for small areas) for page to refresh with results. * Download data (in .tar.gz form, sigh) * 7zip to expand the .gz, then expand the .tar, to get a .tif * GIMP o Colors/Auto/Stretch Contrast o crop when it was too big for OpenSCAD o Export as PNG * OpenSCAD o scale([cos(latitude),1]) { surface("output_USGS10m.png"); }
RW
Raymond West
Sat, Aug 27, 2022 11:51 AM

Contour lines wrt geo-mapping are lines joining points of equal
altitude, so all they do is  show points at the same heigh, nothing more
than that. There is no information wrt what happens between the lines,
and in fact the lines are often generated by interpolation between
points. A simple example, it would be correct to represent a square by
three points, none of them on a corner. Without more information,* the
actual profiles that may be generated are no more  than guesswork.

Based on the information inherent in the contours, probably the best
that can be done is to extrude them to the relevant heights, anything
else is artistic licence, so to speak, (sloping sides, etc.) , but can
be based on other information not inherent in the contours themselves.

Also, if 3d modelling terrain, it is usual to exaggerate the vertical
distances, thereby multiplying any errors.

  • in openscad, the extra information is required by polyhedron (from a
    stack of polygons, contours if you like) by having to add faces to show
    which point relates to others on different levels, and then the best
    guess is that the faces are flat.

On 27/08/2022 02:26, Jordan Brown wrote:

With the ignorance of one who had never tried it, I was thinking that
this "triangularize a contour map" problem couldn't be too hard.

But then I realized that it was even less obvious than I thought how
to connect two adjacent contour lines.  Simple concentric mountains
seem straightforward enough.  However, two peaks can make for cases
that I don't even know how to start on.

      1111111111111111111111111111111111111
      1                                   1
      1     2222222          22222222     1
      1     2     2          2      2     1
      1     2222222          22222222     1
      1                                   1
      1111111111111111111111111111111111111

I keep thinking about doing something with USGS 3D Elevation Program
files.  They are even already conveniently in grayscale image format. 
Unfortunately, they are also, shall we say, kind of big.  The 1x1
degree tile for my area in Southern California is 437M, a 10Kx10K
pixel image.  (Each pixel is about 10 meters.)  I tried a couple of
general-purpose image editor/viewers, and they couldn't handle it. 
Maybe ImageMagick, but I'll have to read up on how to do it.  GIMP
came closet, loading it but then for some reason showing everything
but water as 100% white.

The JPEG is a reasonable size, but is too low-resolution for the kind
of model I want to make:

https://prd-tnm.s3.amazonaws.com/StagedProducts/Elevation/13/TIFF/current/n35w119/USGS_13_n35w119.jpg

Here's the full directory:

https://prd-tnm.s3.amazonaws.com/index.html?prefix=StagedProducts/Elevation/13/TIFF/current/

Note that the directory names are latitude/longitude, but unobviously
they refer to the high end of the range so n35w119 refers to latitude
34.000-34.999 and longitude 118.000-118.999.

Unfortunately, as you might guess from the name, it seems that the
USGS only stocks data for the US.  (Which doesn't make any sense,
since I'm sure it's derived from satellites and they fly over most or
all of the world.)


OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org

Contour lines wrt geo-mapping are lines joining points of equal altitude, so all they do is  show points at the same heigh, nothing more than that. There is no information wrt what happens between the lines, and in fact the lines are often generated by interpolation between points. A simple example, it would be correct to represent a square by three points, none of them on a corner. Without more information,* the actual profiles that may be generated are no more  than guesswork. Based on the information inherent in the contours, probably the best that can be done is to extrude them to the relevant heights, anything else is artistic licence, so to speak, (sloping sides, etc.) , but can be based on other information not inherent in the contours themselves. Also, if 3d modelling terrain, it is usual to exaggerate the vertical distances, thereby multiplying any errors. * in openscad, the extra information is required by polyhedron (from a stack of polygons, contours if you like) by having to add faces to show which point relates to others on different levels, and then the best guess is that the faces are flat. On 27/08/2022 02:26, Jordan Brown wrote: > With the ignorance of one who had never tried it, I was thinking that > this "triangularize a contour map" problem couldn't be too hard. > > But then I realized that it was even less obvious than I thought how > to connect two adjacent contour lines.  Simple concentric mountains > seem straightforward enough.  However, two peaks can make for cases > that I don't even know how to start on. > > 1111111111111111111111111111111111111 > 1 1 > 1 2222222 22222222 1 > 1 2 2 2 2 1 > 1 2222222 22222222 1 > 1 1 > 1111111111111111111111111111111111111 > > I keep thinking about doing something with USGS 3D Elevation Program > files.  They are even already conveniently in grayscale image format.  > Unfortunately, they are also, shall we say, kind of big.  The 1x1 > degree tile for my area in Southern California is 437M, a 10Kx10K > pixel image.  (Each pixel is about 10 meters.)  I tried a couple of > general-purpose image editor/viewers, and they couldn't handle it.  > Maybe ImageMagick, but I'll have to read up on how to do it.  GIMP > came closet, loading it but then for some reason showing everything > but water as 100% white. > > The JPEG is a reasonable size, but is too low-resolution for the kind > of model I want to make: > > https://prd-tnm.s3.amazonaws.com/StagedProducts/Elevation/13/TIFF/current/n35w119/USGS_13_n35w119.jpg > > Here's the full directory: > > https://prd-tnm.s3.amazonaws.com/index.html?prefix=StagedProducts/Elevation/13/TIFF/current/ > > Note that the directory names are latitude/longitude, but unobviously > they refer to the high end of the range so n35w119 refers to latitude > 34.000-34.999 and longitude 118.000-118.999. > > Unfortunately, as you might guess from the name, it seems that the > USGS only stocks data for the US.  (Which doesn't make any sense, > since I'm sure it's derived from satellites and they fly over most or > all of the world.) > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org
SP
Sanjeev Prabhakar
Sun, Sep 4, 2022 6:17 AM

I have written a logic for concave hull in jupyter notebook

https://github.com/sprabhakar2006/openSCAD

On Fri, 26 Aug 2022 at 12:50, Bryan Lee leebc11@acm.org wrote:

I am trying to make a topographic model.
(Think one of those things that shows how high the mountains are.)

My model needs to show the peaks and the valleys.

I have vector curves that represent elevations.  (I hand traced these from
an old map.)
I can import these as a grey-scale PNG of elevations, or as multiple SVGs
that create 2D polygons and extrude them.

However, I want the sides to be sloped, like a real mountain.  NOT have
vertical sides like extrusions.

If this were just a single convex mountain, I could do a hull() around the
multiple elevation levels.

But hull() will create a "flat" area between mountain peeks, and it will
not show the valleys.

Does anyone have suggestions for an algorithm that will work similar to
hull(), but that will curve the surface into concave areas?


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I have written a logic for concave hull in jupyter notebook https://github.com/sprabhakar2006/openSCAD On Fri, 26 Aug 2022 at 12:50, Bryan Lee <leebc11@acm.org> wrote: > I am trying to make a topographic model. > (Think one of those things that shows how high the mountains are.) > > My model needs to show the peaks and the valleys. > > I have vector curves that represent elevations. (I hand traced these from > an old map.) > I can import these as a grey-scale PNG of elevations, or as multiple SVGs > that create 2D polygons and extrude them. > > However, I want the sides to be sloped, like a real mountain. NOT have > vertical sides like extrusions. > > If this were just a single convex mountain, I could do a hull() around the > multiple elevation levels. > > But hull() will create a "flat" area between mountain peeks, and it will > not show the valleys. > > Does anyone have suggestions for an algorithm that will work similar to > hull(), but that will curve the surface into concave areas? > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >