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

MaplibreGL broken river rendering #463

Closed
MightyPork opened this issue Sep 25, 2024 · 10 comments · Fixed by #464
Closed

MaplibreGL broken river rendering #463

MightyPork opened this issue Sep 25, 2024 · 10 comments · Fixed by #464

Comments

@MightyPork
Copy link

MightyPork commented Sep 25, 2024

I opened the issue here maplibre/maplibre-gl-js#4763 but maybe it is a bug in this repo instead. More details are in the other issue.

Screenshot_20240925_123854

the map file was grabbed today using this command:

pmtiles extract https://build.protomaps.com/20240924.pmtiles my_area.pmtiles --bbox=14.566343,50.150491,14.761007,50.243677

I get the same broken rendering with your example html file, completely unchanged outside of editing the source link and coordinates.

This bug does not reproduce with the example file https://pmtiles.io/protomaps(vector)ODbL_firenze.pmtiles

my pmtiles command line tool is installed from AUR, version 1.20.0

@bdon
Copy link
Member

bdon commented Sep 25, 2024

Hi, which example HTML file are you using?

The issue is definitely in here, I am merging in the breaking 4.0 major version changes and some layers have mixed geometry types so we need to add geometry filters to the styles.

@MightyPork
Copy link
Author

this one https://github.com/protomaps/PMTiles/blob/main/js/examples/maplibre.html

you can also see it live on my test page, it's all static files on apache and some CDN for assets

https://bits.ondrovo.com/osm/

@bdon
Copy link
Member

bdon commented Sep 25, 2024

you need to modify the water rule to have a filter on geometry type:

id: "water",
type: "fill",
filter: ["==", ["geometry-type"], "Polygon"],

I will work on updating the examples

@MightyPork
Copy link
Author

So basically the tiles contain closed lines (polygons) as well as open lines and the bug was that it closed the open lines using the fill style?

@MightyPork
Copy link
Author

the fix works perfectly 👍

@bdon
Copy link
Member

bdon commented Sep 25, 2024

yes, exactly. This has to do with the Basemaps repo which generates the 20240924.pmtiles in the public bucket, I'm making a new major revision of the tileset which changes the layers around. So examples written against the previous revision (v3) may be affected, thanks for working through this and let me know if you encounter similar issues.

@MightyPork
Copy link
Author

hmmm, I added (guessed) more styles using the reference at https://maplibre.org/maplibre-style-spec/ and now I also see little streams and possibly other features. These completely disappeared with adding the filter for fill.

Screenshot_20240925_161230

[
      {
                        "id": "water2",
                        "source": "selfhosted",
                        "source-layer": "water",
                        "type": "line",
                        "filter": ["==", ["geometry-type"], "LineString"],
                        "paint": {
                            "line-color": "#80b1d3",
                        },
                    },
                    {
                        "id": "water3",
                        "source": "selfhosted",
                        "source-layer": "water",
                        "type": "line",
                        "filter": ["==", ["geometry-type"], "MultiLineString"],
                        "paint": {
                            "line-color": "#80b1d3",
                        },
                    },
                    {
                        "id": "water4",
                        "source": "selfhosted",
                        "source-layer": "water",
                        "type": "fill",
                        "filter": ["==", ["geometry-type"], "MultiPolygon"],
                        "paint": {
                            "fill-color": "#80b1d3",
                        },
                    },
]

Is there a good-to-use-as-is style compatible with the v4 format I could use instead of trying to make my own?

@bdon
Copy link
Member

bdon commented Sep 25, 2024

Should be fixed by #464

the new style for v4 is not on NPM yet but you can either copy-paste it from maps.protomaps.com Get Style JSON or you can check out http://github.com/protomaps/basemaps repo and run npm run generate-styles in the styles/ directory. For V4 the serialized JSON style has a version per chosen language (en, de etc) in dist/styles

@MightyPork
Copy link
Author

If I want the map to use local names (I'm making maps for Czech Republic, so e.g. Labe instead of Elbe)... I will have to generate my own planet file first, or the language in styles somehow does this? Or it just changes what font is used?

@bdon
Copy link
Member

bdon commented Sep 26, 2024

If you run generate-styles there should be a file like dist/light/cs.json which is the Czech localized version of the style. The planet tileset is the same for all languages.

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 a pull request may close this issue.

2 participants