-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
254 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/perl | ||
#----------------------------------------------------------------------------- | ||
# | ||
# Tirex Tile Rendering System | ||
# | ||
# backends/openseamap | ||
# | ||
#----------------------------------------------------------------------------- | ||
# See Tirex::Backend::Test for documentation. | ||
#----------------------------------------------------------------------------- | ||
# | ||
# Copyright (C) 2019 Frederik Ramm <[email protected]> | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation; either version 2 | ||
# of the License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
#----------------------------------------------------------------------------- | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Tirex::Backend::OpenSeaMap; | ||
|
||
#----------------------------------------------------------------------------- | ||
|
||
my $backend = Tirex::Backend::OpenSeaMap->new(); | ||
$backend->main(); | ||
|
||
#-- THE END ------------------------------------------------------------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
tirex (0.6.1) UNRELEASED; urgency=medium | ||
|
||
* add openseamap backend | ||
|
||
-- Frederik Ramm E <[email protected]> Wed, 21 Aug 2019 16:10:48 +0200 | ||
|
||
tirex (0.6.0) UNRELEASED; urgency=medium | ||
|
||
* tirex-syncd to use ssh master, also allow multiple destinations | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#----------------------------------------------------------------------------- | ||
# | ||
# Konfiguration for OpenSeaMap renderer | ||
# | ||
# /etc/tirex/renderer/openseamap.conf | ||
# | ||
#----------------------------------------------------------------------------- | ||
|
||
#----------------------------------------------------------------------------- | ||
# General configuration | ||
#----------------------------------------------------------------------------- | ||
|
||
# symbolic name | ||
name=openseamap | ||
|
||
# path to executable of renderer | ||
path=/usr/lib/tirex/backends/openseamap | ||
|
||
# UDP port where the master can contact this renderer | ||
# must be individual for each renderer | ||
port=9334 | ||
|
||
# number of processes that should be started | ||
procs=3 | ||
|
||
# syslog facility | ||
#syslog_facility=daemon | ||
|
||
# activate this to see debug messages from renderer | ||
#debug=1 | ||
|
||
#----------------------------------------------------------------------------- | ||
# Backend specific configuration | ||
#----------------------------------------------------------------------------- | ||
|
||
# none | ||
|
||
#-- THE END ------------------------------------------------------------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#----------------------------------------------------------------------------- | ||
# | ||
# Configuration for OpenSeaMap map | ||
# | ||
# /etc/tirex/renderer/openseamap/openseamap.conf | ||
# | ||
#----------------------------------------------------------------------------- | ||
|
||
#----------------------------------------------------------------------------- | ||
# General configuration | ||
#----------------------------------------------------------------------------- | ||
|
||
# symbolic name of this map | ||
name=openseamap | ||
|
||
# tile directory | ||
tiledir=/var/lib/tirex/tiles/openseamap | ||
|
||
# minimum zoom level allowed (default 0) | ||
#minz=0 | ||
|
||
# maximum zoom level allowed (default 17) | ||
maxz=18 | ||
|
||
#----------------------------------------------------------------------------- | ||
# Backend specific configuration | ||
#----------------------------------------------------------------------------- | ||
|
||
# actual rendering program | ||
jar=/srv/jrenderpgsql/jrenderpgsql.jar | ||
|
||
# how to access the database | ||
dburl=jdbc:postgresql:///gis?user=postgres&password=postgres | ||
|
||
|
||
#-- THE END ------------------------------------------------------------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
#----------------------------------------------------------------------------- | ||
# | ||
# Tirex/Backend/OpenSeaMap.pm | ||
# | ||
#----------------------------------------------------------------------------- | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use List::Util qw(); | ||
use Carp; | ||
|
||
use Tirex::Backend; | ||
|
||
#----------------------------------------------------------------------------- | ||
|
||
package Tirex::Backend::OpenSeaMap; | ||
use base qw( Tirex::Backend ); | ||
|
||
=head1 NAME | ||
Tirex::Backend::OpenSeaMap - OpenSeaMap backend for Tirex | ||
=head1 DESCRIPTION | ||
This backend calls an external Java program to generate an OpenSeaMap | ||
meta tile. The Java program is here: https://svn.openstreetmap.org/applications/editors/josm/plugins/seachart/jrenderpgsql/ | ||
Config parameters for the map file: | ||
=over 8 | ||
=item dburl the JDBC database connection URL, with username and password if needed | ||
=item jar the JAR file containing the JRenderPsql class to use | ||
=item scalefactor the scale factor (defaults to 1.0) | ||
=item tilesize the tile size (should be 256 * scalefactor to avoid issues) | ||
=head1 METHODS | ||
=head2 $backend->init() | ||
This method initializes things specific to this backend. | ||
=cut | ||
|
||
sub init | ||
{ | ||
my $self = shift; | ||
|
||
$self->{'border_width'} = 6; | ||
GD::Image->trueColor(1); | ||
|
||
} | ||
|
||
=head2 $backend->check_map_config($map) | ||
=cut | ||
|
||
sub check_map_config | ||
{ | ||
my $self = shift; | ||
my $map = shift; | ||
|
||
if ($Tirex::METATILE_COLUMNS != $Tirex::METATILE_ROWS) | ||
{ | ||
Carp::croak("this plugin cannot work with non-square meta tiles"); | ||
} | ||
|
||
if (!defined($map->{'jar'})) | ||
{ | ||
Carp::croak("must configure renderer in map file"); | ||
} | ||
|
||
if (!-f $map->{'jar'}) | ||
{ | ||
Carp::croak("configured renderer " . $map->{'jar'} . " does not exist"); | ||
} | ||
|
||
if (!defined($map->{'dburl'})) | ||
{ | ||
Carp::croak("must configure dburl in map file"); | ||
} | ||
} | ||
|
||
=head2 $backend->create_metatile() | ||
Create a metatile. | ||
=cut | ||
|
||
sub create_metatile | ||
{ | ||
my $self = shift; | ||
my $map = shift; | ||
my $metatile = shift; | ||
|
||
my $xc = $metatile->get_x(); | ||
my $yc = $metatile->get_y(); | ||
my $zoom = $metatile->get_z(); | ||
|
||
my $pixel = $Tirex::PIXEL_PER_TILE; | ||
my $tmpfile = "/tmp/tirex-$$-openseamap.png"; | ||
my $cmdline = sprintf("java -jar %s --scale %f --tilesize %d '%s' %d %d %d %s", | ||
$map->{'jar'}, $map->{'scalefactor'}, $map->{'tilesize'} * $Tirex::METATILE_COLUMNS, $map->{'dburl'}, $zoom , $xc, $yc, $tmpfile); | ||
|
||
::syslog('debug', 'OpenSeaMap request: %s', $cmdline) if ($Tirex::DEBUG); | ||
system($cmdline); | ||
|
||
my $image = GD::Image->new($tmpfile); | ||
$image->alphaBlending(0); | ||
$image->saveAlpha(1); | ||
|
||
unlink ($tmpfile); | ||
return $image; | ||
} | ||
|
||
|
||
1; | ||
|
||
#-- THE END ------------------------------------------------------------------ |