KmlLayer Class

Summary: Represents a Kml layer with non-destructive behavior that supports read and writing of features and attributes at one time.
A Kml layer is a collection of geographic features, stored in a file.

Module: aspose.gis.formats.kml

Full Name: aspose.gis.formats.kml.KmlLayer

Inheritance: VectorLayer

Aspose.PSD Version: 25.9.0

Properties

NameTypeAccessDescription
attributesBaseFeatureAttributeCollectionrGets the collection of custom attributes for features in this VectorLayer.
countintrGets the number of features in this layer.
driverDriverrGets the KmlLayer.driver that instantiated this layer.
featuresFeature[]rGets the list features.
geometry_typeGeometryTyperGets the type of the geometry for the layer.
ground_overlay_listSystem.Collections.Generic.List<Aspose.Gis.Formats.Kml.SpecificFields.KmlGroundOverlayInfo>rList of KmlGroundOverlayInfo from GroundOverlay nodes
network_link_listSystem.Collections.Generic.List<Aspose.Gis.Formats.Kml.SpecificFields.KmlNetworkLinkInfo>rList of KmlNetworkLinkInfo from NetworkLink nodes
region_listSystem.Collections.Generic.List<Aspose.Gis.Formats.Kml.SpecificFields.KmlRegionInfo>rList of KmlRegionInfo from Region nodes
spatial_reference_systemSpatialReferenceSystemrGet spatial reference system of this layer. For KML this is always WGS84.

Methods

NameDescription
add(feature)Adds a new feature to the layer, if supported by the VectorLayer’s VectorLayer.driver.
add(feature, style)Adds a new feature with the specified style to the layer, if supported by the VectorLayer’s VectorLayer.driver.
as_in_memory()Create a layer clon as the InMemory format.
construct_feature()Creates (but does not add to the layer) a new feature with attributes matching the collection of attributes of this layer.
When done with setting data for the feature, use VectorLayer.add(feature) to add the feature to the layer.
convert(source_path, source_driver, destination_path, destination_driver)Convert a layer to a different format.
convert(source_path, source_driver, destination_path, destination_driver)Convert a layer to a different format.
convert(source_path, source_driver, destination_path, destination_driver, options)Convert a layer to a different format.
convert(source_path, source_driver, destination_path, destination_driver, options)Convert a layer to a different format.
copy_attributes(features_sequence)Copies attributes of other VectorLayer to this one.
copy_attributes(features_sequence, converter)Copies attributes of other VectorLayer to this one.
create(path, driver)Creates the layer and opens it for adding new features.
create(path, driver)Creates the layer and opens it for adding new features.
create(path, driver, options)Creates the layer and opens it for adding new features.
create(path, driver, options)Creates the layer and opens it for adding new features.
create(path, driver, options, spatial_reference_system)Creates the layer and opens it for appending.
create(path, driver, options, spatial_reference_system)Creates the layer and opens it for appending.
create(path, driver, spatial_reference_system)Creates the layer and opens it for appending.
create(path, driver, spatial_reference_system)Creates the layer and opens it for appending.
get_extent()Gets a spatial extent of this layer.
intersection_by_geometry(layer)Intersect a layer to the current layer by geometry.
join(layer, options)Joins a layer to the current layer.
join_by_geometry(layer, options)Joins a layer to the current layer by geometry.
nearest_to(point)Gets the nearest feature to the provided point.
nearest_to(x, y)Gets the nearest feature to the provided coordinate.
open(path, driver)Open the layer for reading.
open(path, driver)Open the layer for reading.
open(path, driver, options)Open the layer for reading.
open(path, driver, options)Open the layer for reading.
remove_at(index)Remove the Feature at the specified index.
replace_at(index, feature)Replace the Feature at the specified index.
save_to(destination_path, destination_driver)Saves features sequence to layer.
save_to(destination_path, destination_driver)Saves features sequence to layer.
save_to(destination_path, destination_driver, options)Saves features sequence to layer.
save_to(destination_path, destination_driver, options)Saves features sequence to layer.
split_to()Split features by geometry type.
use_attributes_index(index_path, attribute_name, force_rebuild)Loads attribute index to speed up filtering by attributes value in filter methods like Aspose.Gis.FeaturesSequence.WhereGreater1(string,0).
If index does not exist creates it first. Use to force index recreation.
use_attributes_index(index_path, attribute_name, force_rebuild)Loads attribute index to speed up filtering by attributes value in filter methods like Aspose.Gis.FeaturesSequence.WhereGreater1(string,0).
If index does not exist creates it first. Use to force index recreation.
use_spatial_index(index_path, force_rebuild)Loads spatial index to speed up filtering by attributes value in filter methods like Aspose.Gis.FeaturesSequence.WhereIntersects(Aspose.Gis.Geometries.IGeometry)
and Aspose.Gis.VectorLayer.NearestTo(float,float).
If index does not exist creates it first. Use to force index recreation.
use_spatial_index(index_path, force_rebuild)Loads spatial index to speed up filtering by attributes value in filter methods like Aspose.Gis.FeaturesSequence.WhereIntersects(Aspose.Gis.Geometries.IGeometry)
and Aspose.Gis.VectorLayer.NearestTo(float,float).
If index does not exist creates it first. Use to force index recreation.
where_equal(attribute_name, value)Selects features with attribute value equal to the provided value.
where_greater(attribute_name, value)Selects features with attribute value greater than the provided value.
where_greater_or_equal(attribute_name, value)Selects features with attribute value greater or equal to the provided value.
where_intersects(extent)Filters features based on the extent.
where_intersects(geometry)Filters features based on the provided geometry.
where_intersects(sequence)Filters features based on the union of all geometries in other features sequence.
where_not_equal(attribute_name, value)Selects features with attribute value not equal to the provided value.
where_not_null(attribute_name)Selects features with attribute not equal to null.
where_null(attribute_name)Selects features with attribute equal to null.
where_set(attribute_name)Selects features with attribute set.
where_smaller(attribute_name, value)Selects features with attribute value smaller than the provided value.
where_smaller_or_equal(attribute_name, value)Selects features with attribute value smaller or equal to the provided value.
where_unset(attribute_name)Selects features where specified attribute is not set.

Method: add(feature)

 add(feature) 

Adds a new feature to the layer, if supported by the VectorLayer’s VectorLayer.driver.

Parameters:

ParameterTypeDescription
featureFeatureThe feature to add.

Method: add(feature, style)

 add(feature, style) 

Adds a new feature with the specified style to the layer, if supported by the VectorLayer’s VectorLayer.driver.

Parameters:

ParameterTypeDescription
featureFeatureThe feature to add.
styleIFeatureStyleThe feature style. Use to indicate missing style.

Method: as_in_memory()

 as_in_memory() 

Create a layer clon as the InMemory format.

Returns

TypeDescription
VectorLayerThe InMemory Layer.

Method: construct_feature()

 construct_feature() 

Creates (but does not add to the layer) a new feature with attributes matching the collection of attributes of this layer.
When done with setting data for the feature, use VectorLayer.add(feature) to add the feature to the layer.

Returns

TypeDescription
FeatureA new feature.

Method: convert(source_path, source_driver, destination_path, destination_driver) [static]

 convert(source_path, source_driver, destination_path, destination_driver) 

Convert a layer to a different format.

Parameters:

ParameterTypeDescription
source_pathstringPath to the layer that will be converted.
source_driverFileDriverThe format driver for the source layer.
destination_pathstringPath to the layer that will created as a result of conversion.
destination_driverFileDriverThe format driver for the destination layer.

Method: convert(source_path, source_driver, destination_path, destination_driver) [static]

 convert(source_path, source_driver, destination_path, destination_driver) 

Convert a layer to a different format.

Parameters:

ParameterTypeDescription
source_pathAbstractPathPath to the layer that will be converted.
source_driverFileDriverThe format driver for the source layer.
destination_pathAbstractPathPath to the layer that will created as a result of conversion.
destination_driverFileDriverThe format driver for the destination layer.

Method: convert(source_path, source_driver, destination_path, destination_driver, options) [static]

 convert(source_path, source_driver, destination_path, destination_driver, options) 

Convert a layer to a different format.

Parameters:

ParameterTypeDescription
source_pathstringPath to the layer that will be converted.
source_driverFileDriverThe format driver for the source layer.
destination_pathstringPath to the layer that will created as a result of conversion.
destination_driverFileDriverThe format driver for the destination layer.
optionsConversionOptionsOptions for the conversion procedure.

Method: convert(source_path, source_driver, destination_path, destination_driver, options) [static]

 convert(source_path, source_driver, destination_path, destination_driver, options) 

Convert a layer to a different format.

Parameters:

ParameterTypeDescription
source_pathAbstractPathPath to the layer that will be converted.
source_driverFileDriverThe format driver for the source layer.
destination_pathAbstractPathPath to the layer that will created as a result of conversion.
destination_driverFileDriverThe format driver for the destination layer.
optionsConversionOptionsOptions for the conversion procedure.

Method: copy_attributes(features_sequence)

 copy_attributes(features_sequence) 

Copies attributes of other VectorLayer to this one.

Parameters:

ParameterTypeDescription
features_sequenceFeaturesSequenceThe features sequence to copy attributes from.

Method: copy_attributes(features_sequence, converter)

 copy_attributes(features_sequence, converter) 

Copies attributes of other VectorLayer to this one.

Parameters:

ParameterTypeDescription
features_sequenceFeaturesSequenceThe features sequence to copy attributes from.
converterIAttributesConverterAn instance of custom IAttributesConverter that will process the attributes one by one.

Method: create(path, driver) [static]

 create(path, driver) 

Creates the layer and opens it for adding new features.

Parameters:

ParameterTypeDescription
pathstringPath to the file.
driverFileDriverDriver to use.

Returns

TypeDescription
VectorLayerA write-only layer.

Method: create(path, driver) [static]

 create(path, driver) 

Creates the layer and opens it for adding new features.

Parameters:

ParameterTypeDescription
pathAbstractPathPath to the file.
driverFileDriverDriver to use.

Returns

TypeDescription
VectorLayerA write-only layer.

Method: create(path, driver, options) [static]

 create(path, driver, options) 

Creates the layer and opens it for adding new features.

Parameters:

ParameterTypeDescription
pathstringPath to the file.
driverFileDriverDriver to use.
optionsDriverOptionsDriver-specific options.

Returns

TypeDescription
VectorLayerA write-only layer.

Method: create(path, driver, options) [static]

 create(path, driver, options) 

Creates the layer and opens it for adding new features.

Parameters:

ParameterTypeDescription
pathAbstractPathPath to the file.
driverFileDriverDriver to use.
optionsDriverOptionsDriver-specific options.

Returns

TypeDescription
VectorLayerA write-only layer.

Method: create(path, driver, options, spatial_reference_system) [static]

 create(path, driver, options, spatial_reference_system) 

Creates the layer and opens it for appending.

Parameters:

ParameterTypeDescription
pathstringPath to the file.
driverFileDriverDriver to use.
optionsDriverOptionsDriver-specific options.
spatial_reference_systemSpatialReferenceSystemSpatial reference system.

Returns

TypeDescription
VectorLayerAn instance of VectorLayer.

Method: create(path, driver, options, spatial_reference_system) [static]

 create(path, driver, options, spatial_reference_system) 

Creates the layer and opens it for appending.

Parameters:

ParameterTypeDescription
pathAbstractPathPath to the file.
driverFileDriverDriver to use.
optionsDriverOptionsDriver-specific options.
spatial_reference_systemSpatialReferenceSystemSpatial reference system.

Returns

TypeDescription
VectorLayerAn instance of VectorLayer.

Method: create(path, driver, spatial_reference_system) [static]

 create(path, driver, spatial_reference_system) 

Creates the layer and opens it for appending.

Parameters:

ParameterTypeDescription
pathstringPath to the file.
driverFileDriverDriver to use.
spatial_reference_systemSpatialReferenceSystemSpatial reference system.

Returns

TypeDescription
VectorLayerAn instance of VectorLayer.

Method: create(path, driver, spatial_reference_system) [static]

 create(path, driver, spatial_reference_system) 

Creates the layer and opens it for appending.

Parameters:

ParameterTypeDescription
pathAbstractPathPath to the file.
driverFileDriverDriver to use.
spatial_reference_systemSpatialReferenceSystemSpatial reference system.

Returns

TypeDescription
VectorLayerAn instance of VectorLayer.

Method: get_extent()

 get_extent() 

Gets a spatial extent of this layer.

Returns

TypeDescription
ExtentA spatial extent of this layer.

Method: intersection_by_geometry(layer)

 intersection_by_geometry(layer) 

Intersect a layer to the current layer by geometry.

Parameters:

ParameterTypeDescription
layerVectorLayerA layer to intersect.

Returns

TypeDescription
VectorLayerA new layer as a result of intersection two layers.

Method: join(layer, options)

 join(layer, options) 

Joins a layer to the current layer.

Parameters:

ParameterTypeDescription
layerVectorLayerA layer to join.
optionsJoinOptionsJoin parameters.

Returns

TypeDescription
VectorLayerA new layer as a result of join two layers.

Method: join_by_geometry(layer, options)

 join_by_geometry(layer, options) 

Joins a layer to the current layer by geometry.

Parameters:

ParameterTypeDescription
layerVectorLayerA layer to join.
optionsJoinByGeometryOptionsJoin parameters.

Returns

TypeDescription
VectorLayerA new layer as a result of join two layers.

Method: nearest_to(point)

 nearest_to(point) 

Gets the nearest feature to the provided point.

Parameters:

ParameterTypeDescription
pointIPointThe point.

Returns

TypeDescription
FeatureThe nearest feature to the provided point.

Method: nearest_to(x, y)

 nearest_to(x, y) 

Gets the nearest feature to the provided coordinate.

Parameters:

ParameterTypeDescription
xdoubleX of the coordinate.
ydoubleY of the coordinate.

Returns

TypeDescription
FeatureThe nearest feature to the provided coordinate.

Method: open(path, driver) [static]

 open(path, driver) 

Open the layer for reading.

Parameters:

ParameterTypeDescription
pathstringPath to the file.
driverFileDriverDriver to use.

Returns

TypeDescription
VectorLayerA read-only layer.

Method: open(path, driver) [static]

 open(path, driver) 

Open the layer for reading.

Parameters:

ParameterTypeDescription
pathAbstractPathPath to the file.
driverFileDriverDriver to use.

Returns

TypeDescription
VectorLayerA read-only layer.

Method: open(path, driver, options) [static]

 open(path, driver, options) 

Open the layer for reading.

Parameters:

ParameterTypeDescription
pathstringPath to the file.
driverFileDriverDriver to use.
optionsDriverOptionsDriver-specific options.

Returns

TypeDescription
VectorLayerA read-only layer.

Method: open(path, driver, options) [static]

 open(path, driver, options) 

Open the layer for reading.

Parameters:

ParameterTypeDescription
pathAbstractPathPath to the file.
driverFileDriverDriver to use.
optionsDriverOptionsDriver-specific options.

Returns

TypeDescription
VectorLayerA read-only layer.

Method: remove_at(index)

 remove_at(index) 

Remove the Feature at the specified index.

Parameters:

ParameterTypeDescription
indexintThe index of the feature.

Method: replace_at(index, feature)

 replace_at(index, feature) 

Replace the Feature at the specified index.

Parameters:

ParameterTypeDescription
indexintThe index of the feature.
featureFeatureThe feature to set.

Method: save_to(destination_path, destination_driver)

 save_to(destination_path, destination_driver) 

Saves features sequence to layer.

Parameters:

ParameterTypeDescription
destination_pathstringPath to the output layer.
destination_driverFileDriverThe format driver for the output layer.

Method: save_to(destination_path, destination_driver)

 save_to(destination_path, destination_driver) 

Saves features sequence to layer.

Parameters:

ParameterTypeDescription
destination_pathAbstractPathPath to the output layer.
destination_driverFileDriverThe format driver for the output layer.

Method: save_to(destination_path, destination_driver, options)

 save_to(destination_path, destination_driver, options) 

Saves features sequence to layer.

Parameters:

ParameterTypeDescription
destination_pathstringPath to the output layer.
destination_driverFileDriverThe format driver for the output layer.
optionsSavingOptionsOptions for the saving procedure.

Method: save_to(destination_path, destination_driver, options)

 save_to(destination_path, destination_driver, options) 

Saves features sequence to layer.

Parameters:

ParameterTypeDescription
destination_pathAbstractPathPath to the output layer.
destination_driverFileDriverThe format driver for the output layer.
optionsSavingOptionsOptions for the saving procedure.

Method: split_to()

 split_to() 

Split features by geometry type.

Returns

TypeDescription
VectorLayer[]Layers with the same type of geometry.

Method: use_attributes_index(index_path, attribute_name, force_rebuild)

 use_attributes_index(index_path, attribute_name, force_rebuild) 

Loads attribute index to speed up filtering by attributes value in filter methods like Aspose.Gis.FeaturesSequence.WhereGreater1(string,0).
If index does not exist creates it first. Use to force index recreation.

Parameters:

ParameterTypeDescription
index_pathstringPath to the index file.
attribute_namestringName of the attribute to build index on.
force_rebuildboolWhether to recreate index even if it already exists.

Method: use_attributes_index(index_path, attribute_name, force_rebuild)

 use_attributes_index(index_path, attribute_name, force_rebuild) 

Loads attribute index to speed up filtering by attributes value in filter methods like Aspose.Gis.FeaturesSequence.WhereGreater1(string,0).
If index does not exist creates it first. Use to force index recreation.

Parameters:

ParameterTypeDescription
index_pathAbstractPathPath to the index file.
attribute_namestringName of the attribute to build index on.
force_rebuildboolWhether to recreate index even if it already exists.

Method: use_spatial_index(index_path, force_rebuild)

 use_spatial_index(index_path, force_rebuild) 

Loads spatial index to speed up filtering by attributes value in filter methods like Aspose.Gis.FeaturesSequence.WhereIntersects(Aspose.Gis.Geometries.IGeometry)
and Aspose.Gis.VectorLayer.NearestTo(float,float).
If index does not exist creates it first. Use to force index recreation.

Parameters:

ParameterTypeDescription
index_pathstringPath to the index file.
force_rebuildboolWhether to recreate index even if it already exists.

Method: use_spatial_index(index_path, force_rebuild)

 use_spatial_index(index_path, force_rebuild) 

Loads spatial index to speed up filtering by attributes value in filter methods like Aspose.Gis.FeaturesSequence.WhereIntersects(Aspose.Gis.Geometries.IGeometry)
and Aspose.Gis.VectorLayer.NearestTo(float,float).
If index does not exist creates it first. Use to force index recreation.

Parameters:

ParameterTypeDescription
index_pathAbstractPathPath to the index file.
force_rebuildboolWhether to recreate index even if it already exists.

Method: where_equal(attribute_name, value)

 where_equal(attribute_name, value) 

Selects features with attribute value equal to the provided value.

Parameters:

ParameterTypeDescription
attribute_namestringAttribute to filter by.
valueobjectValue to compare against.

Returns

TypeDescription
FeaturesSequenceFeatures with attribute value equal to the provided value.

Method: where_greater(attribute_name, value)

 where_greater(attribute_name, value) 

Selects features with attribute value greater than the provided value.

Parameters:

ParameterTypeDescription
attribute_namestringAttribute to filter by.
valueobjectValue to compare against.

Returns

TypeDescription
FeaturesSequenceFeatures with attribute value greater than the provided value.

Method: where_greater_or_equal(attribute_name, value)

 where_greater_or_equal(attribute_name, value) 

Selects features with attribute value greater or equal to the provided value.

Parameters:

ParameterTypeDescription
attribute_namestringAttribute to filter by.
valueobjectValue to compare against.

Returns

TypeDescription
FeaturesSequenceFeatures with attribute value greater or equal to the provided value.

Method: where_intersects(extent)

 where_intersects(extent) 

Filters features based on the extent.

Parameters:

ParameterTypeDescription
extentExtentFilter extent.

Returns

TypeDescription
FeaturesSequenceFeatures that intersect with the provided geometry.

Method: where_intersects(geometry)

 where_intersects(geometry) 

Filters features based on the provided geometry.

Parameters:

ParameterTypeDescription
geometryIGeometryFilter geometry.

Returns

TypeDescription
FeaturesSequenceFeatures that intersect with the provided geometry.

Method: where_intersects(sequence)

 where_intersects(sequence) 

Filters features based on the union of all geometries in other features sequence.

Parameters:

ParameterTypeDescription
sequenceFeaturesSequenceOther features sequence.

Returns

TypeDescription
FeaturesSequenceFeatures that intersect with the union of all geometries in other features sequence.

Method: where_not_equal(attribute_name, value)

 where_not_equal(attribute_name, value) 

Selects features with attribute value not equal to the provided value.

Parameters:

ParameterTypeDescription
attribute_namestringAttribute to filter by.
valueobjectValue to compare against.

Returns

TypeDescription
FeaturesSequenceFeatures with attribute value not equal to the provided value.

Method: where_not_null(attribute_name)

 where_not_null(attribute_name) 

Selects features with attribute not equal to null.

Parameters:

ParameterTypeDescription
attribute_namestringAttribute to filter by.

Returns

TypeDescription
FeaturesSequenceFeatures with attribute value not equal to null.

Method: where_null(attribute_name)

 where_null(attribute_name) 

Selects features with attribute equal to null.

Parameters:

ParameterTypeDescription
attribute_namestringAttribute to filter by.

Returns

TypeDescription
FeaturesSequenceFeatures with attribute value equal to null.

Method: where_set(attribute_name)

 where_set(attribute_name) 

Selects features with attribute set.

Parameters:

ParameterTypeDescription
attribute_namestringAttribute to filter by.

Returns

TypeDescription
FeaturesSequenceFeatures with set attribute value.

Method: where_smaller(attribute_name, value)

 where_smaller(attribute_name, value) 

Selects features with attribute value smaller than the provided value.

Parameters:

ParameterTypeDescription
attribute_namestringAttribute to filter by.
valueobjectValue to compare against.

Returns

TypeDescription
FeaturesSequenceFeatures with attribute value smaller than the provided value.

Method: where_smaller_or_equal(attribute_name, value)

 where_smaller_or_equal(attribute_name, value) 

Selects features with attribute value smaller or equal to the provided value.

Parameters:

ParameterTypeDescription
attribute_namestringAttribute to filter by.
valueobjectValue to compare against.

Returns

TypeDescription
FeaturesSequenceFeatures with attribute value smaller or equal to the provided value.

Method: where_unset(attribute_name)

 where_unset(attribute_name) 

Selects features where specified attribute is not set.

Parameters:

ParameterTypeDescription
attribute_namestringAttribute to filter by.

Returns

TypeDescription
FeaturesSequenceFeatures with unset attribute value.