*** TECHNICAL INFO *** External Services -- All maps in this system are generated by Mapbox (www.mapbox.com) Interactive / non-static maps: Mapbox GL JS API Static Maps (thumbnails): Mapbox Static Images API Trail Location Info: Mapbox Geocoder API -OR- Positionstack API Weather / Forecasts: National Weather Service API -OR- OpenWeather API Elevation Profiles: CanvasJS Data Storage -- When a GPX/KML file is uploaded to our system, a homemade PHP script scans the file for validity, then iterates through the waypoints and track/route segments, extracting coordinates, elevation and timestamps. All data is stored in geoJSON format in a MySQL database table. The original uploaded file is stored for diagnostic purposes, but not used again by the system. Here are the things that happen when you upload a GPX file: 1. File checked client-side, then server-side for extension and size limit. 2. File scanned for track or route elements. 3. Points, elevations and timestamps extracted. 4. Waypoint locations, names, descriptions, elevations, timestamps extracted. 5. Track distance and ascent/descent calculated. 6. Track checked for possible duplicate already in system. 7. Trailhead state determined using Positionstack Geocoder API. 8. National Weather Service grid determined using NWS API. This is how we retrieve forecasts. 9. Region (South / North) determined using trailhead coordinates and Tonopah, NV as the delineator. 10. Generate polyline and retrieve static preview image from Mapbox Static Images API 11. Store original GPX file for debugging and possible future use. 12. Save all data to server database and display new trail data page. Notes: Elevations are automatically added where missing using SRTM data. All lat/lon values are rounded to 5 decimal places. All elevation values are rounded to 2 decimal places. Duplicate location points are ignored, even if they have different elevation values. We don't use any track smoothing yet, so whatever track/route points are present will be retained. Data Retrieval -- All trail data displayed throughout the system is extracted from MySQL database tables. Track data is stored in geoJSON format. Thumbnails -- Thumbnails/track previews are generated using slimmed down versions of the full track. Mapbox's Static Images API has a maximum query length. First, the coordinate point array is run through a script to delete every other array element until the array contains less than 1,000 coordinate points. Then, the array is converted to a Google Maps Encoded Polyline, then URL encoded and passed to Mapbox's Static Image API. When the image is returned, it's saved on our server. GPX/KML File Downloads -- When a user downloads the GPX or KML file for a trail, an internal script dynamically creates the file from the database each time the download is requested. The script builds files in compliance with the GPS Exchange Format and Keyhole Markup Language XML schemas. *** CHANGELOG *** 08/05/2023: - (general) upgraded to Mapbox GL JS v2.15.0 02/01/2023: - (general) upgraded to Mapbox GL JS v2.12.0 9/24/2022: - (trail details) image uploader now reads geotag data from images and stores lat/lon in database for later use 9/23/2022: - (trail details) weather forecast details now load asynchronously and therefore the page will no longer break if the forecast cannot be loaded - (trail details) added weather icons from weather.gov API to extended forecast 9/21/2022: - (trail details) updated image uploader with multi-file drag/drop style, removed description/name inputs 09/18/2022: - (general) upgraded to Mapbox GL JS v2.10.0 08/21/2022: - (trail details) disabled the waypoint add function because no one uses it 07/24/2022: - (general) upgraded to Mapbox GL JS v2.9.2 07/10/2022: - (trail details) fixed an issue where if the weather forecast did not load from the weather.gov API, many other parts of the page would also fail to load, and cause various backend errors 05/16/2022: - (downloads) downloads are now tracked individually by trail ID, time, IP address and file type 05/08/2022: - (trail details) additional weather forecast periods are now displayed in a popup window by clicking "MORE" under the first period 05/04/2022: - (trail details) trail details page now has weather forecasts for a predefined number of periods, using the National Weather Service API 04/25/2022: - (general) upgraded to Mapbox GL JS v2.8.2 04/16/2022: - (general) added number of US states covered to database stats grid - (map) added experimental map style changer to toggle map styles on the fly 04/08/2022: - (general) upgraded to Mapbox GL JS v2.8.0 04/02/2022: - (general) added some things to the database stats grid 03/28/2022: - (map) slight update to hover/click handlers on the main map ** to access the trail details page, the link now appears in the popup when a trail is clicked 03/27/2022: - (uploader) original files are now stored again (separately) for diagnostic purposes only - (uploader) user is now given the option to choose whether or not to upload the waypoints in their GPX file ** this is useful for those who have "private" locations and don't want to share them 03/25/2022: - (uploader) uploaded tracks are now compared with the database and potential duplicates are flagged, giving the uploader a notice to review ** this works by comparing the coordinates at each end of the new trail, with those of all trails in the database 03/24/2022: - (trail thumbnails) fixed text fitment of trail details at bottom of thumbnail 03/19/2022: - (uploader) region and state are now determined at upload for sorting later - (uploader) fixed thumbnail preview to match rating color 03/17/2022: - (map + trail details) track color corresponds to difficulty rating, same as thumbnails 03/13/2022: - (uploader) new uploader supporting drag/drop & client-side size/extension validation 03/11/2022: - (trail list) added sort by region, and region designators on thumbnails 03/09/2022: - (trail thumbnails) added rating, distance, downloads and views to thumbnails - (trail thumbnails) changed thumbnail track color convention to a rating scale rather than region 03/07/2022: - (general) fixed some longstanding formatting issues on various pages - (trail list) added a button at the bottom of the list that brings the viewer back to the top of the page 02/06/2022: - (general) upgraded to Mapbox GL JS v2.7.0 01/24/2022: - (trail details) moved elevation profile graph closer to map - (general) number format applied to index page stats - (gpx) added minified GPX back in as a download option 12/01/2021: - (general) upgraded to Mapbox GL JS v2.6.1 - (trail details) enabled cooperative gestures for trail info page map - (kml) trail waypoints added to KML downloads 07/10/2021: - (trail details) added active weather alerts for trail location using weather.gov API [TEMPORARILY REMOVED FOR IMPROVEMENTS] 06/23/2021: - (general) upgraded to Mapbox GL JS v2.3.0 05/15/2021: - (general) upgraded to Mapbox GL JS v2.2.0 - (trail details) all GPX downloads are now minified - (trail details) added basic KML download option (waypoints not yet included) 03/17/2021: - (trail details) added "-mini" to end of filename for minified GPX downloads 03/10/2021: - (map) added USFS Ranger District vector data, which will soon be query-able so that a user can click inside a district and get more info 03/05/2021: - some visual updates to map info page - (trail details) city, state and county added using Mapbox's geocoder API 02/14/2021: - (general) upgraded to Mapbox GL JS v2.1.1 01/27/2021: - (general) upgraded to Mapbox GL JS v2.0.1 - (uploader) added start/end markers to the trail preview image 01/26/2021: - (trail details) added some more weather data from openweathermap.org API - (trail list) added ratings to trail titles in format "Trail Name | R#" 01/25/2021: - (general) started support for trail groups, which can hold multiple trails belonging to the same region - (trail list) added support for sorting by page views - (trail list) improved performance of thumbnail loading by only querying the full track if needed (this seems to have greatly improved the loading speed of the list page) 01/24/2021: - (index) restructure of statistics section - (trail details) added current trailhead temperature, cloud cover and wind speed using the openweathermap.org API - (trail list) added ability to sort by name, rating, length, date added and number of downloads - (trail list) added ability to toggle sort order between descending and ascending - (uploader) added support for tracks that have no elevation data and are outside the scope of the SRTM datasets 01/11/2021: - (uploader) fixed an issue where an extra space at the beginning or end of the trail name would result in a hyphen being added in the URL safe name 12/28/2020: - (uploader) fixed an issue with the image uploader where images smaller than 1000x1000 pixels get a blank thumbnail 12/19/2020: - (trail list) fixed trail name font sizing on index and list pages 12/18/2020: - (trail details) added distances to elevation profile graphs on X axis - (trail details) added min and max elevations for profile graphs, rounded to whole 100's (makes the graph more interesting) - (trail details) added a corresponding location marker to small map when elevation profile line is hovered over 12/10/2020: - (map) fixed an issue where trails could not be clicked on when map zoomed out - (map) changed 3D terrain to appear at all zoom levels - (map) added sun calculations to determine sky atmosphere depending on map location and local time (also updates when map is panned) 12/08/2020: - (map) trails clustered using centerpoint at zoom level 8 and out for better visibility and searching - (map) clicking within 50px of part of a trail will still select that trail (easier to click with touch) - (general) upgraded to Mapbox GL JS v2.0.0 - (map) 3D terrain now available starting at zoom level 7 and in 12/07/2020: - (map) sorted out ability to add vector overlays for BLM data (map controls to follow!) - (map) restricted main map to US bounds to prevent excessive loading of tiles in other countries - (trail details) some nicer styling applied to the elevation profile graphs - (trail details) added links to weather.gov for trail endpoint locations within their markers on trail info pages - (general) upgraded to Mapbox GL JS v1.12.0 12/04/2020: - dynamically generated opengraph tags for sharing trail info links on social media - began making provisions for geographical polygon support (defined areas) - elevation profile graphs working using CanvasJS - miscellaneous performance tweaks 12/02/2020: - added some statistics to the trail homepage - trail thumbnail tracks are now dark orange for northern region and light green for southern region - placeholder added for trail notices: system under construction for submitting trail closures, weather, restrictions and such 11/27/2020: - added an option to download a condensed, or "minified" version of a GPX file (smaller file size, but not formatted for human readability) 11/16/2020: - added ability to upload pictures to a trail info page (supported: jpeg, jpg, png and gif) 10/12/2020: - new function on trail details page to add a waypoint to that trail - added lat/lon to end markers on trail info page maps 10/05/2020: - converted track and waypoint storage to associative arrays and updated all necessary files to support the conversion - added support for waypoint descriptions - added GPX file download counter - added unique identifier to download temp files to prevent mid-transfer overwriting 10/02/2020: - cleaned up older tracks to round all numbers to proper point precision, add elevations if missing, and delete duplicate points - added a function to ignore duplicate points in newly uploaded files - updated trail view page to count location points dynamically and no longer store a fixed number in the database 09/25/2020: - Better interface for trail details page - Added ascent and descent calculations to trail details page (no track smoothing, these values may be different than other apps or websites) 09/24/2020: - New upload interface with trail preview and statistics before finalizing (pre-upload) - DEM data now automatically added to any points missing elevation - Ascent and descent calculations added to pre-upload stats - Search bar added to trail list page (search by name) 08/24/2020: - Added custom dynamic GPX file generation script for downloads - Added waypoints to trail page map 08/22/2020: - New landing page, user experience and design improvements, new ratings & resources pages 04/26/2020: - Added support for uploading GPX files containing a route , rather than a track 11/14/2019: - Waypoints are now extracted and stored for use later 11/04/2019: - elevation and timetamps are now extracted and stored for use later 11/03/2019: - All tracks are now placed into regions: Northern Nevada and Southern Nevada. Tonopah-ish is the latitudinal divider 10/28/2019: - New trail information page when a track is clicked on from the main map Pre 10/28/2019: - Undocumented