[SOLVED] osgEarth 3.0 :: XYZImageLayer issue? :: Tiles are shifted?

classic Classic list List threaded Threaded
9 messages Options
kefir kefir
Reply | Threaded
Open this post in threaded view
|

[SOLVED] osgEarth 3.0 :: XYZImageLayer issue? :: Tiles are shifted?

This post was updated on .
Why did I put question marks in the title? Because I'm not quite sure if this is a legitimate bug or just some artifacts that are specific to my build (because I have issues with jpegs not being rendered for example).

So the problem is that apparently XYZ driver shifts tiles and renders them in the wrong place. This applies only to osgEarth 3.0, same code on earlier versions behaves as expected.

Here is my setup:
//add elevation layer
TMSElevationLayer* elevation = new TMSElevationLayer();
elevation->setName("Elevation");
elevation->setURL("http://readymap.org/readymap/tiles/1.0.0/116/");
ui->mapWidgetArea->getMap()->addLayer( elevation );

// add an XYZ image layer:
XYZImageLayer* osm = new XYZImageLayer();
osm->setName("OpenStreetMap");
osm->setURL("http://[abc].tile.openstreetmap.org/{z}/{x}/{y}.png");
osm->setProfile(Profile::create("spherical-mercator"));
ui->mapWidgetArea->getMap()->addLayer(osm);


This is what I get:


And if we take a bird's eye view:


Here we can clearly see what i'm talking about. How do I know that tiles are shifted and not the elevation data? Simple - elevation is rendered at correct coordinates. I've marked corresponding points with red dots for your convenience.

So if anyone has any idea what could have gone wrong - please help. Just general direction of where to dig for answers will suffice.

Build details:
  • Qt Creator 4.9.0-rc1 (4.8.84) Based on Qt 5.12.2 (MSVC 2017, 32 bit)
  • MSVC2017 64bit
  • Windows 10
I've tried to compile all the libraries myself, except freetype - that didn't want to compile with OSG so I reverted to prebuilt library for this one.

UPD: I've tried to build latest stable releases of all the libraries. Maybe There's a list of recommended versions?
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: osgEarth 3.0 XYZImageLayer issue? Tiles are shifted?

kefir,

I've tried to reproduce this with the 3.0 branch, with no luck. I tried an earth file and code, geocentric and projected, and everything lines up correctly.

Win 10, OSG 3.6.3, osgEarth 3.0 tip, GDAL 2.3.2.

Here is the earth file for reference.
a.earth


Are you seeing any messages on the console? Try setting envvar OSGEARTH_NOTIFY_LEVEL=INFO and see if anything interesting pops up. Are you trying to use a cache, and maybe have some bad cache data?
Glenn Waldron / Pelican Mapping
kefir kefir
Reply | Threaded
Open this post in threaded view
|

Re: osgEarth 3.0 XYZImageLayer issue? Tiles are shifted?

Here is the output. Only interesting thing seems to be srs=unknown

[osgEarth] [Capabilities] osgEarth Version: 3.0.0 (DEVELOPMENT)
[osgEarth] [Capabilities] OSG Version: 3.6.3
[osgEarth] [Capabilities] GDAL Version: 2.5.0
...
[osgEarth] [TerrainLayer] Layer "TMS Imagery" Cache bin is [3e34d0a6]
[osgEarth] [TerrainLayer] Layer "TMS Imagery" [srs=unknown, min=-180,-90 max=180,90 lod0=2,1 vdatum=geodetic] [cache=FileSystemCache; policy=read-write; bin=yes]
[osgEarth] [TMS] TMS tile map datestamp = Thu, 01 Jan 1970 00:00:00 GMT
[osgEarth] [TerrainLayer] Layer "Elevation" Cache bin is [bdc002c1]
[osgEarth] [TerrainLayer] Layer "Elevation" [srs=unknown, min=-180,-90 max=180,90 lod0=2,1 vdatum=geodetic] [cache=FileSystemCache; policy=read-write; bin=yes]
[osgEarth] [TerrainLayer] Layer "Elevation" Cache bin is [bdc002c1]
[osgEarth] [TerrainLayer] Layer "Elevation" [srs=unknown, min=-180,-90 max=180,90 lod0=2,1 vdatum=geodetic] [cache=FileSystemCache; policy=read-write; bin=yes]
[osgEarth] [TerrainLayer] Layer "OpenStreetMap" Cache bin is [03fe356c]
[osgEarth] [TerrainLayer] Layer "OpenStreetMap" [srs=unknown, min=-20037508.34278925,-20037508.34278925 max=20037508.34278925,20037508.34278925 lod0=1,1 vdatum=geodetic] [cache=FileSystemCache; policy=read-write; bin=yes]
...
[osgEarth] [Map] Map profile is: [srs=unknown, min=-180,-90 max=180,90 lod0=2,1 vdatum=geodetic]


Although I specifically set map srs (I do not use earth files because reasons):
// create empty map.
map = new Map(mapOptions);
map->setProfile(Profile::create("wgs84"));


gwaldron wrote
Are you trying to use a cache, and maybe have some bad cache data?
Cache was cleared prior first run with osgEarth 3.0, driver is filesystem.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: osgEarth 3.0 XYZImageLayer issue? Tiles are shifted?

OK, you don't use earth files - but does the earth file work with osgearth_viewer? If so -- there is an issue in your app. If not -- something else.

Is your GDAL_DATA environment variable pointing at GDAL's data folder? Maybe that is the reason for srs=unknown.

Also, test without the cache.

(Also: "wgs84" is not a profile, it's an SRS. You want "global-geodetic" which is the default so you don't need to set it at all.)
Glenn Waldron / Pelican Mapping
kefir kefir
Reply | Threaded
Open this post in threaded view
|

Re: osgEarth 3.0 XYZImageLayer issue? Tiles are shifted?

Tested without cache - same.
Removed setProfile (thanks for the tip) - same.
Tested with a.earth and osgearth_viewer - same.

srs is still unknown.
[osgEarth]  [Map] Map profile is: [srs=unknown, min=-180,-90 max=180,90 lod0=2,1 vdatum=geodetic]


Maybe I should build different gdal version... Compiling all this stuff for windows is a nightmare - perhaps somewhere along the way something went wrong.

Oh, and yes - GDAL_DATA exists and is pointing to the correct directory
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: osgEarth 3.0 XYZImageLayer issue? Tiles are shifted?

Highly recommend vcpkg for windows dependencies. Once you have it set up it makes life so much easier.

Here are some pointers...not sure how up to date:
http://docs.osgearth.org/en/latest/vcpkg.html
Glenn Waldron / Pelican Mapping
kefir kefir
Reply | Threaded
Open this post in threaded view
|

Re: osgEarth 3.0 XYZImageLayer issue? Tiles are shifted?

Yes vcpkg is a thing and I've tried it and also sometimes got build errors. However later I would need to compile all of this using Intel compiler, so not sure how vcpkg will handle it.
plevy plevy
Reply | Threaded
Open this post in threaded view
|

Re: osgEarth 3.0 XYZImageLayer issue? Tiles are shifted?

Kefir,

Does gdalinfo show the correct srs on other imagery?  Maybe it will point to a missing environment variable or file it cannot find.

--
Paul Levy : Pelican Mapping


On Tue, May 14, 2019 at 9:40 AM kefir [via osgEarth] <[hidden email]> wrote:
Yes vcpkg is a thing and I've tried it and also sometimes got build errors. However later I would need to compile all of this using Intel compiler, so not sure how vcpkg will handle it.


If you reply to this email, your message will be added to the discussion below:
http://forum.osgearth.org/osgEarth-3-0-XYZImageLayer-issue-Tiles-are-shifted-tp7592577p7592586.html
To start a new topic under osgEarth, email [hidden email]
To unsubscribe from osgEarth, click here.
NAML
kefir kefir
Reply | Threaded
Open this post in threaded view
|

Re: osgEarth 3.0 XYZImageLayer issue? Tiles are shifted?

plevy wrote
Does gdalinfo show the correct srs on other imagery?  Maybe it will point to a missing environment variable or file it cannot find.
Now that I've rebuilt OSG using prebuilt libs and then built osgEarth the issue is gone. Not sure What has caused it...