DF45's Diary

Recent diary entries

PK (Point Kilométriques en France)

Posted by DF45 on 14 October 2016 in French (Français). Last updated on 29 September 2026.

L’Opendata officiel a mis en ligne la liste des points kilométriques en France.

https://www.data.gouv.fr/fr/datasets/bornage-du-reseau-routier-national/

L’info m’est arrivée via le blog … d’OSM Maroc ! Un premier import dans QGIS montre les routes et nationales à deux voies. C’est encourageant. Une analyse plus détaillée indique que c’est plus … varié. Beaucoup de routes on un PK gauche et un PK droite … mais pas tous. Certaines ont un seul PK de type I (indéterminé ?) ou G ou D. D’autres PK n’ont carrément pas de coordonnées. Après un test de correction dans un tableur, on va se tourner vers un import dans PostGreSQL afin de pouvoir rejourer les corrections d’élimination des PK incorrects et de faire une moyenne Gauche/Droite.

Le code ci-dessous ;

– ********* Transform_PK.sql *************** – * – * GOAL : Transform the french kilometer point file from french main roads found in
– * opendata.gouv.fr in order to have only one PK instread of having a left and right one – * Include cleanup from obviously errors (lat/long = zero) – * – * PREREQUISITE : a PostGres instance with postgres account – * – * parametres : to be launched with PSQL … -v ficin=’c:...’ -v ficout=’c:...’ – * ficin = complete name (with directory) of the original files – * ficout = complete name (with directory) of the output file – * launching command : (for a postgres DB) – * psql -Upostgres –file=transform_PK.sql -q –log-file=transform_PK.log -v ficin=’xxx’ -v ficout=’xxx’-t – * – * 2016/12/09 Creation DF45 – **
****************************

– ** Preparation (table drop/creation) drop table borne; drop table borne_new; create table borne (route char(10), pr char(3), deppr char(3), concessionPr char(1), abs char(1), x_temp char(10), y_temp char(10), z_temp char(10), cote char(1));

– *** Import of original files COPY borne FROM :ficin DELIMITER ‘ ‘ CSV HEADER ;

… See full entry