swisscoverage

L’API

Un’API pubblica, in sola lettura, che fornisce in JSON gli impianti di telefonia mobile pubblicati dall’UFCOM, come sono oggi e come erano dall’inizio dell’archivio. È gratuita, non richiede alcuna chiave e risponde alle richieste di qualsiasi sito web.

Ogni indirizzo di questa pagina inizia con https://api.swisscoverage.ch.

Il riferimento qui sotto è generato dal contratto dell’API, openapi.json, ed è scritto in inglese, come il contratto.

01Una prima richiesta

Copiate questo comando in un terminale: elenca gli impianti intorno a un punto, dal più vicino.

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

02Fonte e condizioni

I dati provengono dall’Ufficio federale delle comunicazioni UFCOM. Le sue condizioni d’uso chiedono di indicare la fonte: ogni risposta che contiene dati ha un campo attribution, da mostrare ovunque i dati siano usati.

Le condizioni d’uso dell’UFCOM, su 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.

Versione 1.0.0 del contrattoAGPL-3.0-only, for the code; the data keeps the terms of its source

03Endpoint

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.

Esempio

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

Parametri

  • limitintegernella query

    The most items to return.

    • Predefinito 100
    • Almeno 1
    • Al massimo 1000
  • offsetintegernella query

    How many items to skip, for the next pages.

    • Predefinito 0
    • Almeno 0
    • Al massimo 1000000

Risposte

  • 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.

Esempio

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

Risposte

  • 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.

Esempio

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

Parametri

  • idstringnel percorsoobbligatorio

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

    • Esempio 2683328_1247916_Sunrise ZE416-1
    • Fino a 1000 caratteri
    • Corrisponde a ^-?[0-9]+(\.[0-9]+)?_-?[0-9]+(\.[0-9]+)?_[\s\S]+$
  • limitintegernella query

    The most items to return.

    • Predefinito 100
    • Almeno 1
    • Al massimo 1000
  • offsetintegernella query

    How many items to skip, for the next pages.

    • Predefinito 0
    • Almeno 0
    • Al massimo 1000000

Risposte

  • 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.

Esempio

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

Risposte

  • 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.

Esempio

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

Parametri

  • bboxnumber[]nella query

    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.

    • Esattamente 4 valori
  • latnumbernella query

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

    • Esempio 46.948
    • Almeno -90
    • Al massimo 90
  • lonnumbernella query

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

    • Esempio 7.4474
    • Almeno -180
    • Al massimo 180
  • radiusnumbernella query

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

    • Predefinito 1000
    • Esempio 300
    • Almeno 1
    • Al massimo 50000
  • operatorstring[]nella query

    Keeps the sites run by one of these operators.

    Valoriswisscomsunrisesaltsbbother

    • Fino a 5 valori
  • kindstring[]nella query

    Keeps the sites of one of these kinds.

    Valorioutdooroutdoor_low_powerindoortunneltemporaryunknown

    • Fino a 6 valori
  • powerClassstring[]nella query

    Keeps the sites of one of these power classes.

    Valorivery_lowlowmediumhighunknown

    • Fino a 5 valori
  • technologystring[]nella query

    Keeps the sites that have one of these technologies.

    Valori2G3G4G5G

    • Fino a 4 valori
  • limitintegernella query

    The most items to return.

    • Predefinito 100
    • Almeno 1
    • Al massimo 1000
  • offsetintegernella query

    How many items to skip, for the next pages.

    • Predefinito 0
    • Almeno 0
    • Al massimo 1000000

Risposte

  • 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

04Errori

Una richiesta che fallisce riceve uno degli stati qui sotto e un corpo di tipo application/problem+json, i cui campi sono quelli di ErrorModel.

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

ErrorModel

05Cache

  • 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-MatchIntestazione della richiesta

    The ETag of a response already held.

  • 304

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

06Tipi

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.

    • Predefinito about:blank

KindCount

  • stationsintegerobbligatorio

    • Almeno 0
  • valuestringobbligatorio

    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.

    Valorioutdooroutdoor_low_powerindoortunneltemporaryunknown

LV95

  • eastnumberobbligatorio

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

  • northnumberobbligatorio

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

OperatorCount

  • stationsintegerobbligatorio

    • Almeno 0
  • valuestringobbligatorio

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

    Valoriswisscomsunrisesaltsbbother

Period

  • adaptiveboolean | nullobbligatorio

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

  • fromstring (date-time)obbligatorio

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

  • installationLimitValuenumber | nullobbligatorio

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

  • kindstringobbligatorio

    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.

    Valorioutdooroutdoor_low_powerindoortunneltemporaryunknown

  • permitPermit | nullobbligatorio

    Null when OFCOM publishes no permit information.

  • powerClassstringobbligatorio

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

    Valorivery_lowlowmediumhighunknown

  • technologiesstring[]obbligatorio

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

    Valori2G3G4G5G

  • tostring (date-time) | nullobbligatorio

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

Permit

  • typestringobbligatorio

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

    Valorisite_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[]obbligatorio

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

    • Esattamente 2 valori
  • typestringobbligatorio

    ValoriPoint

Position

  • latnumberobbligatorio

    Latitude in WGS84, in degrees.

    • Almeno -90
    • Al massimo 90
  • lonnumberobbligatorio

    Longitude in WGS84, in degrees.

    • Almeno -180
    • Al massimo 180

PowerClassCount

  • stationsintegerobbligatorio

    • Almeno 0
  • valuestringobbligatorio

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

    Valorivery_lowlowmediumhighunknown

PublishedStation

  • adaptiveboolean | nullobbligatorio

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

  • codestringobbligatorio

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

  • firstSeenstring (date-time)obbligatorio

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

  • idstringobbligatorio

    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 | nullobbligatorio

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

  • kindstringobbligatorio

    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.

    Valorioutdooroutdoor_low_powerindoortunneltemporaryunknown

  • lv95LV95obbligatorio

    The position as published.

  • namestringobbligatorio

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

  • operatorstringobbligatorio

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

    Valoriswisscomsunrisesaltsbbother

  • permitPermit | nullobbligatorio

    Null when OFCOM publishes no permit information.

  • positionPositionobbligatorio

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

  • powerClassstringobbligatorio

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

    Valorivery_lowlowmediumhighunknown

  • technologiesstring[]obbligatorio

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

    Valori2G3G4G5G

  • distancenumber

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

SearchResult

  • attributionstringobbligatorio

    The credit OFCOM's terms require.

  • limitintegerobbligatorio

  • offsetintegerobbligatorio

  • snapshotSnapshotobbligatorio

    The snapshot these stations come from.

  • stationsPublishedStation[]obbligatorio

  • totalintegerobbligatorio

    How many stations the search matched, on every page.

Snapshot

  • publishedAtstring (date-time)obbligatorio

    When OFCOM published the file. It identifies the snapshot.

  • sha256stringobbligatorio

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

    • Corrisponde a ^[0-9a-f]{64}$
  • sitesintegerobbligatorio

    The number of sites in the file.

    • Almeno 0

SnapshotList

  • attributionstringobbligatorio

    The credit OFCOM's terms require.

  • limitintegerobbligatorio

  • offsetintegerobbligatorio

  • snapshotsSnapshot[]obbligatorio

    The newest first.

  • totalintegerobbligatorio

    How many snapshots there are, on every page.

StationCollection

  • attributionstringobbligatorio

    The credit OFCOM's terms require.

  • featuresStationFeature[]obbligatorio

  • snapshotSnapshotobbligatorio

    The snapshot these stations come from.

  • typestringobbligatorio

    ValoriFeatureCollection

StationCounts

  • attributionstringobbligatorio

    The credit OFCOM's terms require.

  • kindsKindCount[]obbligatorio

  • operatorsOperatorCount[]obbligatorio

  • powerClassesPowerClassCount[]obbligatorio

  • snapshotSnapshotobbligatorio

    The snapshot these counts come from.

  • stationsintegerobbligatorio

    How many sites the snapshot publishes.

    • Almeno 0
  • technologiesTechnologyCount[]obbligatorio

StationFeature

  • geometryPointGeometryobbligatorio

  • idstringobbligatorio

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

  • propertiesStationPropertiesobbligatorio

  • typestringobbligatorio

    ValoriFeature

StationHistory

  • attributionstringobbligatorio

    The credit OFCOM's terms require.

  • codestringobbligatorio

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

  • firstSeenstring (date-time)obbligatorio

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

  • idstringobbligatorio

    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.

  • limitintegerobbligatorio

  • lv95LV95obbligatorio

    The position as published.

  • namestringobbligatorio

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

  • offsetintegerobbligatorio

  • operatorstringobbligatorio

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

    Valoriswisscomsunrisesaltsbbother

  • periodsPeriod[]obbligatorio

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

  • positionPositionobbligatorio

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

  • publishedbooleanobbligatorio

    Whether the latest snapshot shows the site.

  • totalintegerobbligatorio

    How many periods the site has, on every page.

StationProperties

  • kindstringobbligatorio

    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.

    Valorioutdooroutdoor_low_powerindoortunneltemporaryunknown

  • namestringobbligatorio

    The station label exactly as published.

  • operatorstringobbligatorio

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

    Valoriswisscomsunrisesaltsbbother

  • powerClassstringobbligatorio

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

    Valorivery_lowlowmediumhighunknown

  • technologiesstring[]obbligatorio

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

    Valori2G3G4G5G

TechnologyCount

  • stationsintegerobbligatorio

    • Almeno 0
  • valuestringobbligatorio

    A mobile network generation.

    Valori2G3G4G5G

07Il contratto

Tutta l’API è descritta in OpenAPI 3.1, in un file che l’API fornisce e che il repository conserva. Se ne possono generare dei client.