Added industries collection

This commit is contained in:
vjrj 2018-02-26 12:11:23 +01:00
parent 1ad6bf17cb
commit ccbfe642a8
19 changed files with 277 additions and 58 deletions

14
bin/eu-eea-e-prtr.awk Executable file
View file

@ -0,0 +1,14 @@
# cat dbo.PUBLISH_FACILITYREPORT.csv| ./eu-eea-e-prtr.awk | mongoimport -d "fuegos" -c "industries"
gawk -F',' 'NR>1 { \
gsub(/"/,"",$6);
gsub(/"/,"",$5);
gsub(/\t/,"",$6);
gsub(/\t/,"",$5);
gsub(/\x1a/,"",$5);
gsub(/\x1a/,"",$6);
lon = $14+0;
lat = $13+0;
if (lon != 0 && lat != 0 && lon > -180 && lon < 180 && lat >= -90 && lat <= 90)
printf("{name:\"%s, %s\",geo:{type:\"Point\",coordinates:[%s,%s]},registry:\"1\"}\n" \
,$6,$5,lon,lat)}'

10
bin/us-epa-frs.awk Executable file
View file

@ -0,0 +1,10 @@
# cat NATIONAL_SINGLE.CSV| ./us-epa-frs.awk | mongoimport -d "fuegos" -c "industries"
gawk -F',' 'NR>1{ \
gsub(/"/,"",$33);
gsub(/"/,"",$32);
gsub(/"/,"",$3);
gsub(/\t/,"",$3);
lon = $33+0;
lat = $32+0;
if (lon != 0 && lat != 0 && lon > -180 && lon < 180 && lat >= -90 && lat <= 90) { printf("{name:\"%s\",geo:{type:\"Point\",coordinates:[%s,%s]},registry:\"2\"}\n",name,lon,lat)}}'