alaCarte Maps
Renderer for OpenStreetMap tiles
transform.cpp File Reference
#include <boost/math/constants/constants.hpp>
#include <cmath>
#include "settings.hpp"

Go to the source code of this file.

Macros

#define NORM   (FACTOR * RADIUS/2.0)
 This file is part of alaCarte. More...
 
#define RADIUS   6378137.0
 
#define FACTOR   100.0
 

Functions

void tileToMercator (int tx, int ty, int zoom, coord_t &x, coord_t &y)
 converts tile coordinates to north-west corner of the tile in the Mercator projection. More...
 
void mercatorToTile (coord_t x, coord_t y, int zoom, int &tx, int &ty)
 converts mercator coordinates to the coords of the tile they are contained in. More...
 
void projectMercator (const FloatPoint &p, coord_t &x, coord_t &y)
 converts cooridinates in lat/lon (WGS84) to spherical Mercator (EPSG:3857). More...
 
void inverseMercator (const FixedPoint &p, double &lat, double &lon)
 converts cooridinates in lat/lon (WGS84) to spherical Mercator (EPSG:3857). More...
 
uint64_t spreadBits32 (uint32_t y)
 
uint64_t interleave64 (uint32_t x, uint32_t y)
 
uint64_t xy2hilbert (FixedPoint p)
 

Macro Definition Documentation

#define FACTOR   100.0

Definition at line 41 of file transform.cpp.

#define NORM   (FACTOR * RADIUS/2.0)

This file is part of alaCarte.

alaCarte is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

alaCarte is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with alaCarte. If not, see http://www.gnu.org/licenses/.

Copyright alaCarte 2012-2013 Simon Dreher, Florian Jacob, Tobias Kahlert, Patrick Niklaus, Bernhard Scheirle, Lisa Winter Maintainer: Patrick Niklaus

Definition at line 37 of file transform.cpp.

#define RADIUS   6378137.0

Definition at line 39 of file transform.cpp.

Function Documentation

uint64_t interleave64 ( uint32_t  x,
uint32_t  y 
)

Definition at line 132 of file transform.cpp.

void inverseMercator ( const FixedPoint p,
double &  lat,
double &  lon 
)

converts cooridinates in lat/lon (WGS84) to spherical Mercator (EPSG:3857).

Parameters
ppoint in Mercator coordinates.
latreference to store lat coords.
lonreference to store lon coords.

Definition at line 102 of file transform.cpp.

void mercatorToTile ( coord_t  x,
coord_t  y,
int  zoom,
int &  tx,
int &  ty 
)

converts mercator coordinates to the coords of the tile they are contained in.

Parameters
xcoordinate in the Mercator projection.
ycoordinate in the Mercator projection.
zoomzoomlevel of the tile
txreference to store the x coordinate of the tile
tyreference to store the y coordinate of the tile

Definition at line 73 of file transform.cpp.

void projectMercator ( const FloatPoint p,
coord_t x,
coord_t y 
)

converts cooridinates in lat/lon (WGS84) to spherical Mercator (EPSG:3857).

Parameters
ppoint in lat/lon coordinates.
xreference to store x coords.
yreference to store y coords.

Definition at line 87 of file transform.cpp.

uint64_t spreadBits32 ( uint32_t  y)

Definition at line 108 of file transform.cpp.

void tileToMercator ( int  tx,
int  ty,
int  zoom,
coord_t x,
coord_t y 
)

converts tile coordinates to north-west corner of the tile in the Mercator projection.

Parameters
txx coordinate of the tile
tyy coordinate of the tile
zoomzoomlevel of the tile
xreference to store x coords.
yreference to store y coords.

Definition at line 52 of file transform.cpp.

uint64_t xy2hilbert ( FixedPoint  p)

Definition at line 137 of file transform.cpp.