Note: You can try out the "Volcano Explorer App" here.
Introduction
The NASA Space Apps is an international hackathon that occurs over 48 hours in cities around the world. If you aren't close to any of these cities you can also participate virtually.
This year there is a special focus on Earth. Here you can check the different challenges: https://2017.spaceappschallenge.org/challenges/. Many of them can be tackled directly using the Wolfram Language and its Wolfram Knowledgebase.
To begin with, I thought it would be fun to work a bit on the "Pilot Plus Challenge". The description of this challenge is the following:
Provide private aircraft pilots and passengers with an easy-to-use tool that gives information about the land underneath their flight plans.
Part I - Getting the GeoVisibleRegion of an aircraft
For this challenge we have a very useful built-in Wolfram Language Symbol called GeoVisibleRegion which is is a two-dimensional GeoGraphics primitive that represents the region on the surface of the Earth visible from the point of coordinates lat, lon and height h.
For example the visible region from an altitude of 10 km is:
GeoGraphics[GeoVisibleRegion[{43, -90, 10000}]]
We can even get the region currently viewable from the International Space Station using SatelliteData:
GeoGraphics[GeoVisibleRegion[SatelliteData[Entity["Satellite", "25544"], "Position"]], GeoRange -> "World"]
Sometimes we might not know the coordinates of the place that we want to explore and we only know the name of the place. In such cases one can get the the Latitude and Longitude coordinates using LatitudeLongitude and Interpreter["Location"] :
geoVR[place_String, altitude_] := GeoVisibleRegion[Append[LatitudeLongitude[Interpreter["Location"][place]], altitude]]
GeoGraphics[geoVR["Paris", 100]]
We can also get the NASA satellite image as a GeoBackground:
GeoGraphics[geoVR["Paris", 100], GeoBackground -> GeoStyling["Satellite"], GeoScaleBar -> "Kilometers"]![enter image description here][11]
Getting information of Volcanoes within a region using GeoEntities
So far so good, now we need to identify geographic, natural, and cultural locations of interest from these visible regions. And GeoEntities is exactly what we need! It gives a list of the geographic entities of type enttype contained in the extended region reg.
In particular we will focus on volcanoes, but you can try your other entity types like, "Lake", "Mountain", "City", ... For example these are the volcanoes that you can see from an aircraft at 1000 m above Portland:
volcanoes = GeoEntities[geoVR["Portland", 1000], "Volcano"]
We can check all the properties available for a volcano entity:
Furthermore we can get extra info of these Volcanoes using WikipediaData:
Creating and Deploying the Volcano Explorer App
Now we have the tools to retrieve the data, and we can put them together to create a Wolfram Cloud based App. For this I decided to use FormPage but alternatively we could also use FormFunction or the APIFuntion.
I'm sure that the following code can be optimized. Furthermore the user interface and the design of the App need to be improved, but as a first quick prototype I think it is decent enough.
fp = FormPage[{{"location", "Location"} ->
"Location", {"altitude", "Altitude (m)"} ->
Restricted["Number", {0, 10000}] -> 1000},
With[{geoVR =
GeoVisibleRegion[
Append[LatitudeLongitude[
Interpreter["Location"][#location]], #altitude]]},
Column[{GeoGraphics[{GeoStyling["Satellite",
GeoStylingImageFunction -> (Lighter[#, 0.4] &)],
EdgeForm[{Red, Thick}], geoVR,
With[{volcanoes = GeoEntities[geoVR, "Volcano"]},
If[Length[v = volcanoes] == 0, Nothing,
GeoMarker[GeoEntities[geoVR, "Volcano"],
Entity["Icon", "Volcano"]]]]},
GeoBackground -> GeoStyling["Satellite"],
GeoScaleBar -> "Kilometers"],
If[Length[v] == 0, Nothing, Column@Map[Column@Flatten@{"", "",
Style[#["Name"], Bold, 20],
DeleteMissing[#[{EntityProperty["Volcano", "Image"]}]],
Style["Elevation (m):", Bold],
DeleteMissing[
QuantityMagnitude[#[{EntityProperty["Volcano",
"Elevation"]}], "Meters"]],
Style["Last Eruption (year):", Bold],
DeleteMissing[#[{EntityProperty["Volcano",
"LastKnownEruptionDate"]}]],
GeoGraphics[#, GeoBackground -> GeoStyling["Satellite"],
GeoScaleBar -> "Kilometers"],
WikipediaData[#, "SummaryPlaintext"]} &, v]]}]]
&, FormTheme -> "Red",
AppearanceRules -> <|"Title" -> "Volcano Explorer",
"Description" ->
"Discover the volcanoes that are visible from your aircraft!"|>]
We can then CloudDeploy the FormPage:
CloudDeploy[fp, "VolcanoExplorer", Permissions->"Public"]
And this is the resulting "Volcano Explorer App" , feel free to try it, tweak it and suggest improvements:
As a next step, it could be great to include commercial flight routes into the App. This might be achieved with the code and resources that @Marco Thiel used on his post about flight data and trajectories of planes. Another source of inspiration that we could use to enhance this App is the post from @Arnoud Buzing about earthquakes around a volcano.