{"id":6099,"date":"2022-12-31T15:45:31","date_gmt":"2022-12-31T12:15:31","guid":{"rendered":"https:\/\/en.geobox.ir\/developers\/?post_type=docs&#038;p=6099"},"modified":"2023-01-26T13:42:20","modified_gmt":"2023-01-26T10:12:20","slug":"working-with-vectorlayer","status":"publish","type":"docs","link":"https:\/\/en.geobox.ir\/developers\/docs\/vector\/working-with-vectorlayer\/","title":{"rendered":"Vector layers"},"content":{"rendered":"<h2>Methods:<\/h2>\n<h3>createVectorLayer(options)<\/h3>\n<p>Creates a new vector layer. This function is an asynchronous function.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>options (Object)<\/p>\n<table class=\"table table--fixed table--compact\" style=\"width: 82.5238%; height: 418px;\">\n<thead>\n<tr class=\"bg-gray-faint\" style=\"height: 26px;\">\n<th style=\"text-align: left; height: 48px; width: 22.8381%;\">Name<\/th>\n<th style=\"text-align: left; height: 48px; width: 103.215%;\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"height: 26px;\">\n<td style=\"height: 26px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.name<\/div>\n<div>String<\/div>\n<\/td>\n<td style=\"height: 26px; width: 103.215%; text-align: left;\">Name of new vector layer.<\/td>\n<\/tr>\n<tr style=\"height: 53px;\">\n<td style=\"height: 53px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.layer_type<\/div>\n<div>String<\/div>\n<\/td>\n<td style=\"height: 53px; width: 103.215%; text-align: left;\">Type of new vector layer. \u00a0Choices are: &#8216;Polygon&#8217; | &#8216;Polyline&#8217; | &#8216;Point&#8217; | &#8216;MultiPoint&#8217;.<\/td>\n<\/tr>\n<tr style=\"height: 53px;\">\n<td style=\"height: 53px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.display_name<code class=\"language-json\"><\/code><\/div>\n<div>String?<\/div>\n<\/td>\n<td style=\"height: 53px; width: 103.215%; text-align: left;\">Display name of new vector layer. This parameter is helpful in identifying vector layers easily.<\/td>\n<\/tr>\n<tr style=\"height: 53px;\">\n<td style=\"height: 53px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.description<code class=\"language-json\"><\/code><\/div>\n<div>String?<\/div>\n<\/td>\n<td style=\"height: 53px; width: 103.215%; text-align: left;\">Description of vector layer.<\/td>\n<\/tr>\n<tr style=\"height: 53px;\">\n<td style=\"height: 53px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.user_id<\/div>\n<div>Number?<\/div>\n<\/td>\n<td style=\"height: 53px; width: 103.215%; text-align: left;\">If the admin wants to create a new vector layer for a certain user, this parameter determines which user is the target user.<\/td>\n<\/tr>\n<tr style=\"height: 53px;\">\n<td style=\"height: 53px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.has_z<\/div>\n<div>bolean<\/div>\n<div>default: false<\/div>\n<\/td>\n<td style=\"height: 53px; width: 103.215%; text-align: left;\">If true, geometry has z value.<\/td>\n<\/tr>\n<tr style=\"height: 79px;\">\n<td style=\"height: 79px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.fields<\/div>\n<div>Array?<\/div>\n<\/div>\n<\/td>\n<td style=\"height: 79px; width: 103.215%; text-align: left;\">\n<pre>[{\r\n      'name': 'string',\r\n      'datatype': 'string', \/\/Choices are: 'String' | 'Integer' | 'Long' | 'Float' | 'Date' | 'Time' | 'DateTime'\r\n      'width': 'number',\r\n      'display_name': 'string'\r\n}]<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p id=\"zoomin-returns\" class=\"unprose txt-m mb3 anchor mt12\"><strong>Returns:<\/strong><\/p>\n<p><a href=\"https:\/\/www.geobox.ir\">Vector layer<\/a>: Returns itself to allow for method chaining.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">const newVectorLayer = await Server.createVectorLayer({\r\n   'name': 'string',\r\n   'layer_type': 'Polygon',\r\n   'display_name': 'string',\r\n   'description': 'string',\r\n   'has_z': false,\r\n   'user_id' :0,\r\n   'fields': [\r\n      {\r\n         'name': 'string',\r\n         'datatype': 'String',\r\n         'width': 250,\r\n         'display_name': 'Parcel Name'\r\n      }\r\n   ]\r\n});<\/pre>\n<h3>updateVectorLayer(layer_uuid, options)<\/h3>\n<p>Updates the existing vector layer. Geometry type is not editable. This function is an asynchronous function.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>layer_uuid is the available vector layer uuid.<\/p>\n<p>options (Object)<\/p>\n<table class=\"table table--fixed table--compact\" style=\"width: 82.5238%; height: 185px;\">\n<thead>\n<tr class=\"bg-gray-faint\" style=\"height: 26px;\">\n<th style=\"text-align: left; height: 53px; width: 22.8381%;\">Name<\/th>\n<th style=\"text-align: left; height: 53px; width: 103.215%;\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"height: 26px;\">\n<td style=\"height: 26px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.name<\/div>\n<div>String<\/div>\n<\/td>\n<td style=\"height: 26px; width: 103.215%; text-align: left;\">Name of vector layer.<\/td>\n<\/tr>\n<tr style=\"height: 53px;\">\n<td style=\"height: 53px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.display_name<code class=\"language-json\"><\/code><\/div>\n<div>String?<\/div>\n<\/td>\n<td style=\"height: 53px; width: 103.215%; text-align: left;\">Display name of vector layer. This parameter is helpful in identifying vector layers easily.<\/td>\n<\/tr>\n<tr style=\"height: 53px;\">\n<td style=\"height: 53px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.description<code class=\"language-json\"><\/code><\/div>\n<div>String?<\/div>\n<\/td>\n<td style=\"height: 53px; width: 103.215%; text-align: left;\">Description of vector layer.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p id=\"zoomin-returns\" class=\"unprose txt-m mb3 anchor mt12\"><strong>Returns:<\/strong><\/p>\n<p><a href=\"https:\/\/www.geobox.ir\">Vector layer<\/a>: Returns itself to allow for method chaining.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">const vectorLayer = await Server.updateVectorLayer('4f9f3e4b-4dc1-469b-83ab-00ae00f02581',{\r\n   'name': 'string',\r\n   'display_name': 'string',\r\n   'description': 'string'\r\n});<\/pre>\n<h3>deleteVectorLayer(layer_uuid)<\/h3>\n<p>Deletes the existing vector layer. This function is an asynchronous function.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>layer_uuid is the available vector layer uuid.<\/p>\n<p id=\"zoomin-returns\" class=\"unprose txt-m mb3 anchor mt12\"><strong>Returns:<\/strong><\/p>\n<p>String: Returns a message that shows deleting was successful or not. Null message means deleting was successful.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">const result = await Server.deleteVectorLayer('4f9f3e4b-4dc1-469b-83ab-00ae00f02581');<\/pre>\n<h3>getVectorLayer(layer_uuid)<\/h3>\n<p>Returns the desired existing vector layer. This function is an asynchronous function.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>layer_uuid is the available vector layer uuid.<\/p>\n<p id=\"zoomin-returns\" class=\"unprose txt-m mb3 anchor mt12\"><strong>Returns:<\/strong><\/p>\n<p><a href=\"https:\/\/www.geobox.ir\">Vector layer<\/a>: Returns itself to allow for method chaining.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">const vectorLayer\u00a0= await Server.getVectorLayer('4f9f3e4b-4dc1-469b-83ab-00ae00f02581');<\/pre>\n<h3>getVectorLayersByIds(options)<\/h3>\n<p>Returns the desired existing vector layers. This function is an asynchronous function.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>options (Object)<\/p>\n<table class=\"table table--fixed table--compact\" style=\"width: 82.5238%; height: 121px;\">\n<thead>\n<tr class=\"bg-gray-faint\" style=\"height: 26px;\">\n<th style=\"text-align: left; height: 42px; width: 22.9905%;\">Name<\/th>\n<th style=\"text-align: left; height: 42px; width: 103.063%;\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"height: 26px;\">\n<td style=\"height: 26px; width: 22.9905%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.ids<\/div>\n<div>Number| Array<\/div>\n<\/td>\n<td style=\"height: 26px; width: 103.063%; text-align: left;\">Ids of vector layers. If you want a single vector layer, insert id as a string.<\/td>\n<\/tr>\n<tr style=\"height: 53px;\">\n<td style=\"height: 53px; width: 22.9905%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.user_id<\/div>\n<div>Number?<\/div>\n<\/td>\n<td style=\"height: 53px; width: 103.063%; text-align: left;\">If the admin wants to fetch vector layers of a certain user, this parameter determines which user is the target user.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\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\">Array: Returns an array of <a href=\"https:\/\/www.geobox.ir\">vector layers<\/a>.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">const vectorLayers = await Server.getVectorLayersByIds({\r\n   'ids': [25,125],\r\n   'user_id' :0\r\n});<\/pre>\n<h3>getVectorLayerByName(name, user_id)<\/h3>\n<p>Returns the desired existing vector layer. This function is an asynchronous function.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>name is the available vector layer name.<\/p>\n<p>user_id is the id of the user that the vector layer belongs to.<\/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\"><a href=\"https:\/\/www.geobox.ir\">Vector layer<\/a>: Returns itself to allow for method chaining.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">const vectorLayer = await Server.getVectorLayerByName('city',2);<\/pre>\n<h3>getVectorLayers(options)<\/h3>\n<p>Returns the desired existing vector layers. This function is an asynchronous function.<\/p>\n<p><strong>Parameters:<\/strong><\/p>\n<p>options (Object)<\/p>\n<table class=\"table table--fixed table--compact\" style=\"width: 82.5964%; height: 493px;\">\n<thead>\n<tr class=\"bg-gray-faint\" style=\"height: 26px;\">\n<th style=\"text-align: left; height: 48px; width: 22.8381%;\">Name<\/th>\n<th style=\"text-align: left; height: 48px; width: 102.491%;\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"height: 26px;\">\n<td style=\"height: 26px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.include_settings<\/div>\n<div>Bolean<\/div>\n<div>Default: false<\/div>\n<\/td>\n<td style=\"height: 26px; width: 102.491%; text-align: left;\">If true, returns layer setting in layer_settings property.<\/td>\n<\/tr>\n<tr style=\"height: 26px;\">\n<td style=\"height: 26px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.<span style=\"font-family: inherit; font-size: inherit;\">f<\/span><\/div>\n<div>String<\/div>\n<div>Default: &#8216;json&#8217;<\/div>\n<\/td>\n<td style=\"height: 26px; width: 102.491%; text-align: left;\">Output format. Choices are: \u2018json\u2019 | \u2018html\u2019<\/td>\n<\/tr>\n<tr style=\"height: 26px;\">\n<td style=\"height: 26px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.<span style=\"font-family: inherit; font-size: inherit;\">q<\/span><\/div>\n<div>String?<\/div>\n<\/td>\n<td style=\"height: 26px; width: 102.491%; text-align: left;\">Query filter based on <a href=\"https:\/\/portal.ogc.org\/files\/96288\" rel=\"noopener noreferrer\">OGC CQL standard<\/a>.<br \/>\ne.g. &#8220;field1 LIKE &#8216;%GIS%&#8217; AND created_at &gt; &#8216;2021-01-01&#8242;&#8221;<\/td>\n<\/tr>\n<tr style=\"height: 79px;\">\n<td style=\"height: 79px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.<span style=\"font-family: inherit; font-size: inherit;\">search<\/span><\/div>\n<div>String?<\/div>\n<\/div>\n<\/td>\n<td style=\"height: 79px; width: 102.491%; text-align: left;\">Search term for keyword-based searching among search_fields or all textual fields if search_fields does not have value.<br \/>\nNOTE: if q param is defined this param will be ignored.<\/td>\n<\/tr>\n<tr style=\"height: 26px;\">\n<td style=\"height: 26px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.search_fields<\/div>\n<div>String?<\/div>\n<\/td>\n<td style=\"height: 26px; width: 102.491%; text-align: left;\">Comma separated list of fields for searching<\/td>\n<\/tr>\n<tr style=\"height: 26px;\">\n<td style=\"height: 26px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.<span style=\"font-family: inherit; font-size: inherit;\">order_by<\/span><\/div>\n<div>String?<\/div>\n<\/td>\n<td style=\"height: 26px; width: 102.491%; text-align: left;\">Comma separated list of fields for sorting results [field1 A|D, field2 A|D, \u2026]. e.g. name A, type D<br \/>\nNOTE: &#8220;A&#8221; denotes ascending order and &#8220;D&#8221; denotes descending order.<\/td>\n<\/tr>\n<tr style=\"height: 26px;\">\n<td style=\"height: 26px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.<span style=\"font-family: inherit; font-size: inherit;\">skip<\/span><\/div>\n<div>\n<div>Number?<\/div>\n<div>Default: 0<\/div>\n<\/div>\n<\/td>\n<td style=\"height: 26px; width: 102.491%; text-align: left;\">Number of skipped vector layers.<\/td>\n<\/tr>\n<tr style=\"height: 79px;\">\n<td style=\"height: 79px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.<span style=\"font-family: inherit; font-size: inherit;\">limit<\/span><\/div>\n<div>\n<div>Number?<\/div>\n<div>Default:10<\/div>\n<\/div>\n<\/div>\n<\/td>\n<td style=\"height: 79px; width: 102.491%; text-align: left;\">Maximum number for result vector layers.<\/td>\n<\/tr>\n<tr style=\"height: 53px;\">\n<td style=\"height: 53px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.<span style=\"font-family: inherit; font-size: inherit;\">user_id<\/span><\/div>\n<div>Number?<\/div>\n<\/td>\n<td style=\"height: 53px; width: 102.491%; text-align: left;\">If the admin wants to fetch vector layers of a certain user, this parameter determines which user is the target user.<\/td>\n<\/tr>\n<tr style=\"height: 26px;\">\n<td style=\"height: 26px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.<span style=\"font-family: inherit; font-size: inherit;\">shared<\/span><\/div>\n<div>Bolean<\/div>\n<div>default: false<\/div>\n<\/td>\n<td style=\"height: 26px; width: 102.491%; text-align: left;\">If true, returns only the vector layers that are shared.<\/td>\n<\/tr>\n<tr style=\"height: 26px;\">\n<td style=\"height: 26px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.<span style=\"font-family: inherit; font-size: inherit;\">page<\/span><\/div>\n<div>Number?<\/div>\n<div>Default:1<\/div>\n<\/td>\n<td style=\"height: 26px; width: 102.491%; text-align: left;\">The minimum number of pages is 1.<\/td>\n<\/tr>\n<tr style=\"height: 26px;\">\n<td style=\"height: 26px; width: 22.8381%; text-align: left;\">\n<div class=\"txt-mono txt-bold txt-break-word\">options.<span style=\"font-family: inherit; font-size: inherit;\">page_size<\/span><\/div>\n<div>\n<div>Number?<\/div>\n<div>Default:10<\/div>\n<\/div>\n<\/td>\n<td style=\"height: 26px; width: 102.491%; text-align: left;\">The minimum number of vector layers on each page is 1.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p id=\"zoomin-returns\" class=\"unprose txt-m mb3 anchor mt12\"><strong>Returns:<\/strong><\/p>\n<p>Array: Returns an array of vector layers.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">const vectorLayers= await Server.getVectorLayers({q:`name = 'string'`,user_id :0});<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Methods: createVectorLayer(options) Creates a new vector layer. This function is an asynchronous function. Parameters: options (Object) Name Description options.name String Name of new vector layer. options.layer_type String Type of new vector layer. \u00a0Choices are: &#8216;Polygon&#8217; | &#8216;Polyline&#8217; | &#8216;Point&#8217; | &#8216;MultiPoint&#8217;. options.display_name String? Display name of new vector layer. This parameter is helpful in identifying [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"doc_category":[66],"doc_tag":[],"class_list":["post-6099","docs","type-docs","status-publish","hentry","doc_category-vector"],"_links":{"self":[{"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/docs\/6099","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=6099"}],"version-history":[{"count":43,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/docs\/6099\/revisions"}],"predecessor-version":[{"id":6674,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/docs\/6099\/revisions\/6674"}],"wp:attachment":[{"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/media?parent=6099"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/doc_category?post=6099"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/doc_tag?post=6099"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}