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

Implementing mapbox in Business Text #335

Closed
yosiasz opened this issue Jul 12, 2024 · 4 comments · Fixed by VolkovLabs/volkovlabs.io#723
Closed

Implementing mapbox in Business Text #335

yosiasz opened this issue Jul 12, 2024 · 4 comments · Fixed by VolkovLabs/volkovlabs.io#723
Assignees
Labels
question Further information is requested
Milestone

Comments

@yosiasz
Copy link

yosiasz commented Jul 12, 2024

@mikhail-vl if you want to add it to docu

import("https://cdn.jsdelivr.net/npm/[email protected]/+esm").then(({ default: mapboxGl }) => {
  console.log('mapboxgl', mapboxGl)
  mapboxGl.accessToken = 'pk.eyJ1IjoieW9zaWFzeiIsImEiOiJjbHlpN2Z5em8wY2JoMmtwdGJrbjVtcDZ6In0.BbnHKs0rxyxrJrHAtleoBA';
  const map = new mapboxGl.Map({
    // Choose from Mapbox's core styles, or make your own style with Mapbox Studio
    style: 'mapbox://styles/mapbox/light-v11',
    center: [-74.0066, 40.7135],
    zoom: 15.5,
    pitch: 45,
    bearing: -17.6,
    container: 'map',
    antialias: true
  });

  map.on('style.load', () => {
    // Insert the layer beneath any symbol layer.
    const layers = map.getStyle().layers;
    const labelLayerId = layers.find(
      (layer) => layer.type === 'symbol' && layer.layout['text-field']
    ).id;

    // The 'building' layer in the Mapbox Streets
    // vector tileset contains building height data
    // from OpenStreetMap.
    map.addLayer(
      {
        'id': 'add-3d-buildings',
        'source': 'composite',
        'source-layer': 'building',
        'filter': ['==', 'extrude', 'true'],
        'type': 'fill-extrusion',
        'minzoom': 15,
        'paint': {
          'fill-extrusion-color': '#aaa',

          // Use an 'interpolate' expression to
          // add a smooth transition effect to
          // the buildings as the user zooms in.
          'fill-extrusion-height': [
            'interpolate',
            ['linear'],
            ['zoom'],
            15,
            0,
            15.05,
            ['get', 'height']
          ],
          'fill-extrusion-base': [
            'interpolate',
            ['linear'],
            ['zoom'],
            15,
            0,
            15.05,
            ['get', 'min_height']
          ],
          'fill-extrusion-opacity': 0.6
        }
      },
      labelLayerId
    );
  });
})

based on
https://docs.mapbox.com/mapbox-gl-js/example/3d-buildings/

image

@yosiasz
Copy link
Author

yosiasz commented Jul 12, 2024

chrome-capture-2024-7-11 (1)

@yosiasz yosiasz changed the title mapbox implementing mapbox in Business Chart Jul 12, 2024
@mikhail-vl mikhail-vl self-assigned this Jul 13, 2024
@mikhail-vl mikhail-vl added the question Further information is requested label Jul 13, 2024
@mikhail-vl
Copy link
Member

@yosiasz Thank you, I will add it to the documentation.

Please send us more!

@mikhail-vl
Copy link
Member

@yosiasz Why you decided to do it in the Business Charts instead of Business Text?

@yosiasz
Copy link
Author

yosiasz commented Jul 13, 2024 via email

@mikhail-vl mikhail-vl transferred this issue from VolkovLabs/business-charts Jul 15, 2024
@github-project-automation github-project-automation bot moved this to In review in Business Suite Jul 15, 2024
@mikhail-vl mikhail-vl changed the title implementing mapbox in Business Chart Implementing mapbox in Business Text Jul 15, 2024
@mikhail-vl mikhail-vl added this to the Text 5.2.0 milestone Jul 15, 2024
@github-project-automation github-project-automation bot moved this from In review to Done in Business Suite Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants