Project

skra-geo

0.0
No commit activity in last 3 years
No release in over 3 years
Skra::Geo is a thin ruby wrapper to query WFS API of the [Icelandic National Registry](http://www.skra.is) Geoserver.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.5
>= 0
>= 0

Runtime

>= 0.13.0
 Project Readme

Skra::Geo

Skra::Geo is a thin ruby wrapper to query WFS API of the Icelandic National Registry 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

> 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)
>> Skra::Geo.heinum(1008773) # Looking up by heinum (Property ID)
  • Looking up by street name
>> 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 (Reykjavík)
>> Skra::Geo.street('Holtsgötu', 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
>> Skra::Geo.query([{:name => :POSTNR, :value => 101}]) # All features in postcode 101

Data

A feature returned by the server will have the following structure:

[
  {
    "type": "Feature",
    "id": "VSTADF.fid-51fadf5a_144745ff88d_-259b",
    "geometry": {
      "type": "Point",
      "coordinates": [
        356227.738636364,
        408530.288636364
      ]
    },
    "geometry_name": "HNIT",
    "properties": {
      "HNITNUM": 10019748,
      "SVFNR": "0000",
      "LANDNR": 100404,
      "HEINUM": 1008773,
      "MATSNR": null,
      "POSTNR": 101,
      "HEITI_NF": "Holtsgata",
      "HEITI_TGF": "Holtsgötu",
      "HUSNR": 13,
      "BOKST": null,
      "VIDSK": null,
      "SERHEITI": null,
      "DAGS_INN": "2007-09-07",
      "DAGS_LEIDR": "2010-01-08",
      "GAGNA_EIGN": "Fasteignaskrá Íslands",
      "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 and they usually need conversion to something more standard (like WGS84) to be used. You can use our 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 during the first hackathon organized by Open Knowledge Foundation Iceland. Documentation on the actual functionality of the server was researched from geoserver.org and previous work on the python library fasteignamat-functions was checked as reference.