skra-geo
所属分类:GIS/地图编程
开发工具:Ruby
文件大小:7KB
下载次数:0
上传日期:2020-01-30 11:19:08
上 传 者:
sh-1993
说明: Skra::Geo是一个薄ruby包装器,用于查询冰岛国家注册中心的WFS API(<http:www.Skra.is>)Geoserver
文件列表:
.rspec (31, 2020-01-30)
.travis.yml (40, 2020-01-30)
Gemfile (93, 2020-01-30)
LICENSE.txt (1070, 2020-01-30)
Rakefile (117, 2020-01-30)
lib (0, 2020-01-30)
lib\skra (0, 2020-01-30)
lib\skra\geo.rb (1841, 2020-01-30)
lib\skra\geo (0, 2020-01-30)
lib\skra\geo\version.rb (57, 2020-01-30)
skra-geo.gemspec (1004, 2020-01-30)
spec (0, 2020-01-30)
spec\skra (0, 2020-01-30)
spec\skra\geo_spec.rb (1681, 2020-01-30)
spec\spec_helper.rb (78, 2020-01-30)
# Skra::Geo
Skra::Geo is a thin ruby wrapper to query WFS API of the [Icelandic National Registry](http://www.skra.is) Geoserver.
Its main goal is to provide easy access to geo information of every parcel in Iceland, thus making trivial the implementation
of features like geolocation.
## Installation
Add this line to your application's Gemfile:
gem 'skra-geo'
And then execute:
$ bundle
Or install it yourself as:
$ gem install skra-geo
## Usage
```ruby
> bundle console
>> Skra::Geo.landnr(100404) # Looking up by landnr (Parcel ID)
[
{"type"=>"Feature", "id"=>"VSTADF.fid-51fadf5a_144745fbcac_-1eb7", "geometry"=>{"type"=... data skipped ...4)", "HUSMERKING"=>"13"}},
{"type"=>"Feature", "id"=>"VSTADF.fid-51fadf5a_144745fbcac_-1eb6", "geometry"=>{"type"=... data skipped ...4)", "HUSMERKING"=>"1"}}
]
```
Althought landnr (Parcel ID) is one the most usual ids for querying the server, it's also possible to query the server by different properties:
* Looking up by heinum (Property ID)
```ruby
>> Skra::Geo.heinum(1008773) # Looking up by heinum (Property ID)
```
* Looking up by street name
```ruby
>> Skra::Geo.street('Holtsgata') # All streets in Iceland with that name
>> Skra::Geo.street('Holtsgata', 13) # All buildings No. 13 in Holtsgata streets in Iceland
>> Skra::Geo.street('Holtsgata', 13, 101) # Building No. 13 in Holtsgata streets in postcode 101 (Reykjavik)
>> Skra::Geo.street('Holtsgotu', 13, 101, {:dative => true}) # dative version of the name street (useful in icelandic)
```
* Or even more freely by any property using the ```Skra::Geo#query``` method
```ruby
>> Skra::Geo.query([{:name => :POSTNR, :value => 101}]) # All features in postcode 101
```
## Data
A feature returned by the server will have the following structure:
```json
[
{
"type": "Feature",
"id": "VSTADF.fid-51fadf5a_144745ff88d_-259b",
"geometry": {
"type": "Point",
"coordinates": [
356227.7386363***,
408530.2886363***
]
},
"geometry_name": "HNIT",
"properties": {
"HNITNUM": 10019748,
"SVFNR": "0000",
"LANDNR": 100404,
"HEINUM": 1008773,
"MATSNR": null,
"POSTNR": 101,
"HEITI_NF": "Holtsgata",
"HEITI_TGF": "Holtsgotu",
"HUSNR": 13,
"BOKST": null,
"VIDSK": null,
"SERHEITI": null,
"DAGS_INN": "2007-09-07",
"DAGS_LEIDR": "2010-01-08",
"GAGNA_EIGN": "Fasteignaskra Islands",
"TEGHNIT": 0,
"YFIRFARID": 0,
"YFIRF_HEITI": null,
"ATH": null,
"NAKV_XY": null,
"NOTNR": 956,
"LM_HEIMILISFANG": "Holtsgata 13 (100404)",
"VEF_BIRTING": "Holtsgata 13 (100404)",
"HUSMERKING": "13"
}
}
]
```
Geometry coordinates are returned in [ISNET93](https://is.wikipedia.org/wiki/ISNET93) and they usually need conversion to something more standard (like [WGS84](https://en.wikipedia.org/wiki/World_Geodetic_System)) to be used. You can use our [isnet93](https://github.com/linkingpaths/isnet93) gem to easily convert the coordinates between these two projections.
## Contributing
1. Fork it ( http://github.com//skra-geo/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
## Kudos
This library was extracted from the work made by [Linking Paths](http://www.linkingpaths.com) during the first hackathon organized by [Open Knowledge Foundation Iceland](https://www.facebook.com/OKFNis). Documentation on the actual functionality of the server was researched from [geoserver.org](http://docs.geoserver.org/stable/en/user/services/wfs/reference.html#operations) and previous work on the python library [fasteignamat-functions](https://github.com/pallih/fasteignamat-functions) was checked as reference.
近期下载者:
相关文件:
收藏者: