Google.Maps.MapLoadRegion

Encapsulates a region of the map to load.

Summary

The method MapsService.MakeMapLoadRegion creates an instance of the MapLoadRegion class to load semantic vector tiles for the MapsService.

The following code example loads the region of the map that is visible in the main camera's viewport.

MapsService.MakeMapLoadRegion().AddViewport(Camera.main).Load(options);
  

Public functions

AddBounds(Bounds bounds)
Adds rectangular bounds to the map region.
AddCircle(Vector3 center, float radius)
Adds a circular area to the map region.
AddViewport(Camera camera, float maxDistance)
Expand(float distance)
Grows the region in every direction by at least the given distance.
Load(GameObjectOptions options)
Loads the portion of the map defined by this region.
Load(GameObjectOptions options, int zoom)
Loads the portion of the map defined by this region, at the specified zoom level.
SetLoadingPoint(Vector3? point)
Sets the point in world space where tiles should load first.
UnloadOutside()
Unloads the map outside this region.
UnloadOutside(int zoom)
Unloads the map outside this region, at the specified zoom level.

Public functions

AddBounds

MapLoadRegion AddBounds(
  Bounds bounds
)

Adds rectangular bounds to the map region.

Details
Parameters
bounds
The bounds that define the region.

AddCircle

MapLoadRegion AddCircle(
  Vector3 center,
  float radius
)

Adds a circular area to the map region.

Details
Parameters
center
The center of the circle.
radius
The radius of the circle.

AddViewport

MapLoadRegion AddViewport(
  Camera camera,
  float maxDistance
)

Adds an area to the map region based on the camera's view frustum.

Overrides SetLoadingPoint.

The loaded area of the map is limited by the camera's far clip plane. If this loads too much, especially at shallow camera angles, then it can be limited further by maxDistance. It also loads the Camera to access the camera data in the scene. camera is used to sort the tiles based on their distance from the camera before loading so that tiles that are closest to the camera load first. Note: Calling this method multiple times with different cameras simply sorts the tiles by distance from the last camera.

Details
Parameters
camera
The camera used to limit the area of the map loaded. It is also used to determine which tiles to load first.
maxDistance
The maximum distance from the camera position to load.

Expand

MapLoadRegion Expand(
  float distance
)

Grows the region in every direction by at least the given distance.

Details
Parameters
distance
The distance to expand by.

Load

MapLoadRegion Load(
  GameObjectOptions options
)

Loads the portion of the map defined by this region.

Will use the zoom level defined in Coord.Coords.

Details
Parameters
options
Game object options.

Load

MapLoadRegion Load(
  GameObjectOptions options,
  int zoom
)

Loads the portion of the map defined by this region, at the specified zoom level.

Coord.Coords.Zoom is ignored, and the zoom parameter is used instead.

The default zoom level is 17. This zoom level is considered appropriate for location-based games because lower zoom levels tend to miss some important map features. Zoom level 17 is also more stable, which means the returned map features are less likely to change over time.

Details
Parameters
options
Game object options.
zoom
The magnification level. The range is 0-21. Caution: Zoom level controls the level of detail of map data, and determines the size of the map "tiles" returned. The higher the zoom level, the more detail is returned, which negatively affects performance.

SetLoadingPoint

MapLoadRegion SetLoadingPoint(
  Vector3? point
)

Sets the point in world space where tiles should load first.

The SDK loads tiles in an order that corresponds to their distance from this point.

The tiles that are closest to this point are loaded first, and then more distant tiles are loaded.

Details
Parameters
point
The point in world space where tiles should load first. You can set this to null, which results in the default unordered tile loading behaviour.

UnloadOutside

MapLoadRegion UnloadOutside()

Unloads the map outside this region.

UnloadOutside

MapLoadRegion UnloadOutside(
  int zoom
)

Unloads the map outside this region, at the specified zoom level.

Details
Parameters
zoom
The zoom level. Zoom levels ranges from 0-21. Only tiles at this zoom level are unloaded.