跳转到主要内容

未知

项目描述

摘要
-------
Cube for data.gouv.fr accidents (http://www.data.gouv.fr/fr/dataset/base-de-donnees-accidents-corporels-de-la-circulation-sur-6-annees)



安装
------------

创建实例

cubicweb create accidents my_instance_accidents

创建数据库

cubicweb db-create my_instance_accidents

! 不要启动db-init !

插入postgis

psql my_instance_accidents -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql

psql my_instance_accidents -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql

完成数据库

cubicweb db-init my_instance_accidents



推送数据

在http://fr.dbpedia.org/sparql上获取市和区
使用以下请求以JSON格式


prefix db-owl: <http://dbpedia.org/ontology/>
select ?ville ?code ?name ?lat ?long ?dep ?depcode ?depname where {
?ville db-owl:country <http://fr.dbpedia.org/resource/France> .
?ville dbpedia-owl:inseeCode ?code.
?ville foaf:name ?name.
?ville dbpedia-owl:department ?dep.
?dep dbpedia-owl:inseeCode ?depcode.
?dep foaf:name ?depname.
?ville geo:lat ?lat.
?ville geo:long ?long.
}



使用以下命令推送市/区

cubicweb-ctl shell my_instance_accidents /path/to/cubes/accidents/import_communes.py /path/to/json/files


在data.gouv.fr上下载车辆和事故文件。
推送数据

cubicweb-ctl shell my_instance_accidents /path/to/cubes/accidents/import_vehicules.py /path/to/vehicules.csv


cubicweb-ctl shell my_instance_accidents /path/to/cubes/accidents/import_accidents.py /path/to/accidents.csv

项目详情


下载文件

下载适合您平台文件的文件。如果您不确定要选择哪个,请了解更多关于 安装包 的信息。

源分布

cubicweb-accidents-0.1.0.tar.gz (14.0 kB 查看哈希值)

上传时间: 来源

由以下支持