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

Feat maplib #2679

Merged
merged 4 commits into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
// typescript auto-format settings
"typescript.tsdk": "node_modules/typescript/lib",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
"editor.formatOnSave": true,
"[typescript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added __tests__/integration/snapshots/heatmap_grid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added __tests__/integration/snapshots/line_arc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added __tests__/integration/snapshots/line_arc3D.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added __tests__/integration/snapshots/line_flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added __tests__/integration/snapshots/line_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added __tests__/integration/snapshots/line_simple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added __tests__/integration/snapshots/line_wall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added __tests__/integration/snapshots/mask_multi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added __tests__/integration/snapshots/mask_single.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added __tests__/integration/snapshots/point_column.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added __tests__/integration/snapshots/point_fill.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added __tests__/integration/snapshots/point_text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added __tests__/integration/snapshots/polygon_fill.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/demos/bugfix/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export { setColor } from './set-color';
export { setData } from './set-data';
export { setSize } from './set-size';
export { textOffsets } from './text-offsets';
export { tileText } from './tile-text';
export { tileUpdate } from './tile-update';
export { touchEvent } from './touch-event';
83 changes: 83 additions & 0 deletions examples/demos/bugfix/tile-text.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import { LineLayer, PointLayer, PolygonLayer, Source, TileDebugLayer } from '@antv/l7';
import type { TestCase } from '../../types';
import { CaseScene } from '../../utils';

export const tileText: TestCase = async (options) => {
const scene = await CaseScene({
...options,
mapConfig: {
center: [120.212089, 30.289822],
zoom: 12.83,
},
});
const debugerLayer = new TileDebugLayer();

const source = new Source(
'https://spatialservice.alipay.com/serve_vector_tile/f/merge117/{z}/{x}/{y}.mvt',
{
parser: {
type: 'mvt',
tileSize: 256,
maxZoom: 14,
extent: [-180, -85.051129, 179, 85.051129],
},
},
);

const layer = new PolygonLayer({
// featureId: 'COLOR',
sourceLayer: 'county', // woods hillshade contour ecoregions ecoregions2 city
})
.source(source)
.shape('fill')
.color('#1677ff')
.style({
opacity: 0.6,
});

const linelayer = new LineLayer({
// featureId: 'COLOR',
sourceLayer: 'county', // woods hillshade contour ecoregions ecoregions2 city
})
.source(source)
.shape('line')
.size(1)
.color('#1677ff')
.style({
opacity: 1,
});

const point = new PointLayer({
// featureId: 'COLOR',
sourceLayer: 'name', // woods hillshade contour ecoregions ecoregions2 city
})
.source(source)
.color('#542788')
.shape('circle')
.size(5)
.style({
opacity: 1,
});

const pointtext = new PointLayer({
featureId: 'id',
sourceLayer: 'name', // woods hillshade contour ecoregions ecoregions2 city
})
.source(source)
.color('red')
.shape('name', 'text')
.size(12)
.style({
textOffsets: [0, -10],
textAllowOverlap: false,
opacity: 1,
});
scene.addLayer(debugerLayer);
scene.addLayer(layer);
scene.addLayer(linelayer);
scene.addLayer(point);
scene.addLayer(pointtext);
console.log(pointtext);

return scene;
};
2 changes: 1 addition & 1 deletion packages/source/src/parser/geojson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function getFeatureID(feature: Feature<Geometries, Properties>, key?: string) {
}

// @ts-ignore
if (typeof (feature.properties[key] * 1) === 'number') {
if (!isNaN(feature.properties[key] * 1)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change from typeof (feature.properties[key] * 1) === 'number' to !isNaN(feature.properties[key] * 1) is a more reliable way to check if the property can be converted to a number. This change improves type checking and prevents potential errors when the property is not a valid number.

// @ts-ignore
return feature.properties[key] * 1;
}
Expand Down
Loading