{"id":6046,"date":"2022-12-29T16:35:37","date_gmt":"2022-12-29T13:05:37","guid":{"rendered":"https:\/\/en.geobox.ir\/developers\/?post_type=docs&#038;p=6046"},"modified":"2023-01-21T13:44:01","modified_gmt":"2023-01-21T10:14:01","slug":"edit-features","status":"publish","type":"docs","link":"https:\/\/en.geobox.ir\/developers\/docs\/working-with-features\/edit-features\/","title":{"rendered":"Edit feature"},"content":{"rendered":"<h3>drawNewFeature()<\/h3>\n<p>Sets the map in the drawing mode to draw new feature.<\/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.drawNewFeature();\r\n<\/pre>\n<h3>beginEditFeature(Id)<\/h3>\n<p>Sets the map in the drawing mode to edit existing feature.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>Id (Number): A feature id.<\/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.beginEditFeature(10);\r\n<\/pre>\n<h3>saveEditFeature(Id)<\/h3>\n<p style=\"text-align: justify;\">Use saveEditFeature to save feature changes and cancelEditFeature to cancel changes. If you give the Id of the feature in saveEditFeature, the existing feature will be updated, otherwise a new feature will be inserted.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>Id (Number)?: A feature id.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" dir=\"ltr\" style=\"min-height: 40px;\" data-enlighter-language=\"generic\">intendedLayer.saveEditFeature(10)<\/pre>\n<h3>deleteFeature(Id)<\/h3>\n<p>Deletes the existing feature.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>Id (Number): A feature id.<\/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.deleteFeature(10);\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>drawNewFeature() Sets the map in the drawing mode to draw new feature. Example: const allFeatureLayers = map.getFeatureLayers(); const intendedLayer = allFeatureLayers[&#8220;&lt;intended layer name&gt;&#8221;]; intendedLayer.drawNewFeature(); beginEditFeature(Id) Sets the map in the drawing mode to edit existing feature. Parameters: Id (Number): A feature id. Example: const allFeatureLayers = map.getFeatureLayers(); const intendedLayer = allFeatureLayers[&#8220;&lt;intended layer name&gt;&#8221;]; intendedLayer.beginEditFeature(10); saveEditFeature(Id) [&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-6046","docs","type-docs","status-publish","hentry","doc_category-working-with-features"],"_links":{"self":[{"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/docs\/6046","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=6046"}],"version-history":[{"count":7,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/docs\/6046\/revisions"}],"predecessor-version":[{"id":6645,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/docs\/6046\/revisions\/6645"}],"wp:attachment":[{"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/media?parent=6046"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/doc_category?post=6046"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/doc_tag?post=6046"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}