# Class 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): 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): Style[]

- #### Parameters

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

    Feature to create the editing styles with.

  #### Returns Style[]

  List of style.

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

### createTextStyle_

- createTextStyle_(options): Text

- #### Parameters

  - ##### options: TextOptions

    Options.

  #### Returns Text

  Style.

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

### export

- export(features, formatType): 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): 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): 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, format, fileName, opt_mimeType?): 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, fid): number

- #### Parameters

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

    Features.

  - ##### fid: string

    Feature id

  #### Returns number

  Index of found feature

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

### fitMapToFeature

- fitMapToFeature(feature, map, opt_duration?): 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): number

- #### Parameters

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

    Feature.

  #### Returns number

  Angle.

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

### getArrowDirectionProperty

- getArrowDirectionProperty(feature): string

- #### Parameters

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

    Feature.

  #### Returns string

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

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

### getArrowLineStyles_

- getArrowLineStyles_(feature, arrowDirection, arrowPosition, color): Style[]

- #### 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[]

  Style Arrows style for the line.

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

### getArrowPositionProperty

- getArrowPositionProperty(feature): string

- #### Parameters

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

    Feature.

  #### Returns string

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

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

### getColorProperty

- getColorProperty(feature): string

- #### Parameters

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

    Feature.

  #### Returns string

  Color.

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

### getCoordinateIndexThatHitsAt_

- getCoordinateIndexThatHitsAt_(coordinates, coordinate, min, buffer): number

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

  #### 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

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

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

### getHaloStyle_

- getHaloStyle_(feature): Style

- #### Parameters

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

    Feature.

  #### Returns Style

  Style.

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

### getLineStringStyle_

- getLineStringStyle_(feature): Style[]

- #### Parameters

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

    Feature with linestring geometry.

  #### Returns Style[]

  Style.

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

### getMeasure

- getMeasure(feature): 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.

  #### Parameters

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

    Feature.

  #### Returns string

  Measure.

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

### getNameProperty

- getNameProperty(feature): string

- #### Parameters

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

    Feature.

  #### Returns string

  Name.

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

### getNonSpatialProperties

- getNonSpatialProperties(feature): {}

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

  #### Parameters

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

    Feature.

  #### Returns {}

  Object.

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

### getNumber

- getNumber(feature, attrib): number

- Get a number feature attribute.

  #### Parameters

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

    Feature.

  - ##### attrib: string

    The attribute name.

  #### Returns number

  , The attribute value

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

### getOpacityProperty

- getOpacityProperty(feature): number

- #### Parameters

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

    Feature.

  #### Returns number

  Opacity.

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

### getPointStyle_

- getPointStyle_(feature): Style[]

- #### Parameters

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

    Feature with point geometry.

  #### Returns Style[]

  Style.

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

### getPolygonStyle_

- getPolygonStyle_(feature): Style[]

- #### Parameters

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

    Feature with polygon geometry.

  #### Returns Style[]

  Style.

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

### getRGBAColorProperty

- getRGBAColorProperty(feature): Color

- #### Parameters

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

    Feature.

  #### Returns Color

  Color.

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

### getRadiusLine

- getRadiusLine(feature, azimut): 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.

  #### Parameters

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

    Feature.

  - ##### azimut: number

    Azimut in degrees.

  #### Returns LineString

  The line geometry.

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

### getShowArrowsProperty

- getShowArrowsProperty(feature): boolean

- #### Parameters

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

    Feature.

  #### Returns boolean

  Show at least one arrow.

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

### getShowLabelProperty

- getShowLabelProperty(feature): boolean

- #### Parameters

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

    Feature.

  #### Returns boolean

  Show feature label.

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

### getShowMeasureProperty

- getShowMeasureProperty(feature): boolean

- #### Parameters

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

    Feature.

  #### Returns boolean

  Show measure.

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

### getSizeProperty

- getSizeProperty(feature): number

- #### Parameters

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

    Feature.

  #### Returns number

  Size.

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

### getStrokeProperty

- getStrokeProperty(feature): number

- #### Parameters

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

    Feature.

  #### Returns number

  Stroke.

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

### getStyle

- getStyle(feature): Style[]

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

  #### Parameters

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

    Feature.

  #### Returns Style[]

  The style object.

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

### getTextStyle_

- getTextStyle_(feature): Style

- #### Parameters

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

    Feature with point geometry, rendered as text.

  #### Returns Style

  Style.

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

### getType

- getType(feature): string

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

  #### Parameters

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

    Feature.

  #### Returns string

  The type of geometry.

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

### getVertexInfoAtCoordinate

- getVertexInfoAtCoordinate(feature, coordinate, resolution): 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.

  #### Parameters

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

    Feature.

  - ##### coordinate: Coordinate

    Coordinate.

  - ##### resolution: number

    Current map view resolution.

  #### Returns number[]

  The indexes of the vertex (coordinate) that hits.

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

### getVertexStyle

- getVertexStyle(opt_incGeomFunc?): Style

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

  #### 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

  Style.

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

### optNumber

- optNumber(feature, attrib): number

- Get an optional number feature attribute.

  #### Parameters

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

    Feature.

  - ##### attrib: string

    The attribute name.

  #### Returns number

  , The attribute value

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

### removeVertex

- removeVertex(feature, vertexInfo): 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): void

- #### Parameters

  - ##### projection: Projection

    Projection.

  #### Returns void

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

### setStyle

- setStyle(feature, opt_select?): 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): boolean

- #### Parameters

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

    Feature.

  #### Returns boolean

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

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

### supportsVertex_

- supportsVertex_(feature): boolean

- #### Parameters

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

    Feature.

  #### Returns boolean

  Whether the feature supports vertex or not.

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

Generated using TypeDoc