I have a database that receives real-time data from alarms throughout the day, or on request.

I'd like to create a web map that displays the "bad" alarms.

My current idea is to create a Python script that queries the database every 15 minutes and gets a unique ID and a lat/long of the bad alarms. I will have a feature service setup and use the REST API (through Python) to add or delete alarms based on the previous query. I'll then have a basic web map set up to display this feature service with other related layers.

Is this a good approach? This data will only be viewed internally. I've never used the REST API before, but it seemed like a straightforward solution.

Thanks for any guidance.

1 Answer 1


Regarding your question as to whether you can edit a feature layer using the REST API, the answer is yes. See the Apply Edits section of the REST API for documentation on how do this this.

However, if it's only the status of the alarms which is changing every 15 minutes, you could make the change purely within the web map (without needing to change the values in the database using Apply Edits).

To do this, you would create a feature service containing all alarms. Every 15 minutes, query the database to find out which ones are "bad", then use a Query Task to select those alarms from your feature service. Draw these alarms in a new "bad" layer.

  • The only part I don't understand is how to automate the Query Task to update every 15 minutes when I get the database query results? How do I keep the web map current?
    – geogeogeo
    Jul 24, 2014 at 5:31
  • 2
    @geogeogeo you could accomplish this using setInterval() Jul 24, 2014 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.