Skip to content

marsmith/go2mapper

Repository files navigation

Go2Mapper

  • if a site has only stage, make sure to check AHPS data for stage, and not just discharge HUDSON RIVER AT ALBANY

  • Parse out date of peak from go2fast result and change icons or add number corresponding to # of days out from today

  • toggle for individual flag types - this would require more thought. toggling off one type of item could hide any additional flags from being displayed on the map - would need to reprocess everything on toggle off of a layer

  • upper level filter of groundwater/surface water sites

Mapper application setup

Pre-requisites

node.js installed

Install dependencies

run npm install to install dependencies

Customize application

You can utlize the /dist package by editing user confiruation variables in: /dist/appConfig.js. If doing a full build, edit /src/appConfig.js.

//START user config variables
var MapX = '-76.2'; //set initial map longitude
var MapY = '42.7'; //set initial map latitude
var MapZoom = 7; //set initial map zoom

// Two URLs are provided, the application first attemps the internal URL, if that request fails, revert to external URL
//edit and copy the 'config.php' to each of the folders for the getData request PHP
var spotURLinternal = 'https://ny.water.usgs.gov/htmls/internal/go2/getDataInternal.php';
var spotURLexternal = './getDataExternal.php';

var iconLookup = {
	TROY_DATA: 'blue',
	CORTLAND_DATA: 'yellow',
	POTSDAM_DATA: 'orange',
	CORAM_DATA: 'pink',
	MILFORD_DATA: 'red',
	BUFFALO_DATA: 'light_green'
}

//request URLs
var USGSwaterServicesURL = 'https://staging.waterservices.usgs.gov/nwis/iv/?format=nwjson&sites=';
var proxyURL = 'https://ny.water.usgs.gov/maps/go2/proxy.php?url=';
var AHPSurl = 'https://water.weather.gov/ahps2/hydrograph_to_xml.php?gage=';
var NWMmediumRangeURL = 'https://nwmdata.nohrsc.noaa.gov/latest/forecasts/medium_range/streamflow?station_id=';
var NWMshortRangeURL = 'https://nwmdata.nohrsc.noaa.gov/latest/forecasts/short_range/streamflow?station_id=';
var NWMmapServiceURL = 'https://mapservice.nohrsc.noaa.gov/arcgis/rest/services/references_layers/USGS_Stream_Gauges/MapServer/0';

//For NWS radar overlays, update the function 'addNWSlayers()' with extents from: https://radar.weather.gov/ridge/kmzgenerator.php by downloading and looking at KML file attributes
var siteListJSON = './SiteList.json'; //Auto generated by scripts
var tripListJSON = './TripList.json'; //Auto generated by scripts
var go2warningsJSON = './Go2Warnings.json'; //Auto generated by scripts
var go2liteWarningsJSON = './Go2LiteWarnings.json'; //Auto generated by scripts
var go2predictedWarningsJSON = './Go2PredictedWarnings.json'; //Auto generated by scripts
var go2predictedWarningsJSON_NWM = './Go2PredictedWarnings_NWM.json'; //Auto generated by scripts

//END user config variables 
SPOT Tracking setup

The application is set to color icons in groups based on the "messengerName" field set up in spot for each device in the format of: [OFFICE]_[SECTION]_[PERSON NAME]. The first two parts of the name are used to select color icons from the iconLookup section above, and they correspond to icons located in /src/images/person_icons.

Configure an XML Feed in your SPOT account with a password and all the tracking options enabled. It will only start tracking AFTER you have created the feed. The feed url should be something like: https://api.findmespot.com/spot-main-web/consumer/rest-api/2.0/public/feed/[feedId]/latest.json?feedPassword=[feedPassword]

Build app bundle

npm run build to run create a production ready bundle set. This is not used until you are satisfied you have finished edits and are ready to copy to your web server. Copy the entire contents of /dist to your web server

Known go2mapper applications

v2 NYWSC (original) OHWSC MIWSC WAWSC CAWSC SAWSC

v1 INWSC KYWSC

Go2Mapper support tools

Go2Mapper support tools version 1.0.6 are included as a tarball in /scripts/Go2Mapper_Sun.tar.gz. Installation instructions are included. Please contact tsiskin@usgs.gov for help with the go2mapper support tools