I turns out Visual Studio 2017 changed
| Lägg till bildtext |
Here is where I got the hint what to search for.
| Lägg till bildtext |
{
"bounds": {
"center": {
"latitude": 62.5,
"longitude": 17.2
},
"width": 1,
"height": 1
},
"center": {
"latitude": 62.5,
"longitude": 17.2
},
"centerOffset": {
"point": {
"x": 1000,
"y": 1000
}
},
"credentials": "{YOUR BING MAPS KEY HERE}",
"heading": 45,
"labelOverlay": "hidden",
"mapTypeId": "aerial",
"padding": 100,
"zoom": 2
}
function loadMap() {
var elem = document.querySelector("#map");
Microsoft.Maps.registerModule("ConfigurationModule", "scripts/ConfigurationModule.js");
Microsoft.Maps.loadModule("ConfigurationModule", {
callback: function () {
getConfig(function (jsonConfig) {
var config = ConfigurationModule.getConfig(jsonConfig);
new Microsoft.Maps.Map(elem, config);
})
}
});
}
var getConfig = function (callback) {
var request = new XMLHttpRequest();
request.addEventListener("load", function () {
var config = JSON.parse(this.responseText);
callback(config);
});
request.open("GET", "configuration.json");
request.send();
};
Open SMIL is an effort of combining GIS and SharePoint. I build SMIL over 5 years ago. The company I working for using SMIL in various projects and industries. That implies the platform is flexible and customisable. And maybe the most important thing, it addresses change. The users always want another button, more information, authorisation (in my experience rarely used but often asked for of some reason, maybe it is a culture thing?)
However, GIS has a reputation being expensive and complicated. SharePoint provides a highly customisable platform and Bing Maps is a platform with great features covering world wide data. Combining these platforms platform providing a light GIS have been the target of the OpenSMIL project.
OpenSMIL has i mobile map client connected to a SharePoint site, with geo enabled SharePoint lists represented as GIS layers. The mobile client runs in a browser in a SharePoint context. With this tool the user can collect data. The data is stored into a SharePoint list so it is available immediately in SharePoint.
Inside SharePoint there is a WebPart showing the layers (SharePoint lists with geographical information). SharePoint list items are plotted on the map and are clickable.
SharePoint lists have two maps, one preview that shows on mouseover an icon in the list.And another showing the item. The user can create new or change geometry. For example draw a polygon that might represent the area for a document.
In order to share geographical data with others you can invite them use your SharePoint site or export a list as a KML file. KML is standard See OGC.
But how to enable i list or document library to store geographical information? Easy, just add a column, give it a name and add a new field to the list.
For project place visit, project site. Or jump right into the code.
If I just try to add a property when initializing the Pushpin, Bing Maps will not take notice of that property due to the setOptions function on the Pushpin object. I don't really want to override the setOptions function - since I don't know the domino effect. So there are still two ways to solve the problem.
var pin = new Microsoft.Maps.Pushpin(OpenSMILWebPart.map.getCenter(), {
height: 50, width: 50
});
pin.customfield = 'customData';
Microsoft.Maps.Pushpin.prototype.setAttributes = function () {
this._attributes = arguments[0]
};
Microsoft.Maps.Pushpin.prototype.getAttributes = function () {
return this._attributes;
};
pin.setAttributes({ customObject: 'some data' });
pin.getAttributes();