
Show HN: Closest Volcano - rontoes
https://closestvolcano.com/
======
PostOnce
It would be nice if there was a way to manually enter location, since the
location API on desktop is for me inaccurate by hundreds of miles.

~~~
mkl
Agreed. Actually, I think the default behaviour should be to show a map with a
Voronoi diagram so you can immediately see the closest volcano for any
location.

Hm. The volcano locations are in a JSON list, and SciPy can do spherical
Voronoi calculations...

Edit: Someone already did it for Iceland (though without marking the volcano
positions):
[https://www.flickr.com/photos/78506020@N00/6807458402/](https://www.flickr.com/photos/78506020@N00/6807458402/)

~~~
rontoes
Do you have any experience with the Google Maps API? I would love to implement
this.

~~~
mkl
No I don't. All you need, though, is the ability to draw straight lines (well,
great circle lines) between points. You could do the region generation once
offline, in Python:

    
    
        import numpy as np
        from scipy.spatial import SphericalVoronoi
    
        import json
    
        with open('volcanos.json', 'rt') as f:
            volcanos = json.load(f)
            #There are some nulls in the data:
            volcanos = [v for v in volcanos if v['longitude'] != None and v['latitude'] != None]
    
        def longlat_to_xyz(longlat):
            longlat = longlat.reshape((-1, 2))*(np.pi/180.)
            r = np.cos(longlat[:, 1])
            return np.column_stack((r*np.cos(longlat[:, 0]), r*np.sin(longlat[:, 0]), np.sin(longlat[:, 1])))
        
        #go through set to remove duplicates:
        volcano_longlat = np.array(list(set((v['longitude'], v['latitude']) for v in volcanos)))
        volcano_xyz = longlat_to_xyz(volcano_longlat)
    
        sv = SphericalVoronoi(volcano_xyz)
        sv.sort_vertices_of_regions() #make the vertices go around each shape
    
        #find unique edges (they're shared between regions):
        edges = set()
        for region in sv.regions:
            region.append(region[0])
            for i in range(len(region)-1):
                edges.add((region[i], region[i+1]))
    
        long_min = -30.
        long_max = 330.
        def xyz_to_longlat(xyz, long_min=long_min, long_max=long_max):
            long = np.arctan2(xyz[:, 1], xyz[:, 0])*(180./np.pi)
            long[long<long_min] += 360.
            long[long>long_max] -= 360.
            return np.column_stack((long, np.arcsin(xyz[:, 2])*(180./np.pi)))
    
        vertices = xyz_to_longlat(sv.vertices)
    
        #To draw the regions on Google Maps etc., save edges and vertices as JSON and load into JS.
    
        #To draw the linked map with Matplotlib (very slow for hi-res, and it was fiddly setting up the right conda environment):
        import matplotlib.pyplot as plt
        from mpl_toolkits.basemap import Basemap
    
        fig, ax = plt.subplots(figsize=(16, 10))
        m = Basemap(projection='robin', lon_0=-200, resolution='h', ax=ax)
        m.drawcoastlines(linewidth=.1)
        m.drawcountries(linewidth=.1)
        volcano_longlat2 = xyz_to_longlat(volcano_xyz)
        x, y = m(volcano_longlat2[:, 0], volcano_longlat2[:, 1])
        m.plot(x, y, 'ro', markersize=.5)
    
        for edge in edges:
            m.drawgreatcircle(vertices[edge[0], 0], vertices[edge[0], 1],
                              vertices[edge[1], 0], vertices[edge[1], 1],
                              color='b', linewidth=.3)
        fig.tight_layout()
        fig.savefig('volcano_voronoi.png', dpi=600)

~~~
bonoboTP
You have to use "is not None" instead of "!= None"

------
PopeDotNinja
Closest one to me at the moment (in Pilsen, Czech Republic): Alban Hills [1]

"Fun" facts:

\- it less than 30km from Rome, Italy

\- it emits enough CO2 that it occasionally kills livestock

\- last eruption is thought to be around 5000 BCE

\- a magma chamber is believed to be building up 5-6km below the surface

[1]
[https://en.wikipedia.org/wiki/Alban_Hills](https://en.wikipedia.org/wiki/Alban_Hills)

------
chrisco255
This is awesome, but the closest volcano it brought up for me is a dormant
one. It would be nice to see closest active volcano.

~~~
pacaro
I'm curious, when I was a kid we were taught about the active/dormant/extinct
distinction, but my understanding has been that more modern thinking doesn't
really go for the _dormant_ label, because dormant on a human timescale
doesn't really mean much on a geologic timescale.

------
ryandrake
Huh. It's just a black screen with a red "Calculating..." in the upper left
corner and a Bitcoin wallet in the upper right. Nothing else. Safari 12.1.2

~~~
Spinosaurus
Happens on Chrome as well. Approve location permissions and refresh.

------
ereyes01
Closest to me (in Austin, TX) is the massive Carrizozo Lava Flow in NM. I've
actually been there via the Valley of Fires State Park. It's an amazing place,
and seems to be usually empty- definitely worth a visit if you're in the area!

------
james_in_the_uk
Currently in a country with some excellent volcanoes: Ethiopia. Sadly this
site isn't loading - I assume it is too big a download (not great internet up
here in the mountains). A lightweight version would be great:)

~~~
ape4
That's the problem, if you're actually on a volcano your bandwidth is no good.

------
mikecr
I'm glad of living in a country (Costa Rica) with several volcanos and a lot
of them active, so indeed the app shows the closest!

------
lloeki
ATM this returns an incorrect answer for me (at Strasbourg, yet returning Dôme
volcano circus in the center of France, 645km) as the closest volcano is
actually the Nideck, a 250'000'000 year old volcano, a mere 35km from here.

(Photos, with geological layout at the end)

[http://www.passion-escalade-et-
montagne.com/2018/04/escapade...](http://www.passion-escalade-et-
montagne.com/2018/04/escapade-en-terre-volcanique-nideck-m-et-
hirschfels-545m-29/04/2018.html)

[http://www.randoalsacevosges.com/2015/03/le-volcan-du-
nideck...](http://www.randoalsacevosges.com/2015/03/le-volcan-du-nideck.html)

------
rontoes
Thank you for the feedback! I am going to collate the inaccuracies and update
the volcano database. I am also going to try to fix the errors a few of you
have experienced.

------
ropiwqefjnpoa
Devils Tower for much of the east cost US I'm guessing?

~~~
JshWright
Does Devil's Tower really qualify as a "volcano"?

~~~
jnwatson
“Although magma formed Devils Tower, it was probably never part of a volcano.”
[1]

1\. [https://www.nationalgeographic.org/media/devils-tower-
geolog...](https://www.nationalgeographic.org/media/devils-tower-geology/)

------
Spinosaurus
Looks like volcanos are provided by a giant static JSON file. I'm curious,
where/how was this data compiled?

Regardless, very cool.

~~~
tuukkah
I would query Wikidata for a first try:
[https://query.wikidata.org/#SELECT%20%3Fvolcano%20%3Fvolcano...](https://query.wikidata.org/#SELECT%20%3Fvolcano%20%3FvolcanoLabel%20%3Fcoordinate_location%20WHERE%20%7B%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%20%20%3Fvolcano%20wdt%3AP31%20wd%3AQ8072.%0A%20%20%3Fvolcano%20wdt%3AP625%20%3Fcoordinate_location.%0A%7D%0A)

------
sdan
Apparently Mono Lake Vol Field is the closest to Silicon Valley

------
rurban
No vulcano in Germany? Strange

------
chewxy
TIL there are volcanoes in Australia

------
starpilot
> tfw seattle

~~~
msds
At least we're not Tacoma or Bellingham? Plus, as someone who's always really
been into volcanoes since early childhood being able drive two hours and climb
multiple volcanoes with exciting fumaroles and weird geology is pretty
great...

