mixed datasets (imagery & elevation)

classic Classic list List threaded Threaded
12 messages Options
eric eric
Reply | Threaded
Open this post in threaded view
|

mixed datasets (imagery & elevation)

First of all, 5u for that work, osgearth is a very beautiful and usefull application.

I try to build my own "earth viewer" based on osgearth, using google maps imagery for the image layer  & STRM dataset for the heightfield layer.

I have a few questions, since I have troubles to move one step forward after running the samples, I would greatly appreciate some help.

I'm sorry for the GIS beginner questions, but I cant't find clear answers to those questions using web search engines

I have downloaded all the SRTM elevation dataset, and I want to use it inside osgearth for terrain data, coupled with the google maps dataset for image data

It seems the projection used in google maps & SRTM datasets are different, since SRTM is global-geocentric whereas google uses a Mercator projection.

I tried to change the SRTM dataset to use a mercator projection, with the gdal2tiles & maptiler tools, but after conversion I can't get to use google imagery with SRTM dataset inside my viewer.

I copied all the files generated with maptiler inside a subdirectory of my apache www directory.

Is there any turorial somewhere which can explain how to tile the SRTM dataset to use it inside a "Mercator like" image dataset (google, yahoo, ...), accessing this dataset in a local (file structure) or remote (http structure) manner ?

Being a new GIS developper, I also ask myself questions about using satellite datasets (such as those provided by the google & yahoo osgearth drivers), inside my own pojets (personnal & / or professionnal) ?
The samples say "it is your responsibility to abide by the provider's terms of service when using their data." Do you have any links to the associated terms  of use ? Are there any licences behind the use of those images ?

Thanks in advance.

Best regards,

Eric.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: mixed datasets (imagery & elevation)

Eric,

If I am not mistaken, gdal2tiles/maptiler creates a tile set according to the TMS spec. You will use osgEarth's TMS driver to access it:

http://wush.net/trac/osgearth/wiki/TileSourcePluginTMS

Re. data licenses: each commercial provider has its own terms and conditions for usage. The osgEarth drivers for Google, Yahoo, etc. are for educational purposes only. If you want to use their data in your own product, you will have to work out an agreement with them.

Example:
Google maps/Google earth: http://maps.google.com/help/terms_maps.html

Glenn Waldron / Pelican Mapping
jasonbeverage jasonbeverage
Reply | Threaded
Open this post in threaded view
|

Re: mixed datasets (imagery & elevation)

Hi Erica,

Last time I tried, gdal2tiles didn't support dealing with single band data like SRTM.

My recommendation would be download FWTools to get GDAL and it's supporting programs, then use gdalmerge to make a single TIF file out of the SRTM.  I believe it ends up being about 3GB.

That SRTM will be in a geodetic coordinate system, so you'll then need to warp the file to spherical mercator (use the directions here http://lists.osgeo.org/pipermail/gdal-dev/2009-January/019432.html).

After that, you should be able to reference the spherical mercator SRTM file as a heightfield using the GDAL plugin.

One thing to note, I would recommend using the -co "TILED=YES" option when processing the files.  This creates a tiled version of the tif rather than a scan line based image, which will tremendously increase performance when accessing the data using osgEarth.

Thanks!

Jason

On Sat, Mar 28, 2009 at 10:04 AM, gwaldron (via Nabble) <[hidden email]> wrote:
Eric,

If I am not mistaken, gdal2tiles/maptiler creates a tile set according to the TMS spec. You will use osgEarth's TMS driver to access it:

http://wush.net/trac/osgearth/wiki/TileSourcePluginTMS

Re. data licenses: each commercial provider has its own terms and conditions for usage. The osgEarth drivers for Google, Yahoo, etc. are for educational purposes only. If you want to use their data in your own product, you will have to work out an agreement with them.

Example:
Google maps/Google earth: http://maps.google.com/help/terms_maps.html
Glenn Waldron * Pelican Mapping * [hidden email] * +1 703 652 4791



View message @ http://n2.nabble.com/mixed-datasets-%28imagery---elevation%29-tp2547376p2549104.html
To start a new topic under osgEarth, email [hidden email]
To unsubscribe from osgEarth, click here.


eric eric
Reply | Threaded
Open this post in threaded view
|

Re: mixed datasets (imagery & elevation)

In reply to this post by gwaldron
Hello Glenn, thanks for your answers.

I think I miss something, since I can't render in osgearth the tms tiles I generate with mapTiler.

Below is what I do:

I use mapTiler to generate tiles, with global spherical mercator or global geodetic tiles (result is the same, whatever the kind of tiles).

I use the world.tif file provided with osgearth, to generate zoom levels 0, 1 & 2.

After the tiles have been generated, I can successfully watch them with the openLayers.html file, generated with the tiles.

Then, I move the "world" directory containing the tiles & the tilemapresource.xml file in a subfolder of my apache www directory.

I try to render the tiles inside osgearth, using the following earth file:

<map type="geodetic"> 
  <image name="world" driver="tms">
    <url>http://localhost/world/tilemapresource.xml</url>
  </image>
</map>

I then get the following error when loading the file with osgearth:
Couldn't get tile for 0_0_0

Any ideas are welcomed, I turn around with this problem...

Thanks in advance.

Regards,

Eric.
jasonbeverage jasonbeverage
Reply | Threaded
Open this post in threaded view
|

Re: mixed datasets (imagery & elevation)

By eric

A few things to double check...

If you type that URL in your web browser, does it work?  Can you post the tms XML file for me to look at?

Also, unless something has changed recently, gdal2tiles swaps the x and y coordinates jn the tms xml file producing an incorrect tms file. Swapping the x and y for the bounding box manually fixes that issue.

Jason

Sent from my iPhone

On Mar 28, 2009, at 12:23 PM, "eric (via Nabble) - No Reply" <[hidden email]> wrote:

Hello Glenn, thanks for your answers.

I think I miss something, since I can't render in osgearth the tms tiles I generate with mapTiler.

Below is what I do:

I use mapTiler to generate tiles, with global spherical mercator or global geodetic tiles (result is the same, whatever the kind of tiles).

I use the world.tif file provided with osgearth, to generate zoom levels 0, 1 & 2.

After the tiles have been generated, I can successfully watch them with the openLayers.html file, generated with the tiles.

Then, I move the "world" directory containing the tiles & the tilemapresource.xml file in a subfolder of my apache www directory.

I try to render the tiles inside osgearth, using the following earth file:

<map type="geodetic">  
  <image name="world" driver="tms">
    <url>http://localhost/world/tilemapresource.xml</url>
  </image>
</map>

I then get the following error when loading the file with osgearth:
Couldn't get tile for 0_0_0

Any ideas are welcomed, I turn around with this problem...

Thanks in advance.

Regards,

Eric.



View message @ http://n2.nabble.com/mixed-datasets-%28imagery---elevation%29-tp2547376p2549582.html
To start a new topic under osgEarth, email [hidden email]
To unsubscribe from osgEarth, click here.

eric eric
Reply | Threaded
Open this post in threaded view
|

Re: mixed datasets (imagery & elevation)

Hello Jason.

After I swapped the x & y coordinates, it worked fine for the "world.tif" dataset...

I now try to tile the SRTM 30 dataset, using gdal2tiles gotten from FWTools 2.3.1, but I have some trouble to do it...

The first step using "gdalmerge" is ok (I end end with a global elevation dataset about 3Gb).

Then I use the following command:
gdalwarp -of vrt -t_srs epsg:900913 -wo SOURCE_EXTRA=120 -co "TILED=YES" GTOPO30.tif output.vrt

which is also OK...

Finally I lauch the gdal2tiles command:
gdal2tiles output.vrt

There I get an error:
gdal2tiles.py: error: This version of GDAL is not supported. Please upgrade to 1.6+.

I tried to patch this adding some optionnal parameters like  this:
gdal2tiles -v -rnear GTOPO30.vrt GTOPO30_tiled

Then I got the following error message:

Options: <Values at 0x9e5e68: {'profile': 'mercator', 'googlekey': 'INSERT_YOUR_
KEY_HERE', 'verbose': True, 'copyright': '', 'resume': False, 'url': '', 'kml':
False, 'webviewer': 'all', 'yahookey': 'INSERT_YOUR_YAHOO_APP_ID_HERE', 'zoom':
None, 'resampling': 'near', 'title': 'GTOPO30.vrt', 's_srs': None}>
Input: GTOPO30.vrt
Output: GTOPO30_tiled
Cache: 40 MB

Input file: ( 39359P x 25320L - 1 bands)
Preprocessed file: ( 39359P x 25320L - 1 bands)
Traceback (most recent call last):
  File "E:\perso\dev\3rdParty\FWTools2.3.1\bin\gdal2tiles.py", line 2136, in ?
    gdal2tiles.process()
  File "E:\perso\dev\3rdParty\FWTools2.3.1\bin\gdal2tiles.py", line 470, in proc
ess
    self.open_input()
  File "E:\perso\dev\3rdParty\FWTools2.3.1\bin\gdal2tiles.py", line 809, in open
_input
    self.alphaband = self.out_ds.GetRasterBand(1).GetMaskBand()
AttributeError: Band instance has no attribute 'GetMaskBand'

It seems my geotif still has just one band, maybe the second step failed (it took only a few seconds, compared to the first step which was very lengthy) ?

Thanks.

Regards,

Eric.
jasonbeverage jasonbeverage
Reply | Threaded
Open this post in threaded view
|

Re: mixed datasets (imagery & elevation)

Hey eric

What I would suggest doing is just directly accessing the srtm file via the osgearth Gdal plugin. If you really want to create tiles from it, you can set up osgearth to cache to tms, which also works for elevation. 

I don't think gdal2tiles works at all with single band files

Jason

On Mar 28, 2009, at 8:13 PM, "eric (via Nabble) - No Reply" <[hidden email]> wrote:

Hello Jason.

After I swapped the x & y coordinates, it worked fine for the "world.tif" dataset...

I now try to tile the SRTM 30 dataset, using gdal2tiles gotten from FWTools 2.3.1, but I have some trouble to do it...

The first step using "gdalmerge" is ok (I end end with a global elevation dataset about 3Gb).

Then I use the following command:
gdalwarp -of vrt -t_srs epsg:900913 -wo SOURCE_EXTRA=120 -co "TILED=YES" GTOPO30.tif output.vrt

which is also OK...

Finally I lauch the gdal2tiles command:
gdal2tiles output.vrt

There I get an error:
gdal2tiles.py: error: This version of GDAL is not supported. Please upgrade to 1.6+.

I tried to patch this adding some optionnal parameters like  this:
gdal2tiles -v -rnear GTOPO30.vrt GTOPO30_tiled

Then I got the following error message:

Options: <Values at 0x9e5e68: {'profile': 'mercator', 'googlekey': 'INSERT_YOUR_
KEY_HERE', 'verbose': True, 'copyright': '', 'resume': False, 'url': '', 'kml':
False, 'webviewer': 'all', 'yahookey': 'INSERT_YOUR_YAHOO_APP_ID_HERE', 'zoom':
None, 'resampling': 'near', 'title': 'GTOPO30.vrt', 's_srs': None}>
Input: GTOPO30.vrt
Output: GTOPO30_tiled
Cache: 40 MB

Input file: ( 39359P x 25320L - 1 bands)
Preprocessed file: ( 39359P x 25320L - 1 bands)
Traceback (most recent call last):
  File "E:\perso\dev\3rdParty\FWTools2.3.1\bin\gdal2tiles.py", line 2136, in ?
    gdal2tiles.process()
  File "E:\perso\dev\3rdParty\FWTools2.3.1\bin\gdal2tiles.py", line 470, in proc
ess
    self.open_input()
  File "E:\perso\dev\3rdParty\FWTools2.3.1\bin\gdal2tiles.py", line 809, in open
_input
    self.alphaband = self.out_ds.GetRasterBand(1).GetMaskBand()
AttributeError: Band instance has no attribute 'GetMaskBand'

It seems my geotif still has just one band, maybe the second step failed (it took only a few seconds, compared to the first step which was very lengthy) ?

Thanks.

Regards,

Eric.


View message @ http://n2.nabble.com/mixed-datasets-%28imagery---elevation%29-tp2547376p2550858.html
To start a new topic under osgEarth, email [hidden email]
To unsubscribe from osgEarth, click here.

eric eric
Reply | Threaded
Open this post in threaded view
|

Re: mixed datasets (imagery & elevation)

Thank you Jason, that's much clear now...

However I still get a problem since the performances are really bad in osgEarth.

I generated the "big" SRTM with gdal_merge, with the following options:

gdal_merge -co "TILED=YES" -o GTOPO30.tif %infiles%

where infiles is the list of the source files to be used by gdal_merge.

Then I use gdalwarp:
gdalwarp -of vrt -t_srs epsg:900913 -wo SOURCE_EXTRA=120 -co "TILED=YES" GTOPO30.tif GTOPO30.vrt

Finally, I reference the GTOPO30.vrt in my "earth" file.

There is no more error at this step, but very poor performances...

Did I miss something in the process ?

Thanks in advance.

Regards,

Eric.
jasonbeverage jasonbeverage
Reply | Threaded
Open this post in threaded view
|

Re: mixed datasets (imagery & elevation)

Hey eric,

Almost there:). In the gdalwarp command, try warping to tif instead of a vrt so osgearth isn't doing the warping on the fly. Should be much faster

Jason

Sent from my iPhone

On Mar 29, 2009, at 12:54 PM, "eric (via Nabble) - No Reply" <[hidden email]> wrote:

Thank you Jason, that's much clear now...

However I still get a problem since the performances are really bad in osgEarth.

I generated the "big" SRTM with gdal_merge, with the following options:

gdal_merge -co "TILED=YES" -o GTOPO30.tif %infiles%

where infiles is the list of the source files to be used by gdal_merge.

Then I use gdalwarp:
gdalwarp -of vrt -t_srs epsg:900913 -wo SOURCE_EXTRA=120 -co "TILED=YES" GTOPO30.tif GTOPO30.vrt

Finally, I reference the GTOPO30.vrt in my "earth" file.

There is no more error at this step, but very poor performances...

Did I miss something in the process ?

Thanks in advance.

Regards,

Eric.



View message @ http://n2.nabble.com/mixed-datasets-%28imagery---elevation%29-tp2547376p2553200.html
To start a new topic under osgEarth, email [hidden email]
To unsubscribe from osgEarth, click here.

eric eric
Reply | Threaded
Open this post in threaded view
|

Re: mixed datasets (imagery & elevation)

Jason,

I warped to tif as you told be to, but performance is still very poor (about 5 minutes to initialize the viewer, then it runs very slowly)...

Moreover, I notice a shift between the google images & the elevation data.

Can I try something else to make it run faster ?

Thanks in advance.

Regards,

Eric.
jasonbeverage jasonbeverage
Reply | Threaded
Open this post in threaded view
|

Re: mixed datasets (imagery & elevation)

Can you do a gdalinfo on the file and post the results?  I've got that same dataset on an external harddrive and it runs great. 

One thing you also have to be sure of is to specify the tile size for the gdal driver to use. By default, it uses 256, change it to something like 16 or 32 is more reasonable

Jason

Sent from my iPhone

On Mar 29, 2009, at 6:07 PM, "eric (via Nabble) - No Reply" <[hidden email]> wrote:

Jason,

I warped to tif as you told be to, but performance is still very poor (about 5 minutes to initialize the viewer, then it runs very slowly)...

Moreover, I notice a shift between the google images & the elevation data.

Can I try something else to make it run faster ?

Thanks in advance.

Regards,

Eric.



View message @ http://n2.nabble.com/mixed-datasets-%28imagery---elevation%29-tp2547376p2554490.html
To start a new topic under osgEarth, email [hidden email]
To unsubscribe from osgEarth, click here.

Eric Eric
Reply | Threaded
Open this post in threaded view
|

Re: mixed datasets (imagery & elevation)

Hello Jason.

Thanks for the tip, it works fine now with a tile size of 32...

I still have a minor fix to do, since the skirt_ratio is not well tuned (it looks like the coast is a big cliff all over the world)...

I tried different values from 0 to 1, by I can't tune it to be realistic.

Do you have clues to set this parameter ?


Thanks in advance.

Regards,

Eric.