{"id":6044,"date":"2022-12-29T16:20:44","date_gmt":"2022-12-29T12:50:44","guid":{"rendered":"https:\/\/en.geobox.ir\/developers\/?post_type=docs&#038;p=6044"},"modified":"2023-01-21T12:00:17","modified_gmt":"2023-01-21T08:30:17","slug":"working-with-layer","status":"publish","type":"docs","link":"https:\/\/en.geobox.ir\/developers\/docs\/working-with-layers\/working-with-layer\/","title":{"rendered":"Working with feature layer"},"content":{"rendered":"<h3>hideLayer()<\/h3>\n<p>Turns the layer off.<\/p>\n<p id=\"zoomin-returns\" class=\"unprose txt-m mb3 anchor mt12\"><strong>Returns:<\/strong><\/p>\n<p class=\"unprose txt-m mb3 anchor mt12\">String: Returns a message that shows turning layer off was successful or not. Null message means turning off was successful.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" dir=\"ltr\" style=\"min-height: 40px;\" data-enlighter-language=\"generic\">const allFeatureLayers = map.getFeatureLayers();\r\nconst intendedLayer = allFeatureLayers[\"&lt;intended layer name&gt;\"];\r\nintendedLayer.hideLayer(); \r\n\r\n<\/pre>\n<h3>showLayer()<\/h3>\n<p>Turns the layer on.<\/p>\n<p id=\"zoomin-returns\" class=\"unprose txt-m mb3 anchor mt12\"><strong>Returns:<\/strong><\/p>\n<p class=\"unprose txt-m mb3 anchor mt12\">String: Returns a message that shows turning layer on was successful or not. Null message means turning on was successful.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" dir=\"ltr\" style=\"min-height: 40px;\" data-enlighter-language=\"generic\">const allFeatureLayers = map.getFeatureLayers();\r\nconst intendedLayer = allFeatureLayers[\"&lt;intended layer name&gt;\"];\r\nintendedLayer.showLayer(); \r\n\r\n<\/pre>\n<h3>changeColor(color, geometryType)<\/h3>\n<p style=\"text-align: justify;\">To change the color of layers that can be displayed with more than one color (such as polygon layers that, in addition to fill-color, which is the color of the surface of the layer, also have fill-outline-color, which is the color of the outer border of the layer), you can use the color field key as the second argument of the function (if you don&#8217;t enter the second argument, the default key of each geometry will be used).<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>color(String): New color for this layer. rgb, rgba and hexadecimal values are accepted.<\/p>\n<p>geometryType(String) is desired part of geometry for changing color.<\/p>\n<p id=\"zoomin-returns\" class=\"unprose txt-m mb3 anchor mt12\"><strong>Returns:<\/strong><\/p>\n<p class=\"unprose txt-m mb3 anchor mt12\">String: Returns a message that shows color changing was successful or not. Null message means changing was successful.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" dir=\"ltr\" style=\"min-height: 40px;\" data-enlighter-language=\"generic\">const allFeatureLayers = map.getFeatureLayers();\r\nconst intendedLayer = allFeatureLayers[\"&lt;intended layer name&gt;\"];\r\nintendedLayer.changeColor('red','fill-outline-color'); \r\n\r\n<\/pre>\n<h3>changeWidth(width)<\/h3>\n<p>Changes the width of the linear layer.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>width: new width number.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" dir=\"ltr\" style=\"min-height: 40px;\" data-enlighter-language=\"generic\">const allFeatureLayers = map.getFeatureLayers();\r\nconst intendedLayer = allFeatureLayers[\"&lt;intended layer name&gt;\"];\r\nintendedLayer.changeWidth(5); \r\n\r\n<\/pre>\n<h3>changeRadius(radius)<\/h3>\n<p>Changes the circle diameter of the point layer.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>radius(Number): new radius number.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" dir=\"ltr\" style=\"min-height: 40px;\" data-enlighter-language=\"generic\">const allFeatureLayers = map.getFeatureLayers();\r\nconst intendedLayer = allFeatureLayers[\"&lt;intended layer name&gt;\"];\r\nintendedLayer.changeRadius(5);<\/pre>\n<h3>changeSelectionColor(color)<\/h3>\n<p>Changes selection color of features.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>color(String): New selection color for this layer. rgb, rgba and hexadecimal values are accepted.<\/p>\n<p id=\"zoomin-returns\" class=\"unprose txt-m mb3 anchor mt12\"><strong>Returns:<\/strong><\/p>\n<p class=\"unprose txt-m mb3 anchor mt12\">String: Returns a message that shows color changing was successful or not. Null message means changing was successful.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" dir=\"ltr\" style=\"min-height: 40px;\" data-enlighter-language=\"generic\">const allFeatureLayers = map.getFeatureLayers();\r\nconst intendedLayer = allFeatureLayers[\"&lt;intended layer name&gt;\"];\r\nintendedLayer.changeSelectionColor('red');<\/pre>\n<h3>changeHighlightColor(color)<\/h3>\n<p>Changes highlight color of features.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>color(String): New highlight color for this layer. rgb, rgba and hexadecimal values are accepted.<\/p>\n<p id=\"zoomin-returns\" class=\"unprose txt-m mb3 anchor mt12\"><strong>Returns:<\/strong><\/p>\n<p class=\"unprose txt-m mb3 anchor mt12\">String: Returns a message that shows color changing was successful or not. Null message means changing was successful.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" dir=\"ltr\" style=\"min-height: 40px;\" data-enlighter-language=\"generic\">const allFeatureLayers = map.getFeatureLayers();\r\nconst intendedLayer = allFeatureLayers[\"&lt;intended layer name&gt;\"];\r\nintendedLayer.changeHighlightColor('<b>#0000ff<\/b>');<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>hideLayer() Turns the layer off. Returns: String: Returns a message that shows turning layer off was successful or not. Null message means turning off was successful. Example: const allFeatureLayers = map.getFeatureLayers(); const intendedLayer = allFeatureLayers[&#8220;&lt;intended layer name&gt;&#8221;]; intendedLayer.hideLayer(); showLayer() Turns the layer on. Returns: String: Returns a message that shows turning layer on was successful [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"doc_category":[58],"doc_tag":[],"class_list":["post-6044","docs","type-docs","status-publish","hentry","doc_category-working-with-layers"],"_links":{"self":[{"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/docs\/6044","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/comments?post=6044"}],"version-history":[{"count":9,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/docs\/6044\/revisions"}],"predecessor-version":[{"id":6633,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/docs\/6044\/revisions\/6633"}],"wp:attachment":[{"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/media?parent=6044"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/doc_category?post=6044"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/doc_tag?post=6044"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}