{"id":187361,"date":"2014-10-07T20:41:50","date_gmt":"2014-10-08T03:41:50","guid":{"rendered":"http:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=187361"},"modified":"2018-12-18T09:55:32","modified_gmt":"2018-12-18T17:55:32","slug":"using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source","status":"publish","type":"blog","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source","title":{"rendered":"Using Python to push updates to a hosted feature service from an external source"},"author":4031,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"_acf_changed":false,"_searchwp_excluded":""},"categories":[37511],"tags":[24521,24341],"industry":[],"product":[36551],"class_list":["post-187361","blog","type-blog","status-publish","format-standard","hentry","category-sharing-collaboration","tag-hosted-feature-services","tag-python","product-arcgis-online"],"acf":{"short_description":"We all know the power of using feature services with ArcGIS.com to share our data and maps.","flexible_content":[{"acf_fc_layout":"content","content":"<p>We all know the power of using feature services with ArcGIS.com to share our data and maps. These maps become even more powerful when the content automatically updates.\u00a0<a href=\"http:\/\/doc.arcgis.com\/en\/arcgis-online\/reference\/georss.htm\">GeoRSS<\/a>\u00a0feeds allow you to quickly pull content into your map. Well, what happens if you find an API or some geo-enabled information that doesn\u2019t provide a GeoRSS feed but you want to get that information into your feature service? Python can act as the \u201cglue\u201d to combine the geo-information from the web into your hosted feature service.<\/p>\n<p><a href=\"https:\/\/twitter.com\/DaveAtCOGS\" target=\"_blank\" rel=\"noopener\">Dave MacLean<\/a>\u00a0from the Centre of Geographic Sciences (COGS) has a\u00a0<a href=\"https:\/\/www.arcgis.com\/apps\/OnePane\/basicviewer\/index.html?appid=7cd4e3c8a8fd4e9dbb46cb2e39cd83e3\" target=\"_blank\" rel=\"noopener\">webmap<\/a>\u00a0that captures tweets and photos from the astronauts on the International Space Station (ISS). Recently he worked with us (at Esri) to write a Python script that captures the ISS location from a website supplying the location as JSON and then pushes the relevant information into a hosted feature service. The current ISS location on his map allows viewers to prepare for an ISS sighting.\u00a0<a href=\"https:\/\/www.arcgis.com\/apps\/OnePane\/basicviewer\/index.html?appid=7cd4e3c8a8fd4e9dbb46cb2e39cd83e3\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-42584 alignright\" src=\"http:\/\/blogs.esri.com\/esri\/arcgis\/files\/2014\/10\/ISS_Header.jpg\" alt=\"ISS Webmap\" width=\"635\" height=\"295\" \/><\/a><\/p>\n<p>Dave found a website that provides the real-time location of the ISS making the \u00a0information available in\u00a0<a href=\"http:\/\/en.wikipedia.org\/wiki\/JSON\" target=\"_blank\" rel=\"noopener\">JSON<\/a>, which the Python script parses. The script runs on an old laptop with a 60-second delay (You could investigate a cloud or other hosting solution to run your script if you can\u2019t dedicate a computer to running it). With the script updating the feature service, he used the\u00a0<a href=\"http:\/\/doc.arcgis.com\/en\/arcgis-online\/create-maps\/set-refresh-interval.htm\" target=\"_blank\" rel=\"noopener\">refresh layer<\/a>\u00a0method while building his web application to refresh the layer every minute.<\/p>\n<p>You can\u00a0<a href=\"https:\/\/github.com\/arcpy\/AutomaticUpdatesIntoFeatureService\/blob\/master\/UpdatePointFromExternalAPI.py\" target=\"_blank\" rel=\"noopener\">download<\/a>, fork or just explore the Python code we wrote to upload the ISS location from the\u00a0<a href=\"https:\/\/github.com\/arcpy\/AutomaticUpdatesIntoFeatureService\" target=\"_blank\" rel=\"noopener\">github repo<\/a>. Detailed\u00a0<a href=\"https:\/\/github.com\/arcpy\/AutomaticUpdatesIntoFeatureService\/blob\/master\/README.md\" target=\"_blank\" rel=\"noopener\">instructions to setup and deploy<\/a>\u00a0the script are also provided.\u00a0Here are some of the key points you should note about the script before modifying it to fit your workflows.<\/p>\n<ul>\n<li>The script requires an existing feature service with a point layer and specific \u00a0attributes. It the layer is empty, temporary geometry is inserted into the layer as the script makes updates on existing features. Note the hosted layer and point location are in WGS84. Make sure the spatial reference of your data matches the layer when posting updates.<\/li>\n<li>A user and password which is either an owner or administrator is required. The credentials to obtain a token are saved inside the python file as clear text. Be careful who you share your script with.<\/li>\n<li>The working parts of the script are placed inside a try\/except with a loop that runs indefinitely and a 300 second sleep. So, every 5 minutes the script will update the feature service (Dave\u2019s routine operates every minute). If a problem occurs, the script should recover and continue working.<\/li>\n<\/ul>\n<p>Once you have setup the script, you could run it from any computer that has Python 2.6+ installed (no ArcGIS desktop software required!).<\/p>\n<p>The ISS position is just one example of a website that serves geo-enabled information.\u00a0<a href=\"http:\/\/comcat.cr.usgs.gov\/fdsnws\/event\/1\/\">USGS earthquake reporting services<\/a>\u00a0provides useful information with geographic coordinates. Many other websites provide an API which may not include geographic coordinates, but you could use Python to combine this data with your own local data before pushing updates to your feature service. For example,\u00a0<a href=\"http:\/\/docs.ckan.org\/en\/latest\/api\/index.html\">data.gov provides an API<\/a>\u00a0and Python code examples for consuming it.<\/p>\n"}],"authors":[{"ID":4031,"user_firstname":"Kevin","user_lastname":"Hibma","nickname":"Kevin Hibma","user_nicename":"khibma","display_name":"Kevin Hibma","user_email":"khibma@esri.com","user_url":"","user_registered":"2018-03-02 00:15:39","user_description":"Kevin Hibma has almost two decades of experience building Esri software and works as a product engineer on the ArcGIS Enterprise team.","user_avatar":"<img data-del=\"avatar\" src='https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2024\/07\/kevinhibmaBlog300-213x200.jpg' class='avatar pp-user-avatar avatar-96 photo ' height='96' width='96'\/>"}],"related_articles":"","card_image":false,"wide_image":false},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using Python to push updates to a hosted feature service from an external source<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Python to push updates to a hosted feature service from an external source\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source\" \/>\n<meta property=\"og:site_name\" content=\"ArcGIS Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/esrigis\/\" \/>\n<meta property=\"article:modified_time\" content=\"2018-12-18T17:55:32+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@ESRI\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source\"},\"author\":{\"name\":\"Kevin Hibma\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/e7c86c9932f187db7ea7c20449e7bf64\"},\"headline\":\"Using Python to push updates to a hosted feature service from an external source\",\"datePublished\":\"2014-10-08T03:41:50+00:00\",\"dateModified\":\"2018-12-18T17:55:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source\"},\"wordCount\":14,\"publisher\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\"},\"keywords\":[\"hosted feature services\",\"python\"],\"articleSection\":[\"Sharing and Collaboration\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source\",\"name\":\"Using Python to push updates to a hosted feature service from an external source\",\"isPartOf\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#website\"},\"datePublished\":\"2014-10-08T03:41:50+00:00\",\"dateModified\":\"2018-12-18T17:55:32+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.esri.com\/arcgis-blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using Python to push updates to a hosted feature service from an external source\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#website\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/\",\"name\":\"ArcGIS Blog\",\"description\":\"Get insider info from Esri product teams\",\"publisher\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.esri.com\/arcgis-blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\",\"name\":\"Esri\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png\",\"contentUrl\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png\",\"width\":400,\"height\":400,\"caption\":\"Esri\"},\"image\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/esrigis\/\",\"https:\/\/x.com\/ESRI\",\"https:\/\/www.linkedin.com\/company\/5311\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/e7c86c9932f187db7ea7c20449e7bf64\",\"name\":\"Kevin Hibma\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2024\/07\/kevinhibmaBlog300-213x200.jpg\",\"contentUrl\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2024\/07\/kevinhibmaBlog300-213x200.jpg\",\"caption\":\"Kevin Hibma\"},\"description\":\"Kevin Hibma has almost two decades of experience building Esri software and works as a product engineer on the ArcGIS Enterprise team.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/kevin-hibma-48763610\/\"],\"url\":\"\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Using Python to push updates to a hosted feature service from an external source","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source","og_locale":"en_US","og_type":"article","og_title":"Using Python to push updates to a hosted feature service from an external source","og_url":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source","og_site_name":"ArcGIS Blog","article_publisher":"https:\/\/www.facebook.com\/esrigis\/","article_modified_time":"2018-12-18T17:55:32+00:00","twitter_card":"summary_large_image","twitter_site":"@ESRI","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source#article","isPartOf":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source"},"author":{"name":"Kevin Hibma","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/e7c86c9932f187db7ea7c20449e7bf64"},"headline":"Using Python to push updates to a hosted feature service from an external source","datePublished":"2014-10-08T03:41:50+00:00","dateModified":"2018-12-18T17:55:32+00:00","mainEntityOfPage":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source"},"wordCount":14,"publisher":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization"},"keywords":["hosted feature services","python"],"articleSection":["Sharing and Collaboration"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source","url":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source","name":"Using Python to push updates to a hosted feature service from an external source","isPartOf":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#website"},"datePublished":"2014-10-08T03:41:50+00:00","dateModified":"2018-12-18T17:55:32+00:00","breadcrumb":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-online\/sharing-collaboration\/using-python-to-push-updates-to-a-hosted-feature-service-from-an-external-source#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.esri.com\/arcgis-blog\/"},{"@type":"ListItem","position":2,"name":"Using Python to push updates to a hosted feature service from an external source"}]},{"@type":"WebSite","@id":"https:\/\/www.esri.com\/arcgis-blog\/#website","url":"https:\/\/www.esri.com\/arcgis-blog\/","name":"ArcGIS Blog","description":"Get insider info from Esri product teams","publisher":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.esri.com\/arcgis-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization","name":"Esri","url":"https:\/\/www.esri.com\/arcgis-blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png","contentUrl":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png","width":400,"height":400,"caption":"Esri"},"image":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/esrigis\/","https:\/\/x.com\/ESRI","https:\/\/www.linkedin.com\/company\/5311\/"]},{"@type":"Person","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/e7c86c9932f187db7ea7c20449e7bf64","name":"Kevin Hibma","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/image\/","url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2024\/07\/kevinhibmaBlog300-213x200.jpg","contentUrl":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2024\/07\/kevinhibmaBlog300-213x200.jpg","caption":"Kevin Hibma"},"description":"Kevin Hibma has almost two decades of experience building Esri software and works as a product engineer on the ArcGIS Enterprise team.","sameAs":["https:\/\/www.linkedin.com\/in\/kevin-hibma-48763610\/"],"url":""}]}},"text_date":"October 7, 2014","author_name":"Kevin Hibma","author_page":false,"custom_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2025\/08\/Newsroom-Keyart-Wide-1920-x-1080.jpg","primary_product":"ArcGIS Online","tag_data":[{"term_id":24521,"name":"hosted feature services","slug":"hosted-feature-services","term_group":0,"term_taxonomy_id":24521,"taxonomy":"post_tag","description":"","parent":0,"count":11,"filter":"raw"},{"term_id":24341,"name":"python","slug":"python","term_group":0,"term_taxonomy_id":24341,"taxonomy":"post_tag","description":"","parent":0,"count":171,"filter":"raw"}],"category_data":[{"term_id":37511,"name":"Sharing and Collaboration","slug":"sharing-collaboration","term_group":0,"term_taxonomy_id":37511,"taxonomy":"category","description":"","parent":0,"count":425,"filter":"raw"}],"product_data":[{"term_id":36551,"name":"ArcGIS Online","slug":"arcgis-online","term_group":0,"term_taxonomy_id":36551,"taxonomy":"product","description":"","parent":0,"count":2441,"filter":"raw"}],"primary_product_link":"https:\/\/www.esri.com\/arcgis-blog\/?s=#&products=arcgis-online","_links":{"self":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog\/187361","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog"}],"about":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/types\/blog"}],"author":[{"embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/users\/4031"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/comments?post=187361"}],"version-history":[{"count":0,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog\/187361\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/media?parent=187361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/categories?post=187361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/tags?post=187361"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/industry?post=187361"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/product?post=187361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}