jackhp95 / elm-mapbox / Maps.Convert

Functions for converting between different map units.

Map Size Properties


type alias MapSizes a =
{ a | tileSize : Basics.Float
, zoom : Maps.Internal.Screen.ZoomLevel
, width : Basics.Float
, height : Basics.Float
, center : Maps.Geo.LatLng 
}

The size properties of a map. The conversion functions that require this type can just be passed a map type.

Screen Offset - Latitude/Longitude

screenOffsetToLatLng : MapSizes a -> Maps.Internal.Screen.Offset -> Maps.Geo.LatLng

Take an offset from the top left of the map and convert it to a latitude/longitude. Note that it requires the dimensions of the map (or the map itself) to calculate this conversion.

latLngToScreenOffset : MapSizes a -> Maps.Geo.LatLng -> Maps.Internal.Screen.Offset

Take latitude/longitude anc convert it to an offset from the top left of the map. Note that it requires the dimensions of the map (or the map itself) to calculate this conversion.