Skip to main content

Create your own DMR-ID database file

··649 words·4 mins

Let’s start with the website ham-digital.org. It contains the user database of registered DMR-IDs worldwide.

Update
While these scripts still work, the website ham-digital.org is dead and the european database has been put together on radioid.net.

Are you still waiting for your confirmation email? You may look at the registration site, which contains links to the list of open registrations or the list of local administrators.

Okay, I try to keep this simple. These scripts are made to download an actual snapshot of the DMR-ID database from ham-digital.org. They create a comma-separated list of DMR-IDs and callsigns to import into an amateur radio device. Actually I use them only on my Radioddity GD-77.

Download the full database #

That fetches the whole database, which are something around 180.000 entries at the moment (2020-Nov-15). The script uses about 8MB of RAM. Something like that.

#!/usr/bin/env php
<?php
  /*
   *  Save the full database (much big!!)
   *  DMR-IDS-FULL.csv
   *  Dominic, OE7DRT
   */

  $url = 'https://ham-digital.org/status/users.csv';
  $remote_file = fopen ($url, 'r') or die ($php_errormsg);

  $filename = '/Users/dominic/DMR-IDS-FULL.csv';

  @unlink ($filenme);

  $local_file = fopen ($filename, 'w') or die ($php_errormsg);

  fputcsv ($local_file, array ('dmrid', 'callsign', 'name'));

  while (!feof ($remote_file)) {
    $line = fgetss ($remote_file, 64);
    $elem = explode (',', $line, -4);

    fputcsv ($local_file, $elem);
  }

  fclose ($remote_file);
  fclose ($local_file);
?>

Download only a few regions into separate files #

Fetch some regions (specified in the script) and some additional callsigns from a file that contains one callsign per line. This script uses a lot more RAM. Something around 32MB I guess. Or so.

#!/usr/bin/env php
<?php
  /*
   *  Save regions and favourites in separate files
   *  DMR-IDS-$REGION.csv and DMR-IDS-FAV.csv
   *  Dominic, OE7DRT
   */

  $url = 'https://ham-digital.org/status/users.csv';
  $remote_file = fopen ($url, 'r') or die ($php_errormsg);

  $mem = array ();

  while (!feof ($remote_file)) {
    $line = fgetss ($remote_file, 64);
    $elem = explode (',', $line, -4);
    array_push($mem, $elem);
  }

  $path = '/Users/dominic/';

  $fav_filename = 'Favorite_Callsigns.txt';
  $fav_file = fopen ($path.$fav_filename, 'r') or die($php_errormsg);

  $fav = array ();

  while (!feof ($fav_file)) {
    $line = fgetss ($fav_file, 16);
    if (!empty ($line)) $fav[] = trim ($line);
  }

  fclose ($fav_file);

  $filename = $path.'DMR-IDS-FAV.csv';
  @unlink($filename);

  $fav_out = fopen ($filename, 'w') or die ($php_errormsg);

  foreach ($fav as $callsign) {
    foreach ($mem as $item) {
      if (preg_match("/\b$callsign\b/i", $item[1], $m)) {
        fputcsv ($fav_out, $item);
      }
    }
  }

  fclose ($fav_out);

  // $regions = array ('232', '262', '263', '264', '228', '222');
  // $regions = array ('2327', '2328', '2329');
  $regions = array ('232','262','263','222','228');

  foreach ($regions as $region) {
    $filename = $path.'DMR-IDS-'.$region.'.csv';
    @unlink ($filename);

    $local_file = fopen ($filename, 'w') or die ($php_errormsg);
    fputcsv ($local_file, array ('dmrid', 'callsign', 'name'));

    foreach ($mem as $item) {
      if (preg_match ("/^$region/", $item[0], $m)) {
        fputcsv ($local_file, $item);
      }
    }
  }
    fclose ($remote_file);
  fclose ($local_file);
?>

Download only a few regions into one single file #

Like the one above, but it saves all IDs into one file. Uses probably the same amount of RAM.

#!/usr/bin/env php
<?php
  /*
   *  Save the regions and favourites in a single file
   *  DMR-IDS-SMALL.csv
   *  Dominic, OE7DRT
   */

  $path = '/Users/dominic/';

  $url = 'https://ham-digital.org/status/users.csv';
  $remote_file = fopen ($url, 'r') or die ($php_errormsg);

  $mem = array ();

  while (!feof ($remote_file)) {
    $line = fgetss ($remote_file, 64);
    $elem = explode (',', $line, -4);
    array_push($mem, $elem);
  }

  fclose ($remote_file);

  $whitelist_filename = 'Favorite_Callsigns.txt';
  $whitelist_file = fopen ($path.$whitelist_filename, 'r') or die($php_errormsg);

  $whitelist_array = array ();

  while (!feof ($whitelist_file)) {
    $line = fgetss ($whitelist_file, 16);
    if (!empty ($line)) $whitelist_array[] = trim ($line);
  }

  fclose ($whitelist_file);

  $filename = 'DMR-IDS-SMALL.csv';
  @unlink($path.$filename);

  $file = fopen ($path.$filename, 'w') or die ($php_errormsg);

  fputcsv ($file, array ('dmrid', 'callsign', 'name'));

  // $regions = array ('232', '262', '263', '264', '228', '222');
  //$regions = array ('2327', '2328', '2329');
  $regions = array ('232');

  foreach ($regions as $region) {
    foreach ($mem as $item) {
      if (preg_match ("/^$region/", $item[0], $m)) {
        fputcsv ($file, $item);
      }
    }
  }

  foreach ($whitelist_array as $callsign) {
    foreach ($mem as $item) {
      if (preg_match("/\b$callsign\b/i", $item[1], $m)) {
        fputcsv ($file, $item);
      }
    }
  }

  fclose ($file);
?>
Dominic Reich ¨OE7DRT¨
Author
Dominic Reich ¨OE7DRT¨
40, male, he/him, construction worker since 2016, electrician before, likes tech stuff and nature. Amateur radio operator since 2019. Uses this website as a digital notebook.

Related Posts

  • Get DMRIDs Via Command Line // 2020, February 4
    This is a quick workaround to retrieve a DMRID on console or terminal.
  • My 7-Inch DMR Dashboard // 2020, March 28
    I did not like the small screen and the small housing of my last Hotspot so I decided to make a bigger housing where I needed a bigger screen. Look what I got myself up and running, with some major options to control the hotspot just right off the screen itself. Make sure to install the NextionDrivers when you use this layout – it offers way more possibilities.
  • My Nextion 2.4" DMR Last Heard Dashboard // 2020, February 16
    I created a simple last-heard-dashboard for my small Nextion screen. It currently shows the used slot, its origin (like Network or RF) , the callsign and the used talkgroup.
  • HS Dual Hat With PiStar v4 // 2020, January 23
    This is a MMDVM_HS_Dual_Hat hotspot in duplex mode with DMRGateway and an actual Pi-Star image.
  • Winlink Activity Log (ICS 214) // 2026, March 8
    A script to help me summarize activities used by the Winlink Activity Log Form. Can be used in a Terminal. For Linux. It might also run on Windows 11 with WSL