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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

steve9164
Copy link
Member

@steve9164 steve9164 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

@steve9164
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.

@nf-s nf-s mentioned this pull request May 7, 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.

None yet

3 participants