Select to view content in your preferred language

Multiple point locations need single status update.

184
4
02-26-2025 01:39 PM
Gene_Sipes
Frequent Contributor

I have a JSON feed for school zone flashers. The feed updates a status field when the flashers are active. The feed has data for all of the school zones in my city. Each object in the feed represents one school zone, with multiple point locations representing the school zone flasher signs. In a hosted point feature service, I want to create points for each of the locations that correspond to each school zone and have them all simultaneously updated. Is this possible with a hosted feature service? 

Here is a sample object from my feed:

{
      "group": {
        "group_number": 1,
        "group_name": "Blanco Vista"
      },
      "currently_scheduled_to_flash": false,
      "todays_flashing_schedule": [
        {
          "time": "7:00 AM",
          "relay_1_flashing": true,
          "relay_2_flashing": true
        },
        {
          "time": "8:30 AM",
          "relay_1_flashing": false,
          "relay_2_flashing": false
        },
        {
          "time": "2:30 PM",
          "relay_1_flashing": true,
          "relay_2_flashing": true
        },
        {
          "time": "4:00 PM",
          "relay_1_flashing": false,
          "relay_2_flashing": false
        }
      ],
      "locations": [
        {
          "location_number": 1,
          "location_name": "NB Blanco Vista",
          "location_address": "Unassigned",
          "location_latitude": "29.944873046968684",
          "location_longitude": "-97.89528615238225"
        },
        {
          "location_number": 2,
          "location_name": "SB Blanco Vista",
          "location_address": "Unassigned",
          "location_latitude": "29.948936386501728",
          "location_longitude": "-97.89401411096776"
        },
        {
          "location_number": 3,
          "location_name": "WB Trail Ridge Pass",
          "location_address": "Unassigned",
          "location_latitude": "29.948146752015052",
          "location_longitude": "-97.89420284048913"
        },
        {
          "location_number": 4,
          "location_name": "EB Trail Ridge Pass",
          "location_address": "Unassigned",
          "location_latitude": "29.948672645586512",
          "location_longitude": "-97.89520094529524"
        },
        {
          "location_number": 5,
          "location_name": "WB Old Settlers",
          "location_address": "Unassigned",
          "location_latitude": "29.94549068648647",
          "location_longitude": "-97.89458556692875"
        },
        {
          "location_number": 6,
          "location_name": "EB Old Settlers",
          "location_address": "Unassigned",
          "location_latitude": "29.945987477034123",
          "location_longitude": "-97.89692170762117"
        },
        {
          "location_number": 7,
          "location_name": "NB 2 Blanco Vista MG 1 GP 1 LOC 7",
          "location_address": "Unassigned",
          "location_latitude": "29.945153886533624",
          "location_longitude": "-97.89535172127773"
        },
        {
          "location_number": 8,
          "location_name": "Easton Dr",
          "location_address": "Easton Dr",
          "location_latitude": "29.948778154675484",
          "location_longitude": "-97.89696334572306"
        }
      ]
    },

 

0 Kudos
4 Replies
JeffSilberberg
Frequent Contributor

@Gene_Sipes 

    I looked at your JSON, and I am not sure, based on what I see, what your Track ID (Primary Key) is that you want to update.  How you would from this json -- Also, Not sure what you are getting out of the Today's Flashing Schedule Sub Blocks.  Shouldn't it be more like Begin_Time, End_Time, Flash_Relay_1 (When Acive) Flash_Relay_2 (When Active).  

Just some thoughts -- 

 

In looking at the JSON in https://jsoncrack.com/editor  I think you should prompt the Group. Something Like this -- 

{
    "group_number": 1,
    "group_name": "Blanco Vista",
    "currently_scheduled_to_flash": false,
  "todays_flashing_schedule": [
    {
      "time": "7:00 AM",
      "relay_1_flashing": true,
      "relay_2_flashing": true
    },
    {
      "time": "8:30 AM",
      "relay_1_flashing": false,
      "relay_2_flashing": false
    },
    {
      "time": "2:30 PM",
      "relay_1_flashing": true,
      "relay_2_flashing": true
    },
    {
      "time": "4:00 PM",
      "relay_1_flashing": false,
      "relay_2_flashing": false
    }
  ],
  "locations": [

 

   

0 Kudos
Gene_Sipes
Frequent Contributor

Our vendor for school zone flashers created this feed for us. They should be able to adjust the format for us fairly easily. Do you have any recommendations for that? 

The track ID in this case would be the group number or group name. Essentially each group represents a school zone for a particular school, and each group consists of multiple locations for the school zone flasher signs installed for each school zone. I want to be able to map all of the school zone flashers and show that they are active or not active on my web map in Realtime. 

I might just go ahead and create the points ahead of time in my hosted feature service, and for each group of points associated with a school zone, give them the proper group number. Then just use geo event to update the status of the points based on the group number. 

Ultimate question for me is... can geo event update multiple points with the same group number in a hosted feature service?

0 Kudos
JeffSilberberg
Frequent Contributor

@Gene_Sipes 

I think I would prefer the following JSON over your first pass.  

Also, why haul all the location data each time? If it's static, then why not a Static Feature Layer? 

Maybe something like this -- BUt here still seems to be a lot of redundant data that may be useless.

 

 

{
      "group": {
        "group_number": 1,
        "group_name": "Blanco Vista",
        "currently_scheduled_to_flash": false,
        "todays_flashing_schedule": [
        {
          "begin_time": "7:00 AM",
		  "end_time":   "8:30 AM",
          "relay_1_flashing": true,
          "relay_2_flashing": true
        },
        {
          "begin_time": "2:30 PM",
		  "end_time": "4:00 PM",
          "relay_1_flashing": true,
          "relay_2_flashing": true
        },
       ],
      "locations": [
        {
          "location_number": 1,
          "location_name": "NB Blanco Vista",
          "location_address": "Unassigned",
          "location_latitude": "29.944873046968684",
          "location_longitude": "-97.89528615238225"
        },
        {
          "location_number": 2,
          "location_name": "SB Blanco Vista",
          "location_address": "Unassigned",
          "location_latitude": "29.948936386501728",
          "location_longitude": "-97.89401411096776"
        },
        {
          "location_number": 3,
          "location_name": "WB Trail Ridge Pass",
          "location_address": "Unassigned",
          "location_latitude": "29.948146752015052",
          "location_longitude": "-97.89420284048913"
        },
        {
          "location_number": 4,
          "location_name": "EB Trail Ridge Pass",
          "location_address": "Unassigned",
          "location_latitude": "29.948672645586512",
          "location_longitude": "-97.89520094529524"
        },
        {
          "location_number": 5,
          "location_name": "WB Old Settlers",
          "location_address": "Unassigned",
          "location_latitude": "29.94549068648647",
          "location_longitude": "-97.89458556692875"
        },
        {
          "location_number": 6,
          "location_name": "EB Old Settlers",
          "location_address": "Unassigned",
          "location_latitude": "29.945987477034123",
          "location_longitude": "-97.89692170762117"
        },
        {
          "location_number": 7,
          "location_name": "NB 2 Blanco Vista MG 1 GP 1 LOC 7",
          "location_address": "Unassigned",
          "location_latitude": "29.945153886533624",
          "location_longitude": "-97.89535172127773"
        },
        {
          "location_number": 8,
          "location_name": "Easton Dr",
          "location_address": "Easton Dr",
          "location_latitude": "29.948778154675484",
          "location_longitude": "-97.89696334572306"
        }
      ]
    }

 

 

 

0 Kudos
Gene_Sipes
Frequent Contributor

Thank you! That makes more sense. To put all of the attributes within the group object. I have forwarded this request to the developer. 

 

Also, I agree to your point about the locations. Yes, the flashers' locations are static, so I only want to use them to create the initial points, then once they are completed I only want GeoEvent to update the statuses. So I will modify my definition to only look for the group number and status from the feed and ignore the locations. I don't see any harm in the feed containing the lat and longs, I just wont use them. 

0 Kudos