Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

fails to display OSM data #2576

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 5 comments
Closed

fails to display OSM data #2576

openstreetmap-trac opened this issue Jul 23, 2021 · 5 comments

Comments

@openstreetmap-trac
Copy link

Reporter: landry[at]rhaalovely.net
[Submitted to the original trac issue database at 5.37am, Thursday, 24th December 2009]

I've ported merkaartor to OpenBSD, it compiles fine with a bunch of patches (attached) to appease G++3, (i use NOUSEWEBKIT=1 as our Qt4.5.3 isn't compiled with Webkit), but it fails to display/render any OSM data. I can view gpx tracks, create roads/nodes, but when i download data from osm i only get a zero-feature layer.
The data seems correctly downloaded, i get this on the output :

Downloader::go:  "/api/0.6/map?bbox=3.173418,45.710854,3.250837,45.741532" 
Downloader::on_responseHeaderReceived:  200 "OK"

then a short 'Parsing XML' window.. but then, the download layer is empty :

DrawingMapLayer
2009-12-24T18:13:20 download
({ad04dbd4-53e6-46b2-a895-37811a50ffba})
Size: 0 features

How can i help debug that ? Building a DEBUG version, and ??

@openstreetmap-trac
Copy link
Author

Author: Koying
[Added to the original trac issue at 7.26pm, Thursday, 24th December 2009]

  1. What version are you using: svn, 0.14 from tarball, or...

  2. Attach the "/tmp/merkaartor.log" file (if using 0.14; if using svn, generate one using "merkaartor --log /tmp/merkaartor.log")

  3. Try the following url in a browser to see if you succeed in downloading the data, network-wise:
    "http://www.openstreetmap.org/api/0.6/map?bbox=3.173418,45.710854,3.250837,45.741532"

@openstreetmap-trac
Copy link
Author

Author: landry[at]rhaalovely.net
[Added to the original trac issue at 8.43pm, Thursday, 24th December 2009]

It's with 0.14 from tarball.
output log :

$merkaartor                                                                                                             
****  "2009-12-24T21:42:01"  -- Starting  "Merkaartor 0.14" 
------- "using QT version 4.5.3 (built with 4.5.3)" 
------- on X11 
MerkaartorPreferences::fromOsmPref : "GET /api/0.6/user/preferences/" 
Downloader::go:  "/api/0.6/map?bbox=3.173418,45.710854,3.250837,45.741532" 
Downloader::on_responseHeaderReceived:  200 "OK" 
****  "2009-12-24T21:42:37"  -- Ending  "Merkaartor 0.14" 

of course, the url in a browser works and gets the XML, heck i'm using JOSM without problems since ages.. so far what i've tried :

  • uncomment the #define DEBUG_* at the beginning of src/Maps/DownloadOSM.cpp : this calls showDebug, but there is no content to show. window is empty.

  • played with gdb, which is a pain when dealing with c++ : to my understanding, in Downloader::go() Content ends up being empty after theRequest.request() call.

(gdb) p Content
$5 = {static shared_null = {ref = {_q_value = 1225}, alloc = 0, size = 0, data = 0x3c15e3e8 "", array = ""}, static shared_empty = {
    ref = {_q_value = 4}, alloc = 0, size = 0, data = 0x283223ac "", array = ""}, d = 0x7c372000}

This doesn't make sense as the download window says that it correctly downloaded 177kb of data.

I'll try do add some debug printfs to see what happens..

@openstreetmap-trac
Copy link
Author

Author: landry[at]rhaalovely.net
[Added to the original trac issue at 9.26pm, Thursday, 24th December 2009]

Okay, think i narrowed it down to gzipDecode :

if i add

printf("gzipDecoding Content.size:%d, Content:'%s', Uncompressed.size:%d, Uncompressed:'%s'\n", Content.size(), Content.data(), Uncompressed.size(), Uncompressed.data());

after QByteArray Uncompressed(gzipDecode(Content)); in Downloader::go(), here's what i get on the stdout :

gzipDecoding Content.size:116227, Content:'�', Uncompressed.size:0, Uncompressed:''

Seeing that, can't qUncompress() be used here ? http://qt.nokia.com/doc/4.6/qbytearray.html#qUncompress

If i trace gzipDecode, it fails at ret = inflateInit2(&strm,15+32); ret is -6, which corresponds to Z_VERSION_ERROR. zlib is 1.2.3 here. Can't do much more with that now....

@openstreetmap-trac
Copy link
Author

Author: landry[at]rhaalovely.net
[Added to the original trac issue at 9.48pm, Thursday, 24th December 2009]

Ok, good news, got it, and it was nasty :
so Z_VERSION_ERROR is returned because in the call to inflateInit2, which is a macro expanded to

#define inflateInit2(strm, windowBits) \
        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))

this check is done :

    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
        stream_size != (int)(sizeof(z_stream)))
        return Z_VERSION_ERROR;

sizeofs differs... as merkaartor links with our libz, which has a different sizeof for the struct from the one DownloadOSM.cpp includes :

--- /usr/include/zlib.h	Thu Dec  3 09:15:48 2009
+++ src/zlib/zlib.h	Wed Apr 22 13:57:40 2009
@@ -1,4 +1,3 @
-/*	$OpenBSD: zlib.h,v 1.9 2005/07/20 15:56:41 millert Exp $	*/
 /* zlib.h -- interface of the 'zlib' general purpose compression library
   version 1.2.3, July 18th, 2005
 
@@ -83,11 +82,11 @
 typedef struct z_stream_s {
     Bytef    *next_in;  /* next input byte */
     uInt     avail_in;  /* number of bytes available at next_in */
-    z_off_t  total_in;  /* total nb of input bytes read so far */
+    uLong    total_in;  /* total nb of input bytes read so far */
 
     Bytef    *next_out; /* next output byte should be put there */
     uInt     avail_out; /* remaining free space at next_out */
-    z_off_t  total_out; /* total nb of bytes output so far */
+    uLong    total_out; /* total nb of bytes output so far */

Easy fix :

--- src/Maps/DownloadOSM.cpp.orig	Mon Jul 20 13:12:39 2009
+++ src/Maps/DownloadOSM.cpp	Thu Dec 24 22:38:20 2009
@@ -28,11 +28,11 @
 #include <QStatusBar>
 #include <QInputDialog>
 
-#include "zlib/zlib.h"
+#include <zlib.h>

With that, merkaartor succesfully displays OSM data.

@openstreetmap-trac
Copy link
Author

Author: Koying
[Added to the original trac issue at 4.46pm, Sunday, 14th February 2010]

Applied to SVN and removed embedded zlib

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant