FeatureCollection
Last Updated On 2021-07-16
Version 2MinSDK 7Tutorial Video
A FeatureCollection contains one or more map features as a group. Any events fired on a feature in the collection will also trigger the corresponding event on the collection object. FeatureCollections can be loaded from external resources as a means of populating a Map with content.
Properties
You can set the below properties in the UI part of the builder.
- FeaturesFromGeoJSON - it's a textArea value which is set to blank by default.
- HeihMargin - it's a four value which is set to 0,0,0,0 by default.
- HeihPadding - it's a four value which is set to 0,0,0,0 by default.
- MarginBottom - it's a non negative float value which is set to 0 by default.
- MarginLeft - it's a non negative float value which is set to 0 by default.
- MarginRight - it's a non negative float value which is set to 0 by default.
- MarginTop - it's a non negative float value which is set to 0 by default.
- PaddingBottom - it's a non negative float value which is set to 0 by default.
- PaddingLeft - it's a non negative float value which is set to 0 by default.
- PaddingRight - it's a non negative float value which is set to 0 by default.
- PaddingTop - it's a non negative float value which is set to 0 by default.
- Source - it's a geojson type value which is set to blank by default.
- Visible - it's a visibility value which is set to true by default.
Block Properties
You can set the below blocks properties in the blocks section of the builder.
Features
The list of features placed on this FeatureCollection. This list also includes any features created by calls to FeatureFromDescription
FeaturesFromGeoJSON
Loads a collection of features from the given string. If the string is not valid GeoJSON, the ErrorLoadingFeatureCollection error will be run with url =
Height
Specifies the vertical height of the FeatureCollection, measured in pixels.
HeightPercent
Specifies the vertical height of the FeatureCollection as a percentage of the height of the Screen.
MarginBottom
Property for MarginBottom
MarginLeft
Property for MarginLeft
MarginRight
Property for MarginRight
MarginTop
Property for MarginTop
PaddingBottom
Property for PaddingBottom
PaddingLeft
Property for PaddingLeft
PaddingRight
Property for PaddingRight
PaddingTop
Property for PaddingTop
Source
Specifies the source URL used to populate the feature collection. If the feature collection was not loaded from a URL, this will be the empty string.
Visible
Specifies whether the FeatureCollection should be visible on the screen. Value is true if the FeatureCollection is showing and false if hidden.
Width
Specifies the horizontal width of the FeatureCollection, measured in pixels.
WidthPercent
Specifies the horizontal width of the FeatureCollection as a percentage of the width of the Screen.
Methods
You can set the below method blocks in the blocks section of the builder.
FeatureFromDescription
Converts a feature description into an App Inventor map feature. Points are converted into
LoadFromURL
Load a feature collection in GeoJSON format from the given url. On success, the event GotFeatures will be raised with the given url and a list of the features parsed from the GeoJSON as a list of (key, value) pairs. On failure, the LoadError event will be raised with any applicable HTTP response code and error message.
Events
You can set the below event blocks in the blocks section of the builder.
FeatureClick
The user clicked on a map feature.
FeatureDrag
The user dragged a map feature.
FeatureLongClick
The user long-pressed on a map feature.
FeatureStartDrag
The user started dragging a map feature.
FeatureStopDrag
The user stopped dragging a map feature.
GotFeatures
A GeoJSON document was successfully read from url. The features specified in the document are provided as a list in features.
LoadError
An error was encountered while processing a GeoJSON document at the given url. The responseCode parameter will contain an HTTP status code and the errorMessage parameter will contain a detailed error message.