[HN Gopher] Packing the world for longest lines of sight
       ___________________________________________________________________
        
       Packing the world for longest lines of sight
        
       Author : tombh
       Score  : 130 points
       Date   : 2025-10-05 21:02 UTC (3 days ago)
        
 (HTM) web link (tombh.co.uk)
 (TXT) w3m dump (tombh.co.uk)
        
       | greggsy wrote:
       | Related, there's a Reddit post tracking the furthest photos of
       | the Sydney skyline:
       | 
       | https://www.reddit.com/r/sydney/comments/1lzke5t/the_actual_...
       | 
       | Google Earth map:
       | https://earth.google.com/web/@-32.84964163,149.89452785,590....
        
         | SpicyUme wrote:
         | There's a nearly 450 km photo of the Ecrins from the Pyrenees!
         | 
         | https://beyondrange.wordpress.com/2016/08/03/pic-de-finestre...
         | 
         | That's a cool thing to track, I've been surprised by the places
         | I've seen the Seattle skyline reflected on the water near
         | sundown. No crazy distances, but there's a small time period
         | where it flashes into view.
        
           | lloeki wrote:
           | On clear days from the Vosges mountains you can _easily_ see
           | the French Alps (and even part of Austrian Alps if lucky),
           | and especially the Mont Blanc. e.g places like the Ballon D
           | 'Alsace, and even all the way up north to Donon or
           | Nideck+Schneeberg+.
           | 
           | Quite a bit shorter in distance (between 200 and 300km
           | depending on where you sit) but visually stunning.
           | 
           | I seem to recall in older times there used to be some light
           | semaphore infrastructure to communicate over these distances.
           | 
           | https://web.archive.org/web/20251008080738mp_/https://i72.se.
           | ..
           | 
           | https://www.vosgesmatin.fr/environnement/2023/12/19/quand-
           | le...
           | 
           | https://www.vosgesmatin.fr/environnement/2022/11/12/quand-
           | le...
           | 
           | + Which I hiked this year, unfortunately only had a phone so
           | all I get is the memory of seeing the Mont Blanc from there.
        
             | DiggyJohnson wrote:
             | Panorama in the first of three links is stunning.
        
             | SpicyUme wrote:
             | Those are great pictures. And I've been near there! I've
             | seen the Alps from near Saignelegier then we drove through
             | Plombieres-les-Bains on the way north. On certain clear
             | winter days I bet the mountains look bigger due to lensing.
        
         | 7373737373 wrote:
         | This had me find https://old.reddit.com/r/FromAfar/top/?t=all !
        
       | cozzyd wrote:
       | If you consider atmospheric refraction it might be more
       | complicated...
        
       | eszed wrote:
       | Since you asked about alternate packing solutions:
       | 
       | https://news.ycombinator.com/item?id=43305920
       | 
       | I don't know enough about the subject to have any useful
       | suggestions, but I'd be interested in your take on how a project
       | like yours would work differently if you were to choose a
       | different solution.
        
         | tombh wrote:
         | I'd heard of H3, they definitely sound like they could be
         | related, but I think they're solving a different problem. I
         | think H3 is for efficient storage of geographic data whereas
         | I'm just trying to solve a classic packing problem, like this
         | monstrosity
         | https://www.reddit.com/r/math/comments/111ne5y/deeply_unsett...
        
       | rendaw wrote:
       | I was recently looking into this for roguelike-like visibility
       | calculations. The term I came across was "isovist" not
       | "viewshed", but they seem identical? The former appears to be
       | used a lot in architecture.
       | 
       | Calculating a 2d isovist is (relatively) simple, for 3d it seems
       | much more complex. Is this simplified by the fact that it's
       | dealing with a height map?
        
         | pcthrowaway wrote:
         | Not sure what you mean by 2D isovist, but is it that 3D
         | involves the curvature of the earth?
        
       | lsy wrote:
       | I'm sure it's nearly an academic distinction, but:
       | 
       | > Basically, for any given region, we find its highest point and
       | assume that there is a perfectly placed sibling peak of the same
       | height that is mutually visible.
       | 
       | Shouldn't you always add 335km to the horizon distance to account
       | for the possibility of Everest (i.e. a _taller_ sibling peak)
       | being on the other side of the horizon?
        
         | tennysont wrote:
         | You're right, but all lines of sight are mutual, so we will
         | notice this oversight when checking the other peak.
         | 
         | This seems poorly explained, but I think the author was in a
         | hurry to get to the main algorithm, and sped through the intro.
        
         | tombh wrote:
         | Author here. I really appreciate this question because it's the
         | entire reason I wrote the post. I feel like this is a unique
         | problem and so I'm sure I'm not considering all the
         | possibilities.
         | 
         | I _think_ your suggestion is covered by the fact that I'm
         | basing the size of the tile on the single highest point that it
         | contains. The steps are:                   1. Take any point
         | and calculate the furthest theoretical distance it could see if
         | there were another point at just the perfect distance away for
         | mutual visibility. Note how there could of course be an
         | Everest, but I don't check because step 2 should solve that.
         | 2. Based on that furthest theoretical distance I create a tile
         | of that exact width around the point and then check to see what
         | the new highest point is within that tile _and_ its
         | surroundings. "Surroundings" here means a border region around
         | the tile of the same width as the tile itself. These
         | surroundings don't get viewsheds calculated for them, they're
         | just auxiliary data.         3. If a higher point is found,
         | then increase the width based on that new highest point and
         | repeat step 2. If no higher point is found then the tile is
         | ready.
        
       | dolmen wrote:
       | Does the source dataset includes with enough precision human made
       | buildings?
       | 
       | Will it allow to determine the farthest point theorically visible
       | from the top of the Eiffel Tower?
        
         | tombh wrote:
         | The underlying data isn't that accurate, but I think with a
         | tool like https://www.heywhatsthat.com you can set the
         | coordinates and elevation manually and create a custom
         | viewshed.
        
       | mungoman2 wrote:
       | As proposed in the article, calculating the area weights all
       | points in the viewshed equally. I wonder if it makes sense to
       | give more weight to far-away points? Or maybe less weight? Not
       | sure! But would be interesting to explore and see if it gives
       | anything.
        
         | tombh wrote:
         | I'm the author. Well there's actually a term in the kernel to
         | normalise the surface area of each visible point by a factor of
         | tan(1 radian): https://github.com/tombh/total-
         | viewsheds/blob/main/crates/ke...
         | 
         | I don't know if that's related to what you're thinking about?
        
       | 7373737373 wrote:
       | I've been wondering about using OpenStreetMap data to achieve
       | _something_ similar, like getting the longest uninterrupted (by
       | buildings) distance between two viewpoints (the Nikon Coolpix
       | P900 /P1000/P1100 cameras or a telescope are pretty good for this
       | due to their extreme focal lengths), or maybe something like
       | "most ice cream shop dense area"
       | https://wiki.openstreetmap.org/wiki/Key:amenity
       | 
       | Putting the typical airplane cruise altitude (10km) into the
       | distance to horizon calculator
       | https://www.ringbell.co.uk/info/hdist.htm results in a "reverse"
       | distance of 357km to the horizon. So that's how far typical
       | airplanes can be seen when standing at sea level!
        
         | 7373737373 wrote:
         | The answer to the ice cream question (for places where ice
         | cream can be bought) appears to be Buenos Aires!
         | https://overpass-turbo.eu/?Q=%5Bout%3Ajson%5D%3B%0Anode%28%7...
         | (for any circular area centered around such a shop with 10km
         | radius)
         | 
         | For _ice cream shops_ specifically, Krakow? https://overpass-
         | turbo.eu/?Q=%5Bout%3Ajson%5D%3B%0Anode%28%7...
        
       | mrb wrote:
       | Oh that project is right up my alley, as I did the same! Back in
       | 2021, for fun, I wrote an algorithm to find the longest sightline
       | on earth. And I did find a previously undiscovered sightline.
       | 
       | My code was relatively unoptimized, it ran for 95 days on an
       | 8-core 16-thread AMD Ryzen 5750G to crunch all the data. I have
       | never published my code or results. I should really do it...
       | 
       | I downloaded a digital earth model of about 30 gigabytes from
       | http://www.viewfinderpanoramas.org/Coverage%20map%20viewfind...
       | which had a resolution of 3 seconds, so I had the elevation of
       | each 90x90 meters "tile" of land. I wrote a simple algo in C
       | that: finds potential viewpoints (mountain peaks or plateaus
       | above a minimum ), calculates the longest sightline 360deg around
       | you, taking into account an atmospheric refraction coefficient (I
       | used 0.13 which seems to be a default used by some panorama tools
       | like https://www.udeuschle.de). It's really basic trigonometry:
       | look one tile ahead of you, and the next one, etc, until you find
       | the one with the highest vertical angle of view. Stop one
       | sightline exploration when reaching a certain maximum distance
       | (750 km in my implementation) when it becomes mathematically
       | impossible to find a visible tile beyond this distance. And I
       | found the longest sightline:
       | 
       | In Kyrgyzstan from Pik Dankova (41.059167,77.683333) which is at
       | 5977.5 meters (in my DEM data), you can see 538.1 km into China
       | if you look toward bearing 169.7deg (roughly south) as you see
       | some distant minor peak at 36.295364,78.75593 which is 6444.0
       | meters high. However this sightline is already known. But it's
       | only theoretical. No one ever encountered good enough atmospheric
       | clear-sky conditions to observe it from Pik Dankova. Using the
       | panorama tool maintained by this cool German guy, you can verify
       | it:
       | https://www.udeuschle.de/panoramas/panqueryfull.aspx?mode=ne...
       | 
       | However one notable finding my tool gave me was it discovered the
       | second longest sightline that is competely unknown up until this
       | day AFAIK:
       | 
       | In Colombia, from Pico Cristobal Colon (10.838333,-73.687500)
       | which is at 5668.5 meters (in my DEM data), you can see 502.6 km
       | over the plains of the Caribbean region all the way to the
       | Colombian Andes if you look toward bearing 206.2deg (roughly
       | south-south-west) as you see some distant peak at
       | 6.777286,-75.692304 which is 3347.0 meters high. Here you can
       | verify it here:
       | https://www.udeuschle.de/panoramas/panqueryfull.aspx?mode=ne...
       | 
       | I am not sure if this Comlombian sighline has ever been observed.
       | 
       | As I said I should really publish my code and results. And at
       | some point I would like to optimize it and re-run it using a
       | higher-precision DEM with 30x30 meters tiles instead of 90x90
       | meters. I think there are a few 30-meter DEMs available but I
       | need to find the highest-quality one.
        
         | JR1427 wrote:
         | This is really cool - thanks for posting!
        
         | tombh wrote:
         | Wow, 95 days!! Who would have thought that Colombia had the
         | second highest, I just assumed it'd be another part of the
         | Himalayas. I'm the author of the post, I suppose there's a
         | chance I might find something different if I'm literally
         | calculating every single line of sight on the planet? As
         | there's a chance that the longest line isn't from a peak or
         | plateau?
         | 
         | I'd love to geek out with you about your journey and thoughts
         | if you're up for it?
        
           | dmurray wrote:
           | > As there's a chance that the longest line isn't from a peak
           | or plateau?
           | 
           | Is there such a chance? I'm struggling to think what this
           | could look like. If the furthest point you can see is in a
           | bowl or a valley, why can't you see all the way to the far
           | side of the valley? I think we can rule out topographic
           | ridiculousness like a mountain with a hole in it that you can
           | see through.
           | 
           | OK, instead of a peak or a plateau, perhaps the longest line
           | could be from a ridge in a saddle. So it's a peak when
           | approached from one orientation (say north/south) but a
           | trough when looking east-west. You can't see the higher
           | ground to the east and west because it's hidden behind some
           | other mountain.
        
             | tombh wrote:
             | I wonder if this is related to the so-called coastline
             | paradox? https://en.wikipedia.org/wiki/Coastline_paradox In
             | other words, what is the criteria for filtering out good
             | and bad elevation candidates?
             | 
             | Does it help imagining this on a tennis ball? Let's say we
             | make 2 pyramid-like blobs of plasticine and put them on
             | opposing sides of the tennis ball. Now we slowly move them
             | closer to each other until they can both just see other. Is
             | it not possible to form the pyramids in such a way, that
             | the first point of visibility is the pyramids' bases, and
             | not their peaks?
             | 
             | For me it comes down to the fact that although it might
             | seem obvious what a peak is when you see one, I don't think
             | there's any meaningful way to geographically define one.
             | They're always just _locally_ higher points.
             | 
             | BTW this is exactly why I wrote the post, it's a fairly
             | unique problem, and I'm sure I've made some problematic
             | assumptions.
        
             | manwe150 wrote:
             | If you imagine having a very deep hole in the ground, the
             | longest sight line would be from the lip to the bottom. If
             | you then dig a small hole at the bottom, you wouldn't be
             | able to see the bottom of the second hole, but only some
             | part of the wall
             | 
             | Similar in reverse, if the pyramid had a false peak (a
             | inflection place where topology changes from steep to less
             | steep), it could obscure line of sight between the real
             | peak, if the angle formed by the line of sight between the
             | two distant peaks tries to intersect the intermediate
             | inflection point
        
               | dmurray wrote:
               | I can imagine some shapes like this in theory, I just
               | think we can rule them out in practice.
               | 
               | For the hole example, we know there aren't any holes 500
               | km deep. For the pyramids, we know the line of sight is
               | very close to flat (it's at least 500 km long and less
               | than 10 km in elevation change). If a false peak prevents
               | you from seeing the real peak, the angle of the mountain
               | above the false peak is shallow enough that you can call
               | it a plateau.
        
           | mrb wrote:
           | It'd be a pleasure to chat about this! Hit me up by email: m
           | at zorinaq dot com
           | 
           | Actually, to be exact: I just checked my data and I forgot
           | that technically the 2nd and 3rd longest sightlines I
           | discovered are slight variations of the Pik Dankova
           | sightline. 7 km east of this peak is another mountain with
           | two spots from which there are two sightlines of 521.1 and
           | 510.49 km ending in the same mountain range in China (a few
           | hundred km away from the end point of the 1st sightline.)
           | 
           | Then the 4th longest sightline I found is the one that's
           | arguably unique: 510.45 km, fully contained within China in
           | the Kunlun Mountains from 38.614706,75.184529 to
           | 36.517500,80.333333. So that's an interesting find.
           | 
           | Then my 5th, 6th, 7th, 8th longest sightlines are again
           | slight variations of the 1st Pik Dankova sightline.
           | 
           | Then my 9th longest sigthline in the one in Colombia I
           | mentioned.
           | 
           | It's very possible you could find different results and new
           | longest sightlines, so I encourage you to continue your own
           | research.
           | 
           | For starters here is a limitation of my implementation: my
           | heuristic for finding a potential viewpoint (mountain peak or
           | ridge of a plateau) is imperfect: in the DEM, a tile is
           | considered a potential viewpoint if it is higher than or
           | equal to it's 8 neighbors, _and_ if it is strictly higher
           | than at least one neighbor. Think about a group of 3x3 tiles.
           | They are all the same height, except one tile on the edge of
           | the group that is slighly lower than the others. Then in this
           | case, the central tile is a potential viewpoint because we
           | could have a sightline standing on this central tile, looking
           | over the one neighbor tile that is slightly lower. That would
           | be the case when standing on the edge of a plateau right next
           | to the start of a valley.
           | 
           | But I can think of at least one case where I would
           | accidentally dismiss potential viewpoints: if, when standing
           | on this ridge, the tile behind us is slightly higher (even if
           | it's just by 1 meter), then my heuristic would dismiss the
           | central tile as a potential viewpoint, because my thought was
           | the tile that is sligthly higher is going to be selected by
           | my heuristic as a (better) potential viewpoint instead. But,
           | in reality, if the tile behind us is only a few meters
           | higher, then it is not high enough to look over our initial
           | tile, then over the start of the valley. In that case the
           | central tile is a viewpoint but would be dismissed by my
           | heuristic. This is a very narrow corner case that _probably_
           | doesn 't affect my results, but I am not 100% sure. If the
           | height difference is about 3 or 4 meters or more, the tile
           | behind us would definitely have a clear and longer sightline,
           | so my heuristic isn't breaking anything.
           | 
           | Anyway my whole project was just a weekend thing so I didn't
           | care to be very precise. But now seeing your effort is
           | renewing my interest in fixing my code. Oh and I should
           | definitely port this to GPU as this workload is 100% compute-
           | bound, mostly, sin, cos, sqrt and divisions.
        
       | hdersch wrote:
       | "Viewsheds" of any location can be calculated and matched with
       | photographs using "GeoImageViewer", an application I wrote a
       | couple of years ago. Any feature in the image can be
       | interactively identified in a mapview and vice versa, including
       | the boundary of the viewshed. As has been mentioned in the
       | comments, it is essential to include atmospheric refraction in
       | the calculation, at least for distances above ~100km.
       | 
       | [1] https://hdersch.github.io/Viewing.html
        
         | hebejebelus wrote:
         | Wow, this is really an incredible bit of work! Very impressive
         | stuff, I look forward to using it!
        
         | shrx wrote:
         | There's also https://www.heywhatsthat.com/
        
         | tombh wrote:
         | What a fantastic tool.
         | 
         | I'm the author of the post. Do you have any knowledge about how
         | refraction can vary? I was wondering about calculating the
         | world twice, once with a lower refraction bound and then again
         | with an upper.
        
           | hdersch wrote:
           | Atmospheric refraction is due to the vertical gradients of
           | atmospheric pressure, temperature, and composition of the
           | atmosphere, all of which are usually not precisely known, and
           | which vary with time, so one gets larger lines of sights at
           | certain times. For my application I used the standard
           | formulas for astronomical refraction (-> many weblinks) with
           | constant medium gradients. If I recall correctly this results
           | in ~100m height correction for features in 100km distance and
           | ~400m in 200km distance (features appear higher than without
           | atmospheric refraction). For your application it would make
           | sense to use two extreme values for the gradients to get
           | maximum and minimum, as you suggested.
        
             | tombh wrote:
             | Right, yes variance over time is what I was referring to. I
             | did a bit of research and indeed there seems to be some
             | evidence backed minimum and maximum values I can plug in.
             | But it's quite a variance! Now I'm thinking I should do
             | min, max and average.
        
         | bradrn wrote:
         | This looks amazing! I recently moved to an apartment with a
         | good view out the window, so I was excited to try this to
         | identify some of the more distant hills I can see. Alas, it
         | seems to have developed some bugs in the 4 years since the last
         | commit... when I tried clicking in 'Edit Mode' to select a
         | location, nothing happened and I couldn't continue. Any chance
         | you could look into updating this application?
        
       | me_vinayakakv wrote:
       | Nice work! Do the tiles point to actual heatmap?
        
         | tombh wrote:
         | Each tile's heatmap takes hours to crunch, so I haven't done
         | them all yet. Here's a sneak peek of the UK though
         | https://mastodon.social/@tombh/115330398582193988
        
       | anovikov wrote:
       | Ofc my home country's name was misspelled :/
        
         | tombh wrote:
         | Kyrgyzstan? Damn, I'm sorry. I've update the article now.
        
           | anovikov wrote:
           | Thank you! I kind of understood that from those mountains one
           | could see really far away, but had no idea it was THAT far.
        
       | mrb wrote:
       | Nitpick:
       | 
       | " _resolution of 3 arc-seconds (~100m2)_ "
       | 
       | This resolution is equivalent to tiles of 8500 m2 not 100 m2. I
       | think the author confused tile edge length (92 meters exactly)
       | with tile area.
        
         | tombh wrote:
         | Damn, that's the second time I've confused those 2 concepts.
         | The distinction is significant. I updated the article, thanks.
        
       | Theodores wrote:
       | You have a very interesting project. What happens if you put your
       | maps and elevation data on a 'sphere', to model the world as 3D?
       | You can then leverage a GPU to render a view from one vertex to
       | then determine what is furthest away yet visible from that
       | vertex. The vertices can then be given some type of heatmap
       | colour and an interactive tool made.
       | 
       | A full GIS tool isn't needed for this, with Blender and three.js
       | there are all of the tools needed.
        
         | tombh wrote:
         | This is pretty much what I'm already doing. The kernel is
         | written on the GPU and just does raw visibility calculations.
        
       | reassess_blind wrote:
       | A kid once asked me "How far can humans see?". I told him you can
       | see the Andromeda Galaxy 2.5 million light years away, but when
       | he said he meant on Earth I didn't know the answer.
        
       | lostlogin wrote:
       | > I find these TVS heatmaps eerily beautiful.
       | 
       | The first one somehow looked like something violent going on.
       | Limbs? Bodies?
        
       | liamph wrote:
       | It is interesting to also consider dry land which is below sea
       | level. "For an average height person standing on a beach, their
       | horizon is around 4.5km away." For an average height person
       | standing at sea level, near a large depression such as the Dead
       | Sea, for example, you may be able to see land at a much greater
       | distance.
       | 
       | I doubt if this factor would impact your findings for the longest
       | sight lines on Earth, but perhaps for some local findings.
       | 
       | Also, applying the same concept to other planets has some
       | surprising results. The tallest mountain in the solar system,
       | Olympus Mons, has very gentle slopes. So gentle that from the
       | peak all you can see is Olympus Mons itself.
        
       ___________________________________________________________________
       (page generated 2025-10-08 23:01 UTC)