Drupal Patch For Location Module To Update Province List for Latvia With Latest Data

Made a simple Drupal patch for Location module to display latest administrative divisions of Latvia. Default one is still showing outdated data using old "Rayon" as administrative divisions of Latvia.

Will try to submit this patch to official module release on Drupal.orf

From Wikipedia:  

According to the Administrative territorial reform of Latvia (2009), Latvia changed its administrative divisions from two-level municipalities (the districts were the first-level municipalities, while towns, cities, towns countryside territories and parishes were the second-level municipalities) to one-level municipalities - districts were liquidated, but towns (Latvian: pilsētas), towns countryside territories (Latvian: pilsētu lauku teritorijas) and parishes (Latvian: pagasti) were merged into 110 municipalities (Latvian: novadi) and there are 9 republican cities (Latvian: republikas pilsētas) with their own city council and administration.

To update to the latest administrative division - replace location.lv.inc file (/sites/all/modules/location/supported) with following:

<?php

/**
 * @file
 * Latvia.
 */

/**
 * Returns an associative array of states/territories.
 */
function location_province_list_lv() {
  return array(
  'ADA' => "Ādažu novads",
  'AGL' => "Aglonas novads",
    'AIZ' => "Aizkraukles novads",
    'AIP' => "Aizputes novads",
    'AKN' => "Aknīstes novads",
    'ALO' => "Alojas novads",
    'ALS' => "Alsungas novads",
    'ALU' => "Alūksnes novads",
    'AMA' => "Amatas novads",
    'APE' => "Apes novads",
    'AUC' => "Auces novads",
    'BAB' => "Babītes novads",
    'BAL' => "Baldones novads",
    'BAT' => "Baltinavas novads",
    'BAV' => "Balvu novads",
    'BAU' => "Bauskas novads",
    'BEV' => "Beverīnas novads",
    'BRO' => "Brocēnu novads",
    'BUR' => "Burtnieku novads",
    'CAR' => "Carnikavas novads",
    'CES' => "Cēsu novads",
    'CEV' => "Cesvaines novads",
    'CIB' => "Ciblas novads",
    'DAG' => "Dagdas novads",
    'DAU' => "Daugavpils novads",
    'DOB' => "Dobeles novads",
    'DUN' => "Dundagas novads",
    'DUR' => "Durbes novads",
    'ENG' => "Engures novads",
    'ERG' => "Ērgļu novads",
    'GAR' => "Garkalnes novads",
    'GRO' => "Grobiņas novads",
    'GUL' => "Gulbenes novads",
    'IEC' => "Iecavas novads",
    'IKS' => "Ikšķiles novads",
    'ILU' => "Ilūkstes novads",
    'INC' => "Inčukalna novads",
    'JAU' => "Jaunjelgavas novads",
    'JAP' => "Jaunpiebalgas novads",
    'JAI' => "Jaunpils novads",
    'JEK' => "Jēkabpils novads",
    'JEL' => "Jelgavas novads",
    'KAN' => "Kandavas novads",
    'KAR' => "Kārsavas novads",
    'KOC' => "Kocēnu novads",
    'KOK' => "Kokneses novads",
    'KRA' => "Krāslavas novads",
    'KRI' => "Krimuldas novads",
    'KRU' => "Krustpils novads",
    'KUL' => "Kuldīgas novads",
    'KEG' => "Ķeguma novads",
    'KEK' => "Ķekavas novads",
    'LIE' => "Lielvārdes novads",
    'LIG' => "Līgatnes novads",
    'LIM' => "Limbažu novads",
    'LIV' => "Līvānu novads",
    'LUB' => "Lubānas novads",
    'LUD' => "Ludzas novads",
    'MAD' => "Madonas novads",
    'MAL' => "Mālpils novads",
    'MAR' => "Mārupes novads",
    'MAZ' => "Mazsalacas novads",
    'MER' => "Mērsraga novads",
    'NAU' => "Naukšēnu novads",
    'NER' => "Neretas novads",
    'NIC' => "Nīcas novads",
    'OGR' => "Ogres novads",
    'OLA' => "Olaines novads",
    'OZO' => "Ozolnieku novads",
    'PAR' => "Pārgaujas novads",
    'PAV' => "Pāvilostas novads",
    'PLA' => "Pļaviņu novads",
    'PRE' => "Preiļu novads",
    'PRI' => "Priekules novads",
    'PRK' => "Priekuļu novads",
    'RAU' => "Raunas novads",
    'REZ' => "Rēzeknes novads",
    'RIE' => "Riebiņu novads",
    'ROJ' => "Rojas novads",
    'ROP' => "Ropažu novads",
    'RUC' => "Rucavas novads",
    'RUG' => "Rugāju novads",
    'RUJ' => "Rūjienas novads",
    'RUN' => "Rundāles novads",
    'SAL' => "Salacgrīvas novads",
    'SAA' => "Salas novads",
    'SAS' => "Salaspils novads",
    'SAD' => "Saldus novads",
    'SAU' => "Saulkrastu novads",
    'SEJ' => "Sējas novads",
    'SIG' => "Siguldas novads",
    'SKR' => "Skrīveru novads",
    'SKU' => "Skrundas novads",
    'SMI' => "Smiltenes novads",
    'STO' => "Stopiņu novads",
    'STR' => "Strenču novads",
    'TAL' => "Talsu novads",
    'TER' => "Tērvetes novads",
    'TUK' => "Tukuma novads",
    'VAI' => "Vaiņodes novads",
    'VAL' => "Valkas novads",
    'VAR' => "Varakļānu novads",
    'VAK' => "Vārkavas novads",
    'VEC' => "Vecpiebalgas novads",
    'VEU' => "Vecumnieku novads",
    'VEN' => "Ventspils novads",
    'VIE' => "Viesītes novads",
    'VIL' => "Viļakas novads",
    'VIA' => "Viļānu novads",
    'ZIL' => "Zilupes novads",
    'DGV' => "Daugavpils",
    'JKP' => "Jēkabpils",
    'JGV' => "Jelgava",
    'JUR' => "Jūrmala",
    'LPY' => "Liepāja",
    'RZK' => "Rēzekne",
    'RIG' => "Rīga",
    'VAM' => "Valmiera",
    'VSL' => "Ventspils"
  );
}

/**
 * Returns minimum and maximum latitude and longitude needed to create a bounding box.
 */
function location_bounds_lv() {
  return array(
    'minlng' => 20.8848,
    'minlat' => 55.723733,
    'maxlng' => 28.1695,
    'maxlat' => 58.147367,
  );
}

Clear cache and you should be done. For a live demo see here:

Add new comment