FeatureCollection Component


Properties

features
  Gets the list of features attached to the FeatureCollection (without regard to the value of the feature's Visible{
Data type: array
Designer Writable false
Code Writeable true featurecollectionName.features =
Code Readable true let variable = featurecollectionName.features

featuresFromGeoJSON
  Populates the feature collection from a string containing GeoJSON content. Given the size of such strings, it is recommended to load the feature collection from assets or the web using the Source property.
Data type: string
Designer Writable false
Code Writeable false
Code Readable false

height
  Specifies the FeatureCollection's vertical height, measured in pixels.
Data type: number
Designer Writable false
Code Writeable false
Code Readable false

heightPercent
  Specifies the FeatureCollection's vertical height as a percentage of the Screen's Height.
Data type: number
Designer Writable false
Code Writeable false
Code Readable false

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.
Data type: string
Designer Writable false
Code Writeable false
Code Readable true let variable = featurecollectionName.source

visible
  Specifies whether the FeatureCollection should be visible on the screen. Value is true{
Data type: boolean
Designer Writable true <featurecollection name="featurecollectionName" visible="true">
Code Writeable true featurecollectionName.visible = true
Code Readable true let variable = featurecollectionName.visible

width
  Specifies the horizontal width of the FeatureCollection, measured in pixels.
Data type: number
Designer Writable false
Code Writeable false
Code Readable false

widthPercent
  Specifies the horizontal width of the FeatureCollection as a percentage of the Screen's Width.
Data type: number
Designer Writable false
Code Writeable false
Code Readable false

class
  The styling class of the the component
Data type: string
Designer Writable true <featurecollection name="featurecollectionName" class="Test class">
Code Writeable false
Code Readable false

id
  The styling id of the the component
Data type: string
Designer Writable true <featurecollection name="featurecollectionName" id="Test id">
Code Writeable false
Code Readable false

name
  The name of the component that will be used to refer to it in code.
Data type: string
Designer Writable true <featurecollection name="featurecollectionName" name="testComponent">
Code Writeable false
Code Readable false

Methods

Method name Description Parameters
featureFromDescription Converts a feature description into an App Inventor map feature. Points are converted into Marker components, LineStrings are converted into LineString components, and Polygons (and MultiPolygons) are converted into Polygon components.
featurecollectionName.featureFromDescription(description)
featurecollectionName.featureFromDescription()
description list
loadFromURL Loads 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 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.
featurecollectionName.loadFromURL(url)
featurecollectionName.loadFromURL("Test url")
url string
addEventListener Method used to create event listeners.
See Events below for samples.
eventName string
eventCallbackFunction callback

Events

Event name Description Parameters
featureClick When a feature is clicked, the parent FeatureCollection will also receive a FeatureClick event. The feature parameter indicates which child feature was clicked. This event is run after the Click event on the corresponding feature and after the when any ... Click event if one is provided.
featurecollectionName.addEventListener(
    "featureClick",
    function (feature) {
        //Your code here
    }
)
feature component
featureDrag When the user drags a feature, the parent FeatureCollection will also receive a FeatureDrag event. The feature parameter indicates which child feature was dragged. This event is run after the Drag event on the corresponding feature and after the when any ... Drag event if one is provided.
featurecollectionName.addEventListener(
    "featureDrag",
    function (feature) {
        //Your code here
    }
)
feature component
featureLongClick When a feature is long-clicked, the parent FeatureCollection will also receive a FeatureLongClick event. The feature parameter indicates which child feature was long-clicked. This event is run after the LongClick event on the corresponding feature and after the when any ... LongClick event if one is provided.
featurecollectionName.addEventListener(
    "featureLongClick",
    function (feature) {
        //Your code here
    }
)
feature component
featureStartDrag When the user starts dragging a feature, the parent FeatureCollection will also receive a FeatureStartDrag event. The feature parameter indicates which child feature was dragged. This event is run after the StartDrag event on the corresponding feature and after the when any ... StartDrag event if one is provided.
featurecollectionName.addEventListener(
    "featureStartDrag",
    function (feature) {
        //Your code here
    }
)
feature component
featureStopDrag When the user stops dragging a feature, the parent FeatureCollection will also receive a FeatureStopDrag event. The feature parameter indicates which child feature was dragged. This event is run after the StopDrag event on the corresponding feature and after the when any ... StopDrag event if one is provided.
featurecollectionName.addEventListener(
    "featureStopDrag",
    function (feature) {
        //Your code here
    }
)
feature component
gotFeatures NOTE: If you use this method, it will NOT automatically load the features from the URL onto the map. You will need to use componentName.featureFromDescription(features) method to see them. The GotFeatures event is run when when a feature collection is successfully read from the given url. The features parameter will be a list of feature descriptions that can be converted into components using the FeatureFromDescription method.
featurecollectionName.addEventListener(
    "gotFeatures",
    function (url, features) {
        //Your code here
    }
)
url string
features list
loadError The LoadError event is run when an error occurs while processing a feature collection document at the given url. The responseCode parameter will contain an HTTP status code and the errorMessage parameter will contain a detailed error message.
featurecollectionName.addEventListener(
    "loadError",
    function (url, responseCode, errorMessage) {
        //Your code here
    }
)
url string
responseCode number
errorMessage string