flakey-bit / flakey-bit.github.io

Build a Jekyll blog in minutes, without touching the command line.
MIT License
0 stars 0 forks source link

2018/08/30/loading-g-naf-geocoded-national-address-file-into-sql-server-making-a-simple-query/ #1

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

Loading G-NAF (Geocoded National Address File) into SQL Server & making a simple query – eddiewould.com – Elegant code? Eddie Would!

I had a few hours spare and so thought I’d have a play with the “G-NAF” data set provided free of charge by the Australian government

https://eddiewould.com/2018/08/30/loading-g-naf-geocoded-national-address-file-into-sql-server-making-a-simple-query/

frenzal0 commented 3 years ago

Thanks Eddie - this saved me a lot of time loading it up. If anyone else stumbles across this and is looking to load the full data set I tweaked the jurisdiction script to run through all of the states:

Param( [string]$serverName, [string]$databaseName, [string]$jurisdictionFilesPath

) $jurisdictionName = @("ACT","QLD", "NSW","NT","OT","SA","TAS","VIC","WA") foreach ($node in $jurisdictionName){

$filter = $node+"_*.psv"

Get-ChildItem $jurisdictionFilesPath -Filter $filter | Foreach-Object { $tableName = $.name.Replace($node+"", "").Replace("psv.psv", "") write-host "Procesing" $.Name "into table" $tableName bcp $tableName in $_.FullName -d $databaseName -S $serverName -t"|" -c -T -F 2 } }