Raster maps
Available services
Jāņa sēta offers five types of raster map layers in different projections:
- coloured (traditional) Jāņa sēta map;
- greyscale Jāņa sēta map;
- cadastral information layer (Latvia only);
- LĢIA topographic map (Latvia only);
- LĢIA ortophoto map (Latvia only).
Raster maps can be included in your own products or added to desktop programs by using Jāņa sēta WMS or WMTS services. The services conform to the OGC online mapping standards and are compatible with web map libraries and desktop programs.
WMS
WMS service is used to request rectangular map fragments in freely chosen coordinates. WMS map fragment request base URL is created according to the following scheme:
https://wms<link_number>.kartes.lv/<client_key>/<projection_key>/<layer_key>/
Parameter | Description | Values |
---|---|---|
<link_number> | Web map libraries (Leaflet, OpenLayers) can be provided with multiple domains, which can improve parallel loading speed of map fragments. If only one domain is used, then slower map loading is possible due to browser restrictions. |
|
<client_key> | Your private Jāņa sēta services access key. | |
<projection_key> | Projection key describes service's coordinate system (CRS). |
|
<layer_key> | Layer key describes returned map layer. It should be noted that not all layers are available in all coordinate systems. |
Only wgs: |
Each base URL describes a service for single map layer in single projection. This base URL must be added to map library or desktop program configuration. Further preparation of the raster map service and requesting of specific map fragments will be done automatically.
Service capabilities document
Services' coordinate systems, their extents, sublayers and other parameters can be acquired by making a GetCapabilities request. It returns a standardised XML document, which can be used to precisely setup map layers. Desktop programs use this document to automatically configure the service. In other cases, it is not necessary to request or read it.
GetCapabilities request URL is created according to the following scheme:
https://wms<link_number>.kartes.lv//<projection_key>/<layer_key>/?service=WMS&request=GetCapabilities&version=1.3.0
Parameter | Description | Values |
---|---|---|
service | Service type. |
|
request | GetCapabilities request returns service description in XML format. |
|
version | Specifies used WMS standard version. For this document there are no significant changes between versions. |
|
Map fragment images
To get the map fragment images themselves, a GetMap request must be made. The desired image width, height and geographical coordinates of the fragment's corners can be specified. Request URLs are created by adding the following GET parameters to the service's base URL:
Parameter | Description | Values |
---|---|---|
service | Service type. |
|
request | GetMap request returns map fragment image. |
|
version | Specifies used WMS standard version. |
|
srs crs (1.3.0) |
Projection EPSG code. Must select a code corresponding to the projection in service's base URL. | WGS:
|
width | Image width (pixels). | |
height | Image height (pixels). | |
bbox | Rectangular region of the map fragment. Must provide comma separated minimal and maximal x (longitude) and y (latitude) coordinates in the selected projection (srs or crs parameter). The x and y coordinates of the lower left corner should be specified first, then the upper right corner. | xMin,yMin,xMax,yMax |
Examples
Coloured Jāņa sēta map WMS capabilities document:
https://wms.kartes.lv//wgs/15/?SERVICE=WMS&VERSION=1.0.0&REQUEST=GetCapabilities
Coloured Jāņa sēta map WMS request in WGS projection:
https://wms.kartes.lv//wgs/15/?SERVICE=WMS&VERSION=1.0.0&REQUEST=GetMap&BBOX=2682999,7748141,2686161,7750701&SRS=EPSG:3857&WIDTH=420&HEIGHT=340
Greyscale Jāņa sēta map WMS request in LKS projection
https://wms2.kartes.lv//lks/15bw/?SERVICE=WMS&VERSION=1.0.0&REQUEST=GetMap&BBOX=495210.2393944038195%2C297323.7185847196961%2C522621.1243179840385%2C316295.4527800377691&SRS=EPSG%3A3059&WIDTH=502&HEIGHT=348&FORMAT=image%2Fpng
Cadastral map WMS request
https://wms1.kartes.lv//wgs/cadastral/?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&WIDTH=256&HEIGHT=256&CRS=EPSG%3A4326&STYLES=&BBOX=2737057.1094378084%2C7756218.134887848%2C2738280.1018904033%2C7757441.127340443
LKS best resolution setup
To get the most detailed images map fragments must be requested in scales, which precisely match map zoom levels. In WGS projection (EPSG:3857), it is set up automatically, but in LKS projection (EPSG:3059) scale level resolutions must be configured manually in map libraries.
Scale level | Resolution WGS | Resolution LKS |
---|---|---|
0. | ||
1. | 78271.51696 | |
2. | 39135.75848 | |
3. | 19567.87924 | |
4. | 9783.939620 | |
5. | 4891.969810 | 6007.4787274574555 |
6. | 2445.984905 | 3003.7393637287278 |
7. | 1222.992452 | 1501.8695495724326 |
8. | 611.4962263 | 750.93477478621628 |
9. | 305.7481131 | 375.46751968503941 |
10. | 152.8740566 | 187.73362755058844 |
11. | 76.43702829 | 93.86694606722547 |
12. | 38.21851414 | 46.933473033612735 |
13. | 19.10925707 | 23.4667365168063 |
14. | 9.554728536 | 11.733235966471934 |
15. | 4.777314268 | 5.8666179832359671 |
16. | 2.388657133 | 2.9334412835492341 |
17. | 1.194328566 | 1.4665883498433665 |
18. | 0.597164263 | 0.73342646685293378 |
19. | 0.298582142 | 0.36671323342646689 |
If LKS projection is used with a tiled WMS, it is recommended to provide tile origin coordinates (x, y):
-5682840.1444699997, 4997050.3242600001
WMTS
WMTS service is used to request square map fragments (tiles) by providing tile zoom, row and column sequence numbers.
Service capabilities document
Services' coordinate systems, their extents, precise map tile placement and other parameters can be acquired by making a GetCapabilities request. It returns a standardised XML document, which can be used to precisely setup map layers. Desktop programs use this document to automatically configure the service. In other cases, it is not necessary to request or read it.
Service capabilities document can be obtained by requesting the following URL:
https://wms.kartes.lv//wgs/WMTS/?request=GetCapabilities
This URL must be added to map library or desktop program configuration. Further preparation of the raster map service and requesting of specific map fragments will be done automatically.
Map tile images
To get the map tile images themselves, a request must be made specifying the tile scale, column and row numbers. The request URL is created according to the following scheme:
https://wms<link_number>.kartes.lv/<client_key>/wgs/<layer_key>/<scale_number>/<column_number>/<row_number>.png
Parameter | Description | Values |
---|---|---|
Web map libraries (Leaflet, OpenLayers) can be provided with multiple domains, which can improve parallel loading speed of map fragments. If only one domain is used, then slower map loading is possible due to browser restrictions. |
|
|
Your private Jāņa sēta services access key. | ||
Layer key describes returned map layer. |
|
|
Map tile scale number (z value). | ||
Map tile column number (x value). | ||
Map tile row number (y value). |
WMTS service is available only in WGS—84 (EPSG:3857) projection according to Google Maps map tiling scheme. The tile request will return a 256 pixels by 256 pixels large PNG image. Scale, column and row numbers are counted starting from zero. There is a single tile on the zero scale level (0,0). It covers the entire world. At each subsequent scale level, the tiles are divided into four equal parts. Precise scales and coordinates for each zoom level can be found in the capabilities document. (GetCapabilities).
Examples
Coloured Jāņa sēta map tile:
https://wms.kartes.lv//wgs/15/12/2336/1251.png
Error codes
Code | Description |
---|---|
400 | Request parameters missing or incorrect. |
404 | Requested resource not found. |
5xx | Server error. |
Examples of setup in map libraries
Leaflet
Below are two examples of raster map implementations in the Leaflet web map library:
- greyscale Jāņa sēta map WMS service;
- combined LĢIA ortophoto and cadastral WMTS services.
In both examples WGS projection is used and the map is initially centered in Riga.
const map = L.map('mapId', {
layers: [
L.tileLayer.wms('https://wms{s}.kartes.lv/<span class="kijs_key"></span>/wgs/15bw/', {
subdomains: ['', '1', '2', '3', '4'],
attribution: '<a href="https://balticmaps.eu" target="_blank">Jāņa sēta</a>',
}),
],
center: [56.96, 24.11],
zoom: 12,
})
const map = L.map('mapId', {
layers: [
L.tileLayer('https://wms{s}.kartes.lv/<span class="kijs_key"></span>/wgs/orto/{z}/{x}/{y}', {
subdomains: ['', '1', '2', '3', '4'],
attribution: '<a href="https://balticmaps.eu" target="_blank">Jāņa sēta</a>, <a href="https://www.lgia.gov.lv/" target="_blank">LĢIA</a>',
}),
L.tileLayer('https://wms{s}.kartes.lv/<span class="kijs_key"></span>/wgs/cadastral/{z}/{x}/{y}', {
subdomains: ['', '1', '2', '3', '4'],
attribution: '<a href="https://www.vzd.gov.lv/" target="_blank">VZD</a>',
}),
],
center: [56.96, 24.11],
zoom: 12,
})
OpenLayers
The following describes several examples of the implementation of Jāņa sēta services in the OpenLayers web library.
WMS service
In the first example, the coloured Jāņa sēta map layer is created. Also the general map object is created, the map gets centered in Riga and the previously created myLayer layer is added to it.
The layers created in other examples must be added to the map object as it is done in this example.
import Map from 'ol/Map.js';
import View from 'ol/View.js';
import TileLayer from 'ol/layer/Tile.js';
import OSM from 'ol/source/OSM.js';
const myLayer = new TileLayer({
source: new TileWMS({
url: 'https://wms{1-4}.kartes.lv/<span class="kijs_key"></span>/wgs/15/',
attributions: ['<a href="https://balticmaps.eu" target="_blank">Jāņa sēta</a>'],
}),
})
const myMap = new Map({
view: new View({
center: [24.11, 56.96],
zoom: 12,
}),
layers: [
myLayer, // add layers here
],
target: 'mapId',
});
WMTS service
The layer created in this example uses the cadastral WMTS service, requesting the image by the x, y, and z coordinates of the tiles.
import TileLayer from 'ol/layer/Tile.js';
import XYZ from 'ol/source/XYZ.js';
const myLayer = new TileLayer({
source: new XYZ({
url: 'https://wms{1-4}.kartes.lv/<span class="kijs_key"></span>/wgs/cadastral/{z}/{x}/{y}',
attributions: ['<a href="https://balticmaps.eu" target="_blank">Jāņa sēta</a>', '<a href="https://www.vzd.gov.lv/" target="_blank">VZD</a>'],
})
})
Latvian coordinate system (LKS)
This example shows the use of the LKS coordinate system in the OpenLayers library.
- For map library to be able to correctly put map fragments together, LKS coordinate system must be defined. Projection parameters must be provided in proj4.defs(…) function.
- To create the LKS tile grid, tile origin coordinates and zoom level resolutions must be provided.
- Then the WMS service layer of the greyscale Jāņa sēta map is created, specifying the EPSG:3059 (LKS) projection and the previously created tile grid.
import TileLayer from 'ol/layer/Tile';
import TileWMS from 'ol/source/TileWMS';
import TileGrid from 'ol/tilegrid/TileGrid';
import proj4 from 'proj4';
import { register } from 'ol/proj/proj4';
proj4.defs(
'EPSG:3059',
'+proj=tmerc +lat_0=0 +lon_0=24 +k=0.9996 +x_0=500000 +y_0=-6000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +axis=neu',
)
const lksTileGrid = new TileGrid({
origin: [-5682840.1444699997, 4997050.3242600001],
resolutions: [
6007.4787274574555,
3003.7393637287278,
1501.8695495724326,
750.93477478621628,
375.46751968503941,
187.73362755058844,
93.86694606722547,
46.933473033612735,
23.4667365168063,
11.733235966471934,
5.8666179832359671,
2.9334412835492341,
1.4665883498433665,
0.73342646685293378,
0.36671323342646689,
],
})
const myLayer = new TileLayer({
source: new TileWMS({
url: 'https://wms{1-4}.kartes.lv/<span class="kijs_key"></span>/lks/15bw/',
projection: 'EPSG:3059',
tileGrid: lksTileGrid,
}),
})
Data sources
LĢIA - Latvian Geospatial Information Agency
VZD - Latvian State land service