Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - kech61

Pages: 1 ... 10 11 [12]
166
Themes - Vector maps / Re: [Theme] OSM Cyclo
« on: May 19, 2012, 10:55:28 »
Hello,

I'm shure that Thilo from the mapsforge-team will solve most of our technical issues in the future.

Please dont put too much preasure on him  ;) , as I experienced he is a one-man-show in wide areas of this project,
and I dont want that he leaves this project in frustration - the work he had done its way to precious for the community.

For me the tech-issues are solved far enough to make a version freeze this weekend, the quality of the cycle routes matches Andy Allens OpenCycleMap in wide areas - I developed the resolving scripts with an eye on his maps.
Most of the problems I experienced the last weeks had nothing to do with technics but with wrong tagged relations - I had to find a ballance between skipping them and setting rules (AND code them) that handle suspicious data with additional general rules.

So 50% of the work is done, now the anoying stuff starts, basicly setting up a website, finding sponsors for bandwidth, proteting against download-crawlers, writing the legal stuff, asking for permission to use the contour data of viewfinderpanoramas (its only free for personal use), _maybe_ providing themes for different apps (Locus is the only app I'v seen so far where the implementation of custom themes _PLUS_ symbols is rock-solid) aso......

OK, the sun is shining, my Kayak is waiting eagerly in the garage .... :mrgreen:

best regards
Christian aus der Wachau

167
Themes - Vector maps / AW: [Theme] OSM Cyclo
« on: May 18, 2012, 22:42:57 »
Hello,

Making Cycle maps is a complicated task. A theme is 1% of the job. Mapsforge can only render nodes and ways - cycle and hiking ways are organized in relations...

Wait 2 weeks, Cycle Maps will be available, I promisse..

Christian

Gesendet von meinem ST17i mit Tapatalk 2

168
Maps / Re: [MAPS] - Vector maps (with terrain contour lines)
« on: May 13, 2012, 18:53:12 »
Quote from: "menion"
Netherland map have highest concentration of items on same area compare to other countries. So at one zoom level, your phone needs to handle more data then on different areas ...

Hello,

Same Problem with Netherlands / northern Belgium / NL/DE-Border occurs with other custom maps, even without contour lines - there are not so many in NL ;-) .

As an example:
The Netherlands have 270000 cycle ways referencing to a relation, PLUS 130.983 ways tagged as highway=cycleway and 9480 cycle nodes (ovelapping collissions with distance <5m already filtered out....).
IMO no other country has such a detailed OSM-Database (and btw. such an accurate tagging) - a real challenge for a simple Phone...

For low-memory phones like my XperiaActive a custom tag-mapping.xml will be essential for those areas, reducing the details in Levels 6-10 (or whatever one choose for the mid-range-area of the mapwriter).

Not only Locus is crashing, all other mapping apps too.

Edit: Mhhhh.. I have not the slightest idea of Java-coding yet, but.. might it be possible that there are some array-dims or mem-allocations that run out of their range within the mapviever library ??

best regards
Christian

169
Tools / Re: [TOOL] guide to creating .poly files easily
« on: May 09, 2012, 13:22:05 »
Hello Jurajs,

Im finally here on Locus-Forum, is ways more responsive than Mapsforge-Dev and I hate GoogleGroups :-)
For you Toppic: I create polys as tracks in TTQV (any other MappingTool is possible) and export the tracks as gpx.

I wrote/modified two perlscripts to convert poly2gp and vice-versa.

The gpx2poly script has an additional feature for MapsforgeWriter, it writes a .bat file with the parameters (bbox!!) used for creating the map fitting the borders of the poly-file. The paths are fixed coded for my folder structure but its a matter of a few minutes to adjust this to your needs.

poly2gpx.pl:
Code: [Select]
#!/usr/bin/perl -w
#
# poly2gpx.pl - convert a polygon file to GPX
#
#  see http://wiki.openstreetmap.org/wiki/Osmosis/Polygon_Filter_File_Format
#  for the format of the polygon files
#
# Author: Hanno Hecker <vetinari+osm@ankh-morp.org>
#
# modified for windows (direct input/output from/to file - no more hassle with pipelines)
# made code more readable, this adds some milliseonds to processing time ;-)
# by Christian Kernbeis 2012
#
# Licence: GPL v3.0
# Version: 0.4.1
#
# usage: poly2gpx.pl [filename] WITHOUT EXTENSION
# eg: poly2gpx.pl austria = OK
#  poly2gpx.pl austria.poly = WRONG !!!
#
############################################################################################

use strict;
use Math::Polygon;
use Carp qw( croak );
use Getopt::Long;

my $VERSION = "0.4.1";

my $name  = undef;
my $trans = undef;
my $use_name = 0;

my $polyname = shift;
my $infile = $polyname.".poly";
my $outfile = $polyname.".gpx";


my @nodes    = ();
my $line;
my @infile;
my $trkseg   = 0;
my $trknum   = 0;


#read infile to array
open (IN,"<",$infile) || die("Could not open $infile ...");
while ($line = <IN>){
#print $line; # for testing only
push (@infile, $line);
}
close (IN);

open (out1,">",$outfile) || die("Could not open $outfile ...");

print out1 <<__END;
<?xml version='1.0' encoding='UTF-8'?>
<gpx version="1.1" generator="poly2gpx.pl v$VERSION"
    xmlns="http://www.topografix.com/GPX/1/1">
 <metadata>
  <name></name>
  <desc></desc>
  <author>
   <name></name>
   <email domain="" id=""/>
  </author>
  <copyright author="">
  <year></year>
  <license></license>
  </copyright>
 </metadata>
__END

foreach $line (@infile) {
    if ($line =~ /^s*!?(d+)s*$/) {
        $trknum = $1;
        print out1 " <trk>n",
              "  <trkseg>n";
        $trkseg = 1;
    }
    elsif ($line =~ /^s*ENDs*$/) {
        if ($trkseg) {
            $trkseg = 0;
            $trknum = 0;
            print out1 "  </trkseg>n </trk>n";
        }
        else {
            if ($use_name and defined $name) {
                if ($trans) {
                    eval $trans;
                    if ($@) {
                        warn "WARNING: transformation of $name failed: $@n";
                    }
                }

                if ($nodes[0][0] != $nodes[-1][0] and $nodes[0][1] != $nodes[-1][1]) {
                    push @nodes, $nodes[0];
                    warn "WARNING: polygon '$name' is not closed...n";
                }

                my $poly = Math::Polygon->new(@nodes);
                my $lat_lon = eval { $poly->centroid; }; # see below
                if ($@) { warn $@; }   # ... not here, at the end of the file
                else {
                    #$name = encode_entities_numeric($name);
                    $name =~ s/&/&amp;/g;
                    $name =~ s/</&lt;/g;
                    $name =~ s/>/&gt;/g;
                    printf out1 " <wpt lat="%.7f" lon="%.7f">n  <name>%s</name>n </wpt>n",
                            @{ $lat_lon }, $name;
                }
            }
            print out1 "</gpx>n";
        }
    }
    elsif ($line =~ /^s+([-+d.Ee]+)s+([-+d.Ee]+)s*$/) {
        printf out1 "   <trkpt lat="%.7f" lon="%.7f"/>n", $2, $1;
        push @nodes, [$2, $1]
          if $use_name and $trknum == 1;
    }
    elsif ($line =~ /^(S+)/ and not defined $name) {
        $name = $1
          if $1 ne "polygon";
    }
}
close (out1);
print "### DONE ###";

gpx2poly.pl
Code: [Select]
#!/usr/bin/perl

# script to convert a GPX file to a polygon file.
#
# written by Rodolphe QuiƩdeville <rodolphe@quiedeville.org>, GPL.
#
# Modified for better usability = no more ">" "|", direct file output
# so it's suitable for Windows environment and so on ....
# ensured compatibility with "GPX10" output of tracks from QuoVadis6.0
#
# by Christian Kernbeis 2012, GPL
#
# Scipt have to be started in the directory of th gpx-file !!
#
# usage: eg given file = austria.gpx
# call = gpx2poly.pl austria
# output is written to austria.poly
#  + map_austria.bat = batch for creating mapsforge map with bbox parameters


use strict;

my $infile = shift;

my $poly_id = 0;
my $poly_file;
my $polybuf;
my $outbuf;
my $id=0;
my $fh;
my $line;
my $inextension = "gpx";
my $outextension = "poly";
my $infilestring = "\maps\osm_data\my_clipbounds\europe\".$infile.".".$inextension;
my $outfilestring = "\maps\osm_data\my_clipbounds\europe\".$infile.".".$outextension;
my $bboxfile = "map_".$infile.".bat";

my @latbuff;
my @lonbuff;

my $bbox;

my $min_lat;
my $max_lat;
my $min_lon;
my $max_lon;



#open file
open (fh, $infilestring) or die $!;

while($line = <fh>)
{
if ($line =~ /^s*<trkpt.*slat=["']([0-9.eE-]+)["'] lon=["']([0-9.eE-]+)["']/){
       $polybuf .= sprintf "t%ft%fn", $2,$1;
push (@lonbuff, $2);
push (@latbuff, $1);
}
   elsif ($line =~ /^s*<trk>/){
       $polybuf = "";
       $poly_id++;
   }
   elsif ($line =~ /^s*</trk>/){
       $outbuf .= "$poly_idn$polybuf"."ENDn";
   }
}
close (fh);

open (fh,">",$outfilestring) or die $!;
print fh "$infilen$outbuf"."ENDn";
close fh;


@latbuff = sort { $a <=> $b } @latbuff;
@lonbuff = sort { $a <=> $b } @lonbuff;
$min_lat = @latbuff[0] - 0.0005; #runden auf 3 stellen genau FLOOR
$min_lon = @lonbuff[0] - 0.0005;
@latbuff = reverse sort { $a <=> $b } @latbuff;
@lonbuff = reverse sort { $a <=> $b } @lonbuff;
$max_lat = @latbuff[0] + 0.0005; #runden auf 3 stellen genau CEIL
$max_lon = @lonbuff[0] + 0.0005;


$bbox=
"bbox="
.sprintf ("%.3f",$min_lat)
.","
.sprintf ("%.3f",$min_lon)
.","
.sprintf ("%.3f",$max_lat)
.","
.sprintf ("%.3f",$max_lon);

open (fh,">",$bboxfile) or die $!;
print fh "d:\maps\osmosis\bin\osmosis_e.bat --rb file=D:\maps\Mapsforge\$infile\$infile","_merged.osm.pbf --mw file=D:\maps\Mapsforge\$infile\$infile.map $bbox tag-conf-file=D:\maps\Mapsforge\tag-mapping-cycle.xml bbox-enlargement=5nexitn";
close fh;
print "$bbox";

The scripts are running both on ActivePerl and StrawberryPerl for Windows and should be copied as usual to perlperlsitebin

regards
Christian

Pages: 1 ... 10 11 [12]