Map Tile API Developer's Guide

Combine Building Metainfo from Several Tiles

This article shows example of combining building metainfo from several tiles.

User story

In order to make buildings on the map interactive (highlight upon selection, etc.) user obtains metadata information about images, containing different parts of the same building.

Original map tiles

In most of the cases buildings are split between several tiles, e.g. building from Metainfo Tile with Extruded Buildings example consist of two parts (original tile and tile to the left from it):

https://2.base.maps.cit.api.here.com
/maptile/2.1/maptile/newest/normal.day/19/281707/171901/256/png8
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
https://2.base.maps.cit.api.here.com
/maptile/2.1/maptile/newest/normal.day/19/281706/171901/256/png8
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
To find out that those two parts are actually connected (belong to the same building), user needs to request metainfo for original tile and for the adjoining tiles as well.

See Metainfo Tile with Extruded Buildings for metainfo request details.

Processing Metainfo Tile Response

Assuming the response to the request for original tile delivered the following Metainfo Tile as a JSON object:


{ "metadata" : {
"street labels":[  ],
"labels":[],
"city center labels":[],
"buildings":[ { "id": "1609441356716643099", "vertices": [ 37, 161.69, 18, 199.50, 0, 189.18, 0, 142.78 ], "polygons": [ [ 0, 1, 2, 3]], "outlines": [ [ 0, 1, 2 ], [ 3, 0 ]] } ],
"transit stops":[  ],
"POIs":[  ]
}
}

One can see that a single polygon for the building is cut at the left border of the tile. That means that the building might have other parts on the tile to the left from original one.

Given the fact that in building JSON objects from different tiles will share the same "id" if they belong to the same building, it is easy to identify whether there are other parts of the buildings:

https://2.base.maps.cit.api.here.com
/maptile/2.1/maptile/newest/normal.day/19/281706/171901/256/png8
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&metadata=metaonly
&mgen=2

{ "metadata" : {
"street labels":[ { "name":"Danziger Straße", "font size":"13", "vertices": [ 38.21, -18.57, 79.17, 4.82, 88.82, 10.34, 121.50, 30.46 ] } ],
"labels":[{ "name": "111", "type":"TEXT", "bounding boxes": [ { "annotation box":[ 146.69, 139.41, 26.62, 16.75 ] } ] }],
"city center labels":[],
"buildings":[ { "id": "1609441356716643099", "sectors": [ { "info": { "bottom height": 0, "height": 6.125 }, "vertices": [ 248, 138.69, 243, 146.91, 231, 174.84, 256, 189.18, 256, 142.78, 219, 197.88, 125, 82.78, 99, 132.09 ], "polygons": [ [ 0, 1, 2, 3, 4], [ 5, 2, 1, 6, 7]], "outlines": [ [ 2, 5, 7, 6, 1, 0, 4 ], [ 3, 2 ]] } ] } ],
"transit stops":[  ],
"POIs":[  ]
}
}

Now it is easy to perform search within "buildings" array and find out that it contains JSON object with the same "id" value ("1609441356716643099").

This way you can combine polygons from both tiles and reflect the whole building's shape, merging polygons.

Figure 1. Building shape reflected using metadata
Figure 2. Original building image (2 tiles)
Figure 3. Example of a highlighted building image

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.