Home

Awesome

extjs-carto

Native components for ExtJS to interact with Carto map layers, data and visualizations.

CartoMap.js

Configs

NameTypeDefaultDescription
cartoMapL.mapL.mapThe leaflet map for this component.
zoomNumber4A zoom value to initialize the cartoMap with.
scrollWheelZoomBooleantruetrue to allow the map to be scrolled by the mouse wheel.
basemapString<br>Object<br>L.tileLayer'positronLite'The basemap to be used for the cartoMap.
boundsLatLngBoundsnullThe bounds of the cartoMap.
minZoomNumber3The minimum possible zoom level of the cartoMap.
maxZoomNumber18The maximum possible zoom level of the cartoMap.
mapLockBooleanfalsetrue for the map to update the filters in every store found in storesToLock when the cartoMap bounds change.
layersCarto.util.LayerCollectionnullA collection of the layers of the cartoMap.
selectionExt.data.ModelnullThe selected record of the cartoMap.
selectedActionString<br>String[]nullThe actions to take when a record is selected.
storesExt.data.StorenullThe stores associated with each subLayer of the cartoMap.
storesToLockString[]nullAn array of storeIds to be passed the cartoMap's bounds when mapLock is true.

Instance Properties

NameTypeDefaultDescription
maskWhileLoadingBooleanfalsetrue to mask the map component while tiles are loading.
loadingMessageString'Loading Tiles...'The message to display while the tiles are loading.

Binding

The map's selection is two-way bindable, similarly to other Extjs components. This means it plays well with things like grids.

Example

{
    xtype: 'grid',
    bind: {
        selection: '{selectedItem}',
        store: '{sampleStore}'
    }
}, {
    xtype: 'cartoMap',
    bind: {
        selection: '{selectedItem}'
    },
    basemap: 'darkMatterLite',
    layers: [{
        subLayers: [{
            bind: '{sampleStore}'
        }]
    }]
}

Available Basemaps

Example Usage
{
    xtype: 'cartoMap',
    basemap: 'darkMatterLite'
}

Available Selected Actions

Example Usage
{
    xtype: 'cartoMap',
    selectedAction: 'panTo'
}
{
    xtype: 'cartoMap',
    selectedAction: ['panTo', 'placeMarker']
}

Layers

Layers are a combination of data (from SQL) and styling (from CartoCSS) that render the map. Carto has multiple different types of layers (see the demo for some examples), but there are some configs common to them all.

Configs

NameTypeDefaultDescription
cartoLayerLayernullThe underlying Layer object.
layerIdStringAuto-generated idThe key by which this layer can be retrieved, removed, etc.
usernameString''The username for the associated carto account.
tableString''The table that this layer draws from.
hiddenBooleanfalseSet to true to hide this layer.
mapZIndexNumbernullDefines the order that the layers are rendered on the map.

Layer Groups

Carto can combine multiple layers into one layer group that is created and rendered as one layer, rather than multiple.

Configs

NameTypeDefaultDescription
subLayersCarto.util.SubLayerCollectionnullThe collection of Carto.sublayer.SubLayerBase objects associated with this layer group.

SubLayers

Configs

NameTypeDefaultDescription
layerCarto.layer.LayerGroupnullThe Carto.layer.LayerGroup that owns this subLayer.

See also: Carto.mixin.DataContainingLayer

Torque Layers

Torque layers combine with Carto.css.Torque to create powerful layer objects that can accomplish much more than traditional map layers.

See also: Carto.mixin.DataContainingLayer

Example Usage
{
    xtype: 'cartoMap',
    layers: [{
        type: 'torque',
        css: {
            type: 'torque' // or heatmap, torquecat
        },
        ...
    }]
}

DataContainingLayer.js

Most layers (like [Carto.layer.Torque] and Carto.sublayer.SubLayerBase) contain data. This mixin defines the SQL, CartoCss, and store functionality for layers that render data.

Configs

NameTypeDefaultDescription
storeCarto.CartoStorenullA Carto.CartoStore associated with this layer. If defined, it will create the SQL for this layer.
sqlString''SQL for this layer to use when it is created.
cssObject<br>String<br>String[]Carto.css.PointThe CartoCSS definition for this layer.
selectionExt.data.ModelnullThe layer's current selected record.
interactivityObjectnullUse enable: true to enable interactity on this layer.

CartoCSS

CartoCSS defines how a layer is styled on the map. There are multiple types that are available to be used as-is or extended as appropriate.

NameTypeDescription
pointCarto.css.PointA generic point-based style.
lineCarto.css.LineA generic line-based style.
polygonCarto.css.PolygonA generic polygon-based style.
intensityCarto.css.IntensityPoint style with multiplying effect.
heatmapCarto.css.HeatMapTorque style with multiplying effect.
torqueCarto.css.TorqueTorque style for showing time-based effects.
torquecatCarto.css.TorqueCatTorque style with added categorical grouping.
Example Usage
{
    css: {
        type: 'point',
        // the value config will extend, not overwrite
        value: {
            markerColor: 'blue'
        }
    }
}

CartoStore.js

Configs

NameTypeDefaultDescription
groupByCarto.CartoGroupBynullA groupBy object defining the GROUP BY clause of the Carto.CartoProxy's SQL.

CartoProxy.js

Configs

NameTypeDefaultDescription

CartoGroupBy.js

This is an SQL helper object for defining the GROUP BY clause in the SQL.

Configs

NameTypeDefaultDescription
fieldsObject[]<br>String[]nullAn array of field configs, in the order they should be presented in the GROUP BY clause.
countNameString'cnt'The name of the field that should contain the counts of the different groups.

In addition, the Carto.CartoGroupBy object uses optional extra properties of the Ext.data.field.Field that are not native.

NameTypeDefaultDescription
propertyStringundefinedSpecifies the name of the column for this field, if different from the name of the field.
sqlStringundefinedUse this to force the query to use this SQL for this field. Useful for more complicated queries.
aggregateTypeStringundefinedAn SQL function for aggregating on this field. If specified, this field will not be included in the GROUP BY clause.

Demos

Basic

Grid/Map

Carto Account

Chart/Map

Layer Demos

Store Binding

Fire Map

Wildfire Exploration

Carto Map Explorer

Presentations

SlideShare - SenchaCon 2016: Integrating Geospatial Maps & Big Data Using CARTO via Ext JS Components

Video can be found here of the talk.