Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
], function(AddIn, Dashboard, $, _) {
"use strict";
var inlineGeoJSON = {
name: "inlineGeoJSON",
label: "Inline GeoJSON shape resolver",
defaults: {
colIdx: null, //column index containing the json map definitions
idPropertyName: "" //GeoJSON feature property that will be used to index the feature
implementation: function(tgt, st, opt) {
var map = _.chain(st.tableData.resultset)
.map(function(row, idx){
return [
st.ids[idx], polygonToGeoJson(row[opt.colIdx])
var deferred = $.Deferred();
return deferred.promise();
function polygonToGeoJson(coordinatesStr){
return {
type: "Feature",
geometry: {
type: "Polygon",
coordinates: JSON.parse(coordinatesStr)
Dashboard.registerGlobalAddIn("NewMapComponent", "ShapeResolver", new AddIn(inlineGeoJSON));
return inlineGeoJSON;
this.shapeResolver = "inlineGeoJson";
this.setAddInOptions("ShapeResolver", "inlineGeoJSON", { colIdx: 2});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.