new Feature(id, geojson, style)
Name | Type | Default | Description |
---|---|---|---|
id |
string |
id of feature |
|
geojson |
Object |
GeoJSON representation of the feature |
|
style |
M.style | default vector style |
style to apply |
Extends
- M.facade.Base
Methods
-
clearStyle()
facade/js/feature/Feature.js, line 241 -
Clears the style of the feature. Layer style will apply now to the feature.
-
getAttribute(attribute){string|number|object}
facade/js/feature/Feature.js, line 151 -
Returns the value of one attribute
Name Type Description attribute
string name of the attribute
Returns:
value of the requested attribute
-
getAttributes(){Object}
facade/js/feature/Feature.js, line 122 -
Returns attributes feature
Returns:
all attributes of the feature and their values
-
getCentroid(){M.Feature}
facade/js/feature/Feature.js, line 253 -
Returns de centroid of the feature as a feature itself
Returns:
feature representing the centroid
-
getGeoJSON(){Object}
facade/js/feature/Feature.js, line 110 -
Returns the feature as GeoJSON
Returns:
GeoJSON representation of the feature
-
getGeometry(){object}
facade/js/feature/Feature.js, line 86 -
Returns the geometry of the feature
Returns:
GeoJSON Geometry of the feature
-
getId(){string}
facade/js/feature/Feature.js, line 74 -
Returns the id of the feature
Returns:
Id of the feature
-
getStyle(){M.style.Feature}
facade/js/feature/Feature.js, line 229 -
Gets the style of feature, if any
Returns:
style of the feature
-
setAttribute(attribute, value)
facade/js/feature/Feature.js, line 185 -
Sets a value to an attribute
Name Type Description attribute
string name of the attribute to set
value
string | number | object the value to set
-
setAttributes(attributes)
facade/js/feature/Feature.js, line 134 -
Sets the attributes and their value
Name Type Description attributes
Object attributes to feature
-
setGeometry(Geometry)
facade/js/feature/Feature.js, line 98 -
Sets the geometry of the feature
Name Type Description Geometry
object GeoJSON geometry to set
-
setId(id)
facade/js/feature/Feature.js, line 62 -
Sets the id
Name Type Description id
string id to set
-
setStyle(style)
facade/js/feature/Feature.js, line 198 -
Sets the style to the feature. Style type must fit the appropriate geometry type (point, line, polygon)
Name Type Description style
M.style.Feature style to apply