[osmctools] 01/09: Imported Upstream version 0.4
Sebastiaan Couwenberg
sebastic at moszumanska.debian.org
Fri Feb 27 22:27:16 UTC 2015
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository osmctools.
commit 2640375601ec23758ac01057c3013214443ff0f3
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Fri Feb 27 22:01:51 2015 +0100
Imported Upstream version 0.4
---
src/osmconvert.c | 54 ++++++++++++++++++++++++++++++++++++++++++++----------
src/osmfilter.c | 10 +++++-----
src/osmupdate.c | 13 ++++++++-----
3 files changed, 57 insertions(+), 20 deletions(-)
diff --git a/src/osmconvert.c b/src/osmconvert.c
index 9c39743..3c57700 100644
--- a/src/osmconvert.c
+++ b/src/osmconvert.c
@@ -1,5 +1,5 @@
-// osmconvert 2014-10-13 20:10
-#define VERSION "0.8"
+// osmconvert 2014-11-15 21:10
+#define VERSION "0.8.3"
//
// compile this file:
// gcc osmconvert.c -lz -O3 -o osmconvert
@@ -45,6 +45,7 @@ const char* shorthelptext=
"--diff calculate differences between two files\n"
"--diff-contents same as before, but compare whole contents\n"
"--subtract subtract objects given by following files\n"
+"--pbf-granularity=<val> lon/lat granularity of .pbf input file\n"
"--emulate-osmosis emulate Osmosis XML output format\n"
"--emulate-pbf2osm emulate pbf2osm output format\n"
"--fake-author set changeset to 1 and timestamp to 1970\n"
@@ -199,6 +200,12 @@ const char* helptext=
" one of the input files following this directive. For example:\n"
" osmconvert input.o5m --subtract minus.o5m -o=output.o5m\n"
"\n"
+"--pbf-granularity=<val>\n"
+" Rarely .pbf files come with non-standard granularity.\n"
+" osmconvert will recognize this and suggest to specify the\n"
+" abnormal lon/lat granularity using this command line option.\n"
+" Allowed values are: 100 (default), 1000, 10000, ..., 10000000.\n"
+"\n"
"--emulate-osmosis\n"
"--emulate-pbf2osm\n"
" In case of .osm output format, the program will try to use\n"
@@ -499,6 +506,11 @@ static bool global_outosh= false; // output shall have .osh format
static bool global_outpbf= false; // output shall have .pbf format
static bool global_outcsv= false; // output shall have .csv format
static bool global_outnone= false; // no standard output at all
+static int32_t global_pbfgranularity= 100;
+ // granularity of lon/lat in .pbf files; unit: 1 nanodegree;
+static int32_t global_pbfgranularity100= 0;
+ // granularity of lon/lat in .pbf files; unit: 100 nanodegrees;
+ // 0: default: 100 nanodegrees;
static bool global_emulatepbf2osm= false;
// emulate pbf2osm compatible output
static bool global_emulateosmosis= false;
@@ -2536,7 +2548,7 @@ static inline void write_sint64(int64_t v) {
static inline char* write_createsfix7o(int32_t v,char* s) {
// convert a signed 7 decimals fixpoint value into a string;
- // keep trailing zeroes;
+ // keep trailing zeros;
// v: fixpoint value
// return: pointer do string terminator;
// s[12]: destination string;
@@ -2571,7 +2583,7 @@ static inline void write_sfix7(int32_t v) {
{ *s1++= '-'; v= -v; }
s2= s1;
i= 7;
- while((v%10)==0 && i>0) // trailing zeroes
+ while((v%10)==0 && i>1) // trailing zeros
{ v/= 10; i--; }
while(--i>=0)
{ *s2++= (v%10)+'0'; v/= 10; }
@@ -2587,7 +2599,7 @@ static inline void write_sfix7(int32_t v) {
static inline void write_sfix7o(int32_t v) {
// write a signed 7 decimals fixpoint value to standard output;
- // keep trailing zeroes;
+ // keep trailing zeros;
char s[20],*s1,*s2,c;
int i;
@@ -2610,7 +2622,7 @@ static inline void write_sfix7o(int32_t v) {
static inline void write_sfix6o(int32_t v) {
// write a signed 6 decimals fixpoint value to standard output;
- // keep trailing zeroes;
+ // keep trailing zeros;
char s[20],*s1,*s2,c;
int i;
@@ -3105,8 +3117,14 @@ return 0;
nodelon<nodelone) { // dense nodes left
// provide a node
pb_id+= pbf_sint64(&nodeid);
- pb_lat+= pbf_sint32(&nodelat);
- pb_lon+= pbf_sint32(&nodelon);
+ if(global_pbfgranularity100!=0) {
+ pb_lat+= pbf_sint32(&nodelat)*global_pbfgranularity100;
+ pb_lon+= pbf_sint32(&nodelon)*global_pbfgranularity100;
+ }
+ else {
+ pb_lat+= pbf_sint32(&nodelat);
+ pb_lon+= pbf_sint32(&nodelon);
+ }
if(nodever>=nodevere || nodetime>=nodetimee ||
nodecset>=nodecsete || nodeuid>=nodeuide ||
nodeuser>=nodeusere) // no author information available
@@ -3810,8 +3828,16 @@ return 0;
if(bp[1]!=0x01) goto d_unknown;
bp+= 2;
l= pbf_uint32(&bp);
- if(l!=100)
- ENDEv(-121,"node nanodegrees must be 100: %u",l)
+ if(l!=global_pbfgranularity) {
+ if(l>100)
+ ENDEv(-120,"please specify: "
+ "--pbf-granularity=%u",l)
+ else if(l==100)
+ ENDE(-120,"please do not specify "
+ "--pbf-granularity")
+ else
+ ENDEv(-121,"granularity %u must be >=100.",l)
+ }
break;
case 0x90: // 0x01 V 18, millisec
if(bp[1]!=0x01) goto d_unknown;
@@ -11604,6 +11630,14 @@ return 0;
global_outcsv= true;
continue; // take next parameter
}
+ if((l= strzlcmp(a,"--pbf-granularity="))>0 && a[l]!=0) {
+ // specify lon/lat granularity for .pbf input files
+ global_pbfgranularity= oo__strtouint32(a+l);
+ global_pbfgranularity100= global_pbfgranularity/100;
+ global_pbfgranularity= global_pbfgranularity100*100;
+ if(global_pbfgranularity==1) global_pbfgranularity= 0;
+ continue; // take next parameter
+ }
if(strzcmp(a,"--emulate-pbf2")==0) {
// emulate pbf2osm compatible output
global_emulatepbf2osm= true;
diff --git a/src/osmfilter.c b/src/osmfilter.c
index dc4632b..86d6363 100644
--- a/src/osmfilter.c
+++ b/src/osmfilter.c
@@ -1,5 +1,5 @@
-// osmfilter 2014-10-13 20:30
-#define VERSION "1.3"
+// osmfilter 2014-10-15 12:20
+#define VERSION "1.3A"
//
// compile this file:
// gcc osmfilter.c -O3 -o osmfilter
@@ -1601,7 +1601,7 @@ static inline void write_sfix7(int32_t v) {
{ *s1++= '-'; v= -v; }
s2= s1;
i= 7;
- while((v%10)==0 && i>0) // trailing zeroes
+ while((v%10)==0 && i>1) // trailing zeros
{ v/= 10; i--; }
while(--i>=0)
{ *s2++= (v%10)+'0'; v/= 10; }
@@ -1617,7 +1617,7 @@ static inline void write_sfix7(int32_t v) {
static inline void write_sfix7o(int32_t v) {
// write a signed 7 decimals fixpoint value to standard output;
- // keep trailing zeroes;
+ // keep trailing zeros;
char s[20],*s1,*s2,c;
int i;
@@ -1640,7 +1640,7 @@ static inline void write_sfix7o(int32_t v) {
static inline void write_sfix6o(int32_t v) {
// write a signed 6 decimals fixpoint value to standard output;
- // keep trailing zeroes;
+ // keep trailing zeros;
char s[20],*s1,*s2,c;
int i;
diff --git a/src/osmupdate.c b/src/osmupdate.c
index fc9e183..ff76042 100644
--- a/src/osmupdate.c
+++ b/src/osmupdate.c
@@ -1,10 +1,10 @@
-// osmupdate 2013-04-10 09:00
-#define VERSION "0.3F"
+// osmupdate 2014-10-13 21:00
+#define VERSION "0.3H"
//
// compile this file:
// gcc osmupdate.c -o osmupdate
//
-// (c) 2011..2013 Markus Weber, Nuernberg
+// (c) 2011..2014 Markus Weber, Nuernberg
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Affero General Public License
@@ -561,13 +561,16 @@ exit(1);
maxlen= 1000-1;
while(maxlen>0) {
r= read(fileno(fp),result_p,maxlen);
- if(r<=0) // end of data
+ if(r==0) // end of data
break;
+ if(r<0)
+exit(errno); // (thanks to Ben Konrath)
result_p+= r;
maxlen-= r;
}
*result_p= 0;
- pclose(fp);
+ if(pclose(fp)==-1)
+exit(errno); // (thanks to Ben Konrath)
if(loglevel>=2)
PINFOv("Got shell command result:\n%s",result)
} // end shell_command()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/osmctools.git
More information about the Pkg-grass-devel
mailing list