Summary
Manipulating french regions, départements, communes, etc. polygons from OpenStreetMap or IGN, for display on maps using leaflet.
Data import from OSM
Shapefiles are taken from http://osm13.openstreetmap.fr/~cquest/openfla/export/ (also shared on https://www.data.gouv.fr/fr/organization/openstreetmap)
Different resolution (from 5 meters to 100 meters can be used depending on the scale of maps to display).
The following example imports shapes for regions, departements, arrondissements, epci and communes:
$ cubicweb/bin/cubicweb-ctl osmfrance_import_shp <myinstance> \
> --regions=path/to/regions-20140306-100m-shp.zip \
> --departements=path/to/departements-20140306-100m-shp.zip \
> --arrondissements=path/to/arrondissements-20140306-100m-shp.zip \
> --epci=path/to/epci-20140306-100m-shp.zip \
> --communes=path/to/communes-20140306-100m-shp.zip
Data import from IGN
Shapefiles are taken from GEOFLA version 1.1:
http://www.data.gouv.fr/en/dataset/geofla-communes http://www.data.gouv.fr/fr/dataset/geoflar-arrondissements http://www.data.gouv.fr/en/dataset/geofla-departements-30383060
$ cubicweb/bin/cubicweb-ctl ign_import_shp <myinstance>
> --departements=path/to/DEPARTEMENT.SHP \
> --arrondissements=path/to/ARRONDISSEMENT.SHP \
> --communes=path/to/COMMUNE.SHP
Queries on data
The following query returns the polygon corners (as latitude, longitude coordinates) for Communes (cities) only:
Any DISPLAY(G, 4326) LIMIT 10 WHERE X geometry G, X is Commune
The following returns all types:
Any DISPLAY(G, 4326) LIMIT 10 WHERE X geometry G
Displaying data
The leaflet cube can be used for displaying these polygons on a map; the CW view used for that is leaflet-geojson
For example, the query:
Any DISPLAY(G, 4326),X LIMIT 20 WHERE X geometry G, X is Departement
should display 20 departements, using X (the Departement eid) as Z value (color value) using a yellow-red colormap.
The corresponding URL using the leaflet view is:
http://<server>/view?rql=Any+DISPLAY%28G%2C+4326%29%2CX+LIMIT+20+WHERE+X+geometry+G%2C+X+is+Departement&vid=leaflet-geojson
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file cubicweb-osmfrance-0.2.2.tar.gz.
File metadata
- Download URL: cubicweb-osmfrance-0.2.2.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e8f0d0aba8584ef9b5eaebff895b749af5a9ed5fae551ee0a45bbad309e1abe
|
|
| MD5 |
e173222c7b52facfe4450e30d46e5450
|
|
| BLAKE2b-256 |
996758e020879b6e2e86021c2c12ae08a4311475130c563a964236015cb6183b
|