Forum Discussion
Load GeoJson Map to capabilities.json
- 8 years ago
Regarding the first question you should follow these steps:
- Take a look at this topic to find out more about JS File API
- Define a text property at capabilities.json
"objects": { "internalState": { "displayName": "Internal State", "properties": { "geojsonMap": { "displayName": "geojsonMap", "type": { "text": true } } } } }- Call persistProperties method of host
function save(host: IVisualHost, value: string) { host.persistProperties(<VisualObjectInstancesToPersist>{ merge: [{ objectName: "internalState", selector: null, properties: { geojsonMap: value || "" } }] }); }Regarding the second question.
You should prepare type definitions for you function. Another way is to use TS file instead of JS.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
v-viig thank you for your answer
so what are the alternatives shall I load my map from external ressource with https ? is there any alternative ? Can I load the map from the field pane ? There is already a visual (Shape map) that uses loading through Format Pane. isn't it possible for everybody ? Can't I simply include my map as a js code inside the dependance node_modules and include it in pbiviz.json ?
It isn't possible for custom visuals unfortunately.
There're a few options:
- Load it from an external resource that uses HTTPS
- Keep maps in Power BI data-set and then apply data to the visual. The data would be avialable in the update method
- You can use JS File API to load from local device/PC
- Keep it in an external JS and include into pbiviz.json
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals