Earth & Map API

advanced scripting

World Map Strategy Kit · Scripting Support (C#)

Class: WMSK (namespace WorldMapStrategyKit)

Earth API

Methods for earth/map manipulation and coordinate conversion.

Properties

enum EARTH_STYLE

Gets or sets the e a r t h_ s t y l e.

class EarthStyleExtensions

Gets or sets the earth style extensions.

bool showEarth

Toggle Earth visibility.

EARTH_STYLE earthStyle

Earth map style.

bool blurOnZoom

Gets or sets the blur on zoom.

Color earthColor

Color for Earth (for SolidColor style)

bool earthBumpEnabled

Gets or sets the earth bump enabled.

float earthBumpAmount

Gets or sets the earth bump amount.

Texture2D earthBumpMapTexture

Gets or sets the earth bump map texture.

Texture2D earthTexture

Texture for Earth background

Vector2 earthTextureScale

Earth texture scale

Vector2 earthTextureOffset

Earth texture offset

Material earthMaterial

Gets the currently active Earth material.

bool showWater

Gets or sets the show water.

Texture2D scenicWaterMask

Texture of the water mask for path finding purposes.

Color waterColor

Defines the base water color used in Scenic Plus style.

float waterLevel

Water level for the Scenic Plus styles.

float waterFoamThreshold

Foam threshold (amount) for the Scenic Plus styles.

float waterFoamIntensity

Foam intensity effect..

Coordinate Conversion

Vector2 LatLonToMap(float latitude, float longitude)

Converts geographic coordinates (latitude, longitude) to 2D map coordinates.

Vector2 Map2DToLatLon(Vector2 mapPosition)

Converts 2D map coordinates to geographic coordinates (returns x=latitude, y=longitude).

Vector3 LatLonToSpherePoint(float latitude, float longitude)

Converts latitude/longitude to a 3D point on the sphere surface (for 3D globe mode).

Distance & Bearing

float GetDistance(Vector2 mapPos1, Vector2 mapPos2)

Returns the distance between two map positions (in map units).

float GetDistanceInKm(float lat1, float lon1, float lat2, float lon2)

Returns the great-circle distance between two geographic coordinates in kilometers.

float GetBearing(Vector2 mapPos1, Vector2 mapPos2)

Returns the bearing (direction) from one map position to another in degrees (0-360).

Map Properties

Vector2 earthInvertedMode { get; set; }

Flips the map horizontally and/or vertically.

bool wrapHorizontally { get; set; }

Enables horizontal wrapping (allows infinite scrolling left/right).

Cursor & Position

Vector2 cursorLocation { get; }

The current cursor position in 2D map coordinates.

Vector2 cursorLatLon { get; }

The current cursor position as geographic coordinates (x=latitude, y=longitude).

bool GetMouseMapPosition(out Vector2 mapPosition)

Returns the map position under the mouse cursor. Returns false if the mouse is not over the map.

Additional Methods

bool isScenicPlus(this EARTH_STYLE earthStyle)

isScenicPlus method.

int numTextures(this EARTH_STYLE earthStyle)

numTextures method.

bool supportsBumpMap(this EARTH_STYLE earthStyle)

supportsBumpMap method.

void ResetEarthStyle()

Reloads Earth style and clears any customization

void SetEarthTexture(Texture2D texture)

Texture for Earth background. This method ensures the texture is reassigned even if it's the same texture.

void SetEarthWaterMask(Texture2D texture)

Sets the texture of the water mask.

bool ContainsWater(Vector2 position)

Returns true if specified position is on water.

bool ContainsWater(Vector2 position, float boxSize, out Vector2 waterPosition)

Returns true if specified area with center at "position" contains water. Box size. Exact position where water was found.

float GetAltitude(Vector2 position)

Returns the heightmap value at a given position

Was this page helpful?