メインコンテンツまでスキップ

Data explorer

Explore Mapbox’s location data. Each map vector tile includes high levels of detail about a particular location or building that you can leverage for procedurally generating experiences or styling. The data layers include building data, points of interest (POIs), roads, and real-time traffic data. You can filter these data layers on and off as needed in the Map Editor (access through the Mapbox menu). This article explains how to use vector tiles to generate 3D features and use metadata in your application or game.

Data layers

The data explorer example scene uses a combination of the Mapbox 3D Buildings and Mapbox Streets v7 tilesets to visualize a large array of features. As shown in the screenshot below, you can specify multiple data sources by selecting Custom as the Data Source, then adding multiple comma-separated tileset IDs in the Map Ids field. This allows you to use multiple custom tilesets, or add your custom tileset as well as the default Mapbox Streets tileset. For more information on how to use custom data with the Maps SDK for Unity, refer to the custom data documentation.

The scene has a comprehensive list of Map Features as shown in the screenshot below. This article will cover the features rendered using the Buildings, Roads, and POI layers specifically.

Buildings

To see how the buildings are configured in this scene, navigate to Map Features > Features and click on the Feature named Buildings. In this example the there are customizations to the Modeling and Texturing settings as described below. For more information on possible configurations, see the map features documentation for buildings.

  • Data Layer: The layer name in the tileset that contains building footprints. In the tileset, this is called building.

  • Filters: The are no filters configured for this example. See the traffic and directions example for more information on how you can set up filters.

  • Modeling: In the modeling section, you can make changes to the settings to fine tune your meshes.

    • Primitive Type: Vector data is comprised of lines, polygons, points, or custom data. The primitive type defines the type of vector feature you are trying to access. In the case of buildings this will be “polygon” since building footprints are essentially polygons extruded by a height value.

    • Extrusion Type: The extrusion type setting provides a way to specify max, min, or fixed heights for buildings. The available options are below. You will see different settings in the inspector depending on these dropdown selections. For this example Max Height is specified.

    • Geometry Type: Settings to extrude roofs, sidewalls, or both.

    • Property Name: The name of the property on the building layer of the tileset that is used for extrusion. Property Name defaults to height. For more information see the Mapbox Streets v7 tileset layer reference.

    • Scale Factor: The height scale factor by which you would like to extrude the buildings. For example, if Scale Factor is 2, the building extrusions will be rendered at twice the original scale.

    • Snap to Terrain: This makes sure buildings snap properly to the terrain when using a terrain with elevation. When this is not checked, the buildings might spawn above or below the terrain.

    • Combine Meshes: Check this option if you want to combine all the building meshes on a tile into a single game object. While this helps improve runtime performance, it may not offer you flexibility to make changes on individual buildings (for example, changing the color or texture of a particular building). It may also make it impossible to use a raycast to find the address of a building.

    • Collider Type: This option is used to add a collider to the extruded buildings. The available types of colliders that you can apply to your buildings are Box Collider, Mesh Collider, or Sphere Collider. Note that if you have Combine Meshes selected, this option will add a collider to the entire tile instead of to individual buildings.

  • Texturing: Texturing settings are where you can configure material options for the building geometry.

    • Style Type: The Simple type is specified. The Simple style combines stylized vector designs with scriptable palettes to create a procedurally colored style.
    • Palette Type: City is specified. For more information on possible Palette Type settings, see the map texturing documentation.
  • Behavior Modifiers: Behavior modifiers are ScriptableObjects that work with meshes and game objects to further allow you to decorate, enhance, or make modifications to your game objects. There are no modifiers added to this feature. For an example of a feature that uses a modifier, see the POI feature of this example.

Roads

To see how the buildings are configured in this scene, navigate to Map Features > Features and click on the Feature named Roads. In this example the there are customizations to the Modeling and Texturing settings as described below:

  • Data Layer: The layer name in the tileset that contains road data. In the tileset, this is called road.

  • Filters: The are no filters configured for this example. See the traffic and directions example for more information on how you can set up filters.

  • Modeling: In the modeling section, you can make changes to the settings to fine tune your meshes.

    • Primitive Type: The primitive type defines the type of vector feature you are trying to access. For roads, the value of Primitive Type is Line.

    • Line Width: This is the setting for the width of the road line feature. In this example it's value is 3.

    • Extrusion Type: The extrusion type setting provides a way to specify max, min, or fixed heights for the feature. For roads, this is usually set to Absolute height to give a fixed height value.

    • Geometry Type: Settings to extrude the top part of the roads, and, if necessary, to render their side walls. This will give the roads a width.

    • Scale Factor: The height scale factor by which you would like to visualize the roads. For example, if set to 2, the road's width and line height will be twice the original scale.

    • Snap to Terrain: This makes sure roads snap properly to the terrain while using a terrain with elevation. When this is not checked, the roads might spawn above or below the terrain.

    • Combine Meshes: Check this option if you want to combine all the road meshes on a tile into a single game object. While this helps improve runtime performance, it may not offer you flexibility to make changes to individual roads (for example, changing the color or texture of a particular road). It may also make it impossible to use a raycast to find the address of a road.

    • Collider Type: This option is used to add a collider to a road. The available types of colliders that you can apply to your roads are Box Collider, Mesh Collider, or Sphere Collider. Note that if you have the Combine Meshes selected, this option will add a collider to the entire tile instead of to individual roads.

  • Texturing: Texturing settings are where you can configure material options for the building geometry.

    • Style Type: A Custom type is specified. When Custom is selected, materials must be assigned.

    • Texturing Type: Tiled is specified for this example.

    • Top Material: This is the material selected for the top of the road features.

    • Side Material: This is the material selected for the sides of the road features.

  • Behavior Modifiers: Behavior modifiers are ScriptableObjects that work with meshes and game objects to further allow you to decorate, enhance, or make modifications to your game objects. There are no modifiers added to this feature. For an example of a feature that uses a modifier, see the POI feature of this example.

POIs

To see how the buildings are configured in this scene, navigate to Map Features > Features and click on the Feature named PoiLabels. In this example the there are customizations to the Filters, Modeling, and Behavior Modifiers settings as described below.

  • Data Layer: The layer name in the tileset that contains POI data. In the tileset, this is called poi_label.

  • Filters: Using filters you can make settings to conditionally render vector features contained in the poi_label layer. Using filters in this way allows for controlling the POI label density in the scene.

    • Key: localrank is specified. This value comes from the poi_label layer in the tileset.
    • Operator: Is Equal is selected. Other options are Contains, Is Greater, Is Less, and Is in Range are other possible options.
    • Num Value: 1 is specified. This means that only the most important place in each cell will be rendered.
  • Modeling: In the modeling section, you can make changes to the settings to fine tune your meshes.
    • Primitive Type: The primitive type defines the type of vector feature you are trying to access. For POIs, the Primitive Type is Point.
    • Snap to Terrain: This makes sure points snap properly to the terrain while using a terrain with elevation. When this is not checked, the points might spawn above or below the terrain.
    • Combine Meshes: Check this option if you want to combine all the points on a tile into a single game object. While this helps improve runtime performance, it may not offer you flexibility to make changes to, or interact with individual points.
  • Behavior Modifiers:
    • Feature Position: This setting is for selecting where in the tile the feature will be placed.
    • Mesh Modifiers: No modifiers are configured for this scene. For an example of how Mesh Modifiers can be used, see the astronaut game example.
    • Game Object Modifiers: This scene makes use of a PrefabModifier which allows you to specify a prefab game object to be spawned at each point. Click on the modifier to inspect the settings and/or edit the prefab.

Clicking Add New will open a dialogue that has all the available modifiers so that they can be added to the feature and configured.

このexampleは役に立ちましたか?