in Components/PCF/AzureMaps/data-set/azureMapsDataSetControl/index.ts [136:188]
private onMapReady(dataSet: DataSet) {
debugger;
//Create a data source and add it to the map.
this.dataSource = new azureMapsControl.source.DataSource("newID", {
cluster: true
});
this.map.sources.add(this.dataSource);
//Create three point features on the map and add some metadata in the properties which we will want to display in a popup.
this.dataPoints.push(
new azureMapsControl.data.Feature(new azureMapsControl.data.Point([-122.33, 47.61]), {
name: 'Convention center',
description: 'Washington State Convention Center'
})
);
if (dataSet.sortedRecordIds.length > 0) {
for (let currentRecordId of dataSet.sortedRecordIds) {
this.getCoords(dataSet.records[currentRecordId]).then((searchAddrResp: SearchAddressResponse) => {
console.log(searchAddrResp);
if (searchAddrResp.results && searchAddrResp.results.length > 0) {
this.dataPoints.push(
new azureMapsControl.data.Feature(new azureMapsControl.data.Point([_.get(searchAddrResp, 'results[0].position.lon'), _.get(searchAddrResp, 'results[0].position.lat')]), {
id: currentRecordId,
name: _.get(dataSet.records[currentRecordId], 'sourceFieldName'),
description: _.get(dataSet.records[currentRecordId], 'sourceFieldDescription')
})
);
if (this.dataPoints.length === (dataSet.sortedRecordIds.length + 1)) {
this.buildSymbolLayer();
this.resetCamera();
}
}
});
}
}
//Create a popup but leave it closed so we can update it and display it later.
this.popup = new azureMapsControl.Popup({
position: [0, 0],
pixelOffset: [0, -18]
});
this.map.events.add('touchend', this.closePopup.bind(this));
//Create a HTML marker and add it to the map.
this.map.markers.add(new azureMapsControl.HtmlMarker({
htmlContent: "<div><div class='pin bounce'></div><div class='pulse'></div></div>",
position: [-122.33, 47.61],//seattle convention center
pixelOffset: [5, -18]
}));
};