Search results

Populate Data

In this section you can learn how to populate shape data for providing Data input to Map control and usage of DataSource property.

Shape Data

The Shape Data collection describing geographical shape information can be obtained from GEOJSON format shapes.

.\ Maps_GeoJSON\All Countries with States

You can assign the complete contents in “WorldMap.json” file to new JSON object. For better understanding, a TS file “world-map.js” is already created to store JSON data in JSON object “worldMap”.


export let worldMap = //Paste all the content copied from the JSON file//

Data Binding

The Maps control supports data binding with the dataSource property in the shape layers.


The following properties in shape layers is be used for binding data in Maps control,

* dataSource
* shapeDataPath
* shapePropertyPath

Data Source

The dataSource property accepts the collection values as input. For example, you can provide the list of objects as input.

Shape Data Path

The shapeDataPath property is used to refer the data ID in DataSource. For example, population MapData contains data ids ‘Name’ and ‘Population’. The shapeDataPath and the shapePropertyPath properties are related to each other (refer to shapePropertyPath for more details).

Shape Property Path

The shapePropertyPath property is similar to the shapeDataPath that refers to the column name in the data property of shape layers to identify the shape. When the values of the shapeDataPath property in the dataSource property and the value of shapePropertyPath in the data property match, then the associated object from the dataSource is bound to the corresponding shape.

The datasource is populated with JSON data relative to shape data and stored in JSON object. The world countries population as datasource is used for better understanding.

The “populationData.ts” file is used to store JSON data in JSON object “populationData”.

Refer both shape data and datasource as illustrated in the following code example.


export let populationData: object[] = [{  "Country": "China", "Membership": "Permanent"},
            {"Country": "France","Membership": "Permanent" },
            { "Country": "Russia","Membership": "Permanent"},
            {"Country": "Kazakhstan","Membership": "Non-Permanent"},
            { "Country": "Poland","Membership": "Non-Permanent"},
            {"Country": "Sweden","Membership": "Non-Permanent"}],
    <div id="app">
          <div class='wrapper'>
            <ejs-maps :legendSettings='legendSettings'>
                    <e-layer :shapeData='shapeData' :shapePropertyPath='shapePropertyPath' :shapeDataPath='shapeDataPath' :dataSource='dataSource' ></e-layer>

import Vue from 'vue';
import { MapsPlugin, Legend } from '@syncfusion/ej2-vue-maps';
import { world_map} from './world-map.js';
export default {
data () {
        shapeData: world_map,
        dataSource: [{  "Country": "China", "Membership": "Permanent"},
            {"Country": "France","Membership": "Permanent" },
            { "Country": "Russia","Membership": "Permanent"},
            {"Country": "Kazakhstan","Membership": "Non-Permanent"},
            { "Country": "Poland","Membership": "Non-Permanent"},
            {"Country": "Sweden","Membership": "Non-Permanent"}],
        shapePropertyPath: 'name',
        shapeDataPath: 'Country',
        shapeSettings: {
            colorValuePath: 'Membership',
                colorMapping: [
                    value: 'Permanent', color: '#D84444'
                    value: 'Non-Permanent', color: '#316DB5'
        legendSettings: {
            visible: true
provide: {
    maps: [Legend]
  .wrapper {
    max-width: 400px;
    margin: 0 auto;