Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade protomaps and use it for region mapping #6725

Closed
wants to merge 3 commits into from

Conversation

tephenavies
Copy link
Member

@tephenavies tephenavies commented Mar 14, 2023

What this PR does

Upgrading protomaps to support compressed tiles, pmtiles archive version 3 and using protomaps renderer for region mapping.

  • Remove MapboxVectorTileImageryProvider
  • Update ProtomapsImageryProvider to accept a feature info function similar to
    const getImageryLayerFeatureInfo = action(
    (
    style: TableStyle,
    feature: VectorTileFeature,
    currentTimeRows: number[] | undefined
    ) => {
    if (isDefined(style.regionColumn?.regionType?.uniqueIdProp)) {
    const regionType = style.regionColumn!.regionType!;
    const regionRows =
    style.regionColumn!.valuesAsRegions.regionIdToRowNumbersMap.get(
    feature.properties[regionType.uniqueIdProp]
    ) ?? [];
    const rowId = getImageryLayerFilteredRow(
    style,
    currentTimeRows,
    regionRows
    );
    if (!isDefined(rowId)) return;
    style.tableModel.tableColumns;
    const rowObject = style.tableModel.tableColumns.reduce<{
    [key: string]: string | number | null;
    }>((obj, column) => {
    obj[column.name] = column.valueFunctionForType(rowId);
    return obj;
    }, {});
    // Preserve values from d and insert feature properties after entries from d
    const featureData = Object.assign(
    {},
    rowObject,
    feature.properties,
    rowObject
    );
    const featureInfo = new ImageryLayerFeatureInfo();
    if (isDefined(regionType.nameProp)) {
    featureInfo.name = featureData[regionType.nameProp] as string;
    }
    featureData.id = feature.properties[regionType.uniqueIdProp];
    featureInfo.properties = featureData;
    const terriaFeatureData: TerriaFeatureData = {
    rowIds: isJsonNumber(regionRows) ? [regionRows] : [...regionRows],
    type: "terriaFeatureData"
    };
    featureInfo.data = terriaFeatureData;
    featureInfo.configureDescriptionFromProperties(featureData);
    featureInfo.configureNameFromProperties(featureData);
    return featureInfo;
    }

Test me

Checklist

  • There are unit tests to verify my changes are correct or unit tests aren't applicable (if so, write quick reason why unit tests don't exist)
  • I've updated relevant documentation in doc/.
  • I've updated CHANGES.md with what I changed.
  • I've provided instructions in the PR description on how to test this PR.

@AnaBelgun
Copy link
Member

Update 15 March:

  • testing before PR review and merge

@tephenavies
Copy link
Member Author

Doesn't work with feature information properly yet. CSV values are missing from the table but vector tile attributes are making it through.

@AnaBelgun
Copy link
Member

@steve9164 check this #7144 / talk to @nf-s

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ tephenavies
❌ nf-s
You have signed the CLA already but the status is still pending? Let us recheck it.

@nf-s
Copy link
Contributor

nf-s commented Dec 10, 2024

Bumped into #7144

@nf-s nf-s closed this Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants