The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Store Open Street Map data with DBI, especially for Switzerland

SYNOPSIS use Geo::OSM::DBI; # or ... use Geo::OSM::DBI::CH;

The exact specifica are yet to be defined.

METHODS

new

    my $osm_db_ch = Geo::OSM::DBI::CH->new($dbh);

Create and return a Geo::OSM::DBI::CH object that will access the Open Street Database referenced by the DBI::db object $dbh). It's unclear to me what a DBI::db object actually is...

create_table_municipalities_ch

    $osm_db_ch->create_table_municipalities_ch();

First creates the table municipalities by calling the parent's class create_table_municipalities. Then, it uses the data in table municipalities to create municipalities_ch. Finanlly, it creates the view municipalities_ch_v.

municipalities_ch

    $osm_db_ch->create_table_municipalities_ch();
    …
    my %municipalities = $osm_db_ch->municipalities_ch();

rel_id_ch

    my $rel_id = $osm_db_ch->rel_id_ch();

Return the relation id of Switzerland.

As of 2017-09-05, it returns 51701.

Note: apparently, a country can have multiple relations with key = 'ISO3166-1' (See "rel_ids_ISO_3166_1" in Geo::OSM::DBI), yet Switzerland has (as it does not have access to the sea) only one.

rel_id_ch

Return the relation of Switzerland.

See "rel_id_ch" in Geo::OSM::DBI for more details.

COPYRIGHT and LICENSE

Copyright © 2017 René Nyffenegger, Switzerland. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at: http://www.perlfoundation.org/artistic_license_2_0

SOURCE CODE

The source code is on github. Meaningful pull requests are welcome.