Geoshapes Api and Geo Converter - noi-techpark/opendatahub-docs GitHub Wiki
GeoShapes API
The GeoShapes API provides geographic and administrative data for various entities, primarily in Italy. It can be used as a standalone API to retrieve geoshapes of entities in Europe or in combination with other API endpoints of the Open Data Hub to filter specific regions.
Details
Key Fields:
- ID (
id
): Unique identifier for the geographic entity. - Name (
name
): Name of the entity in the local language. - Type (
type
): Administrative unit type in English (e.g., "municipality"). - Country (
country
): Two-letter country code (e.g., "IT"). - Source (
source
): Source of the shape data. - Srid (
srid
): Spatial Reference Identifier, currently 3 Srids supported, EPSG:4326, EPSG:32632, EPSG:3857. - Geometry (
geometry
): PostGIS Geometry field.
Additional Metadata:
- Source (
source
): Indicates the origin of the data (e.g., "istat"). - License Info (
licenseinfo
): JSON structure containing licensing information: - Meta (
_meta
): Contains metadata about the entity:
Additional Information:
This Additional Information is stored into the Mapping Column
- Alternative Name (
name_alternative
): Optional alternative name. - Abbreviation (
abbrev
): Shortened version of the name, if available (nullable). - Shape Length (
shape_leng
): Length of the polygon boundary (optional). - Shape Area (
shape_area
): Area of the polygon (optional).- Administrative Codes:code_rip
: Italian macro-region code (nullable).code_reg
: Italian region code (nullable).code_prov
: Italian province code (nullable).code_cm
: Italian metropolitan city code (nullable).code_uts
: Italian territorial unit code (nullable).istatnumber
: ISTAT statistical code for the entity (nullable).
Coordinate System
The primary coordinate system for the API's geographic data is EPSG:4326, representing latitude and longitude in the WGS84 datum. This ensures compatibility with most geospatial tools.
By passing the parameter srid
the desired coordinate system is returned:
EPSG:4326/WGS84 (standard)
https://tourism.api.opendatahub.com/v1/GeoShape/3014_istat
OR
https://tourism.api.opendatahub.com/v1/GeoShape/3014_istat?srid=4326
OR
https://tourism.api.opendatahub.com/v1/GeoShape/3014_istat?srid=wgs84
EPSG:32632
https://tourism.api.opendatahub.com/v1/GeoShape/3014_istat?srid=32632
EPSG:3857/Mercator
https://tourism.api.opendatahub.com/v1/GeoShape/3014_istat?srid=3857
OR
https://tourism.api.opendatahub.com/v1/GeoShape/3014_istat?srid=mercator
Usage
The API can be used directly to retrieve the boundaries of different entities.
Alternatively, the data can be used with other endpoints of the Open Data Hub, where users can pass it as the parameter polygon
in the form of Id
or (Compatibility reasons) Country.Type.Id
or Country.Type.Name
.
For example, to get all webcams located in Switzerland, the following API call can be used:
https://tourism.api.opendatahub.com/v1/WebcamInfo?pagenumber=1&pagesize=10&polygon=ch.state.Switzerland&removenullvalues=false
OR By using its ID (8032_swisstopo)
https://tourism.api.opendatahub.com/v1/WebcamInfo?pagenumber=1&pagesize=10&polygon=8032_swisstopo&removenullvalues=false
More information on how to use the polygon filter can be found in the Polygon Filter Functionality Documentation.
GeoConverter API
GeoConverter API Documentation.
The GeoConverter API converts KML and GPX files to GeoJSON format.
Endpoints
Convert KML to GeoJSON
- GET
/v1/GeoConverter/KmlToGeoJson
: Converts a KML file from a URL. - POST
/v1/GeoConverter/KmlToGeoJson
: Converts a KML file provided in the request body.
Convert GPX to GeoJSON
- GET
/v1/GeoConverter/GpxToGeoJson
: Converts a GPX file from a URL. - POST
/v1/GeoConverter/GpxToGeoJson
: Converts a GPX file provided in the request body.
Example
Convert KML from URL
GET /v1/GeoConverter/KmlToGeoJson?url=https://example.com/myfile.kml
Visit the Swagger to test it in action: GeoConverter API Documentation.