# 2D Topographical Map

**URL:** <https://discourse.processing.org/t/2d-topographical-map/19260>\
**Category:** Coding Questions\
**Created:** [March 31, 2020, 6:17pm UTC](https://discourse.processing.org/t/2d-topographical-map/19260 "2020-03-31T18:17:33Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![solub](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/solub/32/333_2.png) [@solub](https://discourse.processing.org/u/solub)\
**Post date:** [March 31, 2020, 6:41pm UTC](https://discourse.processing.org/t/2d-topographical-map/19260/2 "2020-03-31T18:41:42Z")

</div>

Hi @heatmiser,

That [related forum thread](https://discourse.processing.org/t/topographical-map/13302/14) can be a good starter.

In a nutshell, you can either work with pixels (see LuckSmith’s suggestion) or with line segments. For the latter, people usually use the _Marching Square_ algorithm or a variant approach called _Meandering Triangles_ (see JeremyDouglass’ post). You can also have a library do all the work for you (see the “blobDetection” example).

If you need to easily have access to each and every contour-line or convert them to PShapes, resorting to a library might be more appropriate.  
On the contrary, if customization is not a priority and you want to find the contours by yourself the _Meandering Triangles_ approach could be a good choice.

example (meandering triangles)

 ![Annotation 2020-03-29 164133](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/8/8768eafad154f00e3261bba856ea1dc116780925.png)

edit: Example in p5.js ([link](https://editor.p5js.org/solub/sketches/I3V99NXlX))

https://editor.p5js.org/solub/embed/I3V99NXlX

---

_[View the full topic](https://discourse.processing.org/t/2d-topographical-map/19260)._
