Create map

The My Government Services application consumes maps that are accessible to the general public and named users in your ArcGIS Online organization. Create a My Government Services map and share it with the general public interested in government facility and curbside collection information. Residents and other interested parties can then access the My Government Services application on smartphones, desktop computers, or tablet devices.

My Government Services map

To create an ArcGIS Online My Government Services map, complete the following steps:

  1. Sign in to your ArcGIS Online organization.
  2. Create a map to display government facility locations, by completing the following workflow:
    • Choose a basemap.
    • Add the GovernmentServices layer to the map.
    • Configure pop-up for all of the point layers using a custom attribute display option and the name field as the pop-up title for all layers. When configuring the pop-ups, click View HTML Source and add the following code, and then click OK.
      		
          {FULLADDR}<br />{MUNICIPALITY}, {STATE}<br /><br /><b>Operational Hours:</b><br />{OPERDAYS}<br />{OPERHOURS}<br /><br /><b>Contact Information:</b><br />{CONTACT}<br />{PHONE}<br /><a href="{AGENCYURL}" target="_blank">Website</a>
              
      
      An example of a pop-up configuration for the Recycling Facilities layer in the My Government Services application.
      Configure pop-up for the Garbage Collection, Recycling Collection, and Yard Waste Collection layers using a custom attribute display option and the agency field as the pop-up title. When configuring the pop-ups, add an attribute expression, change the title of the expression to Next Pickup, and add the following expression.
      	
      /*If pickup occurs weekly, specify 1. 
      If every other week specify 2, etc.*/
      var pickupWeekInterval = 1;
      
      /*Specify a date in the past in which pickup occurred.
      This is used in the case where pickup doesn't occur every week 
      to determine the weeks where pickup is occurring.*/
      var firstPickupWeek = Date('2017-01-01');
      
      /*If the pickup service isn't available year-round 
      specify the first and last day of the season that pickup will occur, [[Start Month, Start Day], [[End Month, End Day]]*/ 
      var openSeason = [[1,1],[12,31]]
      
      //Specify any holidays where pickup will not occur, [Month, Day]
      var holidays = [[1,1],[7,4],[12,25]] 
      
      /*Specify any variable holidays where pickup will not occur, [Occurrence, Month, Day of the Week (Sunday = 0, Saturday = 6)]
      These are holidays that don't fall on the same date every year, i.e. Memorial Day, Labor Day, Thanksgiving
      [-1,5,1] corresponds to Memorial Day -> Last occurrence in May of a Monday
      [1,9,1] corresponds to Labor Day -> 1st occurrence in September of a Monday 
      [4,11,4] corresponds to Thanksgiving -> 4th occurrence in November of a Thursday*/
      var variableHolidays = [[-1,5,1],[1,9,1],[4,11,4]]; 
      
      /*Specify if the next scheduled pickup day falls on a holiday, when will the next actual pickup be.
      "Next Weekday" - The pickup will occur on the next weekday after the holiday
      "Next Day" - The pickup will occur on the next day after the holiday
      "Next Scheduled Pickup" - The pickup will occur on the next scheduled day after the holiday*/
      var nextPickupHoliday = "Next Weekday";
      
      var pickupDays = [];
      var pickupDaysFields = [$feature.SUNDAY, $feature.MONDAY, $feature.TUESDAY,
      						$feature.WEDNESDAY, $feature.THURSDAY,
      						$feature.FRIDAY, $feature.SATURDAY]
      for (var k in pickupDaysFields) {
      	if (pickupDaysFields[k] == 'Yes') {
      		pickupDays[Count(pickupDays)] = k;
      	}
      }			
      if (Count(pickupDays) == 0)
      	return;			
      
      function calcRelativeHoliday(week, month, day, year) {
      	var holiday;
      	if (week < 0){
      		var lastDay = DateAdd(Date(year, month + 1, 1), -1, 'days');
      		var dayOfWeek = Weekday(lastDay);
      		var dayDiff = day - dayOfWeek;
      		if (dayDiff > 0) 
      			dayDiff -= 7;
      		holiday = DateAdd(lastDay, dayDiff + ((week + 1) * 7), 'days');
      	}
      	else{
      		var firstDay = Date(year, month, 1);
      		var dayOfWeek = Weekday(firstDay);
      		var dayDiff = day - dayOfWeek;
      		if (dayDiff < 0) 
      			dayDiff += 7;
      		holiday = DateAdd(firstDay, dayDiff + ((week - 1) * 7), 'days');	
      	}
      	return holiday;
      }
      
      function getNextPickupDay(fromDate) {
      	var currentDay = Weekday(fromDate);
      	var pickupOffset = 0;
      	if (pickupWeekInterval > 1){
      		var weekDif = DateDiff(DateAdd(fromDate, 0 - currentDay, 'days'), 
      						DateAdd(firstPickupWeek, 0 - Weekday(firstPickupWeek), 'days'),
      						'days') / 7;
      		
      		weekDif = weekDif % pickupWeekInterval;
      		if (weekDif > 0)
      			pickupOffset = pickupWeekInterval - weekDif;
      	}
      
      	var difDays;
      	var nextPickupDay;
      	if (pickupOffset > 0) {
      		nextPickupDay = pickupDays[0];
      		difDays = nextPickupDay - currentDay;
      		difDays += (7 * pickupOffset);
      	}
      	else {
      		for(var k in pickupDays) {
      			if (pickupDays[k] >= currentDay) {
      				nextPickupDay = pickupDays[k];
      				break;
      			}
      		}
      		
      		if (IsEmpty(nextPickupDay))
      			nextPickupDay = pickupDays[0];
      			
      		difDays = nextPickupDay - currentDay;
      		if (nextPickupDay < currentDay)
      			difDays += (7 * pickupWeekInterval); 
      	}
      	return DateAdd(fromDate, difDays, 'days');	
      }
      
      function getHolidays(fromDate) {
      	var holidayDates = [];
      	for (var k in holidays) {
      		var holiday = Date(Year(fromDate), holidays[k][0] -1, holidays[k][1]);
      		if (holiday < fromDate)
      			holiday = Date(Year(fromDate) + 1, holidays[k][0] -1, holidays[k][1]);
      		holidayDates[k] = holiday;
      	}
      	for (var k in variableHolidays) {
      		var x = variableHolidays[k];
      		var holiday = calcRelativeHoliday(x[0], x[1]-1, x[2], Year(fromDate));
      		if (holiday < fromDate)
      			holiday = calcRelativeHoliday(x[0], x[1]-1, x[2], Year(fromDate) + 1);
      		holidayDates[Count(holidayDates)] = holiday;
      	}
      	return holidayDates;
      }
      
      function validateSeasonPickup(pickupDate) {
      	var startSeasonMonth = openSeason[0][0]-1;
      	var startSeasonDay = openSeason[0][1];
      	var endSeasonMonth = openSeason[1][0]-1;
      	var endSeasonDay = openSeason[1][1];
      	
      	if (Date(Year(pickupDate), startSeasonMonth, startSeasonDay) > Date(Year(pickupDate), endSeasonMonth, endSeasonDay)) {
      		if (pickupDate < Date(Year(pickupDate), startSeasonMonth, startSeasonDay) && pickupDate > Date(Year(pickupDate) - 1, endSeasonMonth, endSeasonDay))
      			pickupDate = getNextPickupDay(Date(Year(pickupDate), startSeasonMonth, startSeasonDay))
      	}
      	else {
      		if (pickupDate < Date(Year(pickupDate), startSeasonMonth, startSeasonDay))
      			pickupDate = getNextPickupDay(Date(Year(pickupDate), startSeasonMonth, startSeasonDay));
      		else if (pickupDate > Date(Year(pickupDate), endSeasonMonth, endSeasonDay))
      			pickupDate = getNextPickupDay(Date(Year(pickupDate) + 1, startSeasonMonth, startSeasonDay));
      	}
      	return pickupDate;
      }
      
      function validateHolidayPickup(pickupDate, holidayDates) {
      	for(var k in holidayDates) {
      		if (pickupDate == holidayDates[k]) {
      			if (nextPickupHoliday == "Next Scheduled Pickup") {
      				pickupDate = getNextPickupDay(DateAdd(pickupDate, 1, 'days'));
      			}
      			else if (nextPickupHoliday == "Next Day") {
      				pickupDate = DateAdd(pickupDate, 1, 'days');
      			}
      			else if (nextPickupHoliday == "Next Weekday") {
      				var currentDay = Weekday(pickupDate);
      				if (currentDay > 4) {
      					pickupDate = DateAdd(pickupDate, 8 - currentDay, 'days');
      				}
      				else {
      					pickupDate = DateAdd(pickupDate, 1, 'days');
      				}					
      			}
      			break;
      		}
      	}
      	return pickupDate
      }
      
      var nextPickup = getNextPickupDay(Today());
      nextPickup = validateSeasonPickup(nextPickup);
      nextPickup = validateHolidayPickup(nextPickup, getHolidays(nextPickup));
      return Text(nextPickup, 'dddd, MMMM D');
          
      
      Then, configure the custom attribute display, by clicking View HTML Source. Copy and paste the HTML below, and then click OK.
          
      The next collection is scheduled for <b>{expression/expr0}</b>.<br /> <br />{DESCRIPT} <br /> <br /><b>Contact Information:</b><br />{CONTACT}<br />{PHONE}<br /><a href="{AGENCYURL} " target="_blank">Website</a>
          
      
      An example of a pop-up configuration for the Recycling Collection layer in the My Government Services application.
      Configure pop-up for the Street Cleaning layer using a custom attribute display option and the agency field as the pop-up title. When configuring the pop-ups, add an attribute expression, change the title of the expression to Next Cleaning, and add the following expression.
      	
      /*If the cleaning isn't available year-round 
      specify the first and last day of the season that cleaning will occur*/ 
      var openSeason = [[1,1],[12,31]]
      
      var cleaningWeek = [];
      var cleaningWeekFields = [$feature.WEEKONE, $feature.WEEKTWO,
      						  $feature.WEEKTHREE, $feature.WEEKFOUR]
      for (var k in cleaningWeekFields) {
      	if (cleaningWeekFields[k] == 'Yes') {
      		cleaningWeek[Count(cleaningWeek)] = k;
      	}
      }
      if (Count(cleaningWeek)	== 0)
      	return;
      	
      function getNextCleaningWeek(fromDate) {
      	var firstSundayCurrentMonth = Date(Year(fromDate), Month(fromDate), 1);
      	var firstWeekday = Weekday(firstSundayCurrentMonth);
      	if (firstWeekday > 0)
      		firstSundayCurrentMonth = DateAdd(firstSundayCurrentMonth, 7 - firstWeekday, 'days');
      	for (var k in cleaningWeek) {
      		var startCleaningWeek = DateAdd(firstSundayCurrentMonth, (cleaningWeek[k]*7), 'days');
      		if (fromDate <= startCleaningWeek)
      			return [startCleaningWeek, DateAdd(startCleaningWeek, 6, 'days')];
      	}
      	
      	var firstSundayNextMonth = Date(Year(fromDate), Month(fromDate) + 1, 1);
      	var firstWeekday = Weekday(firstSundayNextMonth);
      	if (firstWeekday > 0)
      		firstSundayNextMonth = DateAdd(firstSundayNextMonth, 7 - firstWeekday, 'days');
      	var startCleaningWeek = DateAdd(firstSundayNextMonth, (7 * cleaningWeek[0]), 'days');
      	return [startCleaningWeek, DateAdd(startCleaningWeek, 6, 'days')];
      }
      	
      function validateSeasonCleaning(cleaningWeek) {
      	var startSeasonMonth = openSeason[0][0]-1;
      	var startSeasonDay = openSeason[0][1];
      	var endSeasonMonth = openSeason[1][0]-1;
      	var endSeasonDay = openSeason[1][1];
      	
      	if (Date(Year(cleaningWeek[1]), startSeasonMonth, startSeasonDay) > Date(Year(cleaningWeek[1]), endSeasonMonth, endSeasonDay)) {
      		if (cleaningWeek[1] < Date(Year(cleaningWeek[1]), startSeasonMonth, startSeasonDay) && cleaningWeek[1] > Date(Year(cleaningWeek[1]) - 1, endSeasonMonth, endSeasonDay))
      			cleaningWeek = getNextCleaningWeek(Date(Year(cleaningWeek[1]), startSeasonMonth, startSeasonDay))
      	}
      	else {
      		if (cleaningWeek[1] < Date(Year(cleaningWeek[1]), startSeasonMonth, startSeasonDay))
      			cleaningWeek = getNextCleaningWeek(Date(Year(cleaningWeek[1]), startSeasonMonth, startSeasonDay));
      		else if (cleaningWeek[1] > Date(Year(cleaningWeek[1]), endSeasonMonth, endSeasonDay))
      			cleaningWeek = getNextCleaningWeek(Date(Year(cleaningWeek[1]) + 1, startSeasonMonth, startSeasonDay));
      	}
      	return cleaningWeek;
      }
      
      var nextCleaning = getNextCleaningWeek(Today());
      nextCleaning = validateSeasonCleaning(nextCleaning);
      return Text(nextCleaning[0], 'MMMM D, YYYY');
          
      
      Then, configure the custom attribute display, by clicking View HTML Source. Copy and paste the HTML below, and then click OK.
          
      The next street cleaning is scheduled for the week of <b>{expression/expr0}</b>.<br /><br />{DESCRIPT} <br /> <br /><b>Contact Information:</b><br />{CONTACT}<br />{PHONE}<br /><a href="{AGENCYURL} " target="_blank">Website</a>
          
      
      An example of a pop-up configuration for the Street Cleaning layer in the My Government Services application.
    • Save the map as My Government Services and add the following tags:
      • Tags: Curbside, Pickup, My Government Services, Public Works, Garbage
  3. Share the map with everyone.
  4. Browse to the Government Services map and edit the item details:
    • Thumbnail Image: Your image
    • Description: Locations of government facilities and public works collection areas.
Top