Wolfram Language

Open live version

Track a GPS-Equipped Wolf

Make a webpage that shows an up-to-date track of a wolf with a GPS tracking device.


code

CloudDeploy[ExportForm[Rasterize[ GeoGraphics[Line[ Import[ "http://www.wyocoopunit.org/index.php/download_file/662/Smr_\ wntr_poly.kml", "Data"][[1, 2, 2, 1, 1]] ], ImageMargins -> 50, GeoBackground -> GeoStyling["ReliefMap"], GeoRangePadding -> \!\(\* NamespaceBox["LinguisticAssistant", DynamicModuleBox[{WolframAlphaClient`Private`query$$ = "15 km", WolframAlphaClient`Private`boxes$$ = TemplateBox[{"15"}, "QuantityUnit", DisplayFunction -> (TooltipBox[ StyleBox[ RowBox[{#, " ", StyleBox[ RowBox[{" ", "\"km\""}], "QuantityUnitTraditionalInput"]}], ShowStringCharacters -> False], "Unit: kilometers"]& ), InterpretationFunction -> (RowBox[{"Quantity", "[", RowBox[{#, ",", "\"Kilometers\""}], "]"}]& ), SyntaxForm -> Mod], WolframAlphaClient`Private`allassumptions$$ = {}, WolframAlphaClient`Private`assumptions$$ = {}, WolframAlphaClient`Private`open$$ = {1, 2}}, DynamicBox[ToBoxes[ AlphaIntegration`LinguisticAssistantBoxes["", 1, Dynamic[WolframAlphaClient`Private`query$$], Dynamic[WolframAlphaClient`Private`boxes$$], Dynamic[WolframAlphaClient`Private`allassumptions$$], Dynamic[WolframAlphaClient`Private`assumptions$$], Dynamic[WolframAlphaClient`Private`open$$]], StandardForm], ImageSizeCache->{73., {8., 16.}}], DynamicModuleValues:>{}], BaseStyle->{Deployed -> True}, DeleteWithContents->True, Editable->False, SelectWithContents->True]\), GeoScaleBar -> Automatic] ], "JPEG"], Permissions -> "Public"]

how it works

This pulls GPS data from a website:

Import["http://www.wyocoopunit.org/index.php/download_file/662/Smr_\ wntr_poly.kml", "Data"]

Use Part to select only the tracked points from the data:

gpspts = Import[ "http://www.wyocoopunit.org/index.php/download_file/662/Smr_wntr_\ poly.kml", "Data"][[1, 2, 2, 1, 1]];

The data is a long GeoPosition list of {latitude, longitude, height} points:

Short[gpspts, 5]

This plots the GPS data on a background of local terrain. Note the use of Ctrl+= to enter natural language units:

GeoGraphics[Point[gpspts], GeoBackground -> GeoStyling["ReliefMap"], GeoRangePadding -> \!\(\* NamespaceBox["LinguisticAssistant", DynamicModuleBox[{WolframAlphaClient`Private`query$$ = "15 km", WolframAlphaClient`Private`boxes$$ = TemplateBox[{"15"}, "QuantityUnit", DisplayFunction -> (TooltipBox[ StyleBox[ RowBox[{#, " ", StyleBox[ RowBox[{" ", "\"km\""}], "QuantityUnitTraditionalInput"]}], ShowStringCharacters -> False], "Unit: kilometers"]& ), InterpretationFunction -> (RowBox[{"Quantity", "[", RowBox[{#, ",", "\"Kilometers\""}], "]"}]& ), SyntaxForm -> Mod], WolframAlphaClient`Private`allassumptions$$ = {}, WolframAlphaClient`Private`assumptions$$ = {}, WolframAlphaClient`Private`open$$ = {1, 2}}, DynamicBox[ToBoxes[ AlphaIntegration`LinguisticAssistantBoxes["", 1, Dynamic[WolframAlphaClient`Private`query$$], Dynamic[WolframAlphaClient`Private`boxes$$], Dynamic[WolframAlphaClient`Private`allassumptions$$], Dynamic[WolframAlphaClient`Private`assumptions$$], Dynamic[WolframAlphaClient`Private`open$$]], StandardForm], ImageSizeCache->{76., {8., 16.}}], DynamicModuleValues:>{}], BaseStyle->{Deployed -> True}, DeleteWithContents->True, Editable->False, SelectWithContents->True]\), GeoScaleBar -> Automatic]

This variation plots the wolfs movements as a line:

GeoGraphics[Line[gpspts], GeoBackground -> GeoStyling["ReliefMap"], GeoRangePadding -> \!\(\* NamespaceBox["LinguisticAssistant", DynamicModuleBox[{WolframAlphaClient`Private`query$$ = "15 km", WolframAlphaClient`Private`boxes$$ = TemplateBox[{"15"}, "QuantityUnit", DisplayFunction -> (TooltipBox[ StyleBox[ RowBox[{#, " ", StyleBox[ RowBox[{" ", "\"km\""}], "QuantityUnitTraditionalInput"]}], ShowStringCharacters -> False], "Unit: kilometers"]& ), InterpretationFunction -> (RowBox[{"Quantity", "[", RowBox[{#, ",", "\"Kilometers\""}], "]"}]& ), SyntaxForm -> Mod], WolframAlphaClient`Private`allassumptions$$ = {}, WolframAlphaClient`Private`assumptions$$ = {}, WolframAlphaClient`Private`open$$ = {1, 2}}, DynamicBox[ToBoxes[ AlphaIntegration`LinguisticAssistantBoxes["", 1, Dynamic[WolframAlphaClient`Private`query$$], Dynamic[WolframAlphaClient`Private`boxes$$], Dynamic[WolframAlphaClient`Private`allassumptions$$], Dynamic[WolframAlphaClient`Private`assumptions$$], Dynamic[WolframAlphaClient`Private`open$$]], StandardForm], ImageSizeCache->{76., {8., 16.}}], DynamicModuleValues:>{}], BaseStyle->{Deployed -> True}, DeleteWithContents->True, Editable->False, SelectWithContents->True]\), GeoScaleBar -> Automatic]

Deploy the map to the cloud as a jpeg image:

CloudDeploy[ExportForm[Rasterize[ GeoGraphics[Line[ Import[ "http://www.wyocoopunit.org/index.php/download_file/662/Smr_\ wntr_poly.kml", "Data"][[1, 2, 2, 1, 1, All]]], ImageMargins -> 50, GeoBackground -> GeoStyling["ReliefMap"], GeoRangePadding -> \!\(\* NamespaceBox["LinguisticAssistant", DynamicModuleBox[{WolframAlphaClient`Private`query$$ = "15 km", WolframAlphaClient`Private`boxes$$ = TemplateBox[{"15"}, "QuantityUnit", DisplayFunction -> (TooltipBox[ StyleBox[ RowBox[{#, " ", StyleBox[ RowBox[{" ", "\"km\""}], "QuantityUnitTraditionalInput"]}], ShowStringCharacters -> False], "Unit: kilometers"]& ), InterpretationFunction -> (RowBox[{"Quantity", "[", RowBox[{#, ",", "\"Kilometers\""}], "]"}]& ), SyntaxForm -> Mod], WolframAlphaClient`Private`allassumptions$$ = {}, WolframAlphaClient`Private`assumptions$$ = {}, WolframAlphaClient`Private`open$$ = {1, 2}}, DynamicBox[ToBoxes[ AlphaIntegration`LinguisticAssistantBoxes["", 1, Dynamic[WolframAlphaClient`Private`query$$], Dynamic[WolframAlphaClient`Private`boxes$$], Dynamic[WolframAlphaClient`Private`allassumptions$$], Dynamic[WolframAlphaClient`Private`assumptions$$], Dynamic[WolframAlphaClient`Private`open$$]], StandardForm], ImageSizeCache->{76., {8., 16.}}], DynamicModuleValues:>{}], BaseStyle->{Deployed -> True}, DeleteWithContents->True, Editable->False, SelectWithContents->True]\), GeoScaleBar -> Automatic] ], "JPEG"], Permissions -> "Public"]

You can produce other visualizations from the raw data, for example, of altitude changes along the wolfs path and distance traveled over time. Use GeoElevationData to get the altitude in meters and ListLinePlot to plot it.

ListLinePlot[GeoElevationData[gpspts, UnitSystem -> "Metric"], Filling -> Axis]

Plot the distance traveled using GeoDistance, in miles:

ListLinePlot[ Accumulate[ QuantityMagnitude[GeoDistance @@@ Partition[gpspts[[1]], 2, 1], "Miles"]]]