Skip to content

Foreground extrusions missing with vector tile returned by the vector tile search API #86560

@thibaultclem

Description

@thibaultclem

Elasticsearch Version

8.2.0

Installed Plugins

No response

Java Version

bundled

OS Version

Elastic Cloud on GCP

Problem Description

We use Mapbox GL JS to retrieve tiles from the new vector tile search API.

Everything work as expected until we try to extrude the features to display it in 3D:

map.addLayer({
          id: 'building_layer',
          type: "fill-extrusion",
          source: 'building_source',
          minzoom: 12,
          "source-layer": "hits",
          paint: {
            "fill-extrusion-color": "#00ade6",
            "fill-extrusion-height": 2,
          },
        });

As you can see on the image, the foreground extrusions is missing:
Screen Shot 2022-05-06 at 4 44 36 PM

When I decode the tile using node-mapnik I get:

[{"name":"hits","extent":4096,"version":2,"features":[{"type":3,"properties":{"_id":"59633","_index":"building-v1","id":59633,"gross_floor":180,"floor_nb":2,"unit_nb":1,"protected_rank":0,"principal_type":"Zone d'habitation de très faible densité","city_name":"La Tour-de-Peilz"},"geometry":[9,934,5244,26,22,18,6,7,21,17,15]}]},{"name":"meta","extent":4096,"version":2,"features":[{"type":3,"properties":{"_shards.failed":0,"_shards.skipped":0,"_shards.successful":1,"_shards.total":1,"timed_out":false,"took":1},"geometry":[9,0,8192,26,8192,0,0,8191,8191,0,15]}]}]

Then when I try to get the validity report of this tile with node-mapnik I got the following error:

[Error: Vector Tile has POLYGON with first ring clockwise. It is not valid according to v2 of VT spec.]

As @iverase mentionned it here, this looks very similar to the bug fixed in the upstream library you are using and seems the fix has never been released:
wdtinc/mapbox-vector-tile-java#36

Steps to Reproduce

Create any index with a geoshape:

PUT /extrusion_issue
{
  "mappings": {
    "properties": {
      "location": {
        "type": "geo_shape"
      }
    }
  }
}

Insert a document with polygon:

POST /extrusion_issue/_doc
{
  "location" : {
    "type" : "Polygon",
    "coordinates" : [
        [
          [
            6.865488747,
            46.459649483
          ],
          [
            6.865734629,
            46.459515699
          ],
          [
            6.865794859,
            46.45956863
          ],
          [
            6.865549366,
            46.459702596
          ],
          [
            6.865488747,
            46.459649483
          ]
        ]
      ]
  }
}

Use mapbox GL JS to retrieve the tile form the vector tile search API and extrude the polygon:

map.addLayer({
          id: 'building_layer',
          type: "fill-extrusion",
          source: 'building_source',
          minzoom: 12,
          "source-layer": "hits",
          paint: {
            "fill-extrusion-color": "#00ade6",
            "fill-extrusion-height": 2,
          },
        });

Logs (if relevant)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Analytics/GeoIndexing, search aggregations of geo points and shapes>bugTeam:AnalyticsMeta label for analytical engine team (ESQL/Aggs/Geo)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions