GeoCzech logo GeoCzech Docs

GeoCzech API

MapServer

Turn any data file on the web into a map service (WMS and WFS) — and show it in QGIS, Leaflet, OpenLayers or any GIS, without installing a map server.

What it does

MapServer reads a data file from a URL and serves it on the fly through the standard OGC interfaces:

  • WMS — map images (PNG/JPEG) for any area and size, with a legend,
  • WFS — the features themselves (GeoJSON, CSV, GML), with attributes,
  • GetFeatureInfo — "what is here?" when someone clicks the map,
  • SLD — your own colours and symbols.

It works with vector data (Shapefile, GeoPackage, GeoJSON, KML …) and rasters (GeoTIFF and more). Nothing is uploaded or pre-processed: MapServer fetches the file when the first map is requested and keeps it in a short-lived cache.

Typical uses

  • Show a GeoTIFF or Shapefile from your storage as a layer in QGIS or ArcGIS.
  • Add your data as an overlay to a web map (Leaflet, OpenLayers, MapLibre).
  • Let users click on the map and see feature attributes.
  • Provide a quick preview image of a dataset.
  • Give partners a map service of your data without running GeoServer.

Preview

MapServer for API customers is in preview. Access is granted with a map key (see below); map keys are being rolled out. Map rendering is charged by rendering time — see Credits.

At a glance

  • Map service: https://maps.geoczech.dev/
  • Access: a map key in the URL — KEY=gcz_map_… (create one)
  • Protocols: WMS 1.3.0 (and 1.1.1), WFS 2.0.0, SLD 1.0/1.1
  • Data: any public http(s) URL of a vector or raster file (ZIP is fine)
  • Default map CRS: EPSG:3857; also EPSG:4326, 5514, 4258, 32633, 32634 …

How it works

Every MapServer request is a plain GET URL. The URL says which file to show (FILE_URL), what you want (SERVICE, REQUEST …) and carries your map key (KEY), which says whose credits pay for the map.

https://maps.geoczech.dev/?KEY=gcz_map_…&FILE_URL=<your data>&SERVICE=WMS&REQUEST=GetMap&…
  1. Create a map key in the Console under Developers → API keys → Create map key and restrict it to your data (see below).
  2. Build the service URL: https://maps.geoczech.dev/?KEY=<map key>&FILE_URL=<data URL>.
  3. Use it in any WMS/WFS client — QGIS, a web map, your script. The URL keeps working until you rotate, pause or delete the key.

Map keys

A map key (it starts with gcz_map_) is a key made for map URLs. Unlike an API key it is not secret — it is part of every map request, so anyone who sees your map (or your QGIS project) can read it. That is why a map key:

  • works only for MapServer — it cannot run any other API tool, and an API key (gcz_live_…) is never accepted in a map URL,
  • should be restricted so that a copied key is useless for anybody else:
Restriction What it does Recommended
Allowed data URLs MapServer renders only files whose FILE_URL starts with one of these prefixes, e.g. https://my-bucket.s3.eu-central-1.amazonaws.com/maps/ (a whole folder) or the URL of a single file. Yes, always. Without it, anyone with the key can render any data from the internet on your credits.
Monthly credit limit The key stops working for the rest of the month after spending this many credits. Yes.
Allowed domains Only web maps on these domains can use the key (checked via Origin/Referer). For web maps. Desktop GIS sends no Referer — use a separate key for QGIS.
Allowed IP addresses Only these addresses or ranges. For QGIS in your office network or your own servers.
Expiry date The key stops working after this date. For temporary access.

Map keys count towards the number of keys in your plan, together with API keys.

Sending the key: add KEY=<map key> to the URL (works in every client). Clients that can set HTTP headers may send X-API-Key: <map key> instead. Desktop GIS can log in with HTTP Basic — any user name and the map key as the password (in QGIS Authentication → Basic); the key then stays out of the URL and the project file. A request without a usable key answers HTTP 401 with WWW-Authenticate: Basic, so these clients ask for the login.

Never put an API key into a map URL

API keys (gcz_live_…) are secret. MapServer rejects them with secret_key_in_url — if that happens, rotate the API key in the Console, because it may have ended up in logs or browser history.

Maps from the Map Viewer

A map saved in the MyGeodata Map Viewer can be published as a map service: one WMS (1.3.0 and 1.1.1) with all layers of the map, drawn with the map's styles, labels, opacity and scale limits. The owner gets its address in Share → Map service (WMS):

https://maps.geoczech.dev/m/<map service>/?KEY=gcz_map_…&SERVICE=WMS&REQUEST=GetCapabilities
  • The first layer of the capabilities is the whole map; groups and layers of the map follow under it. LAYERS may name any of them — a group or the whole map draws its visible layers in the map's order.
  • GetMap (image/png, image/jpeg, image/webp, image/vnd.jpeg-png, image/vnd.jpeg-webp), GetLegendGraphic and — when the owner allows it — GetFeatureInfo (text/html, text/plain, application/json). No FILE_URL, no WFS and no own styles: the service draws what the map shows.
  • The key must belong to the owner of the map and allow it (a key restricted to other maps answers map_service_not_allowed). The images are billed to the owner like any MapServer rendering.
  • The service follows the last saved version of the map; switched off it answers map_service_disabled, an unknown address map_service_not_found (HTTP 404).

Access errors

When a request is not allowed, MapServer answers with an OGC ServiceExceptionReport (XML) whose code tells you why — QGIS and web map libraries show it as the layer error.

HTTP code Meaning
401 missing_map_key No KEY in the URL.
401 invalid_api_key The key does not exist (typo? copied only part of it?).
401 api_key_expired, api_key_revoked, api_key_paused, api_key_rotated The key exists but is not active.
403 secret_key_in_url An API key was used instead of a map key — rotate that API key.
403 file_url_not_allowed FILE_URL is not within the key's allowed data URLs, or the key works only for published maps.
403 map_service_not_allowed The key belongs to another account than the published map, or it is restricted to other maps.
404 map_service_not_found, map_service_disabled The published map does not exist or its owner switched it off.
403 ip_not_allowed, domain_not_allowed The request comes from an address/page the key is not allowed for.
403 api_access_denied, account_inactive The plan has no API access, or the account is suspended.
402 insufficient_credits, api_key_monthly_limit No credits left, or the key reached its monthly limit.
429 rate_limited Too many requests at once — slow down.

Changes made in the Console (pausing a key, new restrictions) take effect within about a minute.

An answer larger than the service can send (about 4.5 MB of image) is HTTP 413 response_too_large and costs no credits: ask for a smaller WIDTH / HEIGHT or a smaller FORMAT (image/vnd.jpeg-webp, image/jpeg).

What is in the service? (GetCapabilities)

GetCapabilities returns an XML description of the service: the layer names, their extent and the coordinate systems you can ask for. GIS programs call it automatically when you add the service.

Layer names come from the file (or the layers inside it): only letters, digits and underscores are kept, so st-helena-places.geojson becomes sthelenaplaces and st-helena-dem.tif becomes sthelenadem. A GeoPackage with several layers gives several WMS layers.

List the layers
curl -G "https://maps.geoczech.dev/" \
  --data-urlencode "FILE_URL=https://cdn.geoczech.dev/docs-samples/v1/st-helena-places.geojson" \
  --data-urlencode "KEY=YOUR_MAP_KEY" \
  --data-urlencode "SERVICE=WMS" \
  --data-urlencode "VERSION=1.3.0" \
  --data-urlencode "REQUEST=GetCapabilities"
Response (XML, shortened)
<WMS_Capabilities version="1.3.0" …>
  <Capability>
    <Layer>
      <Name>geoczech_wms</Name>
      <Layer queryable="1">
        <Name>sthelenaplaces</Name>
        <Title>st-helena-places</Title>
        <EX_GeographicBoundingBox>
          <westBoundLongitude>-5.772174</westBoundLongitude>
          <eastBoundLongitude>-5.638883</eastBoundLongitude>
          <southBoundLatitude>-16.008899</southBoundLatitude>
          <northBoundLatitude>-15.906601</northBoundLatitude>
        </EX_GeographicBoundingBox>
        …

A map image (GetMap)

Ask for a picture of the map. If you leave out BBOX, MapServer shows the whole dataset; WIDTH/HEIGHT default to 512 px (max. 4096).

Default styling: vector data that carry their own drawing style (KML/KMZ, MapInfo, DXF, DGN, or an OGR_STYLE attribute in any format) are drawn with it; other vector features in blue. Rasters with their own colour table are drawn in those colours, RGB images in colour, single-band rasters (like elevation) in grey with automatic contrast. No-data areas are transparent. The raster parameters below (BANDS, STRETCH, RANGE, COLORMAP) change that without writing a style.

Query parameters

FILE_URL string (URL) required

The data file — public http(s) URL within the key's allowed data URLs.

KEY string required

Your map key (gcz_map_…). Alternatively the X-API-Key header.

SERVICE string default WMS

Allowed values: WMS · WFS

REQUEST string default GetCapabilities

Allowed values: GetCapabilities · GetMap · GetFeatureInfo · GetLegendGraphic · GetFeature · DescribeFeatureType · DescribeData

VERSION string default 1.3.0

WMS 1.3.0 (or 1.1.1); WFS 2.0.0.

LAYERS string

Comma-separated layer names. All layers when left out.

CRS string default EPSG:3857

Coordinate system of BBOX and of the image (SRS in WMS 1.1.1).

BBOX string

Area to show: minX,minY,maxX,maxY in CRS. Calculated from the data when left out. Note: in WMS 1.3.0 with EPSG:4326 the order is minLat,minLon,maxLat,maxLon.

WIDTH, HEIGHT integer (px) default 512

Image size, max. 4096 × 4096.

FORMAT string default image/png
  • image/png — PNG with transparency, full colours. The default.
  • image/png; mode=24bit — always the full-colour PNG.
  • image/png; mode=8bit — PNG with a palette of 256 colours, transparency kept. About 60 % smaller for a vector map, but the colour of small symbols may shift.
  • image/jpeg — JPEG, no transparency.
  • image/vnd.jpeg-png — best for aerial images and scanned maps laid over a basemap: a JPEG when the whole image is opaque, a PNG as soon as any pixel is transparent (the edge of the raster, a rotated image, nodata). An opaque image is five to ten times smaller and comes faster; Content-Type of the response says which of the two you got.
  • image/webp — lossy WebP with transparency.
  • image/vnd.jpeg-webp — the same JPEG for an opaque image, a WebP with transparency otherwise. Best for photos in a web map: a photo with a transparent edge is many times smaller as WebP than as PNG. Desktop GIS may not read WebP — use image/vnd.jpeg-png there.

Allowed values: image/png · image/png; mode=24bit · image/png; mode=8bit · image/jpeg · image/webp · image/vnd.jpeg-png · image/vnd.jpeg-webp

TRANSPARENT boolean

Transparent background (PNG only) — use TRUE for overlays.

Allowed values: TRUE · FALSE

FILE_CRS string

Coordinate system of the data, when the file does not contain it (e.g. EPSG:32730).

BANDS string

Raster bands to draw: three numbers = red, green, blue (BANDS=4,3,2 for a false-colour satellite image), one number = that band in grey or with a COLORMAP.

STRETCH string

Contrast stretch of the drawn bands: two percentiles (STRETCH=2,98), minmax or none. GRAY_CLIP=low,high is the older name of the percentile form.

RANGE string

Lowest and highest drawn value instead of a stretch computed from the data, e.g. RANGE=0,2500.

NODATA number

Cell value drawn transparent — instead of (or in place of a missing) no-data value of the file, e.g. NODATA=0 for the black border of a scan.

COLORMAP string

Colours of a single band: a name (gray, terrain, viridis, magma, turbo, blues, greens, ylorrd, rdylgn, spectral) or your own stops value:colour (COLORMAP=0:#2f7d4f,500:#f4e285,1000:#ffffff).

Advanced parameters (2)
FEATURE_STYLES string

off draws vector layers with the default style even when the data carry their own.

Allowed values: off

STYLES, BGCOLOR string

Standard WMS parameters.

Render the elevation model as PNG
curl -G "https://maps.geoczech.dev/" \
  --data-urlencode "FILE_URL=https://cdn.geoczech.dev/docs-samples/v1/st-helena-dem.tif" \
  --data-urlencode "KEY=YOUR_MAP_KEY" \
  --data-urlencode "SERVICE=WMS" \
  --data-urlencode "VERSION=1.3.0" \
  --data-urlencode "REQUEST=GetMap" \
  --data-urlencode "LAYERS=sthelenadem" \
  --data-urlencode "CRS=EPSG:3857" \
  --data-urlencode "WIDTH=800" \
  --data-urlencode "HEIGHT=600" \
  --data-urlencode "FORMAT=image/png" \
  -o terrain.png

In QGIS and web maps

Any software that speaks WMS can show the layer. Use the service URL with your map key as the address — https://maps.geoczech.dev/?KEY=<map key>&FILE_URL=<data URL>. The capabilities returned by MapServer carry the key and the data URL, so the client sends them with every map request automatically.

Add the layer to a map
1. Layer → Add Layer → Add WMS/WMTS Layer…
2. Click "New", give the connection a name (e.g. "St Helena elevation")
   and paste as the URL:
   https://maps.geoczech.dev/?KEY=YOUR_MAP_KEY&FILE_URL=https://cdn.geoczech.dev/docs-samples/v1/st-helena-dem.tif
3. Click "Connect", select the layer "sthelenadem" and click "Add".

The connection keeps working until you rotate, pause or delete the map key.
Use a map key without a domain allowlist — QGIS sends no Referer.

Clicked feature info (GetFeatureInfo)

Returns the attributes of the features at a pixel of a map image — the request your web map sends when a user clicks. I/J are the pixel coordinates in the image described by BBOX, WIDTH and HEIGHT; INFO_FORMAT can be application/json, text/html (default), text/plain or GML.

What is at this pixel?
curl -G "https://maps.geoczech.dev/" \
  --data-urlencode "FILE_URL=https://cdn.geoczech.dev/docs-samples/v1/st-helena-places-utm.zip" \
  --data-urlencode "KEY=YOUR_MAP_KEY" \
  --data-urlencode "SERVICE=WMS" \
  --data-urlencode "VERSION=1.3.0" \
  --data-urlencode "REQUEST=GetFeatureInfo" \
  --data-urlencode "LAYERS=sthelenaplacesutm" \
  --data-urlencode "QUERY_LAYERS=sthelenaplacesutm" \
  --data-urlencode "CRS=EPSG:3857" \
  --data-urlencode "BBOX=-637312,-1797355,-635312,-1795355" \
  --data-urlencode "WIDTH=500" \
  --data-urlencode "HEIGHT=500" \
  --data-urlencode "I=250" \
  --data-urlencode "J=250" \
  --data-urlencode "INFO_FORMAT=application/json"
Response
{
  "type": "FeatureCollection",
  "name": "sthelenaplacesutm",
  "features": [
    {"type": "Feature",
     "properties": {"id": "10", "name": "Jamestown", "category": "town", "kind": "settlement", "elevation": "36"},
     "geometry": {"type": "Point", "coordinates": [-636311.919, -1796354.959]}}
  ]
}

Legend (GetLegendGraphic)

A small image with the symbols of a layer — use LAYER (singular) and the same SLD/SLD_BODY as for the map, if you use a custom style.

Legend image
curl -G "https://maps.geoczech.dev/" \
  --data-urlencode "FILE_URL=https://cdn.geoczech.dev/docs-samples/v1/st-helena-places.geojson" \
  --data-urlencode "KEY=YOUR_MAP_KEY" \
  --data-urlencode "SERVICE=WMS" \
  --data-urlencode "VERSION=1.3.0" \
  --data-urlencode "REQUEST=GetLegendGraphic" \
  --data-urlencode "LAYER=sthelenaplaces" \
  --data-urlencode "FORMAT=image/png" \
  -o legend.png

What is in the file (DescribeData)

REQUEST=DescribeData returns one JSON document about the file — handy when you build your own layer list, legend or style editor:

  • layers in drawing order, each with its name (use it in LAYERS), title, kind (vector / raster), geometry, attributes (fields), featureCount, extent (longitude/latitude) and coordinate system,
  • for vector layers featureStyles — whether the data carry their own drawing style and its legend — and suggestedStyle, a ready-made style proposal when the kind of data is obvious (water, forests, contours, roads…),
  • for rasters the bands, the colour palette and rendering — how the raster is drawn with the BANDS / STRETCH / RANGE / COLORMAP you send along,
  • performance — roughly how long one redraw takes (expectedSeconds) and, when the format itself is what makes it slow, an advice to convert the data (for example a large GeoJSON to FlatGeobuf).

No SERVICE parameter is needed; FILE_URL and KEY work as everywhere else.

Describe the sample places
curl -G "https://maps.geoczech.dev/" \
  --data-urlencode "FILE_URL=https://cdn.geoczech.dev/docs-samples/v1/st-helena-places.geojson" \
  --data-urlencode "KEY=YOUR_MAP_KEY" \
  --data-urlencode "REQUEST=DescribeData"
Response (JSON, shortened)
{
  "version": 1,
  "extent": [-5.7721743, -16.008899, -5.638883, -15.906601],
  "layers": [
    {
      "name": "sthelenaplaces",
      "title": "st-helena-places",
      "kind": "vector",
      "geometry": "point",
      "featureCount": 58,
      "fields": [{"name": "name", "type": "String"}, …],
      "extent": [-5.7721743, -16.008899, -5.638883, -15.906601],
      "crs": "EPSG:4326",
      "featureStyles": null,
      "suggestedStyle": null
    }
  ],
  "skipped": [],
  "performance": {"expectedSeconds": 0.07, "readSeconds": 0.0, "rating": "fast", …}
}

The data itself (WFS)

With SERVICE=WFS you get the features instead of a picture — for example as GeoJSON to draw them yourself in a web map, or to download a subset of the data.

Parameter Meaning
TYPENAMES Layer name (from GetCapabilities).
OUTPUTFORMAT geojson (default), csv (geometry as WKT) or gml.
COUNT Maximum number of features.
SRSNAME Coordinate system of the returned geometries.
BBOX Only features in this area.
Get features as GeoJSON
curl -G "https://maps.geoczech.dev/" \
  --data-urlencode "FILE_URL=https://cdn.geoczech.dev/docs-samples/v1/st-helena-places-utm.zip" \
  --data-urlencode "KEY=YOUR_MAP_KEY" \
  --data-urlencode "SERVICE=WFS" \
  --data-urlencode "VERSION=2.0.0" \
  --data-urlencode "REQUEST=GetFeature" \
  --data-urlencode "TYPENAMES=sthelenaplacesutm" \
  --data-urlencode "OUTPUTFORMAT=geojson" \
  --data-urlencode "COUNT=2"
Response
{
  "type": "FeatureCollection",
  "name": "sthelenaplacesutm",
  "features": [
    {"type": "Feature", "properties": {"id": "1", "name": "Bluemans Field", "category": "hamlet", "kind": "settlement", "elevation": "551"},
     "geometry": {"type": "Point", "coordinates": [-5.735501, -15.956658]}},
    {"type": "Feature", "properties": {"id": "2", "name": "Bottom Woods", "category": "hamlet", "kind": "settlement", "elevation": "455"},
     "geometry": {"type": "Point", "coordinates": [-5.671312, -15.944942]}}
  ]
}

Your own style (SLD)

Pass a style as SLD (Styled Layer Descriptor, an XML standard that QGIS can export): either a link to an .sld file in SLD, or the XML itself (URL-encoded) in SLD_BODY. The NamedLayer/Name in the SLD must match the layer name.

Red points with a custom style
curl -G "https://maps.geoczech.dev/" \
  --data-urlencode "FILE_URL=https://cdn.geoczech.dev/docs-samples/v1/st-helena-places.geojson" \
  --data-urlencode "KEY=YOUR_MAP_KEY" \
  --data-urlencode "SERVICE=WMS" \
  --data-urlencode "VERSION=1.3.0" \
  --data-urlencode "REQUEST=GetMap" \
  --data-urlencode "LAYERS=sthelenaplaces" \
  --data-urlencode "CRS=EPSG:3857" \
  --data-urlencode "WIDTH=800" \
  --data-urlencode "HEIGHT=600" \
  --data-urlencode "FORMAT=image/png" \
  --data-urlencode "TRANSPARENT=TRUE" \
  --data-urlencode "SLD_BODY=<StyledLayerDescriptor version=\"1.0.0\" xmlns=\"http://www.opengis.net/sld\" xmlns:ogc=\"http://www.opengis.net/ogc\"><NamedLayer><Name>sthelenaplaces</Name><UserStyle><FeatureTypeStyle><Rule><PointSymbolizer><Graphic><Mark><WellKnownName>circle</WellKnownName><Fill><CssParameter name=\"fill\">#d7263d</CssParameter></Fill></Mark><Size>12</Size></Graphic></PointSymbolizer></Rule></FeatureTypeStyle></UserStyle></NamedLayer></StyledLayerDescriptor>" \
  -o red-points.png

Good to know

  • Data URLs must be public http(s) links (no login). Private network addresses are blocked.
  • Caching: the data file is cached by URL for a while, and map images may be cached by browsers for up to an hour. When your data changes, change the URL (for example add ?v=2) — the key's allowed data URL prefix still matches.
  • Time limit: each request must finish within about 60 seconds. Huge files (many GB) are better converted to an efficient format first — e.g. a tiled, compressed GeoTIFF or a GeoPackage — with the Converter.
  • Speed: text formats without a spatial index (GeoJSON, GML, KML, GPX, CSV, DXF) are read whole for every map image, however small the area is — from tens of thousands of features that takes seconds. The same data in FlatGeobuf or GeoPackage draw several times faster. DescribeData tells you when it is worth it (performance.advice).
  • CORS is enabled, so map images and WFS data can be loaded directly from web pages.

Last updated 2026-11-17