maputils

maputils — Notes about TMS / Spherical Mercator conversion

Functions

Description

VikCoords are in Spherical Mercator projection (VIK_COORD_LATLON) MapCoords are in Inverse TMS

See: http://docs.openlayers.org/library/spherical_mercator.html See: http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification NB: the Y axis is inverted, ie the origin is at top-left corner.

Functions

VIK_GZ()

#define VIK_GZ(x) ((1<<(x)))

map_utils_mpp_to_scale ()

gint
map_utils_mpp_to_scale (gdouble mpp);

Parameters

mpp

The so called 'mpp'

 

Returns

the zoom scale value which may be negative.


map_utils_mpp_to_zoom_level ()

guint8
map_utils_mpp_to_zoom_level (gdouble mpp);

Parameters

mpp

The so called 'mpp'

 

Returns

a Zoom Level See: http://wiki.openstreetmap.org/wiki/Zoom_levels


map_utils_vikcoord_to_iTMS ()

gboolean
map_utils_vikcoord_to_iTMS (const VikCoord *src,
                            gdouble xzoom,
                            gdouble yzoom,
                            MapCoord *dest);

Convert a VikCoord in VIK_COORD_LATLON format into Inverse TMS coordinates

Parameters

src

Original VikCoord in VIK_COORD_LATLON format

 

xzoom

Viking zoom level in x direction

 

yzoom

Viking zoom level in y direction (actually needs to be same as xzoom)

 

dest

The resulting Inverse TMS coordinates in MapCoord

 

Returns

whether the conversion was performed


map_utils_iTMS_to_center_vikcoord ()

void
map_utils_iTMS_to_center_vikcoord (const MapCoord *src,
                                   VikCoord *dest);

Convert a MapCoord in Inverse TMS format into Spherical Mercator coordinates for the center of the TMS area

Parameters

src

Original MapCoord in Inverse TMS format

 

dest

The resulting Spherical Mercator coordinates in VikCoord

 

map_utils_iTMS_to_vikcoord ()

void
map_utils_iTMS_to_vikcoord (const MapCoord *src,
                            VikCoord *dest);

Convert a MapCoord in Inverse TMS format into Spherical Mercator coordinates (for the top left corner of the Inverse TMS area)

Parameters

src

Original MapCoord in Inverse TMS format

 

dest

The resulting Spherical Mercator coordinates in VikCoord