Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Mapboxgl load Martin generated vector slices, small-scale automatic simplification, how to solve? #1046

Closed
szygiser opened this issue Dec 7, 2023 · 16 comments
Labels

Comments

@szygiser
Copy link

szygiser commented Dec 7, 2023

b6cc18b4cf88b6ad7af92e2f3a8f792

Mapboxgl load Martin generated vector slices, small-scale automatic simplification, how to solve?

@nyurik
Copy link
Member

nyurik commented Dec 7, 2023

@szygiser I do not understand the question. Please provide more details

@nyurik nyurik added the question label Dec 7, 2023
@szygiser
Copy link
Author

szygiser commented Dec 8, 2023

@szygiser I do not understand the question. Please provide more details

I used mpboxgl to load the vector tiles of the line layer generated by Martin. When I reduced the map scale, the line layer became blurred。

@szygiser
Copy link
Author

szygiser commented Dec 8, 2023

@szygiser I do not understand the question. Please provide more details

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Add a third party vector tile source</title>
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
    <link href="https://api.mapbox.com/mapbox-gl-js/v2.14.1/mapbox-gl.css" rel="stylesheet">
    <script src="https://api.mapbox.com/mapbox-gl-js/v2.14.1/mapbox-gl.js"></script>
    <style>
        body {
            margin: 0;
            padding: 0;
        }

        #map {
            position: absolute;
            top: 0;
            bottom: 0;
            width: 100%;
        }
    </style>
</head>
<body>
<div id="map"></div>
<script>
    // TO MAKE THE MAP APPEAR YOU MUST
    // ADD YOUR ACCESS TOKEN FROM
    // https://account.mapbox.com
    mapboxgl.accessToken = 'pk.eyJ1Ijoic29uZ3plbmd5dSIsImEiOiJjbGo0ZDM0bmMwMTBzM2RreGlqMXNsc2YwIn0.ik-fY3Yx7mRu02ySZnjavQ';
    const map = new mapboxgl.Map({
        container: 'map',
        // Choose from Mapbox's core styles, or make your own style with Mapbox Studio
        style: 'mapbox://styles/mapbox/light-v11',
        zoom: 10,
        center: [117.110805, 36.663046],
        projection: 'mercator',
        antialiased: true,
        hash: true,
        minTileCacheSize: 512,
        collectResourceTiming: true,
        cooperativeGestures: false,
        crossSourceCollisions: true,
        refreshExpiredTiles: true,
        trackResize: false
    });

    map.on('load', () => {
            addMvt();
        }
    );

    map.addControl(new mapboxgl.NavigationControl());

    function addMvt() {
        map.addLayer({
            id: 'lines',
            type: 'line',
            source: {
                type: 'vector',
                url: 'http://localhost:3000/ghgas_pipesectionhpa'
            },
            'source-layer': 'ghgas_pipesectionhpa',
            paint: {
                'line-opacity': 1,
                'line-color': 'rgb(53, 175, 109)',
                'line-width': 2
            }
        });
    }
</script>
</body>
</html>

@nyurik
Copy link
Member

nyurik commented Dec 8, 2023

I don't know for sure - the way you look the mapbox lib seems ok (i'm not an expert), esp since you use v2 that i have never used (maplibre was forked from v1). I think this is not a Martin issue. Martin generates tiles as MVT vectors for each zoom level. As you zoom in/out, you will get a different tile with different data. Bluriness is not part of it unless mapbox did something weird(?).

@sharkAndshark
Copy link
Collaborator

sharkAndshark commented Dec 8, 2023

Hi @szygiser ,Would you mind to share your data here? Or would you like to share your SQL if it's a function source?

@szygiser
Copy link
Author

szygiser commented Dec 8, 2023 via email

@szygiser
Copy link
Author

szygiser commented Dec 8, 2023 via email

@nyurik
Copy link
Member

nyurik commented Dec 8, 2023

@szygiser please use github web interface. Your email do not get through correctly (i fixed one of your emails). The data did not come in.

@szygiser
Copy link
Author

szygiser commented Dec 8, 2023

@szygiser please use github web interface. Your email do not get through correctly (i fixed one of your emails). The data did not come in.
hpa.gdb.zip

@szygiser
Copy link
Author

szygiser commented Dec 8, 2023

Hi @szygiser ,Would you mind to share your data here? Or would you like to share your SQL if it's a function source?

hpa.gdb.zip

@sharkAndshark
Copy link
Collaborator

@szygiser What's the Spatial Reference here? There's no spatial reference information in your gdb file.

@szygiser
Copy link
Author

szygiser commented Dec 14, 2023 via email

@szygiser
Copy link
Author

@szygiser What's the Spatial Reference here? There's no spatial reference information in your gdb file.
you can also use the shp file. the Spatial Reference of this file is WGS84.
shp.zip

@sharkAndshark
Copy link
Collaborator

I duplicate it with our debug.thml @nyurik Just import the shp.zip and run martin then move to /8/211/99

image

@sharkAndshark
Copy link
Collaborator

sharkAndshark commented Dec 14, 2023

And I saved the 7/105/49(need to remove the .txt )

z7x105y49.mvt.txt

@sharkAndshark
Copy link
Collaborator

sharkAndshark commented Dec 14, 2023

That's because they are all too small so postgis droped them @szygiser
If you merged all lines into one single, it looks normal:
image

@maplibre maplibre locked and limited conversation to collaborators Dec 17, 2023
@nyurik nyurik converted this issue into discussion #1077 Dec 17, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

3 participants