# Class: modelit.mapviewer.RDTileSource

### Extends: modelit.mapviewer.AbstractTileSource

## DESCRIPTION:

modelit.mapviewer.RDTileSource constructor.

#

## Properties

baseUrl | string, default value: 'png'. |
      The tile url without parameters.
isWGS | Return true if WGS coordinate. |
MAX_LAT | Maximum latitude (north) for mercator display |
maxZoomLevel | number |
      Maximum (greatest detail) zoomlevel.
MIN_LAT | Minimum latitude (south) for mercator display |
minZoomLevel | number |
      Minimum (lowest detail) zoomlevel.
name | string |
      The name of the tilesource.
numberOfThreads | number, default value: 2 |
      Number of threads that can be used to download the tiles.
      Note that some of the tileproviders have a limit of the number of
      parallel requests.
tileSize | number, default value: 256. |
      The tilesize in pixels. Tile are assumed to be square.
tileType | string, default value: 'png'. |
      The image type of the tiles.
tileUrl | string|@(zoomlevel, x, y) = string> |
      The part of the url that defines which tile to retrieve.

# Public Method: YToLat

## DESCRIPTION:

Transforms pixel coordinate Y to latitude

## CALL:

lat = YToLat(aY, aZoomlevel)

## INPUT:

obj | any |
    modelit.mapviewer.RDTileSource
aY | any |
    Double with y-coordinate in pixelspace.
aZoomlevel | any |
    Integer with zoomlevel.

## OUTPUT:

lat | any |
    Double with latitude.

# Public Method: LatToY

## DESCRIPTION:

Transforms latitude to pixelspace.

## CALL:

y = LatToY(obj, aLatitude, aZoomlevel)

## INPUT:

obj | modelit.mapviewer.RDTileSource |
aLatitude | number |
    the latitude.
aZoomlevel | integer |
    the zoomlevel.

## OUTPUT:

y | number |
    the y-coordinate in pixelspace.

# Public Method: XToLon

## DESCRIPTION:

Transforms pixel coordinate X to RD.

## CALL:

lon = XToLon(obj, aX, aZoomlevel)

## INPUT:

obj | modelit.mapviewer.RDTileSource |
aX | number |
    the x-coordinate in pixelspace.
aZoomlevel | integer |
    the zoomlevel.

## OUTPUT:

lon | number |
    the longitude.

# Public Method: localToPixel

## DESCRIPTION:

Transform local coordinates to pixel coordinates.

## CALL:

xy = localToPixel(obj, xy_local, aZoomlevel)

## INPUT:

obj | any |
    <modelit.mapviewer.RDTileSource>
xy_local | any |
    <Double> Nx2, with local coordinates(RD).
aZoomlevel | any |
    <integer> with zoomlevel.

## OUTPUT:

xy | any |
    <Double> NNx2, with x-coordinate in pixelspace.

# Public Method: pixelToLocal

## DESCRIPTION:

pixel coordinates to local coordinates (RD), all in 1

# Public Method: LonToX

## DESCRIPTION:

Transform longitude to pixelspace.

## CALL:

x = LonToX(obj, aLongitude, aZoomlevel)

## INPUT:

obj | any |
    <modelit.mapviewer.RDTileSource>
aLongitude | any |
    <Double> with longitude (RD).
aZoomlevel | any |
    <integer> with zoomlevel.

## OUTPUT:

x | any |
    <Double> with x-coordinate in pixelspace.

# Public Method: pixel2Zoomlevel

## DESCRIPTION:

Determine zoomlevel from x coordinate.

## CALL:

zm = pixel2Zoomlevel(obj, x)

## INPUT:

obj | modelit.mapviewer.RDTileSource |
x | integer|integer[] |
    pixel coordinate in x direction

## OUTPUT:

zm | integer |
    defined as: 2^aZoomlevel * tileSize.

# Public Method: getMaxPixels

## DESCRIPTION:

Get the maximum number of pixels in y or x for a zoomlevel.

## CALL:

maxPixels = getMaxPixels(aZoomlevel)

## INPUT:

obj | modelit.mapviewer.RDTileSource |
aZoomlevel | integer|integer[] |
    the zoomlevel(s).

## OUTPUT:

maxPixels | integer |
    defined as: 2^aZoomlevel * tileSize.

# Public Method: getName

## DESCRIPTION:

Get name that uniquely identifies this tilesource. Used for caching.

## CALL:

name = getName(obj)

## INPUT:

obj | modelit.mapviewer.RDTileSource |

## OUTPUT:

name | string |

# Public Method: RDTileSource

## DESCRIPTION:

modelit.mapviewer.RDTileSource constructor.

## CALL:

obj = RDTileSource(tileType)

## INPUT:

tileType | string |
    The image type of the tiles.

## OUTPUT:

obj | modelit.mapviewer.RDTileSource |
    Documentation for modelit.mapviewer.RDTileSource/RDTileSource
       doc modelit.mapviewer.RDTileSource

# Public Static Method: WGSToLocal

## DESCRIPTION:

Transforms WGS coordinates to local (=RD)

## CALL:

xy_local = WGSToLocal(xy_wgs)

## INPUT:

obj | any |
     modelit.mapviewer.RDTileSource
    wx,wy:
     WGS coordinates, scalar, vector or matrix

## OUTPUT:

       lon,lat:
         Coresponding local coordinates (RD)

# Public Static Method: localToWGS

## DESCRIPTION:

Transforms local coordinates (=RD) to WGS

## CALL:

[xy_wgs] = localToWGS(xy_local)

## INPUT:

xy_local | any |
    Local coordinates, Nx2, colum1 corresponds to x, column2
    corresponds to y

## OUTPUT:

xy_wgs | any |
    Coresponding WGS coordinates

# Private Method: falseNorthing

## DESCRIPTION:

The linear value added to all y-coordinates of a map projection so that none of the values in the geographic region being mapped are negative.

## CALL:

fn = falseNorthing(obj, aZoomlevel)

## INPUT:

obj | any |
    <modelit.mapviewer.RDTileSource>
aZoomlevel | any |
    <integer> with zoomlevel.

## OUTPUT:

fn | any |
    Corrected y-coordinate.

# Private Method: falseEasting

## DESCRIPTION:

The linear value added to all x-coordinates of a map projection so that none of the values in the geographic region being mapped are negative.

## CALL:

fe = falseEasting(obj, aZoomlevel)

## INPUT:

obj | any |
    <modelit.mapviewer.RDTileSource>
aZoomlevel | any |
    <integer> with zoomlevel.

## OUTPUT:

fe | any |
    Corrected x-coordinate.

# Private Method: radius

## DESCRIPTION:

Get radius in pixels at a given zoomlevel.

## CALL:

r = radius(obj, aZoomlevel)

## INPUT:

obj | any |
    <modelit.mapviewer.RDTileSource>
aZoomlevel | any |
    <integer> with zoomlevel.

## OUTPUT:

r | any |
    Integer with radius in pixels at a given zoomlevel.

# Public Method: getTileUrl

### Inherited from modelit.mapviewer.AbstractTileSource

## DESCRIPTION:

Get url to retrieve a specific tile at a given (x,y) index and zoomlevel from the tileserver

## CALL:

url = getTileUrl(obj, zoomlevel, x, y)

## INPUT:

obj | modelit.mapviewer.PDOKTileSource |
zoomlevel | integer |
    the zoomlevel. Choose zoomlevel between
    getMinZoomLevel and getMaxZoomLevel
x | number |
    Horizontal tile index.
y | number |
    Vertical tile index.

## OUTPUT:

url | string |
         url for a tile with index (x,y) and zoomlevel at the tileserver.
    Help for modelit.mapviewer.RDTileSource/getTileUrl is inherited from superclass modelit.mapviewer.AbstractTileSource

# Public Method: getBaseUrl

### Inherited from modelit.mapviewer.AbstractTileSource

## DESCRIPTION:

Get the base url for this TileSource, use this with getTileUrl. To get the url for a specific tile at a specific coordinate and zoomlevel.

## CALL:

url = getBaseUrl(obj)

## INPUT:

obj | modelit.mapviewer.AbstractTileSource |

## OUTPUT:

url | string |
            with base url.
    Help for modelit.mapviewer.RDTileSource/getBaseUrl is inherited from superclass modelit.mapviewer.AbstractTileSource

# Public Method: getTileType

### Inherited from modelit.mapviewer.AbstractTileSource

## DESCRIPTION:

Get the image type of the tiles.

## CALL:

type = getTileType(obj)

## INPUT:

obj | modelit.mapviewer.AbstractTileSource |

## OUTPUT:

type | string |
         with image type. For OpenStreetMap tiles type='png'
    Help for modelit.mapviewer.RDTileSource/getTileType is inherited from superclass modelit.mapviewer.AbstractTileSource

# Public Method: getMinZoomLevel

### Inherited from modelit.mapviewer.AbstractTileSource

## DESCRIPTION:

The minimum zoom value. This value is usually 0.

## CALL:

zoom = getMinZoomLevel(obj)

## INPUT:

obj | modelit.mapviewer.AbstractTileSource |

## OUTPUT:

zoom | integer |
         with the minimum (less detailed) zoomlevel.
    Help for modelit.mapviewer.RDTileSource/getMinZoomLevel is inherited from superclass modelit.mapviewer.AbstractTileSource

# Public Method: getMaxZoomLevel

### Inherited from modelit.mapviewer.AbstractTileSource

## DESCRIPTION:

The maximum zoom value.

## CALL:

zoom = getMaxZoomLevel(obj)

## INPUT:

obj | modelit.mapviewer.AbstractTileSource |

## OUTPUT:

zoom | integer |
         with the maximum (most detailed) zoomlevel.
    Help for modelit.mapviewer.RDTileSource/getMaxZoomLevel is inherited from superclass modelit.mapviewer.AbstractTileSource

# Public Method: getTileSize

### Inherited from modelit.mapviewer.AbstractTileSource

## DESCRIPTION:

The tilesize of the square tiles in pixels.

## CALL:

tileSize = getTileSize(obj)

## INPUT:

obj | modelit.mapviewer.AbstractTileSource |

## OUTPUT:

tileSize | integer |
         the width and height for a tile in pixels.
    Help for modelit.mapviewer.RDTileSource/getTileSize is inherited from superclass modelit.mapviewer.AbstractTileSource