GNIVTS FTS
informs that since the beginning of 2018 KLADR will cease to exist and will not be able to download it.
Disclaimer:
If you do not understand at all what these sets of letters mean, do not worry. Below we describe the realities of working with addresses in Russia. If you are not interested, read about topographical quibbles .
Correct addresses are needed for companies that love their customers. Familiar banks, insurance and online stores, which now use the KLADR directory, ask us what to do next. Therefore, we wore out and wrote a step-by-step guide on the transition
from one letter to another from KLADR to FIAS.

Why are address classifiers needed?
Companies need customer addresses to send letters, specify in contracts and agreements. But it is not enough just to send a letter: it is desirable that it be received and read. Therefore, the addresses must be correct and understandable.
')
What do you think, what state body is most interested in receiving letters from him? Right! Tax. Therefore, the Federal Tax Service of Russia has been developing and supporting the departmental all-Russian address classifiers for many years. And since there are no more complete directories, they have been used everywhere.
First there was KLADR, and there were 6 levels in it:
Region → District → City → Town → Street → House with buildings and buildings
Since 2012, a new classifier, FIAS, has been commissioned. We wrote about the main differences three years ago in the article “FIAS or KLADR: we choose the reference book of addresses” . In the FTS, the development of a new classifier approached more thoroughly and tried to take into account all the mistakes of KLADR. From the interesting added date of the beginning and end of the recording, entered a fixed ID for each house (it is assumed that it will not change).
Both classifiers are still being updated, but compatibility is becoming more difficult to maintain. Last year, new levels began to be added to FIAS. For example, planning structures are all kinds of country partnerships and microdistricts, in the classifier there are already more than 81,000. Finally, the Federal Tax Service made a logical decision to stop supporting KLADR and remove it at the end of 2017.
How addresses are stored in FIAS and KLADR
We have seen many ways to store addresses in the KLADR structure. Basically they boil down to two options:
- Code KLADR to the street + house part of the form "house 1 building 3 apartment 33 ", as parts of the houses in the classifier are stored as ranges
- Address in the form of text - one field or divided by structure KLADR.
Since there is no part of houses in FIAS, we recommend storing the address as:
- FIAS code to the street + house + apartment to identify the address ( detailed recommendations ).
- Address in one line in FIAS format. It is better to keep the original address. FIAS is still a tax reference book, and not everything is there.
That is, the task of migration is reduced to translating the code or text address in the KLADR format into the FIAS code.
Classification codes look like this:
- KLADR : SS + PPP + YYY + PPP + UUUU + DDDD;
- FIAS : SS + PPP + YYY + PPP + SSSS + UUUU + DDDD (or ZZZZ) + OOOO.
It looks scary, consider an example: Leningrad region, Vsevolozhsk district, the village of Kudrovo, md New Okkervil. The address really exists, here
it is on Yandex.Maps . At first glance, the classification code of KLADR and FIAS looks the same for it:
470050000550023 . We decompose it into components.
No | Level | Example | FIAS code | code KLADR |
one | Region | Leningrad region | SS : 47 | SS : 47 |
2 | Autonomous District | | | |
3 | Area | Vsevolozhsk district | PPP : 005 | PPP : 005 |
four | City | | YYY : 000 | YYY : 000 |
five | Urban territory | | | |
6 | Locality | village Kudrovo | SPT : 055 | SPT : 055 |
65 | Planning structure | md New Okkervil | SCCS : 0023 | |
7 | The outside | | Woooo | WOW : 0023 |
75 | Land plot | | | |
eight | Building, structure, object under construction | | DDDD | DDDD |
9 | The room within the building | | OOOO | |
90 | Additional territory | | | |
91 | Subordinate additional areas | | | |
We spread the address on the FIAS and KLADR levelsIt is clear from the example that even in simple situations there is a misunderstanding between classifiers. But there is another very important point.
The classification code reflects the current address structure, and it may change. For example, at Okkervil the area will change and all code will become invalid, we will not find it any more.
To get rid of this, a FIAS
identification code was added to
FIAS . This is a global identifier for each object: city, street, district, etc. It looks like a set of letters and numbers, which is formed according to the GUID standard (Globally Unique Identifier). A typical GUID in FIAS looks like this:
f77948dc-7bc8-42cb-979e-2c958d162d63 .
KLADR code → FIAS identification code
If your address is stored as KLADR street code + house part (“house 1 building 3 apartment 44”), then everything is relatively simple for it.
The ADDROBJ table stores all address objects with their identifiers.For the work, you will need the table ADDROBJ from the FIAS download in xml or dbf format. It stores all objects (cities, streets, etc.) in a row with unique GUIDs.
We will use the following columns:
- KLADR code (PlainCode);
- name and type of text (FormalName and ShortName);
- the relevance of the object (CurrStatus);
- zip code (PostalCode);
- own and parent identifier of FIAS (AoGuid and ParentGuid);
- level (AoLevel).
Example:
Moscow, Alexander Solzhenitsyn st . KLADR code:
77000000000151900 .
Step 1. Select from the code KLADR code to the street, that is, take the first 15 digits: 770000000001519 00 .
- If KLADR is less than 15 digits, we take 11 and add zeros - this is the code to the settlement: 77000000000 0000 ;
- Less than 11 digits - we take 8: 77000000 000000000 ;
- Less than 8 - we take 5: 77000 000000000000 ;
- Less than 5 - take 2 digits of the region code: 77 000000000000000 .
Step 2. We are looking for the KLADR code in the PlainCode field. If one record is found, then save the value of the AoGuid field and skip the next item. But according to our code 770000000001519 there are three records, we need additional verification.
Step 3. Find the current entry. A field value of CurrStatus = 0 means that the entry is current. Select it and save the value of the AoGuid field. FIAS identification code found!
- Alexander Solzhenitsyn, CurrStatus = 2;
- Communist B., CurrStatus = 1;
- Alexander Solzhenitsyn, CurrStatus = 0, AuGuid = f77948dc-7bc8-42cb-979e-2c958d162d63 .
As a bonus, let's collect a text address from the AoGuid found:
- we take PostalCode is a zip code: 109004
- add ShortName and FormalName: 109004, ul. Alexandra Solzhenitsyn
- if the object is a region (field AoLevel = 1), then the address is ready. But in our case, AoLevel = 7 is the street. Therefore, we look for the parent element in the ParentGuid field and repeat the previous item;
- for Aleksandr Solzhenitsyn Street, the parent record immediately has the level of the region - this is Moscow. Save ShortName and FormalName and collect the address: 109004, Moscow, st. Alexandra Solzhenitsyn
But you can do even easier and use the ready-made service. DaData.ru is able to suggest addresses in specific regions, districts, cities and localities. Understands the names (" Peterhof "), the KLADR codes (" 7800000800000 ") and FIAS (" 8f238984-812b-4bb1-850b-49749fb5c56d ").
Line address KLADR → FIAS code
The easiest option is to use
DaData.ru . The service will do everything for you automatically. But you can have fun yourself.
Single line addresses
If your addresses are stored in one line, like this:
Mr. Moscow, Bolshaya Kommunisticheskaya Street, Building 3, congratulations, this is the most interesting task. You need to write your own address parser, which will divide the string in KLADR format into parts, look for each of its components in FIAS, taking into account typos, abbreviations, historical names and determine the FIAS-code from them. It is easier to do this with a ready-made address parser. How to choose an algorithm for the address filter , we told earlier.
Addresses on KLADR
If your addresses are stored in KLADR, the task is a little easier.
Type of region | Name of the region | Street type | Street name | House type | House number |
g | Moscow | the outside | Communist B. | house | 3 |
Something like this looks like the address spread out on KLADRThe FIAS code can be collected using the same ADDROBJ table. But in this case you need to move through the levels from larger to smaller.
Step 1. We take the name of the region and look for it in the FormalName field of the ADDROBJ table.
FormalName = Moscow →
AoGuid = 0c5b2444-70a0-4932-980c-b4dc0d3f02b5
Step 2. Go further down the levels and look for FormalName with a fixed parent - found by AoGuid in the previous step. In our case, the “city” and “settlement” levels are empty, and the next non-empty level is the street.
ParentGuid = 0c5b2444-70a0-4932-980c-b4dc0d3f02b5 ,
FormalName = Communist B. → AoGuid = f77948dc-7bc8-42cb-979e-2c958d162d63
Step 3. If you reach the street, you can find a house. To do this, look at the HOUSE table for a house number with a fixed street AoGuid. FIAS is not full of houses, so do not be discouraged if the desired number is not found.
AoGuid = f77948dc-7bc8-42cb-979e-2c958d162d63 ,
house number 3 →
HouseGuid = bce8be1f-f2f7-4cce-836e-08daac0b931e
Underwater rocks
Can something go wrong? Of course. For example, the name can easily find several objects. "Moscow, Tverskaya" - is it about the square or about the street? Then you need to compare types, but not everything is so simple.
LEVEL | SCNAME | SOCRNAME | KOD_T_ST |
7 | tract | Tract | 727 |
7 | dumb | Dead end | 728 |
7 | street | The outside | 729 |
7 | uch-to | Plot | 730 |
7 | f / x | Farm | 789 |
7 | farm | Farm | 769 |
7 | x | The farm | 758 |
7 | sh | Highway | 731 |
The SOCRBASE table stores the full and abbreviated object types.The KLADR type can be abbreviated and complete: “ul” - “Street”, “x” - “Khutor”. Only abbreviated type is stored in FIAS explicitly (in the field ShortName). A full type into an abbreviated type can be turned using the SOCRBASE table, for each level it stores the correspondence of abbreviated and full types.
§ § §
And finally, the good news for those who are too lazy to bother with all of the above. In the near future, we plan to release FIAS in the KLADR format for those who do not have time to switch to the FIAS format by the end of the year. Follow the news :-)
PS Thank you for the invaluable help in creating this article by my colleagues on HFLabs,
Mikhail Berezin , Elena Rastorguev and
Anton Zhiyanov .