Estonian EHAK xml parser written in php

I decided to share a little PHP class which was written because I needed it last month. This parser is not fully ready yet. It even has some known bugs and missing features. Also optimizing is needed. But let it be out here- maybe it helps someone out or even gets someone to collaborate with me.

Basically it takes official settlements xml as input provided by http://metaweb.stat.ee/ and outputs nice array out of it. How to use output is up to you. It currently has methods to parse xml into "3 levels". This is how settelments are commonly used to select a aadress in Estonia. You can see this pattern it in example also.

In my code I added little example with common javascript filtering for counties and cities. You can look at live demo here. My code uses PHP SimpleXMLElement component so your server should have support for it.

What EHAK stands for?

EHAK stands for Eesti haldus- ja asustusjaotuse klassifikaator, which in English is "The Classification of Administrative and Settlement Units of Estonia". Basically this is register for every Estonian settlement. Every settlement has a name, classification and unique code to identify it.

The territory of Estonia is divided into counties. Every county is divided into cities and rural municipalities. Smaller parts are city districts, small towns, cities without municipal status and villages.

Related links

I am co-founder of web/media studio GIVE me. and (android)developer at start-up named Choco. Read my about page to learn more.