Documentation for maplib/Catalog.kt

class Object

Catalog object class. This is base class for all catalog objects.

fun constructor(name: String, type: Int, path: String, handle: Long)

Main constructor

Parameters
  • name – e Object name

  • type – e Object type

  • path – h Object path

  • handle – e Object handle for C API

val name : String

e Object name

val type : Int

e Object type

val path : String

h Object path

fun constructor(handle: Long)

Third constructor

Parameters
  • handle – Object handle for C API

fun getProperties(forDomain: String = "") : Map<String, String>

Get catalog object properties.

Parameters
  • forDomain – Parameters domain

Returns

Dictionary of key-value.

fun getProperty(name: String, defaultValue: String, domain: String = "") : String

Get catalog object property.

Parameters
  • name – Key name.

  • defaultValue – Default value.

  • domain – Domain name.

Returns

Property value.

fun setProperty(name: String, value: String, domain: String) : Boolean

Set catalog object property.

Parameters
  • name – Key name.

  • value – Key value.

  • domain – Domain name.

Returns

True on success.

fun isSame(otherObject: Object) : Boolean

Compare current catalog object with other.

Parameters
  • otherObject – Catalog object to compare.

Returns

True if equal.

fun children(filter: Array<Type> = emptyArray()) : Array<Object>

Get catalog object children.

Parameters
  • filter – Catalog object types to filter.

Returns

Array of catalog object class instances.

fun child(name: String, fullMatch: Boolean = true) : Object?

Get child by name.

Parameters
  • name – Catalog object child name.

  • fullMatch – If true the name must be equal, else the function return last child the name begins with ‘name’.

Returns

Catalog object child instance or null.

fun refresh()

Refresh catalog object. Reread children.

fun create(name: String, options: Map<String, String> = mapOf()) : Object?

Create new catalog object.

Parameters
  • name – New object name.

  • options – Dictionary describing new catalog object. The keys are created object dependent. The mandatory key is:

  • TYPE - this is string value of type Type

Returns

Created catalog object instance or null.

fun canCreate(type: Type) : Boolean

Check if object type can be created at this parent object

Parameters
  • type – Object type to check.

Returns

true if object of type can be created at this parent object or false.

fun createTMS(name: String, url: String, epsg: Int, z_min: Int, z_max: Int, fullExtent: Envelope, limitExtent: Envelope, cacheExpires: Int, options: Map<String, String> = mapOf()) : Raster?

Create TMS datasource

Parameters
  • name – TMS connection name

  • url – TMS url. {x}, {y} and {z} must be present in url string

  • epsg – EPSG code of TMS

  • z_min – Minimum zoom. Default is 0

  • z_max – Maximum zoom. Default is 18

  • fullExtent – Full extent of TMS datasource. Depends on tile schema and projection

  • limitExtent – Data extent. Maybe equal or less of fullExtent

  • cacheExpires – Time in seconds to remove old tiles

  • options – Additional options as key: value array

Returns

Raster object or null

fun createDirectory(name: String) : Object?

Create new directory.

Parameters
  • name – Directory name.

Returns

Created directory or null.

fun delete() : Boolean

Delete catalog object.

Returns

True on success.

fun delete(name: String) : Boolean

Delete catalog object with name.

Parameters
  • name – Object name to delete.

Returns

True on success.

fun copy(asType: Type, inDestination: Object, move: Boolean, withOptions: Map<String, String> = mapOf(), callback: ((status: StatusCode, complete: Double, message: String) -> Boolean)? = null) : Boolean

Copy current catalog object to destination object.

Parameters
  • asType – Output catalog object type.

  • inDestination – Destination catalog object.

  • move – Move object. This object will be deleted.

  • withOptions – Key-value dictionary. This will affect how the copy will be performed.

  • callback – Callback function. May be null

Returns

True on success.

static fun isTable(type: Int) : Boolean

Check if type is non spatial table.

Parameters
  • type – Type to check.

Returns

True if this type belongs to table types.

static fun isRaster(type: Int) : Boolean

Check if type is raster.

Parameters
  • type – Type to check.

Returns

True if this type belongs to raster types.

static fun isFeatureClass(type: Int) : Boolean

Check if type is FeatureClass.

Parameters
  • type – Type to check.

Returns

True if this type belongs to FeatureClass types.

static fun isContainer(type: Int) : Boolean

Check if type is container (catalog object which can hold other objects).

Parameters
  • type – Type to check.

Returns

True if this type belongs to container types.

static fun forceChildToTable(table: Object) : Table?

Force catalog object instance to table.

Parameters
  • table – Catalog object instance.

Returns

Table class instance or null.

static fun forceChildToFeatureClass(featureClass: Object) : FeatureClass?

Force catalog object instance to FeatureClass.

Parameters
  • featureClass – Catalog object instance.

Returns

FeatureClass class instance or null.

static fun forceChildToRaster(raster: Object) : Raster?

Force catalog object instance to raster.

Parameters
  • raster – Catalog object instance.

Returns

Raster class instance or null.

static fun forceChildToMemoryStore(memoryStore: Object) : MemoryStore?

Force catalog object instance to memory store.

Parameters
  • memoryStore – Catalog object instance.

Returns

MemoryStore class instance or null.

static fun forceChildToNGWResourceGroup(ngwResource: Object) : NGWResourceGroup?

Force catalog object instance to NextGIS Web resource group.

Parameters
  • ngwResource – Catalog object instance.

Returns

NGWResourceGroup class instance or null.

enum class Type

Catalog object types

  • UNKNOWN = 0

  • ROOT = 51

  • FOLDER = 53

  • CONTAINER_NGW = 63

  • CONTAINER_NGS = 64

  • CONTAINER_MEM = 71

  • CONTAINER_NGWGROUP = 3001

  • CONTAINER_NGWTRACKERGROUP = 3002

  • FC_GEOJSON = 507

  • FC_MEM = 509

  • FC_GPKG = 515

  • FC_GPX = 517

  • RASTER_TMS = 1011

  • TABLE_GPKG = 1507

  • NGW_TRACKER = 3018

class Catalog

Catalog is root object of virtual file system tree.

constructor(handle Long)

Main constructor

static fun getCurrentDirectory() : String

Get current directory

Returns

Get current directory. This is file system path

fun childByPath(path: String) : Object?

Get catalog child by file system path.

Parameters
  • path – File system path.

Returns

Catalog object class instance or nil.

fun createConnection(name: String, connection: ConnectionDescription, options: Map<String, String> = mapOf()) : Object?

Create connection at default directory corespondent to connection type (i.e. for NextGIS Web connection, the connection file will be created at ngc://GIS Server connections path.

Parameters
  • name – Connection file name.

  • connection – Connection object. Before create connection, execute check function for test connection.

  • options – Create options as key = value array.

Returns

Created connection object or null.

enum class RootObjects

Catalog root objects names

  • UNKNOWN

  • LOCAL_CONNECTIONS

  • GIS_CONNECTIONS

  • DB_CONNECTIONS

class ConnectionDescription

ConnectionDescription is class to store connection properties.

fun constructor(type: Object.Type, options: Map<String,  String>  mapOf())

Main constructor

Parameters
  • type – e Connection object type.

  • options – s Connection options as key = value map.

val type : Object.Type

e Connection object type.

val options : Map<String

s Connection options as key = value map.

fun check() : Boolean

Check if connection is valid.

Returns

true if connection is valid.