{"id":5950,"date":"2022-12-26T12:17:20","date_gmt":"2022-12-26T08:47:20","guid":{"rendered":"https:\/\/en.geobox.ir\/developers\/?post_type=docs&#038;p=5950"},"modified":"2023-01-21T12:38:27","modified_gmt":"2023-01-21T09:08:27","slug":"data-manipulation","status":"publish","type":"docs","link":"https:\/\/en.geobox.ir\/developers\/docs\/working-with-features\/data-manipulation\/","title":{"rendered":"Working with feature"},"content":{"rendered":"<p>Tip: To use all the methods below, you must first select the desired layer through the result array of the map.getFeatureLayers().<\/p>\n<h2>Properties:<\/h2>\n<h3 id=\"1-toc-title\" class=\"betterdocs-content-heading\">selectionSet<\/h3>\n<p>After selecting features, you can access the list of selected Ids using selectionSet.<\/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\">Set: Returns a set of ids<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">const\u00a0allFeatureLayers\u00a0=\u00a0map.getFeatureLayers();\u00a0\r\nconst intendedLayer = allFeatureLayers[\"&lt;intended layer name&gt;\"];\u00a0\r\nconst Ids = intendedLayer.selectionSet;<\/pre>\n<h3 id=\"1-toc-title\" class=\"betterdocs-content-heading\">highlightSet<\/h3>\n<p>After highlighting features, you can access the list of highlighted Ids using highlightSet .<\/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\">Set: Returns a set of ids<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">const\u00a0allFeatureLayers\u00a0=\u00a0map.getFeatureLayers();\u00a0\r\nconst intendedLayer = allFeatureLayers[\"&lt;intended layer name&gt;\"];\u00a0\r\nconst Ids = intendedLayer.highlightSet;<\/pre>\n<h2>Methods:<\/h2>\n<h3>select(Ids)<\/h3>\n<p>Selects one or multiple features.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>Ids(Number | Array): Array of features ids. If you want a single feature, insert id as a number.<\/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 selecting features was successful or not. Null message means selecting 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.select([10,25]); \r\n\r\n<\/pre>\n<h3>addToSelection(Ids)<\/h3>\n<p>Adds one or multiple features from the layer to the selected features.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>Ids(Number | Array): Array of features ids. If you want a single feature, insert id as a number.<\/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 selecting features was successful or not. Null message means selecting 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.addToSelection([10,25]); \r\n\r\n<\/pre>\n<h3>removeFromSelecion(Ids)<\/h3>\n<p>Deselects one or multiple features.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>Ids(Number | Array): Array of features ids. If you want a single feature, insert id as a number.<\/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 deselecting features was successful or not. Null message means deselecting 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.removeFromSelection([10,25]); \r\n\r\n<\/pre>\n<h3>clearSelection()<\/h3>\n<p>Deselects all features.<\/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 deselecting features was successful or not. Null message means deselecting 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.clearSelection(); \r\n\r\n<\/pre>\n<h3>highlight (Ids)<\/h3>\n<p>Highlights one or multiple features.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>Ids(Number | Array): Array of features ids. If you want a single feature, insert id as a number.<\/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 highlighting features was successful or not. Null message means highlighting 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.highlight([10,25]); \r\n\r\n<\/pre>\n<div>\n<h3><span style=\"font-size: 14pt;\">addToHighlight(Ids)<\/span><\/h3>\n<\/div>\n<p>Adds one or multiple features from the layer to the highlighted features.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>Ids(Number | Array): Array of features ids. If you want a single feature, insert id as a number.<\/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 highlighting features was successful or not. Null message means highlighting 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.addToHighlight([10,25]); \r\n\r\n<\/pre>\n<h3>removeFromHighlight(Ids)<\/h3>\n<p>Removes one or multiple features from the highlight mode.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>Ids(Number | Array): Array of features ids. If you want a single feature, insert id as a number.<\/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 removing features from highlight mode was successful or not. Null message means removing features from highlight mode 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.removeFromHighlight([10,25]); \r\n\r\n<\/pre>\n<h3>clearHighlight()<\/h3>\n<p>Removes all features from the highlight mode.<\/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 removing all features from highlight mode was successful or not. Null message means removing all features from highlight mode\u00a0was 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.clearHighlight(); \r\n\r\n<\/pre>\n<h3>flashFeature(Id)<\/h3>\n<p>Sets a feature to blink.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>Id (Number): A feature id.<\/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 flashing feature was successful or not. Null message means flashing 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.flashFeature(10); \r\n<\/pre>\n<p class='codepen'  data-height='500' data-theme-id='1' data-slug-hash='yLqYQee' data-default-tab='result' data-animations='run' data-editable='' data-embed-version='2'>\nSee the Pen <a href=\"https:\/\/codepen.io\/geobox-gl-demo\/pen\/yLqYQee\">Contact Form \u2013 Pen a Day 20<\/a> by Geobox (<a href=\"https:\/\/codepen.io\/geobox-gl-demo\">@geobox-gl-demo<\/a>) on <a href=\"http:\/\/codepen.io\">CodePen<\/a>.1<\/p>\n<script async src=\"https:\/\/cpwebassets.codepen.io\/assets\/embed\/ei.js\"><\/script>\n<h3><\/h3>\n<h3>zoomToFeature(Id)<\/h3>\n<p>Zooms to the feature.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>Id (Number): A feature id.<\/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 zooming to feature was successful or not. Null message means zooming 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.zoomToFeature(10);\r\n<\/pre>\n<h3>openPopup(Id, titleField, <span style=\"font-size: 1.125rem;\">latLngLocation)<\/span><\/h3>\n<p>Opens the feature popup. If you want to open the popup in another location, enter its location as the third argument.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>Id (Number): A feature id.<\/p>\n<p>Id (String)?: Field name that you want to show field value as a title.<\/p>\n<p><span style=\"font-size: 12pt;\">latLngLocation(Array)?: An array contains latitude and longitude. e.g. [32, 51]. If you want to open popup in another location, use this parameter.<\/span><\/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 opening popup was successful or not. Null message means opening popup 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.openPopup(10,'name',[37,53]);\r\n<\/pre>\n<h3>removePopup()<\/h3>\n<p>Closes the existing popup. (Note that only one popup can be opened in the map, and the popup will be closed when a new popup is opened)<\/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 flashing feature was successful or not. Null message means flashing 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.removePopup();\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Tip: To use all the methods below, you must first select the desired layer through the result array of the map.getFeatureLayers(). Properties: selectionSet After selecting features, you can access the list of selected Ids using selectionSet. Returns: Set: Returns a set of ids Example: const\u00a0allFeatureLayers\u00a0=\u00a0map.getFeatureLayers();\u00a0 const intendedLayer = allFeatureLayers[&#8220;&lt;intended layer name&gt;&#8221;];\u00a0 const Ids = intendedLayer.selectionSet; [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"doc_category":[61],"doc_tag":[],"class_list":["post-5950","docs","type-docs","status-publish","hentry","doc_category-working-with-features"],"_links":{"self":[{"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/docs\/5950","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=5950"}],"version-history":[{"count":38,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/docs\/5950\/revisions"}],"predecessor-version":[{"id":6643,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/docs\/5950\/revisions\/6643"}],"wp:attachment":[{"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/media?parent=5950"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/doc_category?post=5950"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/doc_tag?post=5950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}