magda icon indicating copy to clipboard operation
magda copied to clipboard

Post message in v8 terriajs format

Open mwu2018 opened this issue 4 years ago • 3 comments

Description

As a parent window, it will post the message to national map. The message is in v7 terriajs format. Once the national map is upgraded to v8 terriajs, the format must be changed to something similar to

{
  "catalog": [
    {
      "name": "Credit Licence Dataset - National Map",
      "type": "magda",
      "recordId": "dist-dga-548075a1-c36e-4837-bf26-cc00567b5c23",
      "url": "https://dev.magda.io/"
    }
  ],
  "baseMapName": "Positron (Light)"
}

Acceptance Criteria

When click on Open in national map, the item should be displayed in the national map.

Technical Notes

n/a

Out of Scope

n/a

mwu2018 avatar Oct 27 '20 00:10 mwu2018

@mwu2018 In order to support Magda internal storage files. I recently made some change to MagdaCatelogueItem.ts in magda-preview-map (See this PR) and it (not the button function but the preview map feature.) now sends the following to `magda-preview-map: See here

{
            initSources: [
                {
                    catalog: [
                        {
                            name: selectedDistribution.title,
                            type: "magda-item",
                            url: config.baseUrl,
                            storageApiUrl: config.storageApiUrl,
                            distributionId: selectedDistribution.identifier,
                            // --- default internal storage bucket name
                            defaultBucket: DATASETS_BUCKET,
                            isEnabled: true,
                            zoomOnEnable: true
                        }
                    ],
                    baseMapName: "Positron (Light)",
                    homeCamera: {
                        north: -8,
                        east: 158,
                        south: -45,
                        west: 109
                    },
                    corsDomains: [urijs(config.baseExternalUrl).hostname()]
                }
            ]
        }

We probably need to make sure terriaJs support those features. Otherwise, magda-preview-map repo still cannot be upgraded to the latest version TerriaMap (Otherwise, it will lose the internal storage support).

t83714 avatar Oct 28 '20 02:10 t83714

According to https://github.com/TerriaJS/terriajs/blob/magda-doc/doc/connecting-to-data/catalog-type-details/magda-distribution.md, the posted catalog format mush be like

    const catConfig = {
            initSources: [
                {
                    catalog: [
                        {
                            name: this.props.distribution.title,
                            type: "magda",
                            recordId: this.props.distribution.identifier,
                            url: config.baseExternalUrl
                        }
                    ],
                    workbench: ['//' + this.props.distribution.title]
                }
            ]
        };

mwu2018 avatar Nov 13 '20 03:11 mwu2018

And a better format to generate id:

{
initSources: [
                {
                    catalog: [
                        {
                            name: this.props.distribution.title,
                            type: "magda",
                            recordId: this.props.distribution.identifier,
                            url: config.baseExternalUrl,
                            id: "data.gov.au-postMessage-" + this.props.distribution.identifier
                        }
                    ],
                    workbench: ["data.gov.au-postMessage-" + this.props.distribution.identifier]
                }
            ]
}

t83714 avatar Nov 13 '20 04:11 t83714