https://www.usmedia.nl/

2 minutes

Geschreven door: hidde

IP Address to Municipality

How we used Kadaster Open Data to serve content based on the municipality of the visitor.

  • opendata
  • technology

Some of our clients wanted to provide localized content based on the municipality of the visitor.

Having played with Open Data for an “Apps for Amsterdam” contest in the past we decided to visit the website of the Cadastral Survey in the Netherlands.

Sure enough they were willing to provide us with data set containing the municipal boundaries of the Netherlands (see Image). This data is provided in two formats: Microstation DGN and ESRI’s Shapefile. Being suckers for open standards we opted for the Shapefiles.

The implementation of a web service accepting coordinates in WGS84 and returning a municipality name and code (e.g. Amsterdam – 0363) was pretty straight forward. We started with a default project consisting of Spring MVC combined with Jackson and SLF4J. We added the Geotools library which allowed us to read and query the boundary data.

it takes about 10 milliseconds to retrieve requested information

Using the GeoTools library we can easily convert the WGS84 coordinates to RD-coordinates (Rijksdriehoekscoördinaten) used in the Shapefiles. Next we query the data set for municipality containing the given coordinates and return two of the data attributes (i.e. Municipality name & code) as JSON to the client. All together it takes about 10 milliseconds to retrieve requested information including processing the request and formulating the response.

We have learned quite a bit about processing geographic information from this project (e.g. data formats, coordinate systems) and we were happy to see that with the tools provided by the Open Source community it was no more than four hours work to implement a service that gave us exactly the functionality we needed. Also Kudos to the Kadaster/CBS for opening up the data and providing it to Us.

The web service and its documentation is available at gls.usmedia.nl.

coffee?

contact us for a chat and discuss if we are the right partner for you.