swisscoverage

Die API

Eine öffentliche API, nur zum Lesen, die als JSON die Mobilfunkstandorte liefert, die das BAKOM veröffentlicht: wie sie heute sind und wie sie seit Beginn des Archivs waren. Sie ist kostenlos, braucht keinen Schlüssel und beantwortet Anfragen von jeder Website.

Jede Adresse auf dieser Seite beginnt mit https://api.swisscoverage.ch.

Die Referenz unten wird aus dem Vertrag der API, openapi.json, erzeugt und ist wie dieser auf Englisch.

01Eine erste Anfrage

Kopieren Sie diesen Befehl in ein Terminal: Er listet die Anlagen um einen Punkt auf, die nächste zuerst.

curl -sS --compressed 'https://api.swisscoverage.ch/v1/stations/search?lat=46.948&lon=7.4474&radius=300'

02Quelle und Bedingungen

Die Daten stammen vom Bundesamt für Kommunikation BAKOM. Seine Nutzungsbedingungen verlangen die Angabe der Quelle: Jede Antwort mit Daten hat ein Feld attribution, das überall anzuzeigen ist, wo die Daten verwendet werden.

Die Nutzungsbedingungen des BAKOM, auf opendata.swiss

The mobile network sites of Switzerland that OFCOM publishes, as they are today and as they were since the archive began. Read-only, and free to use. Source: Federal Office of Communications OFCOM, whose terms ask that the source be given: https://opendata.swiss/en/terms-of-use/#terms_by. Every response may be cached: the data changes once a day.

Version 1.0.0 des VertragsAGPL-3.0-only, for the code; the data keeps the terms of its source

03Endpunkte

GET/v1/snapshots

The snapshots

The files published by OFCOM that the data comes from, one per day since the archive began, the newest first.

Beispiel

curl -sS --compressed 'https://api.swisscoverage.ch/v1/snapshots'

Parameter

  • limitintegerin der Abfrage

    The most items to return.

    • Standard 100
    • Mindestens 1
    • Höchstens 1000
  • offsetintegerin der Abfrage

    How many items to skip, for the next pages.

    • Standard 0
    • Mindestens 0
    • Höchstens 1000000

Antworten

  • 200OKSnapshotListapplication/json
  • 304Not modified: the response named by If-None-Match is still the current one.
  • 422Unprocessable EntityErrorModelapplication/problem+json
  • 500Internal Server ErrorErrorModelapplication/problem+json
  • 503Service UnavailableErrorModelapplication/problem+json

GET/v1/stations

Every station published today

Every site of the latest snapshot, as one GeoJSON FeatureCollection, which is what the map loads. It is not paginated: the dataset bounds it, at about 23,000 sites. For a station's details, read it by its id.

Beispiel

curl -sS --compressed 'https://api.swisscoverage.ch/v1/stations'

Antworten

  • 200OKStationCollectionapplication/geo+json
  • 304Not modified: the response named by If-None-Match is still the current one.
  • 422Unprocessable EntityErrorModelapplication/problem+json
  • 500Internal Server ErrorErrorModelapplication/problem+json
  • 503Service UnavailableErrorModelapplication/problem+json

GET/v1/stations/{id}

One station and its history

A site, published today or in the past, with what each snapshot published about it: one period for each stretch of time during which nothing changed, the latest first.

Beispiel

curl -sS --compressed 'https://api.swisscoverage.ch/v1/stations/2683328_1247916_Sunrise%20ZE416-1'

Parameter

  • idstringim Pfaderforderlich

    The station's identifier, as east_north_label, such as 2683000_1247000_Sunrise ZH601-1, percent-encoded in the path.

    • Beispiel 2683328_1247916_Sunrise ZE416-1
    • Bis zu 1000 Zeichen
    • Entspricht ^-?[0-9]+(\.[0-9]+)?_-?[0-9]+(\.[0-9]+)?_[\s\S]+$
  • limitintegerin der Abfrage

    The most items to return.

    • Standard 100
    • Mindestens 1
    • Höchstens 1000
  • offsetintegerin der Abfrage

    How many items to skip, for the next pages.

    • Standard 0
    • Mindestens 0
    • Höchstens 1000000

Antworten

  • 200OKStationHistoryapplication/json
  • 304Not modified: the response named by If-None-Match is still the current one.
  • 404Not FoundErrorModelapplication/problem+json
  • 422Unprocessable EntityErrorModelapplication/problem+json
  • 500Internal Server ErrorErrorModelapplication/problem+json
  • 503Service UnavailableErrorModelapplication/problem+json

GET/v1/stations/counts

Counts of stations

How many sites the latest snapshot publishes, in all and for each operator, kind, power class and technology. Every value is listed, with zero when no site has it. A site counts once for each of its technologies.

Beispiel

curl -sS --compressed 'https://api.swisscoverage.ch/v1/stations/counts'

Antworten

  • 200OKStationCountsapplication/json
  • 304Not modified: the response named by If-None-Match is still the current one.
  • 422Unprocessable EntityErrorModelapplication/problem+json
  • 500Internal Server ErrorErrorModelapplication/problem+json
  • 503Service UnavailableErrorModelapplication/problem+json

GET/v1/stations/search

Stations in a rectangle or around a point

The sites of the latest snapshot inside a rectangle, given by bbox, or within radius metres of a point, given by lat and lon. Exactly one of the two is required. Each filter accepts several values, separated by commas, and keeps the sites that have one of them; filters combine with each other. Results are ordered by label and position, or nearest first around a point.

Beispiel

curl -sS --compressed 'https://api.swisscoverage.ch/v1/stations/search?lat=46.948&lon=7.4474&radius=300'

Parameter

  • bboxnumber[]in der Abfrage

    A rectangle in WGS84, as west,south,east,north in degrees: the longitude of its west edge, the latitude of its south edge, and so on. Edges are included.

    • Genau 4 Werte
  • latnumberin der Abfrage

    The latitude of the point to search around, in WGS84 degrees. Requires lon.

    • Beispiel 46.948
    • Mindestens -90
    • Höchstens 90
  • lonnumberin der Abfrage

    The longitude of the point to search around, in WGS84 degrees. Requires lat.

    • Beispiel 7.4474
    • Mindestens -180
    • Höchstens 180
  • radiusnumberin der Abfrage

    Around a point: the distance to search within, in metres.

    • Standard 1000
    • Beispiel 300
    • Mindestens 1
    • Höchstens 50000
  • operatorstring[]in der Abfrage

    Keeps the sites run by one of these operators.

    Werteswisscomsunrisesaltsbbother

    • Bis zu 5 Werte
  • kindstring[]in der Abfrage

    Keeps the sites of one of these kinds.

    Werteoutdooroutdoor_low_powerindoortunneltemporaryunknown

    • Bis zu 6 Werte
  • powerClassstring[]in der Abfrage

    Keeps the sites of one of these power classes.

    Wertevery_lowlowmediumhighunknown

    • Bis zu 5 Werte
  • technologystring[]in der Abfrage

    Keeps the sites that have one of these technologies.

    Werte2G3G4G5G

    • Bis zu 4 Werte
  • limitintegerin der Abfrage

    The most items to return.

    • Standard 100
    • Mindestens 1
    • Höchstens 1000
  • offsetintegerin der Abfrage

    How many items to skip, for the next pages.

    • Standard 0
    • Mindestens 0
    • Höchstens 1000000

Antworten

  • 200OKSearchResultapplication/json
  • 304Not modified: the response named by If-None-Match is still the current one.
  • 422Unprocessable EntityErrorModelapplication/problem+json
  • 500Internal Server ErrorErrorModelapplication/problem+json
  • 503Service UnavailableErrorModelapplication/problem+json

04Fehler

Eine fehlgeschlagene Anfrage erhält einen der Status unten und einen Inhalt vom Typ application/problem+json, dessen Felder die von ErrorModel sind.

  • 404Not Found
  • 422Unprocessable Entity
  • 500Internal Server Error
  • 503Service Unavailable

ErrorModel

05Caching

  • Cache-Control

    The response may be reused for five minutes: the data changes once a day.

  • ETag

    Changes exactly when the response does. Send it back in If-None-Match to get 304 when nothing changed.

  • If-None-MatchHeader der Anfrage

    The ETag of a response already held.

  • 304

    Not modified: the response named by If-None-Match is still the current one.

06Typen

ErrorDetail

  • locationstring

    Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'

  • messagestring

    Error message text

  • valueany

    The value at the given location

ErrorModel

  • detailstring

    A human-readable explanation specific to this occurrence of the problem.

  • errorsErrorDetail[]

    Optional list of individual error details

  • instancestring (uri)

    A URI reference that identifies the specific occurrence of the problem.

  • statusinteger

    HTTP status code

  • titlestring

    A short, human-readable summary of the problem type. This value should not change between occurrences of the error.

  • typestring (uri)

    A URI reference to human-readable documentation for the error.

    • Standard about:blank

KindCount

  • stationsintegererforderlich

    • Mindestens 0
  • valuestringerforderlich

    The type of site: outdoor above 6 W ERP, outdoor up to 6 W ERP, indoor up to 6 W ERP, in a tunnel, temporary, or not published.

    Werteoutdooroutdoor_low_powerindoortunneltemporaryunknown

LV95

  • eastnumbererforderlich

    Easting in LV95 (EPSG:2056), in metres.

  • northnumbererforderlich

    Northing in LV95 (EPSG:2056), in metres.

OperatorCount

  • stationsintegererforderlich

    • Mindestens 0
  • valuestringerforderlich

    Who runs the station. other groups the stations published without a known operator, such as foreign stations near the border.

    Werteswisscomsunrisesaltsbbother

Period

  • adaptiveboolean | nullerforderlich

    Whether at least part of the site runs adaptive antennas. Null when the file says something that is not recognised.

  • fromstring (date-time)erforderlich

    The publication time of the snapshot that first showed these values.

  • installationLimitValuenumber | nullerforderlich

    The installation limit value, in V/m. Null when absent or left blank.

  • kindstringerforderlich

    The type of site: outdoor above 6 W ERP, outdoor up to 6 W ERP, indoor up to 6 W ERP, in a tunnel, temporary, or not published.

    Werteoutdooroutdoor_low_powerindoortunneltemporaryunknown

  • permitPermit | nullerforderlich

    Null when OFCOM publishes no permit information.

  • powerClassstringerforderlich

    The class of ERP90, the highest cumulated power radiated in a 90° sector, as OFCOM publishes it.

    Wertevery_lowlowmediumhighunknown

  • technologiesstring[]erforderlich

    In generation order. Empty when the file lists none that is recognised.

    Werte2G3G4G5G

  • tostring (date-time) | nullerforderlich

    The publication time of the first snapshot that no longer did. Null while they are still published.

Permit

  • typestringerforderlich

    site_data_sheet: a site data sheet was filed. exempt: the site is exempt from the precautionary emission limit (NISV Annex 1 No. 64).

    Wertesite_data_sheetexempt

  • datestring (date)

    The date of the site data sheet. Absent for an exemption, and when the published date is not a day that exists.

PointGeometry

  • coordinatesnumber[]erforderlich

    Longitude and latitude in WGS84, in degrees, to 7 decimals.

    • Genau 2 Werte
  • typestringerforderlich

    WertePoint

Position

  • latnumbererforderlich

    Latitude in WGS84, in degrees.

    • Mindestens -90
    • Höchstens 90
  • lonnumbererforderlich

    Longitude in WGS84, in degrees.

    • Mindestens -180
    • Höchstens 180

PowerClassCount

  • stationsintegererforderlich

    • Mindestens 0
  • valuestringerforderlich

    The class of ERP90, the highest cumulated power radiated in a 90° sector, as OFCOM publishes it.

    Wertevery_lowlowmediumhighunknown

PublishedStation

  • adaptiveboolean | nullerforderlich

    Whether at least part of the site runs adaptive antennas. Null when the file says something that is not recognised.

  • codestringerforderlich

    The label without the operator's name, such as "ZH601-1".

  • firstSeenstring (date-time)erforderlich

    The publication time of the first snapshot that showed the site.

  • idstringerforderlich

    The site's identifier: its LV95 position and its label, as east_north_label. OFCOM publishes no identifier, and a label alone is not unique.

  • installationLimitValuenumber | nullerforderlich

    The installation limit value, in V/m. Null when absent or left blank.

  • kindstringerforderlich

    The type of site: outdoor above 6 W ERP, outdoor up to 6 W ERP, indoor up to 6 W ERP, in a tunnel, temporary, or not published.

    Werteoutdooroutdoor_low_powerindoortunneltemporaryunknown

  • lv95LV95erforderlich

    The position as published.

  • namestringerforderlich

    The station label exactly as published, such as "Sunrise ZH601-1".

  • operatorstringerforderlich

    Who runs the station. other groups the stations published without a known operator, such as foreign stations near the border.

    Werteswisscomsunrisesaltsbbother

  • permitPermit | nullerforderlich

    Null when OFCOM publishes no permit information.

  • positionPositionerforderlich

    The same position in WGS84, computed with the rigorous transformation, to 7 decimals.

  • powerClassstringerforderlich

    The class of ERP90, the highest cumulated power radiated in a 90° sector, as OFCOM publishes it.

    Wertevery_lowlowmediumhighunknown

  • technologiesstring[]erforderlich

    In generation order. Empty when the file lists none that is recognised.

    Werte2G3G4G5G

  • distancenumber

    Around a point only: the distance from it, in metres, on the ellipsoid.

SearchResult

  • attributionstringerforderlich

    The credit OFCOM's terms require.

  • limitintegererforderlich

  • offsetintegererforderlich

  • snapshotSnapshoterforderlich

    The snapshot these stations come from.

  • stationsPublishedStation[]erforderlich

  • totalintegererforderlich

    How many stations the search matched, on every page.

Snapshot

  • publishedAtstring (date-time)erforderlich

    When OFCOM published the file. It identifies the snapshot.

  • sha256stringerforderlich

    The SHA-256 of the file as published, in hexadecimal.

    • Entspricht ^[0-9a-f]{64}$
  • sitesintegererforderlich

    The number of sites in the file.

    • Mindestens 0

SnapshotList

  • attributionstringerforderlich

    The credit OFCOM's terms require.

  • limitintegererforderlich

  • offsetintegererforderlich

  • snapshotsSnapshot[]erforderlich

    The newest first.

  • totalintegererforderlich

    How many snapshots there are, on every page.

StationCollection

  • attributionstringerforderlich

    The credit OFCOM's terms require.

  • featuresStationFeature[]erforderlich

  • snapshotSnapshoterforderlich

    The snapshot these stations come from.

  • typestringerforderlich

    WerteFeatureCollection

StationCounts

  • attributionstringerforderlich

    The credit OFCOM's terms require.

  • kindsKindCount[]erforderlich

  • operatorsOperatorCount[]erforderlich

  • powerClassesPowerClassCount[]erforderlich

  • snapshotSnapshoterforderlich

    The snapshot these counts come from.

  • stationsintegererforderlich

    How many sites the snapshot publishes.

    • Mindestens 0
  • technologiesTechnologyCount[]erforderlich

StationFeature

  • geometryPointGeometryerforderlich

  • idstringerforderlich

    The station's identifier, as in the station's own response.

  • propertiesStationPropertieserforderlich

  • typestringerforderlich

    WerteFeature

StationHistory

  • attributionstringerforderlich

    The credit OFCOM's terms require.

  • codestringerforderlich

    The label without the operator's name, such as "ZH601-1".

  • firstSeenstring (date-time)erforderlich

    The publication time of the first snapshot that showed the site.

  • idstringerforderlich

    The site's identifier: its LV95 position and its label, as east_north_label. OFCOM publishes no identifier, and a label alone is not unique.

  • limitintegererforderlich

  • lv95LV95erforderlich

    The position as published.

  • namestringerforderlich

    The station label exactly as published, such as "Sunrise ZH601-1".

  • offsetintegererforderlich

  • operatorstringerforderlich

    Who runs the station. other groups the stations published without a known operator, such as foreign stations near the border.

    Werteswisscomsunrisesaltsbbother

  • periodsPeriod[]erforderlich

    What was published of the site, period by period, the latest first.

  • positionPositionerforderlich

    The same position in WGS84, computed with the rigorous transformation, to 7 decimals.

  • publishedbooleanerforderlich

    Whether the latest snapshot shows the site.

  • totalintegererforderlich

    How many periods the site has, on every page.

StationProperties

  • kindstringerforderlich

    The type of site: outdoor above 6 W ERP, outdoor up to 6 W ERP, indoor up to 6 W ERP, in a tunnel, temporary, or not published.

    Werteoutdooroutdoor_low_powerindoortunneltemporaryunknown

  • namestringerforderlich

    The station label exactly as published.

  • operatorstringerforderlich

    Who runs the station. other groups the stations published without a known operator, such as foreign stations near the border.

    Werteswisscomsunrisesaltsbbother

  • powerClassstringerforderlich

    The class of ERP90, the highest cumulated power radiated in a 90° sector, as OFCOM publishes it.

    Wertevery_lowlowmediumhighunknown

  • technologiesstring[]erforderlich

    In generation order. Empty when the file lists none that is recognised.

    Werte2G3G4G5G

TechnologyCount

  • stationsintegererforderlich

    • Mindestens 0
  • valuestringerforderlich

    A mobile network generation.

    Werte2G3G4G5G

07Der Vertrag

Die ganze API ist in OpenAPI 3.1 beschrieben, in einer Datei, die die API ausliefert und das Repository aufbewahrt. Daraus lassen sich Clients erzeugen.