public class

TileService

extends Object
java.lang.Object
   ↳ com.microstrategy.web.app.maps.TileService

Class Overview

The tile service reads the tile files and generates the map of tile id and shape ids. By default there is only one tile file named tiles.idx. If user generates extra tiles.idx files, the file can be added to the same folder where the tiles.idx is located and renamed as tiles1.idx or tiles2.idx etc. The tile data file is generated using offline script. The tiles info is generated at zoom level 8. We use Google mercader projection to calculate which tile a LatLng object belongs to or which tiles a bounding box contains.

Summary

Fields
protected static MapProjection projection
Public Constructors
TileService(String tileIndexFolder)
Class Constructor
Public Methods
List<String> filterShapesInTiles(LatLng southWest, LatLng northEast, int shapeType, List<String> shapeIds)
For a given bounding box and a given shape id array, find all the shapes that are in the shape id array and inside the given bounding box.
List<String> getShapesInTiles(LatLng southWest, LatLng northEast, int shapeType)
Retrieves all the shape ids in the bounding box for a given shape type.
Map<Integer, List<Integer>> getTilesMapForType(Integer shapeType)
Get the hash map of the tile ids and shape id list for a given type.
Protected Methods
static BoundingBox getBoundingBoxFromLatLngBounds(LatLng southWest, LatLng northEast, int zoomLevel)
Get the bounding box in pixel for the given south west and north east points in map at a given zoom level.
static List<Integer> getMapTiles(LatLng southWest, LatLng northEast, int zoomLevel)
The function returns a list of title ids at a given zoom level.
static Map<Integer, Map<Integer, List<Integer>>> loadShapes(String path)
Read the tile data from tile*.idx files and fetch the hash map data for a given shape type.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected static MapProjection projection

Public Constructors

public TileService (String tileIndexFolder)

Class Constructor

Parameters
tileIndexFolder The folder path where the tile.idx file is located

Public Methods

public List<String> filterShapesInTiles (LatLng southWest, LatLng northEast, int shapeType, List<String> shapeIds)

For a given bounding box and a given shape id array, find all the shapes that are in the shape id array and inside the given bounding box.

Parameters
southWest The south west of the bounding box.
northEast The north east of the bounding box.
shapeType The shape type.
shapeIds The candidate shape ids.
Returns
  • A filtered array of shape ids. The shapes are all inside the bounding box.

public List<String> getShapesInTiles (LatLng southWest, LatLng northEast, int shapeType)

Retrieves all the shape ids in the bounding box for a given shape type.

Parameters
southWest Bounding box south west point.
northEast Bounding box north east point.
shapeType The shape type.
Returns
  • An array of shape id strings

public Map<Integer, List<Integer>> getTilesMapForType (Integer shapeType)

Get the hash map of the tile ids and shape id list for a given type. The hash map is cached. If the cache is missing, it will go through the file reading process to repopulate the data.

Parameters
shapeType The shape type.
Returns
  • The hash map cached by our inner cache object.

Protected Methods

protected static BoundingBox getBoundingBoxFromLatLngBounds (LatLng southWest, LatLng northEast, int zoomLevel)

Get the bounding box in pixel for the given south west and north east points in map at a given zoom level.

Parameters
southWest The lat and lng of the south west point.
northEast The lat and lng of the north east point.
zoomLevel The current zoom level.
Returns
  • The bounding box in pixel after google projection

protected static List<Integer> getMapTiles (LatLng southWest, LatLng northEast, int zoomLevel)

The function returns a list of title ids at a given zoom level. The tiles are contains within the given bounding box.

Parameters
southWest The south west of the bounding box.
northEast The north east of the bounding box.
zoomLevel The zoom level the map is currently in.
Returns
  • Array of integers that represent the tile ids

protected static Map<Integer, Map<Integer, List<Integer>>> loadShapes (String path)

Read the tile data from tile*.idx files and fetch the hash map data for a given shape type.

Parameters
path The folder path to all tilex.idx files
Returns
  • A hash map object contains the shapeType as the key as the key and tile data for that shape as the value.