phaza / norwegian-address-data
解析来自挪威测绘局的地址数据
0.6
2015-05-08 12:12 UTC
Requires
- php: >= 5.5
- academe/proj4php: ~0.6
Requires (Dev)
- phpunit/phpunit: ~4.5
README
是什么
此包包含从挪威测绘局解析挪威地址信息的功能。
如何
安装包
composer require "phaza/norwegian-address-data"
使用解析器
裸SOSI文件
$sosiparser = new SOSIParser( function ( Address $address ) { //Do something with $address here } ); $handle = fopen( 'somefile.sos', 'r' ); $sosiparser->parse( $handle ); fclose( $handle );
来自挪威测绘局的压缩文件
$sosiparser = new SOSIParser( function ( Address $address ) { //Do something with $address here } ); $file = new SplFileInfo('Vegdata_Norge_Adresser_UTM33_SOSI.zip'); $unwrapper = new ZipUnwrapper( $file, $sosiparser ); $unwrapper->parse();
地址对象的描述
地址对象有两种类型。一种是有街道和门牌号的地址(StreetAddress),另一种是没有街道和门牌号的地址(CadastreAddress)。
common attributes:
$id; // Unique id of this point within this municipality
$municipality_id; // The id of the municipality this address is contained within
$zip_code_id; // The zip code id
$zip_code_name; // The zip code name
$display; // The display version of this address
getCoords() // Coordinates for this point, returned as an Utm object with northing and easting.
CadastreAddress:
$gnr; // land parcel number, unique within a municipality
$bnr; // property number, unique within a $gnr
$fnr; // rental property number, unique within a $bnr
$unr; // sub division number, unique within a $fnr
StreetAddress:
$street_name;
$street_id; // unique within a municipality
$number;
$letter;