# Geotiles and Partitioning

## Operations with Single Objects

The HERE Geotiles package offers a collection of utility functions to help you operate with data that is partitioned using the HERETile tiling scheme. The terms "tile" and "tile ID" equate to the integer (long) key of a HereQuad as described in reference above.

Capabilities include:

• Finding tile that contains a given geographic point
• Finding all tiles partially or wholly included inside a given bounding box
• Finding all tiles partially or wholly included inside a given Shapely geometry
• Obtaining list of ancestor and descendant tiles
• Obtaining list of neighboring tiles
• Retrieving the boundary of a given tile
• Checking if given tile is a descendant or parent of another
• Checking validity of a tile ID

See examples, below. For details of all methods, see the API documentation.

### Note

Notice that when dealing with latitude/longitude coordinate pairs, all methods take longitude as first argument of the two. This is in keeping with the conventions used by Shapely.

import here.geotiles.heretile as ht
from shapely.geometry import Polygon

# Which level 10 tile contains point 41.88429530213, -87.63881888707832?
tile10 = ht.from_coordinates(-87.63881888707832, 41.88429530213, 10)
print(tile10)
1255998

# List all of tile10's level 12 descendants
for i in ht.descendants(tile10, 12):
print(i)
20095968
20095969
20095972
20095973
20095970
20095971
20095974
20095975
20095976
20095977
20095980
20095981
20095978
20095979
20095982
20095983

# Get the boundary of tile10 as a Shapely Polygon
print(ht.get_polygon(tile10))
POLYGON ((-87.5390625 41.8359375, -87.5390625 42.1875, -87.890625 42.1875, -87.890625 41.8359375, -87.5390625 41.8359375))


## Vectorized Operations

Analogous methods operating with (Geo)DataFrames instead of single objects are available in the here-geopandas_adapter-geotiles package. This subpackage will be included if you install here-geopandas_adapter. See the API documentation for details.