Skip to content

Feature Collection

Category Requires Version
Maps API 21, Android 5.0 Lollipop 2

Overview

A FeatureColletion 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.

Events

Feature Click

The user clicked on a map feature.

Params
feature Component

Feature Drag

The user dragged a map feature.

Params
feature Component

Feature Long Click

The user long-pressed on a map feature.

Params
feature Component

Feature Start Drag

The user started dragging a map feature.

Params
feature Component

Feature Stop Drag

The user stopped dragging a map feature.

Params
feature Component

Got Features

A GeoJSON document was successfully read from url. The features specified in the document are provided as a list in features.

Params
url Text
features List

Load Error

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.

Params
url Text
response Code Number
error Message Text

Methods

Feature From Description

Returns: Any

Convert a feature description into an App Inventor map feature. Currently the onlysupported conversion is from a GeoJSON point to Marker component. If the feature hasproperties, they will be mapped into App Inventor properties using the following mapping:description becomes Description;draggable becomes Draggable;infobox becomes EnableInfobox;fill becomes FillColor;fill-opacity becomes FillOpacity;image becomes ImageAsset;stroke becomes StrokeColor;stroke-opacity becomes StrokeOpacity;stroke-width becomes StrokeWidth;title becomes Title;visible becomes Visible

Params
description List

Load From URL

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.

Params
url Text

Properties

Features

List ➖ Read Write - Blocks

The list of features placed on this map. This list also includes any features created by calls to FeatureFromDescription

Features From Geo JSON

Text ➖ Write - Designer Blocks

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

Number ➖ Read Write - Blocks

Specifies the component's vertical height, measured in pixels.

Height Percent

Number ➖ Write - Blocks

Specifies the component's vertical height as a percentageof the height of its parent Component.

Source

Text ➖ Read - Designer Blocks

Gets or sets 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

Boolean Default: True ➖ Read Write - Designer Blocks

Returns true iff the component is visible.

Width

Number ➖ Read Write - Blocks

Specifies the component's horizontal width, measured in pixels.

Width Percent

Number ➖ Write - Blocks

Specifies the component's horizontal width as a percentageof the Width of its parent Component.


Last update: November 9, 2022