Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

Load GeoJson Map to capabilities.json

Hello,

 

I'm currently developing a custom visual, so I'm looking to load a geojson map through capabilities.json. My question is: how can I achieve that ? Shall I just consider the map as measure ?

 

Thank you,

  • v-viig's avatar
    v-viig
    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
                    }
                }
            }
        }
    }
    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

    [email protected]

24 Replies