Online Maps  v3
OnlineMaps Class Reference

The main class. With it you can control the map. More...

Inheritance diagram for OnlineMaps:
IOnlineMapsSavableComponent

Public Member Functions

void CheckServerConnection (Action< bool > callback)
 Allows you to test the connection to the Internet. More...
 
void DispatchEvent (params OnlineMapsEvents[] evs)
 Dispatch map events. More...
 
void GetBottomRightPosition (out double lng, out double lat)
 Get the bottom-right corner of the map. More...
 
void GetCorners (out double tlx, out double tly, out double brx, out double bry)
 Returns the coordinates of the corners of the map More...
 
OnlineMapsDrawingElement GetDrawingElement (Vector2 screenPosition)
 Gets drawing element from screen. More...
 
void GetPosition (out double lng, out double lat)
 Get the map coordinate. More...
 
OnlineMapsSavableItem[] GetSavableItems ()
 Returns an array of items to save More...
 
void GetTileCorners (out double tlx, out double tly, out double brx, out double bry)
 Get the tile coordinates of the corners of the map More...
 
void GetTileCorners (out double tlx, out double tly, out double brx, out double bry, int zoom)
 Get the tile coordinates of the corners of the map More...
 
void GetTilePosition (out double px, out double py)
 Get the tile coordinates of the map More...
 
void GetTilePosition (out double px, out double py, int zoom)
 Get the tile coordinates of the map More...
 
void GetTopLeftPosition (out double lng, out double lat)
 Get the top-left corner of the map. More...
 
bool InMapView (double lng, double lat)
 Checks if the coordinates are in the map view. More...
 
void Redraw ()
 Full redraw map. More...
 
void RedrawImmediately ()
 Stops the current process map generation, clears all buffers and completely redraws the map. More...
 
void SetPosition (double lng, double lat, bool ignoreSamePosition=true)
 Set the the map coordinate. More...
 
void SetPositionAndZoom (double lng, double lat, float? ZOOM=null)
 Sets the position and zoom. More...
 
void SetTexture (Texture2D newTexture)
 Sets the texture, which will draw the map. Texture displaying on the source you need to change yourself. More...
 
void SetTilePosition (double tx, double ty, int? tileZoom=null)
 Sets the position of the center point of the map based on the tile position. More...
 
void UpdateCorners ()
 Updates the coordinates of the corners of the map More...
 

Public Attributes

Action OnChangePosition
 Event caused when the user change map position. More...
 
Action OnChangeZoom
 Event caused when the user change map zoom. More...
 
Action OnGUIAfter
 Event caused at the end of OnGUI method More...
 
Action OnGUIBefore
 Event caused at the beginning of OnGUI method More...
 
Func< Vector2, OnlineMapsMarkerOnGetMarkerFromScreen
 Intercepts getting marker by the screen coordinates. More...
 
Action OnLateUpdateAfter
 The event is invoked at the end LateUpdate. More...
 
Action OnLateUpdateBefore
 The event is called at the start LateUpdate. More...
 
Action OnMapUpdated
 Event which is called after the redrawing of the map. More...
 
Action OnUpdateBefore
 Event is called before Update. More...
 
Action OnUpdateLate
 Event is called after Update. More...
 
bool allowRedraw
 Allows drawing of map.
Important: The interaction with the map, add or remove markers and drawing elements, automatically allowed to redraw the map.
Use lockRedraw, to prohibit the redrawing of the map.
More...
 
bool blockAllInteractions
 Allows you to block all user interactions with the map, markers, drawing elements. But you can still interact with the map using the API. More...
 
int countParentLevels = 5
 Tiles for the specified number of parent levels will be loaded. More...
 
string customProviderURL = "http://localhost/{zoom}/{y}/{x}"
 URL of custom provider.
Support tokens:
{x} - tile x
{y} - tile y
{zoom} - zoom level
{quad} - uniquely identifies a single tile at a particular level of detail. More...
 
string customTrafficProviderURL = "http://localhost/{zoom}/{y}/{x}"
 URL of custom traffic provider.
Support tokens:
{x} - tile x
{y} - tile y
{zoom} - zoom level
{quad} - uniquely identifies a single tile at a particular level of detail. More...
 
Texture2D defaultTileTexture
 Texture displayed until the tile is not loaded. More...
 
bool dispatchEvents = true
 Specifies whether to dispatch the event. More...
 
bool dragMarkerHoldingCTRL = false
 Drag marker while holding CTRL. More...
 
Color emptyColor = Color.gray
 Color, which is used until the tile is not loaded, unless specified field defaultTileTexture. More...
 
int height = 1024
 Map height in pixels. More...
 
bool labels = true
 Specifies whether to display the labels on the map. More...
 
string language = "en"
 Language of the labels on the map. More...
 
bool lockRedraw = false
 Prohibits drawing of maps.
Important: Do not forget to disable this restriction. Otherwise, the map will never be redrawn. More...
 
bool needRedraw
 A flag that indicates that need to redraw the map. More...
 
bool notInteractUnderGUI = true
 Not interact under the GUI. More...
 
string mapType
 ID of current map type. More...
 
OnlineMapsOSMOverpassServer osmServer = OnlineMapsOSMOverpassServer.main
 Server for requests to the Open Street Map Overpass API. More...
 
string proxyURL = "https://service.infinity-code.com/redirect.php?"
 URL of the proxy server used for WebGL platform. More...
 
bool redrawOnPlay
 A flag that indicates whether to redraw the map at startup. More...
 
bool renderInThread = true
 Render map in a separate thread. Recommended. More...
 
string resourcesPath = "OnlineMapsTiles/{zoom}/{x}/{y}"
 Template path in Resources, from where the tiles will be loaded. This field supports tokens. More...
 
string streamingAssetsPath = "OnlineMapsTiles/{zoom}/{x}/{y}.png"
 Template path in Streaming Assets, from where the tiles will be loaded. This field supports tokens. More...
 
OnlineMapsShowMarkerTooltip showMarkerTooltip = OnlineMapsShowMarkerTooltip.onHover
 Indicates when the marker will show tips. More...
 
OnlineMapsSource source = OnlineMapsSource.Online
 Specifies from where the tiles should be loaded (Online, Resources, Online and Resources). More...
 
bool stopPlayingWhenScriptsCompile = true
 Indicates that Unity need to stop playing when compiling scripts. More...
 
Texture2D texture
 Texture, which is used to draw the map.
To change this value, use OnlineMaps.SetTexture. More...
 
OnlineMapsTileManager tileManager
 Reference to tile manager More...
 
OnlineMapsTooltipDrawerBase tooltipDrawer
 Reference to tooltip drawer More...
 
Texture2D tooltipBackgroundTexture
 Background texture of tooltip More...
 
bool traffic = false
 Specifies whether to draw traffic More...
 
OnlineMapsTrafficProvider trafficProvider
 Provider of traffic jams More...
 
string trafficProviderID = "googlemaps"
 ID of current traffic provider More...
 
bool useCurrentZoomTiles = false
 Use only the current zoom level of the tiles. More...
 
bool useProxy = true
 Use a proxy server for WebGL? More...
 
bool useSoftwareJPEGDecoder = false
 Specifies is necessary to use software JPEG decoder. Use only if you have problems with hardware decoding of JPEG. More...
 
int width = 1024
 Map width in pixels. More...
 

Static Public Attributes

const string version = "3.8.3.1"
 The current version of Online Maps More...
 
const int MINZOOM = 1
 The minimum zoom level More...
 
const int MAXZOOM = 20
 The maximum zoom level More...
 
static Action< OnlineMapsOnStart
 The event is called when the map starts. More...
 
static Action< OnlineMapsOnPreloadTiles
 The event occurs after generating buffer and before update control to preload tiles for tileset. More...
 
static bool isUserControl = false
 Specifies whether the user interacts with the map. More...
 

Properties

static OnlineMaps instance [get]
 Singleton instance of map. More...
 
OnlineMapsProvider.MapType activeType [get, set]
 Active type of map. More...
 
Vector2 bottomRightPosition [get]
 Gets the bottom right position. More...
 
OnlineMapsGeoRect bounds [get]
 Gets the coordinates of the map view. More...
 
OnlineMapsBuffer buffer [get]
 Reference to the current draw buffer. More...
 
OnlineMapsBufferStatus bufferStatus [get]
 The current state of the drawing buffer. More...
 
OnlineMapsControlBase control [get]
 Gets the current control. More...
 
OnlineMapsControlBase3D control3D [get]
 Gets the current 3D control. More...
 
OnlineMapsDrawingElementManager drawingElementManager [get]
 Gets the drawing element manager from control. More...
 
float floatZoom [get, set]
 Gets and sets float zoom value More...
 
OnlineMapsMarkerManager markerManager [get]
 Gets the markers manager from control. More...
 
OnlineMapsMarker3DManagermarker3DManager [get]
 Gets the 3D markers manager from control. More...
 
Vector2 position [get, set]
 Coordinates of the center point of the map. More...
 
OnlineMapsPositionRange positionRange [get, set]
 Limits the range of map coordinates. More...
 
OnlineMapsProjection projection [get]
 Projection of active provider. More...
 
Vector2 topLeftPosition [get]
 Gets the top left position. More...
 
int zoom [get, set]
 Current zoom. More...
 
float zoomFactor [get]
 The scaling factor for zoom More...
 
OnlineMapsRange zoomRange [get, set]
 Specifies the valid range of map zoom. More...
 
float zoomScale [get]
 The fractional part of zoom More...
 

Detailed Description

The main class. With it you can control the map.

Member Function Documentation

◆ CheckServerConnection()

void OnlineMaps.CheckServerConnection ( Action< bool >  callback)

Allows you to test the connection to the Internet.

Parameters
callbackFunction, which will return the availability of the Internet.

◆ DispatchEvent()

void OnlineMaps.DispatchEvent ( params OnlineMapsEvents[]  evs)

Dispatch map events.

Parameters
evsEvents you want to dispatch.

◆ GetBottomRightPosition()

void OnlineMaps.GetBottomRightPosition ( out double  lng,
out double  lat 
)

Get the bottom-right corner of the map.

Parameters
lngLongitude
latLatitude

◆ GetCorners()

void OnlineMaps.GetCorners ( out double  tlx,
out double  tly,
out double  brx,
out double  bry 
)

Returns the coordinates of the corners of the map

Parameters
tlxLongitude of the left border
tlyLatitude of the top border
brxLongitude of the right border
bryLatitude of the bottom border

◆ GetDrawingElement()

OnlineMapsDrawingElement OnlineMaps.GetDrawingElement ( Vector2  screenPosition)

Gets drawing element from screen.

Parameters
screenPositionScreen position.
Returns
Drawing element

◆ GetPosition()

void OnlineMaps.GetPosition ( out double  lng,
out double  lat 
)

Get the map coordinate.

Parameters
lngLongitude
latLatitude

◆ GetSavableItems()

OnlineMapsSavableItem [] OnlineMaps.GetSavableItems ( )

Returns an array of items to save

Returns
Array of items to save

Implements IOnlineMapsSavableComponent.

◆ GetTileCorners() [1/2]

void OnlineMaps.GetTileCorners ( out double  tlx,
out double  tly,
out double  brx,
out double  bry 
)

Get the tile coordinates of the corners of the map

Parameters
tlxLeft tile X
tlyTop tile Y
brxRight tile X
bryBottom tile Y

◆ GetTileCorners() [2/2]

void OnlineMaps.GetTileCorners ( out double  tlx,
out double  tly,
out double  brx,
out double  bry,
int  zoom 
)

Get the tile coordinates of the corners of the map

Parameters
tlxLeft tile X
tlyTop tile Y
brxRight tile X
bryBottom tile Y
zoomZoom

◆ GetTilePosition() [1/2]

void OnlineMaps.GetTilePosition ( out double  px,
out double  py 
)

Get the tile coordinates of the map

Parameters
pxTile X
pyTile Y

◆ GetTilePosition() [2/2]

void OnlineMaps.GetTilePosition ( out double  px,
out double  py,
int  zoom 
)

Get the tile coordinates of the map

Parameters
pxTile X
pyTile Y
zoomZoom

◆ GetTopLeftPosition()

void OnlineMaps.GetTopLeftPosition ( out double  lng,
out double  lat 
)

Get the top-left corner of the map.

Parameters
lngLongitude
latLatitude

◆ InMapView()

bool OnlineMaps.InMapView ( double  lng,
double  lat 
)

Checks if the coordinates are in the map view.

Parameters
lngLongitude
latLatitude
Returns
True - coordinates in map view. False - coordinates outside the map view.

◆ Redraw()

void OnlineMaps.Redraw ( )

Full redraw map.

◆ RedrawImmediately()

void OnlineMaps.RedrawImmediately ( )

Stops the current process map generation, clears all buffers and completely redraws the map.

◆ SetPosition()

void OnlineMaps.SetPosition ( double  lng,
double  lat,
bool  ignoreSamePosition = true 
)

Set the the map coordinate.

Parameters
lngLongitude
latLatitude

◆ SetPositionAndZoom()

void OnlineMaps.SetPositionAndZoom ( double  lng,
double  lat,
float?  ZOOM = null 
)

Sets the position and zoom.

Parameters
lngLongitude
latLatitude
ZOOMZoom

◆ SetTexture()

void OnlineMaps.SetTexture ( Texture2D  newTexture)

Sets the texture, which will draw the map. Texture displaying on the source you need to change yourself.

Parameters
newTextureTexture, where you want to draw the map.

◆ SetTilePosition()

void OnlineMaps.SetTilePosition ( double  tx,
double  ty,
int?  tileZoom = null 
)

Sets the position of the center point of the map based on the tile position.

Parameters
txTile X
tyTile Y
tileZoomTile zoom

◆ UpdateCorners()

void OnlineMaps.UpdateCorners ( )

Updates the coordinates of the corners of the map

Member Data Documentation

◆ allowRedraw

bool OnlineMaps.allowRedraw

Allows drawing of map.
Important: The interaction with the map, add or remove markers and drawing elements, automatically allowed to redraw the map.
Use lockRedraw, to prohibit the redrawing of the map.

◆ blockAllInteractions

bool OnlineMaps.blockAllInteractions

Allows you to block all user interactions with the map, markers, drawing elements. But you can still interact with the map using the API.

◆ countParentLevels

int OnlineMaps.countParentLevels = 5

Tiles for the specified number of parent levels will be loaded.

◆ customProviderURL

string OnlineMaps.customProviderURL = "http://localhost/{zoom}/{y}/{x}"

URL of custom provider.
Support tokens:
{x} - tile x
{y} - tile y
{zoom} - zoom level
{quad} - uniquely identifies a single tile at a particular level of detail.

◆ customTrafficProviderURL

string OnlineMaps.customTrafficProviderURL = "http://localhost/{zoom}/{y}/{x}"

URL of custom traffic provider.
Support tokens:
{x} - tile x
{y} - tile y
{zoom} - zoom level
{quad} - uniquely identifies a single tile at a particular level of detail.

◆ defaultTileTexture

Texture2D OnlineMaps.defaultTileTexture

Texture displayed until the tile is not loaded.

◆ dispatchEvents

bool OnlineMaps.dispatchEvents = true

Specifies whether to dispatch the event.

◆ dragMarkerHoldingCTRL

bool OnlineMaps.dragMarkerHoldingCTRL = false

Drag marker while holding CTRL.

◆ emptyColor

Color OnlineMaps.emptyColor = Color.gray

Color, which is used until the tile is not loaded, unless specified field defaultTileTexture.

◆ height

int OnlineMaps.height = 1024

Map height in pixels.

◆ isUserControl

bool OnlineMaps.isUserControl = false
static

Specifies whether the user interacts with the map.

◆ labels

bool OnlineMaps.labels = true

Specifies whether to display the labels on the map.

◆ language

string OnlineMaps.language = "en"

Language of the labels on the map.

◆ lockRedraw

bool OnlineMaps.lockRedraw = false

Prohibits drawing of maps.
Important: Do not forget to disable this restriction. Otherwise, the map will never be redrawn.

◆ mapType

string OnlineMaps.mapType

ID of current map type.

◆ MAXZOOM

const int OnlineMaps.MAXZOOM = 20
static

The maximum zoom level

◆ MINZOOM

const int OnlineMaps.MINZOOM = 1
static

The minimum zoom level

◆ needRedraw

bool OnlineMaps.needRedraw

A flag that indicates that need to redraw the map.

◆ notInteractUnderGUI

bool OnlineMaps.notInteractUnderGUI = true

Not interact under the GUI.

◆ OnChangePosition

Action OnlineMaps.OnChangePosition

Event caused when the user change map position.

◆ OnChangeZoom

Action OnlineMaps.OnChangeZoom

Event caused when the user change map zoom.

◆ OnGetMarkerFromScreen

Func<Vector2, OnlineMapsMarker> OnlineMaps.OnGetMarkerFromScreen

Intercepts getting marker by the screen coordinates.

◆ OnGUIAfter

Action OnlineMaps.OnGUIAfter

Event caused at the end of OnGUI method

◆ OnGUIBefore

Action OnlineMaps.OnGUIBefore

Event caused at the beginning of OnGUI method

◆ OnLateUpdateAfter

Action OnlineMaps.OnLateUpdateAfter

The event is invoked at the end LateUpdate.

◆ OnLateUpdateBefore

Action OnlineMaps.OnLateUpdateBefore

The event is called at the start LateUpdate.

◆ OnMapUpdated

Action OnlineMaps.OnMapUpdated

Event which is called after the redrawing of the map.

◆ OnPreloadTiles

Action<OnlineMaps> OnlineMaps.OnPreloadTiles
static

The event occurs after generating buffer and before update control to preload tiles for tileset.

◆ OnStart

Action<OnlineMaps> OnlineMaps.OnStart
static

The event is called when the map starts.

◆ OnUpdateBefore

Action OnlineMaps.OnUpdateBefore

Event is called before Update.

◆ OnUpdateLate

Action OnlineMaps.OnUpdateLate

Event is called after Update.

◆ osmServer

OnlineMapsOSMOverpassServer OnlineMaps.osmServer = OnlineMapsOSMOverpassServer.main

Server for requests to the Open Street Map Overpass API.

◆ proxyURL

string OnlineMaps.proxyURL = "https://service.infinity-code.com/redirect.php?"

URL of the proxy server used for WebGL platform.

◆ redrawOnPlay

bool OnlineMaps.redrawOnPlay

A flag that indicates whether to redraw the map at startup.

◆ renderInThread

bool OnlineMaps.renderInThread = true

Render map in a separate thread. Recommended.

◆ resourcesPath

string OnlineMaps.resourcesPath = "OnlineMapsTiles/{zoom}/{x}/{y}"

Template path in Resources, from where the tiles will be loaded. This field supports tokens.

◆ showMarkerTooltip

OnlineMapsShowMarkerTooltip OnlineMaps.showMarkerTooltip = OnlineMapsShowMarkerTooltip.onHover

Indicates when the marker will show tips.

◆ source

OnlineMapsSource OnlineMaps.source = OnlineMapsSource.Online

Specifies from where the tiles should be loaded (Online, Resources, Online and Resources).

◆ stopPlayingWhenScriptsCompile

bool OnlineMaps.stopPlayingWhenScriptsCompile = true

Indicates that Unity need to stop playing when compiling scripts.

◆ streamingAssetsPath

string OnlineMaps.streamingAssetsPath = "OnlineMapsTiles/{zoom}/{x}/{y}.png"

Template path in Streaming Assets, from where the tiles will be loaded. This field supports tokens.

◆ texture

Texture2D OnlineMaps.texture

Texture, which is used to draw the map.
To change this value, use OnlineMaps.SetTexture.

◆ tileManager

OnlineMapsTileManager OnlineMaps.tileManager

Reference to tile manager

◆ tooltipBackgroundTexture

Texture2D OnlineMaps.tooltipBackgroundTexture

Background texture of tooltip

◆ tooltipDrawer

OnlineMapsTooltipDrawerBase OnlineMaps.tooltipDrawer

Reference to tooltip drawer

◆ traffic

bool OnlineMaps.traffic = false

Specifies whether to draw traffic

◆ trafficProvider

OnlineMapsTrafficProvider OnlineMaps.trafficProvider

Provider of traffic jams

◆ trafficProviderID

string OnlineMaps.trafficProviderID = "googlemaps"

ID of current traffic provider

◆ useCurrentZoomTiles

bool OnlineMaps.useCurrentZoomTiles = false

Use only the current zoom level of the tiles.

◆ useProxy

bool OnlineMaps.useProxy = true

Use a proxy server for WebGL?

◆ useSoftwareJPEGDecoder

bool OnlineMaps.useSoftwareJPEGDecoder = false

Specifies is necessary to use software JPEG decoder. Use only if you have problems with hardware decoding of JPEG.

◆ version

const string OnlineMaps.version = "3.8.3.1"
static

The current version of Online Maps

◆ width

int OnlineMaps.width = 1024

Map width in pixels.

Property Documentation

◆ activeType

OnlineMapsProvider.MapType OnlineMaps.activeType
getset

Active type of map.

◆ bottomRightPosition

Vector2 OnlineMaps.bottomRightPosition
get

Gets the bottom right position.

The bottom right position.

◆ bounds

OnlineMapsGeoRect OnlineMaps.bounds
get

Gets the coordinates of the map view.

◆ buffer

OnlineMapsBuffer OnlineMaps.buffer
get

Reference to the current draw buffer.

◆ bufferStatus

OnlineMapsBufferStatus OnlineMaps.bufferStatus
get

The current state of the drawing buffer.

◆ control

OnlineMapsControlBase OnlineMaps.control
get

Gets the current control.

◆ control3D

OnlineMapsControlBase3D OnlineMaps.control3D
get

Gets the current 3D control.

◆ drawingElementManager

OnlineMapsDrawingElementManager OnlineMaps.drawingElementManager
get

Gets the drawing element manager from control.

◆ floatZoom

float OnlineMaps.floatZoom
getset

Gets and sets float zoom value

◆ instance

OnlineMaps OnlineMaps.instance
staticget

Singleton instance of map.

◆ marker3DManager

OnlineMapsMarker3DManager? OnlineMaps.marker3DManager
get

Gets the 3D markers manager from control.

◆ markerManager

OnlineMapsMarkerManager OnlineMaps.markerManager
get

Gets the markers manager from control.

◆ position

Vector2 OnlineMaps.position
getset

Coordinates of the center point of the map.

◆ positionRange

OnlineMapsPositionRange OnlineMaps.positionRange
getset

Limits the range of map coordinates.

◆ projection

OnlineMapsProjection OnlineMaps.projection
get

Projection of active provider.

◆ topLeftPosition

Vector2 OnlineMaps.topLeftPosition
get

Gets the top left position.

The top left position.

◆ zoom

int OnlineMaps.zoom
getset

Current zoom.

◆ zoomFactor

float OnlineMaps.zoomFactor
get

The scaling factor for zoom

◆ zoomRange

OnlineMapsRange OnlineMaps.zoomRange
getset

Specifies the valid range of map zoom.

◆ zoomScale

float OnlineMaps.zoomScale
get

The fractional part of zoom