Documentation for maplib/Store.kt
- class MemoryStore
In memory spatial data storage. After class instance destruction all data will loose.
- constructor(copyFrom Object)
Main constructor
- Parameters
copyFrom – m Origin object to copy properties.
- fun createFeatureClass(name: String, geometryType: Geometry.Type, epsg: Int, fields: List<Field>, options: Map<String, String>) : FeatureClass?
Create feature class in storage.
- Parameters
name – Feature class name.
geometryType – Geometry type.
epsg – Spatial reference EPSG code.
fields – Feature class fields.
options – Any other create option if form of key-value dictionary.
- Returns
FeatureClass class instance or null.
- class Store
Spatial data storage. This is geopackage with specific additions.
- constructor(copyFrom Object)
Main constructor
- Parameters
copyFrom – m Origin object to copy properties.
- fun createFeatureClass(name: String, geometryType: Geometry.Type, fields: List<Field>, options: Map<String, String>) : FeatureClass?
Create feature class in storage.
- Parameters
name – Feature class name.
geometryType – Geometry type.
fields – Feature class fields.
options – Any other create option if form of key-value dictionary.
- Returns
FeatureClass class instance or null.
- enum class ChangeCode
The table, datasource, map and etc. change codes enumerator.
NOP
CREATE_OBJECT
DELETE_OBJECT
CHANGE_OBJECT
CREATE_FEATURE : Create feature/row.
CHANGE_FEATURE : Change feature/row.
DELETE_FEATURE : Delete feature/row.
DELETEALL_FEATURES : Delete all features.
CREATE_ATTACHMENT : Create new attachment
CHANGE_ATTACHMENT : Change attachment name and/or description
DELETE_ATTACHMENT : Delete attachment
DELETEALL_ATTACHMENTS : Delete all attachments
CREATE_MAP
CHANGE_MAP
CREATE_LAYER
DELETE_LAYER
CHANGE_LAYER
TOKEN_EXPIRED
TOKEN_CHANGED
ALL = 524286
- data class EditOperation
Edit operation for logging properties.
- fun constructor(fid: Long, aid: Long, rid: Long, arid: Long, operationType: ChangeCode)
Main constructor
- Parameters
fid – d Edited feature identifier.
aid – d Edited feature attachment identifier.
rid – d Edited feature remote identifier.
arid – d Edited feature attachment remote identifier.
operationType – e Edit operation type.
- val operationType : ChangeCode
e Edit operation type.
- class Raster
Spatial referenced raster or image. For external raster sources (from internet services) maximum cache size and time to live can be set. Just execute setProperty(“TMS_CACHE_EXPIRES”, value, “”) and setProperty(“TMS_CACHE_MAX_SIZE”, value, “”): - TMS_CACHE_EXPIRES=604800 - Time in seconds cached files will stay valid. If cached file expires it is deleted when maximum size of cache is reached. Also expired file can be overwritten by the new one from internet. Defaults to 604800 (7 days). - TMS_CACHE_MAX_SIZE=33554432 - The cache maximum size in bytes. If cache reached maximum size, expired cached files will be deleted. Defaults to 33554432 (32Mb).
- constructor(copyFrom Object)
Main constructor
- Parameters
copyFrom – m Origin object to copy properties.
- fun cacheArea(bbox: Envelope, zoomLevels: List<Int>, callback: ((status: StatusCode, complete: Double, message: String) -> Boolean)? = null) : Boolean
Cache tiles for some area for TMS datasource.
- Parameters
bbox – Area to cache.
zoomLevels – Zoom levels to cache.
callback – Callback function which executes periodically indicating progress.
- Returns
True on success.
- class Table
Non spatial table.
- constructor(copyFrom Object)
Main constructor
- Parameters
copyFrom – m Origin object to copy properties.
- val fields : Array<Field> = API.featureClassFieldsInt(handle)
Fields array
- var batchMode : Boolean
Enable/disable batch mode property. The sqlite journal will be switch on/off.
- fun createFeature() : Feature?
Create new feature/row in memory.
- Returns
New feature class instance or null.
- fun insertFeature(feature: Feature, logEdits: Boolean = true) : Boolean
Insert feature into table.
- Parameters
feature – Feature/row to insert.
logEdits – Log edits in history table. This log can be received using editOperations function.
- Returns
True on success.
- fun updateFeature(feature: Feature, logEdits: Boolean = true) : Boolean
Update feature/row.
- Parameters
feature – Feature/row to update.
logEdits – Log edits in history table. This log can be received using editOperations function.
- Returns
True on success.
- fun deleteFeature(id: Long, logEdits: Boolean = true) : Boolean
Delete feature/row.
- Parameters
id – Feature/row identifier.
logEdits – Log edits in history table. This log can be received using editOperations function.
- Returns
True on success.
- fun deleteFeature(feature: Feature, logEdits: Boolean = true) : Boolean
Delete feature/row.
- Parameters
feature – Feature/row to delete.
logEdits – Log edits in history table. This log can be received using editOperations function.
- Returns
True on success.
- fun deleteFeatures(logEdits: Boolean = true) : Boolean
Delete all features/rows in table.
- Parameters
logEdits – Log edits in history table. This log can be received using editOperations function.
- Returns
True on success.
- fun reset()
Reset reading features/rows.
- fun getFeature(index: Long) : Feature?
Get feature/row by identifier.
- Parameters
index – Feature/row
- Returns
Feature class instance or null.
- fun fieldIndexAndType(name: String) : Pair<Int, Field.Type>
Search field index and type by field name.
- Parameters
name – Field name.
- Returns
Pair with index and type. If field is not exists the index will be negative and field type will be UNKNOWN
- fun editOperations() : Array<EditOperation>
Get edit operations log.
- Returns
EditOperation class array. It may be empty.
- fun delete(editOperation: EditOperation)
Delete edit operation from log.
- Parameters
editOperation – EditOperation to delete.
- class FeatureClass
Spatial table.
- constructor(copyFrom Object)
Main constructor
- Parameters
copyFrom – m Origin object to copy properties.
- val geometryType : Geometry.Type = Geometry.Type.from(API.featureClassGeometryTypeInt(handle))
Geometry type of feature class.
- fun createOverviews(force: Boolean, zoomLevels: List<Int>, callback: ((status: StatusCode, complete: Double, message: String) -> Boolean)? = null) : Boolean
Create vector overviews to speedup drawing. This is a synchronous method.
- Parameters
force – If true the previous overviews will be deleted.
zoomLevels – The list of zoom levels to generate.
callback – Callback function to show process and cancel creation if needed.
- Returns
True on success.
- fun setSpatialFilter(envelope: Envelope) : Boolean
Set spatial filter.
- Parameters
envelope – Features intesect with envelope will be returned via nextFeature.
- Returns
True on success.
- fun setSpatialFilter(geometry: Geometry) : Boolean
Set spatial filter.
- Parameters
geometry – Features intesect with geometry will be returned via nextFeature.
- Returns
True on success.
- class Field
FeatureClass/Table filed class.
- fun constructor(name: String, alias: String, type: Type, defaultValue: String = null)
Main constructor
- Parameters
name – e Field name.
alias – s Field alias.
type – e Field type.
defaultValue – e Field default value.
- static fun fieldTypeToName(fieldType: Type) : String
Field type name string.
- Parameters
fieldType – Field type.
- Returns
Name string.
- enum class Type
Field type enumerator.
UNKNOWN : Unknown type.
INTEGER = 0 : Integer type.
REAL = 2 : Real type.
STRING = 4 : String type.
DATE = 11 : Date/time type.