{"id":423,"date":"2015-06-22T22:08:40","date_gmt":"2015-06-22T22:08:40","guid":{"rendered":"http:\/\/www.pawebgate.com\/blogging\/?p=423"},"modified":"2019-06-25T07:50:47","modified_gmt":"2019-06-25T07:50:47","slug":"querying-a-layer-using-an-arcgis-online-map","status":"publish","type":"post","link":"https:\/\/www.pawebgate.com\/blogging\/querying-a-layer-using-an-arcgis-online-map\/","title":{"rendered":"Querying a Layer using an ArcGIS Online Map"},"content":{"rendered":"<p><a href=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/ArcGIS_Online_Specialty_Large-LightBackground.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-424 \" src=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/ArcGIS_Online_Specialty_Large-LightBackground.png\" alt=\"ArcGIS-Online\" width=\"209\" height=\"111\" srcset=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/ArcGIS_Online_Specialty_Large-LightBackground.png 692w, https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/ArcGIS_Online_Specialty_Large-LightBackground-300x159.png 300w\" sizes=\"auto, (max-width: 209px) 100vw, 209px\" \/><\/a>While exploring the possibilities of <a title=\"ArcGIS for JavaScript\" href=\"https:\/\/developers.arcgis.com\/javascript\/\" target=\"_blank\" rel=\"noopener noreferrer\">ArcGIS API for JavaScript<\/a>, I was wondering how to query a web map that has been created through <a href=\"https:\/\/www.arcgis.com\/home\/\" target=\"_blank\" rel=\"noopener noreferrer\">ArcGIS Online<\/a>.<\/p>\n<p>I spent quite a lot of time trying to figure out how to pass my Web Map created through ArcGIS Online as a URL. Especially for &#8220;var MapServiceToDisplay&#8221; and &#8220;var MapServiceToSearch&#8221;.<\/p>\n<p>So here is the answer:<\/p>\n<p><!--more--><\/p>\n<p>The first thing you have to do is create an account in ArcGIS Online. After catering for profile photos and other general settings, create a map.<\/p>\n<p><a href=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/create-map.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-428\" src=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/create-map.png\" alt=\"create-map-arcgis_online\" width=\"979\" height=\"383\" srcset=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/create-map.png 1286w, https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/create-map-300x117.png 300w, https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/create-map-1024x401.png 1024w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/a><\/p>\n<p>Next you have to Share this new map<\/p>\n<p><a href=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/share.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-430\" src=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/share.png\" alt=\"share-arcgis-online_map\" width=\"972\" height=\"453\" srcset=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/share.png 1296w, https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/share-300x140.png 300w, https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/share-1024x477.png 1024w\" sizes=\"auto, (max-width: 972px) 100vw, 972px\" \/><\/a><\/p>\n<p>After that, add an item to your map, preferably from your computer<\/p>\n<p><a href=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/add-item.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-431\" src=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/add-item.png\" alt=\"arcgisonline-add-item\" width=\"978\" height=\"376\" srcset=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/add-item.png 1277w, https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/add-item-300x115.png 300w, https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/add-item-1024x394.png 1024w\" sizes=\"auto, (max-width: 978px) 100vw, 978px\" \/><\/a><\/p>\n<p><em>Remember also to Publish this file as a feature layer<\/em><\/p>\n<p><a href=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/feature-layer.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-432\" src=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/feature-layer.png\" alt=\"arcgisonline-feature-layer\" width=\"979\" height=\"430\" srcset=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/feature-layer.png 1270w, https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/feature-layer-300x132.png 300w, https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/feature-layer-1024x450.png 1024w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/a><\/p>\n<p>Next: Share this Feature Layer<\/p>\n<p><a href=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/feature-layer-share.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-436\" src=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/feature-layer-share.png\" alt=\"arcgisonline-share-feature-layer\" width=\"985\" height=\"410\" srcset=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/feature-layer-share.png 1292w, https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/feature-layer-share-300x125.png 300w, https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/feature-layer-share-1024x426.png 1024w\" sizes=\"auto, (max-width: 985px) 100vw, 985px\" \/><\/a><\/p>\n<p>Next step is to Add Feature Layer to Map, Save your map after adding your layer.<\/p>\n<p><a href=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/arcgisonline-add-layer-to-map.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-438\" src=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/arcgisonline-add-layer-to-map.png\" alt=\"arcgisonline-add-layer-to-map\" width=\"993\" height=\"404\" srcset=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/arcgisonline-add-layer-to-map.png 1285w, https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/arcgisonline-add-layer-to-map-300x122.png 300w, https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/arcgisonline-add-layer-to-map-1024x417.png 1024w\" sizes=\"auto, (max-width: 993px) 100vw, 993px\" \/><\/a><\/p>\n<p>Now, as soon as you do that, if you click on the Map that this new layer resides, you will get the following link for the Map Contents:<\/p>\n<p><a href=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/arcgisonline-link.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-440\" src=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/arcgisonline-link.png\" alt=\"arcgisonline-link\" width=\"996\" height=\"469\" srcset=\"https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/arcgisonline-link.png 1297w, https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/arcgisonline-link-300x141.png 300w, https:\/\/www.pawebgate.com\/blogging\/wp-content\/uploads\/2015\/06\/arcgisonline-link-1024x482.png 1024w\" sizes=\"auto, (max-width: 996px) 100vw, 996px\" \/><\/a><\/p>\n<p>You can now use this link for var MapServiceToDisplay and var MapServiceToSearch whenever you want to refer to this map as follows:<\/p>\n<p>var MapServiceToDisplay = &#8220;https:\/\/services5.arcgis.com\/3a3dkCUNh3aCnKgy\/ArcGIS\/rest\/services\/kalyvia_egsa\/FeatureServer\/&#8221;;<br \/>\nvar MapServiceToSearch = &#8220;https:\/\/services5.arcgis.com\/3a3dkCUNh3aCnKgy\/ArcGIS\/rest\/services\/kalyvia_egsa\/FeatureServer\/0&#8221;;<\/p>\n<p>0 in the line above implies the layer you want to query.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While exploring the possibilities of ArcGIS API for JavaScript, I was wondering how to query a web map that has been created through ArcGIS Online. I spent quite a lot of time trying to figure out how to pass my Web Map created through ArcGIS Online as a URL. Especially for &#8220;var MapServiceToDisplay&#8221; and &#8220;var &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.pawebgate.com\/blogging\/querying-a-layer-using-an-arcgis-online-map\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Querying a Layer using an ArcGIS Online Map&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[78,77,82,79,80,81],"class_list":["post-423","post","type-post","status-publish","format-standard","hentry","category-technology","tag-arcgis-for-javascript","tag-arcgis-online","tag-esri","tag-mapservicetodisplay","tag-mapservicetosearch","tag-web-appbuilder-for-arcgis","entry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.pawebgate.com\/blogging\/wp-json\/wp\/v2\/posts\/423","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pawebgate.com\/blogging\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pawebgate.com\/blogging\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pawebgate.com\/blogging\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pawebgate.com\/blogging\/wp-json\/wp\/v2\/comments?post=423"}],"version-history":[{"count":13,"href":"https:\/\/www.pawebgate.com\/blogging\/wp-json\/wp\/v2\/posts\/423\/revisions"}],"predecessor-version":[{"id":549,"href":"https:\/\/www.pawebgate.com\/blogging\/wp-json\/wp\/v2\/posts\/423\/revisions\/549"}],"wp:attachment":[{"href":"https:\/\/www.pawebgate.com\/blogging\/wp-json\/wp\/v2\/media?parent=423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pawebgate.com\/blogging\/wp-json\/wp\/v2\/categories?post=423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pawebgate.com\/blogging\/wp-json\/wp\/v2\/tags?post=423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}