Reference Source
public class | source

MapGeoJSON

Extends:

leaflet~L.GeoJSON → MapGeoJSON

GeoJson can set style by api or options.

See:

Example:

var data = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
104.91763561707054,
30.154133143258463
],
[
104.93278268710557,
30.092682588091314
],
[
105.03502903861937,
30.10582236698391
]]}}]
};

var geojson = new KQ.Map.MapGeoJSON(data);
geojson.addToMapView(mapView);

Constructor Summary

Public Constructor
public

constructor(geojson_obj: Object, options: Object)

Constructor creates a GeoJSON layer

Method Summary

Public Methods
public

addData(data: GeoJSON): Null

Adds a GeoJSON object to the layer.

public

addToMapView(mapview: MapView): Null

Add geojson to mapview

public

bindOnClick(callback: function(e: Object): null): Null

Bind on click event callback on each layer.

public

Returns the LatLngBounds of the Feature Group.

public

remove(): Null

Remove geojson from mapview

public

setStyle(style: Object): Null

Changes styles of GeoJSON vector layers.

Public Constructors

public constructor(geojson_obj: Object, options: Object) source

Constructor creates a GeoJSON layer

Params:

NameTypeAttributeDescription
geojson_obj Object

geojson object

options Object

config params

Public Methods

public addData(data: GeoJSON): Null source

Adds a GeoJSON object to the layer.

Params:

NameTypeAttributeDescription
data GeoJSON

GeoJSON data

Return:

Null

public addToMapView(mapview: MapView): Null source

Add geojson to mapview

Params:

NameTypeAttributeDescription
mapview MapView

mapview object

Return:

Null

public bindOnClick(callback: function(e: Object): null): Null source

Bind on click event callback on each layer.

Params:

NameTypeAttributeDescription
callback function(e: Object): null

callback function will run on object click event

Return:

Null

public getBounds(): LatLngBounds source

Returns the LatLngBounds of the Feature Group.

Return:

LatLngBounds

public remove(): Null source

Remove geojson from mapview

Return:

Null

public setStyle(style: Object): Null source

Changes styles of GeoJSON vector layers.

Params:

NameTypeAttributeDescription
style Object

style params

style.stroke Boolean

Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.

style.color String

Stroke color, such as '#3388ff'.

style.weight Number

Stroke width in pixels

style.opacity Number

Stroke opacity

style.lineCap String

A string that defines shape to be used at the end of the stroke.

style.lineJoin String

A string that defines shape to be used at the corners of the stroke.

style.dashArray String

A string that defines the stroke dash pattern.

style.dashOffset String

A string that defines the distance into the dash pattern to start the dash.

style.fill Boolean

Whether to fill the path with color. Set it to false to disable filling on polygons or circles.

style.fillColor String

Fill color.

style.fillOpacity Number

Fill opacity(0~1).

style.fillRule String

A string that defines how the inside of a shape is determined.

Return:

Null