# Class FeatureHelper

#### Hierarchy

- FeatureHelper

- Defined in src/misc/FeatureHelper.js:137

#####
Index

### Properties

$filter_
decimals_
ngeoNumberCoordinates_
numberFormat_
pointFilterArgs_
pointFilterFn_
precision_
projection_
spherical
unitPrefixFormat_

### Methods

clearNonSpatialProperties
createEditingStyles
createTextStyle_
export
exportGPX
exportKML
export_
findFeatureIndexByFid
fitMapToFeature
getAngleProperty
getArrowDirectionProperty
getArrowLineStyles_
getArrowPositionProperty
getColorProperty
getCoordinateIndexThatHitsAt_
getHaloStyle_
getLineStringStyle_
getMeasure
getNameProperty
getNonSpatialProperties
getNumber
getOpacityProperty
getPointStyle_
getPolygonStyle_
getRGBAColorProperty
getRadiusLine
getShowArrowsProperty
getShowLabelProperty
getShowMeasureProperty
getSizeProperty
getStrokeProperty
getStyle
getTextStyle_
getType
getVertexInfoAtCoordinate
getVertexStyle
optNumber
removeVertex
setProjection
setStyle
supportsVertexRemoval_
supportsVertex_

## Properties

### $filter_

$filter_: IFilterService

- Defined in src/misc/FeatureHelper.js:147

### decimals_

decimals_: number

- Defined in src/misc/FeatureHelper.js:152

### ngeoNumberCoordinates_

ngeoNumberCoordinates_: numberCoordinates

- Defined in src/misc/FeatureHelper.js:177

### numberFormat_

numberFormat_: formatNumber

- Defined in src/misc/FeatureHelper.js:167

### pointFilterArgs_

pointFilterArgs_: any[]

Arguments to apply to the point filter function.

- Defined in src/misc/FeatureHelper.js:193
- Defined in src/misc/FeatureHelper.js:201

### pointFilterFn_

pointFilterFn_: IFilterFilter

Filter function to display point coordinates or null to don't use any filter.

- Defined in src/misc/FeatureHelper.js:186
- Defined in src/misc/FeatureHelper.js:200
- Defined in src/misc/FeatureHelper.js:203

### precision_

precision_: number

- Defined in src/misc/FeatureHelper.js:157

### projection_

projection_: Projection

- Defined in src/misc/FeatureHelper.js:209
- Defined in src/misc/FeatureHelper.js:216

### spherical

spherical: boolean

- Defined in src/misc/FeatureHelper.js:162

### unitPrefixFormat_

unitPrefixFormat_: unitPrefix

- Defined in src/misc/FeatureHelper.js:172

## Methods

### clearNonSpatialProperties

- clearNonSpatialProperties(feature: Feature<Geometry>): void

- Clear all properties of a feature, with the exception of the geometry.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  #### Returns void

  - Defined in src/misc/FeatureHelper.js:1636

### createEditingStyles

- createEditingStyles(feature: Feature<Geometry>): Style[]

- ### Returns

  List of style.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature to create the editing styles with.

  #### Returns Style[]

  - Defined in src/misc/FeatureHelper.js:646

### createTextStyle_

- createTextStyle_(options: TextOptions): Text

- ### Returns

  Style.

  #### Parameters

  - ##### options: TextOptions

    Options.

  #### Returns Text

  - Defined in src/misc/FeatureHelper.js:1337

### export

- export(features: Feature<Geometry>[], formatType: string): void

- Export features in the given format. The projection of the exported features is: `EPSG:4326`.

  #### Parameters

  - ##### features: Feature<Geometry>[]

    Array of vector features.

  - ##### formatType: string

    Format type to export the features.

  #### Returns void

  - Defined in src/misc/FeatureHelper.js:1251

### exportGPX

- exportGPX(features: Feature<Geometry>[]): void

- Export features in GPX and download the result to the browser. The projection of the exported features is: `EPSG:4326`.

  #### Parameters

  - ##### features: Feature<Geometry>[]

    Array of vector features.

  #### Returns void

  - Defined in src/misc/FeatureHelper.js:1270

### exportKML

- exportKML(features: Feature<Geometry>[]): void

- Export features in KML and download the result to the browser. The projection of the exported features is: `EPSG:4326`.

  #### Parameters

  - ##### features: Feature<Geometry>[]

    Array of vector features.

  #### Returns void

  - Defined in src/misc/FeatureHelper.js:1284

### export_

- export_(features: Feature<Geometry>[], format: FeatureFormat, fileName: string, opt_mimeType?: string): void

- Export features using a given format to a specific filename and download the result to the browser. The projection of the exported features is: `EPSG:4326`.

  #### Parameters

  - ##### features: Feature<Geometry>[]

    Array of vector features.

  - ##### format: FeatureFormat

    Format

  - ##### fileName: string

    Name of the file.

  - ##### `Optional` opt_mimeType: string

    Mime type. Defaults to 'text/plain'.

  #### Returns void

  - Defined in src/misc/FeatureHelper.js:1302

### findFeatureIndexByFid

- findFeatureIndexByFid(features: Feature<Geometry>[], fid: string): number

- ### Returns

  Index of found feature

  #### Parameters

  - ##### features: Feature<Geometry>[]

    Features.

  - ##### fid: string

    Feature id

  #### Returns number

  - Defined in src/misc/FeatureHelper.js:1651

### fitMapToFeature

- fitMapToFeature(feature: Feature<Geometry>, map: Map, opt_duration?: number): void

- This methods will try to fit a feature into a map view.

  If the feature is already visible, then the map will be zoomed out if the feature is too big for the current view.

  If the feature is not visible but would fit in the map view, the map is panned to the center of the feature.

  If the feature is not visible and would not fit in the map view, the map is fix to the feature's extent.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  - ##### map: Map

    Map.

  - ##### `Optional` opt_duration: number

    Aimation duration. Defaults to `250`.

  #### Returns void

  - Defined in src/misc/FeatureHelper.js:1495

### getAngleProperty

- getAngleProperty(feature: Feature<Geometry>): number

- ### Returns

  Angle.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  #### Returns number

  - Defined in src/misc/FeatureHelper.js:1120

### getArrowDirectionProperty

- getArrowDirectionProperty(feature: Feature<Geometry>): string

- ### Returns

  The ArrowDirections value of the feature. ArrowDirections.NONE by default.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  #### Returns string

  - Defined in src/misc/FeatureHelper.js:1222

### getArrowLineStyles_

- getArrowLineStyles_(feature: Feature<LineString>, arrowDirection: string, arrowPosition: string, color: Color): Style[]

- ### Returns

  Style Arrows style for the line.

  #### Parameters

  - ##### feature: Feature<LineString>

    Feature with linestring geometry.

  - ##### arrowDirection: string

    An ArrowDirections value.

  - ##### arrowPosition: string

    An ArrowPositions value.

  - ##### color: Color

    an hex Color.

  #### Returns Style[]

  - Defined in src/misc/FeatureHelper.js:342

### getArrowPositionProperty

- getArrowPositionProperty(feature: Feature<Geometry>): string

- ### Returns

  The ArrowPositions value of the feature. ArrowPositions.FIRST by default.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  #### Returns string

  - Defined in src/misc/FeatureHelper.js:1234

### getColorProperty

- getColorProperty(feature: Feature<Geometry>): string

- ### Returns

  Color.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  #### Returns string

  - Defined in src/misc/FeatureHelper.js:1130

### getCoordinateIndexThatHitsAt_

- getCoordinateIndexThatHitsAt_(coordinates: Coordinate[], coordinate: Coordinate, min: number, buffer: number): number

- Loop in the given coordinates and look one that hits an other given coordinate using a buffer. If one does, return its index.

  ### Returns

  Index of the coordinate that hits. If none did, -1 is returned.

  #### Parameters

  - ##### coordinates: Coordinate[]

    Coordinates in which to loop to find the one that hits the other given coordinate.

  - ##### coordinate: Coordinate

    Coordinate that has to hit.

  - ##### min: number

    Minimum number of coordinates required to look for the one that hits.

  - ##### buffer: number

    Buffer, in map view units, to extend the extent with.

  #### Returns number

  - Defined in src/misc/FeatureHelper.js:823

### getHaloStyle_

- getHaloStyle_(feature: Feature<Geometry>): Style

- ### Returns

  Style.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  #### Returns Style

  - Defined in src/misc/FeatureHelper.js:1036

### getLineStringStyle_

- getLineStringStyle_(feature: Feature<LineString>): Style[]

- ### Returns

  Style.

  #### Parameters

  - ##### feature: Feature<LineString>

    Feature with linestring geometry.

  #### Returns Style[]

  - Defined in src/misc/FeatureHelper.js:289

### getMeasure

- getMeasure(feature: Feature<Geometry>): string

- Get the measure of the given feature as a string. For points, you can format the result by setting a filter to apply on the coordinate with the function import('ngeo/misc/FeatureHelper').setPointFilterFn.

  ### Returns

  Measure.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  #### Returns string

  - Defined in src/misc/FeatureHelper.js:1373

### getNameProperty

- getNameProperty(feature: Feature<Geometry>): string

- ### Returns

  Name.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  #### Returns string

  - Defined in src/misc/FeatureHelper.js:1151

### getNonSpatialProperties

- getNonSpatialProperties(feature: Feature<Geometry>): Object

- Return the properties of a feature, with the exception of the geometry.

  ### Returns

  Object.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  #### Returns Object

  - Defined in src/misc/FeatureHelper.js:1618

### getNumber

- getNumber(feature: Feature<Geometry>, attrib: string): number

- Get a number feature attribute.

  ### Returns

  , The attribute value

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  - ##### attrib: string

    The attribute name.

  #### Returns number

  - Defined in src/misc/FeatureHelper.js:501

### getOpacityProperty

- getOpacityProperty(feature: Feature<Geometry>): number

- ### Returns

  Opacity.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  #### Returns number

  - Defined in src/misc/FeatureHelper.js:1161

### getPointStyle_

- getPointStyle_(feature: Feature<Geometry>): Style[]

- ### Returns

  Style.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature with point geometry.

  #### Returns Style[]

  - Defined in src/misc/FeatureHelper.js:430

### getPolygonStyle_

- getPolygonStyle_(feature: Feature<Geometry>): Style[]

- ### Returns

  Style.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature with polygon geometry.

  #### Returns Style[]

  - Defined in src/misc/FeatureHelper.js:514

### getRGBAColorProperty

- getRGBAColorProperty(feature: Feature<Geometry>): Color

- ### Returns

  Color.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  #### Returns Color

  - Defined in src/misc/FeatureHelper.js:1139

### getRadiusLine

- getRadiusLine(feature: Feature<Geometry>, azimut: number): LineString

- This method generates a line string geometry that represents the radius for a given azimut. It expects the input geometry to be a circle.

  ### Returns

  The line geometry.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  - ##### azimut: number

    Azimut in degrees.

  #### Returns LineString

  - Defined in src/misc/FeatureHelper.js:1595

### getShowArrowsProperty

- getShowArrowsProperty(feature: Feature<Geometry>): boolean

- ### Returns

  Show at least one arrow.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  #### Returns boolean

  - Defined in src/misc/FeatureHelper.js:1197

### getShowLabelProperty

- getShowLabelProperty(feature: Feature<Geometry>): boolean

- ### Returns

  Show feature label.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  #### Returns boolean

  - Defined in src/misc/FeatureHelper.js:1183

### getShowMeasureProperty

- getShowMeasureProperty(feature: Feature<Geometry>): boolean

- ### Returns

  Show measure.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  #### Returns boolean

  - Defined in src/misc/FeatureHelper.js:1169

### getSizeProperty

- getSizeProperty(feature: Feature<Geometry>): number

- ### Returns

  Size.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  #### Returns number

  - Defined in src/misc/FeatureHelper.js:1206

### getStrokeProperty

- getStrokeProperty(feature: Feature<Geometry>): number

- ### Returns

  Stroke.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  #### Returns number

  - Defined in src/misc/FeatureHelper.js:1214

### getStyle

- getStyle(feature: Feature<Geometry>): Style[]

- Create and return a style object from a given feature using its inner properties and depending on its geometry type.

  ### Returns

  The style object.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  #### Returns Style[]

  - Defined in src/misc/FeatureHelper.js:247

### getTextStyle_

- getTextStyle_(feature: Feature<Geometry>): Style

- ### Returns

  Style.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature with point geometry, rendered as text.

  #### Returns Style

  - Defined in src/misc/FeatureHelper.js:627

### getType

- getType(feature: Feature<Geometry>): string

- Return the type of geometry of a feature using its geometry property and some inner properties.

  ### Returns

  The type of geometry.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  #### Returns string

  - Defined in src/misc/FeatureHelper.js:1443

### getVertexInfoAtCoordinate

- getVertexInfoAtCoordinate(feature: Feature<Geometry>, coordinate: Coordinate, resolution: number): number[]

- For a given feature, if its geometry supports vertice that can be removed on click, then check if there is a vertex a the given coordinate. The map current map view resolution is used to calculate a buffer of the size of the vertex (using its style).

  If a vertex hits, then return its information, i.e. its indexes among the coordinates of the geometry of the feature, as an array. For example, if the geometry is a LineString, then the coordinates are an array of ol.Coordinate, so a single index is required. For a polygon, coordinates are an array of array of coordinates, so 2 indexes are required.

  If removing a vertex would make the geometry invalid, then the vertex info is not returned.

  ### Returns

  The indexes of the vertex (coordinate) that hits.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  - ##### coordinate: Coordinate

    Coordinate.

  - ##### resolution: number

    Current map view resolution.

  #### Returns number[]

  - Defined in src/misc/FeatureHelper.js:735

### getVertexStyle

- getVertexStyle(opt_incGeomFunc?: boolean): Style

- Create and return a style object to be used for vertex.

  ### Returns

  Style.

  #### Parameters

  - ##### `Optional` opt_incGeomFunc: boolean

    Whether to include the geometry function or not. One wants to use the geometry function when you want to draw the vertex of features that don't have point geometries. One doesn't want to include the geometry function if you just want to have the style object itself to be used to draw features that have point geometries. Defaults to `true`.

  #### Returns Style

  - Defined in src/misc/FeatureHelper.js:854

### optNumber

- optNumber(feature: Feature<Geometry>, attrib: string): number

- Get an optional number feature attribute.

  ### Returns

  , The attribute value

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  - ##### attrib: string

    The attribute name.

  #### Returns number

  - Defined in src/misc/FeatureHelper.js:481

### removeVertex

- removeVertex(feature: Feature<Geometry>, vertexInfo: number[]): void

- Remove a vertex from a feature using the given information (indexes).

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  - ##### vertexInfo: number[]

    The indexes of the vertex (coordinate) to remove.

  #### Returns void

  - Defined in src/misc/FeatureHelper.js:924

### setProjection

- setProjection(projection: Projection): void

- #### Parameters

  - ##### projection: Projection

    Projection.

  #### Returns void

  - Defined in src/misc/FeatureHelper.js:215

### setStyle

- setStyle(feature: Feature<Geometry>, opt_select?: boolean): void

- Set the style of a feature using its inner properties and depending on its geometry type.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  - ##### `Optional` opt_select: boolean

    Whether the feature should be rendered as selected, which includes additional vertex and halo styles.

  #### Returns void

  - Defined in src/misc/FeatureHelper.js:229

### supportsVertexRemoval_

- supportsVertexRemoval_(feature: Feature<Geometry>): boolean

- ### Returns

  Whether the feature supports having its vertex removed or not. Does not validate the number of coordinates.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  #### Returns boolean

  - Defined in src/misc/FeatureHelper.js:1021

### supportsVertex_

- supportsVertex_(feature: Feature<Geometry>): boolean

- ### Returns

  Whether the feature supports vertex or not.

  #### Parameters

  - ##### feature: Feature<Geometry>

    Feature.

  #### Returns boolean

  - Defined in src/misc/FeatureHelper.js:1004

Generated using TypeDoc