Skip to content

Add polylines with geographic coordinates #3547

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

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

Conversation

adrian-cojocaru
Copy link
Collaborator

@adrian-cojocaru adrian-cojocaru commented Jun 11, 2025

Enable adding polylines with geographic coordinates for custom drawables

@adrian-cojocaru adrian-cojocaru changed the title Add polylines in geographic coordinates Add polylines with geographic coordinates Jun 11, 2025
Copy link

github-actions bot commented Jun 11, 2025

Bloaty Results 🐋

Compared to main

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0% +20.7Ki  +0.0% +6.96Ki    TOTAL

Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results/pr-3547-compared-to-main.txt

Compared to d387090 (legacy)

    FILE SIZE        VM SIZE    
 --------------  -------------- 
   +33% +38.1Mi  +448% +26.7Mi    TOTAL

Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results/pr-3547-compared-to-legacy.txt

Copy link

github-actions bot commented Jun 11, 2025

Benchmark Results ⚡

Benchmark                                                     Time             CPU      Time Old      Time New       CPU Old       CPU New
------------------------------------------------------------------------------------------------------------------------------------------
OVERALL_GEOMEAN                                            +0.0048         +0.0049             0             0             0             0

Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/benchmark-results/pr-3547-compared-to-main.txt

Copy link

Bloaty Results (iOS) 🐋

Compared to main

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  [ = ]       0  [ = ]       0    TOTAL

Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results-ios/pr-3547-compared-to-main.txt

@@ -519,8 +519,23 @@ util::SimpleIdentity CustomDrawableLayerHost::Interface::addPolyline(const LineS

switch (shaderType) {
case LineShaderType::Classic: {
// TODO: build classic polyline with Geo coordinates
return util::SimpleIdentity::Empty;
// build classic polyline with Geo coordinates
Copy link
Collaborator

Choose a reason for hiding this comment

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

This was left out because the transformation matrixes don't have enough precision at global scale with the standard shader, but it's handled in the Wide Vector.

Copy link
Collaborator

Choose a reason for hiding this comment

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

check out the usage of diff matrixes to enhance precision in wide vector metal shader

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is mostly a backup for platforms/backends that don't have WideVector implementations (yet).

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok, but you should check the results, as the lack of precision makes it really unusable past a certain zoom level.

Copy link
Collaborator

Choose a reason for hiding this comment

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

could we document this limitation, in code comments or other docs?

Copy link
Collaborator Author

@adrian-cojocaru adrian-cojocaru Jun 12, 2025

Choose a reason for hiding this comment

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

I'm thinking of moving this bit in the example code (with comments) and removing the line type selection on addPolyline (global) for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've been looking over the different matrices, but only mvpMatrix is used in the shader and this should be the tile matrix (same as the line shader). Is there something else that I'm missing or the extra precision is from the different input types (float3 vs short2)?

Copy link
Collaborator

Choose a reason for hiding this comment

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

indeed, looks like the diff is not used in the final version.
if the geometry is stable at zoom >= 20 then go ahead with the changes

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.

2 participants