-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MySQL Import script for NLExtract dumps #220
Comments
We welcome contributions like these. There are so many use-cases through which people use BAG data. I was also thinking of alternative DB formats like Remark: For most other key-registries like BRT-Top10NL, BGT and BRK, NLExtract uses Stetl as the ETL tool. A Stetl config, like for example BRK ETL allows for multiple |
Even een update om de import wat efficiënter te laten verlopen: CREATE TABLE bagadres (
openbareruimte VARCHAR(80) NOT NULL,
huisnummer INT(5) NOT NULL,
huisletter CHAR(1) DEFAULT NULL,
huisnummertoevoeging VARCHAR(4) DEFAULT NULL,
postcode CHAR(6) NOT NULL,
woonplaats VARCHAR(80) NOT NULL,
gemeente VARCHAR(80) NOT NULL,
provincie VARCHAR(16) NOT NULL,
object_id BIGINT(16) NOT NULL,
object_type CHAR(3) NOT NULL,
nevenadres BOOLEAN NOT NULL,
x DECIMAL(9,3) NOT NULL,
y DECIMAL(9,3) NOT NULL,
lon DECIMAL(10,8) NOT NULL,
lat DECIMAL(11,8) NOT NULL,
point POINT NOT NULL,
KEY object_id (object_id),
KEY postcode (postcode)
);
LOAD DATA INFILE '/absolute/path/to/your/file/bagadres.csv'
INTO TABLE bagadres
FIELDS TERMINATED by ';'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(openbareruimte,huisnummer,huisletter,huisnummertoevoeging,postcode,woonplaats,gemeente,provincie,object_id,object_type,@nevenadres,x,y,lon,lat)
SET huisletter = NULLIF(@huisletter, ''),
huisnummertoevoeging = NULLIF(@huisnummertoevoeging, ''),
nevenadres = CASE WHEN @nevenadres = 'f' THEN 0
WHEN @nevenadres = 't' THEN 1
END,
point = POINT(lat,lon); Let op, minimaal MySQL |
First of all: thanks a lot for making all this BAG data accessible for noobs 😄
To be able to easily import the .csv dumps listed at http://data.nlextract.nl/bag/csv/ into a MySQL database, the following SQL statements might be useful:
I would have created a Pull Request, but I am not sure you guys intend to adopt MySQL related stuff in this repository...
The text was updated successfully, but these errors were encountered: