![]() |
|
|||||||
| Development Help Help for building applications or diagnosing problems with WWJ |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Sep 2009
Posts: 7
![]() |
Hi forum !
I have some problems regarding a DEM data source. My source is a Mapserver instance serving Geotiff Float32 files. I modified EarthMergedElevationModel.xml like this : Code:
<?xml version="1.0" encoding="UTF-8"?>
<ElevationModel version="1" modelType="Compound">
<ElevationModel version="1">
<DisplayName>Earth Elevation Model</DisplayName>
<Service serviceName="OGC:WMS" version="1.3">
<GetCapabilitiesURL>http://www.nasa.network.com/elev</GetCapabilitiesURL>
<GetMapURL>http://www.nasa.network.com/elev</GetMapURL>
<LayerNames>mergedSrtm</LayerNames>
</Service>
<RetrievePropertiesFromService>true</RetrievePropertiesFromService>
<LastUpdate>1241377491917</LastUpdate>
<DataCacheName>Earth/mergedSRTMV1</DataCacheName>
<ImageFormat>image/bil</ImageFormat>
<FormatSuffix>.bil</FormatSuffix>
<NumLevels count="10" numEmpty="0"/>
<TileOrigin>
<LatLon units="degrees" latitude="-90" longitude="-180"/>
</TileOrigin>
<LevelZeroTileDelta>
<LatLon units="degrees" latitude="20" longitude="20"/>
</LevelZeroTileDelta>
<TileSize>
<Dimension width="150" height="150"/>
</TileSize>
<Sector>
<SouthWest>
<LatLon units="degrees" latitude="-90" longitude="-180"/>
</SouthWest>
<NorthEast>
<LatLon units="degrees" latitude="90" longitude="180"/>
</NorthEast>
</Sector>
<SectorResolutionLimit maxLevelNum="9">
<Sector>
<SouthWest>
<LatLon units="degrees" latitude="24" longitude="-125"/>
</SouthWest>
<NorthEast>
<LatLon units="degrees" latitude="50" longitude="-66.8"/>
</NorthEast>
</Sector>
</SectorResolutionLimit>
<SectorResolutionLimit maxLevelNum="9">
<Sector>
<SouthWest>
<LatLon units="degrees" latitude="18.5" longitude="-160.5"/>
</SouthWest>
<NorthEast>
<LatLon units="degrees" latitude="22.5" longitude="-154.5"/>
</NorthEast>
</Sector>
</SectorResolutionLimit>
<SectorResolutionLimit maxLevelNum="9">
<Sector>
<SouthWest>
<LatLon units="degrees" latitude="17.8" longitude="-67.4"/>
</SouthWest>
<NorthEast>
<LatLon units="degrees" latitude="18.7" longitude="-64.5"/>
</NorthEast>
</Sector>
</SectorResolutionLimit>
<SectorResolutionLimit maxLevelNum="9">
<Sector>
<SouthWest>
<LatLon units="degrees" latitude="48" longitude="-179.9"/>
</SouthWest>
<NorthEast>
<LatLon units="degrees" latitude="66" longitude="-128"/>
</NorthEast>
</Sector>
</SectorResolutionLimit>
<SectorResolutionLimit maxLevelNum="8">
<Sector>
<SouthWest>
<LatLon units="degrees" latitude="-54" longitude="-180"/>
</SouthWest>
<NorthEast>
<LatLon units="degrees" latitude="60" longitude="180"/>
</NorthEast>
</Sector>
</SectorResolutionLimit>
<SectorResolutionLimit maxLevelNum="4">
<Sector>
<SouthWest>
<LatLon units="degrees" latitude="-90" longitude="-180"/>
</SouthWest>
<NorthEast>
<LatLon units="degrees" latitude="90" longitude="180"/>
</NorthEast>
</Sector>
</SectorResolutionLimit>
</ElevationModel>
<ElevationModel version="1">
<DisplayName>Earth Elevation Model</DisplayName>
<Service serviceName="OGC:WMS" version="1.3">
<GetCapabilitiesURL>http://isdas-vm-bea-5/cgi/bin/mapserv.exe?MAP=F:/test_bea/bathy/MAP.map&</GetCapabilitiesURL>
<GetMapURL>http://isdas-vm-bea-5/cgi/bin/mapserv.exe?MAP=F:/test_bea/bathy/MAP.map&</GetMapURL>
<LayerNames>bathy_wgs84</LayerNames>
</Service>
<RetrievePropertiesFromService>true</RetrievePropertiesFromService>
<LastUpdate>1241377491917</LastUpdate>
<DataCacheName>Earth/bathy_wgs84</DataCacheName>
<ImageFormat>image/tiff</ImageFormat>
<DataType byteOrder="LittleEndian" type="Int16" />
<ExtremeElevations min="500" max="600" />
<FormatSuffix>.bil</FormatSuffix>
<MissingData signal="0" replacement="0" />
<NumLevels count="15" numEmpty="0"/>
<TileOrigin>
<LatLon units="degrees" latitude="43" longitude="5.5"/>
</TileOrigin>
<LevelZeroTileDelta>
<LatLon units="degrees" latitude="0.00303762424" longitude="0.00303762424"/>
</LevelZeroTileDelta>
<TileSize>
<Dimension width="512" height="512"/>
</TileSize>
<Sector>
<SouthWest>
<LatLon units="degrees" latitude="43.1745" longitude="5.625"/>
</SouthWest>
<NorthEast>
<LatLon units="degrees" latitude="43.1766" longitude="5.635"/>
</NorthEast>
</Sector>
<SectorResolutionLimit maxLevelNum="14">
<Sector>
<SouthWest>
<LatLon units="degrees" latitude="43.1745" longitude="5.625"/>
</SouthWest>
<NorthEast>
<LatLon units="degrees" latitude="43.1766" longitude="5.635"/>
</NorthEast>
</Sector>
</SectorResolutionLimit>
</ElevationModel>
</ElevationModel>
Code:
#This Map Was Generated By Isdas do not modifie #Generaded : 10/5/2009 1:50:40 PM MAP Name "test_bathy" CONFIG "PROJ_LIB" "c:\inetpub\wwwroot\cgi\proj_lib\" EXTENT 5.625419 43.174280 5.633779 43.176772 SIZE 512 512 IMAGETYPE PNG24 IMAGECOLOR 255 255 255 UNITS METERS OUTPUTFORMAT NAME PNG24 DRIVER "GD/PNG" MIMETYPE "image/png" EXTENSION PNG IMAGEMODE RGBA TRANSPARENT ON END OUTPUTFORMAT NAME GTiff DRIVER "GDAL/GTiff" MIMETYPE "image/tiff" IMAGEMODE FLOAT32 EXTENSION "tif" #FORMATOPTION "TILED=YES" #FORMATOPTION "BLOCKXSIZE=512" #FORMATOPTION "BLOCKYSIZE=512" END PROJECTION "init=epsg:4326" END WEB IMAGEPATH "f:\ms_tmp\" IMAGEURL "http://ISDAS-VM-BEA-5/ms_tmp" METADATA "wms_server_version" "1.1.1" "wms_format" "image/png" "ows_schemas_location" "http://ISDAS-VM-BEA-5/webgdaroot/ogc/" "wms_exceptions_format" "application/vnd.ogc.se_xml" "wms_title" "2009-10-05_095903" "wms_srs" "epsg:4326 epsg:32631" "wms_onlineresource" "http://isdas-vm-bea-5/cgi/bin/mapserv.exe?SERVICE=WMS&VERSION=1.1.1&MAP=F:/test_bea/bathy/MAP.map&" END END LAYER NAME "bathy_wgs84" STATUS ON TILEINDEX "F:/test_bea/bathy/bathy_wgs84.shp" TILEITEM "location" TYPE RASTER UNITS METERS METADATA "wms_title" "bathy_wgs84" "wms_srs" "epsg:32631 epsg:4326" "wms_onlineresource" "http://isdas-vm-bea-5/cgi/bin/mapserv.exe?SERVICE=WMS&VERSION=1.1.1&MAP=F:/test_bea/bathy/MAP.map&" END PROJECTION "init=epsg:4326" END END #~~~ END The resquests generated by Worldwind are correct and the files returned by Mapserver are good... My first problem is that Worldwind did not seem to read correctly the file ; why ? because I first tried with Byte layer and it was working ! ![]() I looked into the bil files and found that some had some data but most were empty (all pixels to the same value). Files having data were looking "strange" as if the source image was cropped. I then modified BasicElevationModel.java like this : Code:
protected static ByteBuffer convertImageToElevations(ByteBuffer buffer, String contentType) throws IOException
{
File tempFile = File.createTempFile("wwj-", WWIO.makeSuffixForMimeType(contentType));
try
{
WWIO.saveBuffer(buffer, tempFile);
BufferedImage image = ImageIO.read(tempFile);
ByteBuffer byteBuffer = BufferUtil.newByteBuffer(image.getWidth() * image.getHeight() * 2);
byteBuffer.order(java.nio.ByteOrder.LITTLE_ENDIAN);
ShortBuffer bilBuffer = byteBuffer.asShortBuffer();
WritableRaster raster = image.getRaster();
boolean atleastone = false;
int minX = 9999;
int minY = 9999;
int maxX = -1;
int maxY = -1;
int height = image.getHeight();
int width = image.getWidth();
for(int y = 0; y < height; y++)
{
for(int x = 0; x < width; x++)
{
int b = 0;
float val = raster.getSampleFloat(x, y, b);
if(val != 0) {
minX = Math.min(minX, x);
minY = Math.min(minY, y);
maxX = Math.max(maxX, x);
maxY = Math.max(maxY, y);
}
if( (val > -32000)&&(val < 32000) )
{
bilBuffer.put((short) val);
if(val != 0)
atleastone = true;
}
else
{
bilBuffer.put((short)0);
}
}
}
if(atleastone == true)
{
Logging.logger().log(java.util.logging.Level.INFO, "" + minX + " " + minY + " " + maxX + " " + maxY);
copyFiles(tempFile.getPath(), tempFile.getPath() + "_.tif");
}
return byteBuffer;
}
finally
{
if (tempFile != null)
//noinspection ResultOfMethodCallIgnored
tempFile.delete();
}
}
![]() My second problem is that I want to have decimal values in the Z axis. I tried to put Float32 as my layer's datatype, and modify the above function in order to create a bil32 file but I had no chance to make it work. I suppose that I'm doing the complet wrong method for both of my problems but now I'm stucked... ![]() Please hhhheeeellllppppp ! I can provide source pictures, downloaded pictures, bil pictures, everything ! Thanks in advance for any suggestion... ![]() |
|
|
|
|
|
#2 |
|
Worldwind Developer
Join Date: Jan 2006
Location: Hobart, Australia
Posts: 754
![]() |
Here is your problem :
ShortBuffer bilBuffer = byteBuffer.asShortBuffer(); The Float32 buffer is being interpreted as short i.e. int16 and only part of your data will be read. The behaviour is unpredictable. You can look at the configuration options I have mentioned in this thread instead of doing any modification to the code. I will keep an eye on how things work out for you. Cheers, what_nick.
__________________
Coding This and That in World Wind and helping new people out, as long as they don't pester too much. Currently blogging at: http://whatnicklife.blogspot.com Working at: Aerometrex - http://aerometrex.com.au/blog/ Impact so far: ![]() |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Sep 2009
Posts: 7
![]() |
Thanks for your message, what_nick.
I've tried what you've written in your own thread and I'm getting exceptions. Code:
<DataType byteOrder="BigEngian" type="Float32" /> <MissingData signal="0"/> Code:
Oct 16, 2009 5:16:56 PM gov.nasa.worldwind.WorldWindowGLAutoDrawable display SEVERE: Exception while attempting to repaint WorldWindow java.lang.IndexOutOfBoundsException: 254028 at java.nio.ByteBufferAsFloatBufferB.get(Unknown Source) at gov.nasa.worldwind.util.BufferWrapper$FloatBufferWrapper.getDouble(BufferWrapper.java:738) at gov.nasa.worldwind.terrain.BasicElevationModel.lookupElevation(BasicElevationModel.java:1168) at gov.nasa.worldwind.terrain.BasicElevationModel.getUnmappedElevation(BasicElevationModel.java:1072) at gov.nasa.worldwind.terrain.CompoundElevationModel.getUnmappedElevation(CompoundElevationModel.java:310) at gov.nasa.worldwind.terrain.AbstractElevationModel.getElevation(AbstractElevationModel.java:121) at gov.nasa.worldwind.globes.EllipsoidalGlobe.getElevation(EllipsoidalGlobe.java:376) at gov.nasa.worldwind.geom.Sector.computeCornerPoints(Sector.java:545) at gov.nasa.worldwind.terrain.RectangularTessellator.needToSplit(RectangularTessellator.java:400) at gov.nasa.worldwind.terrain.RectangularTessellator.selectVisibleTiles(RectangularTessellator.java:383) at gov.nasa.worldwind.terrain.RectangularTessellator.selectVisibleTiles(RectangularTessellator.java:389) at gov.nasa.worldwind.terrain.RectangularTessellator.selectVisibleTiles(RectangularTessellator.java:389) at gov.nasa.worldwind.terrain.RectangularTessellator.selectVisibleTiles(RectangularTessellator.java:389) at gov.nasa.worldwind.terrain.RectangularTessellator.selectVisibleTiles(RectangularTessellator.java:389) at gov.nasa.worldwind.terrain.RectangularTessellator.selectVisibleTiles(RectangularTessellator.java:389) at gov.nasa.worldwind.terrain.RectangularTessellator.selectVisibleTiles(RectangularTessellator.java:389) at gov.nasa.worldwind.terrain.RectangularTessellator.selectVisibleTiles(RectangularTessellator.java:389) at gov.nasa.worldwind.terrain.RectangularTessellator.selectVisibleTiles(RectangularTessellator.java:389) at gov.nasa.worldwind.terrain.RectangularTessellator.selectVisibleTiles(RectangularTessellator.java:389) at gov.nasa.worldwind.terrain.RectangularTessellator.selectVisibleTiles(RectangularTessellator.java:389) at gov.nasa.worldwind.terrain.RectangularTessellator.selectVisibleTiles(RectangularTessellator.java:389) at gov.nasa.worldwind.terrain.RectangularTessellator.selectVisibleTiles(RectangularTessellator.java:389) at gov.nasa.worldwind.terrain.RectangularTessellator.selectVisibleTiles(RectangularTessellator.java:389) at gov.nasa.worldwind.terrain.RectangularTessellator.tessellate(RectangularTessellator.java:312) at gov.nasa.worldwind.globes.EllipsoidalGlobe.tessellate(EllipsoidalGlobe.java:740) at gov.nasa.worldwind.AbstractSceneController.createTerrain(AbstractSceneController.java:339) at gov.nasa.worldwind.BasicSceneController.doRepaint(BasicSceneController.java:24) at gov.nasa.worldwind.AbstractSceneController.repaint(AbstractSceneController.java:210) at gov.nasa.worldwind.WorldWindowGLAutoDrawable.doDisplay(WorldWindowGLAutoDrawable.java:304) at gov.nasa.worldwind.WorldWindowGLAutoDrawable.display(WorldWindowGLAutoDrawable.java:231) at com.sun.opengl.impl.GLDrawableHelper.display(GLDrawableHelper.java:78) at javax.media.opengl.GLCanvas$DisplayAction.run(GLCanvas.java:435) at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:194) at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:412) at javax.media.opengl.GLCanvas.display(GLCanvas.java:244) at javax.media.opengl.GLCanvas.paint(GLCanvas.java:277) at javax.media.opengl.GLCanvas.update(GLCanvas.java:354) at sun.awt.RepaintArea.updateComponent(Unknown Source) at sun.awt.RepaintArea.paint(Unknown Source) at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Will be back as soon as possible. Benoît |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Sep 2009
Posts: 7
![]() |
Ok, I made it "work". Not perfect but better.
What I did : - change my Mapserver MAP file to allow download of bil files in float32 Code:
OUTPUTFORMAT NAME HDR DRIVER "GDAL/EHdr" MIMETYPE "application/bil32" IMAGEMODE FLOAT32 EXTENSION "bil" END Code:
<DataType byteOrder="LittleEndian" type="Float32" /> <MissingData signal="0" replacement="0" /> - a thousand of exceptions per second as I zoom on my layer Code:
Oct 16, 2009 6:01:56 PM gov.nasa.worldwind.util.BufferWrapper$FloatBufferWrapper getDouble - huge slow down when zooming on my layer (maybe the exceptions ?) Will come next week ! Have a nice weekend ! Benoît |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Oct 2009
Posts: 3
![]() |
Hi,
I am able to serve Lidar DEMs via Mapserver but I can't zoom more than 14 levels: Code:
OUTPUTFORMAT NAME 'bil' DRIVER GDAL/EHdr IMAGEMODE FLOAT32 MIMETYPE "image/bil" # FORMATOPTION "COMPRESSED_OUTPUT=TRUE" END Code:
<ElevationModel version="1">
<DisplayName>Lidar</DisplayName>
<Service serviceName="OGC:WMS" version="1.3">
<GetCapabilitiesURL>http://192.168.178.68/cgi-bin/mapserv?map=C:\ms4w\apps\mapfiles\srtm\srtm3_lidar.map</GetCapabilitiesURL>
<GetMapURL>http://192.168.178.68/cgi-bin/mapserv?map=C:\ms4w\apps\mapfiles\srtm\srtm3_lidar.map</GetMapURL>
<LayerNames>lidar</LayerNames>
</Service>
<LastUpdate>1245969932910</LastUpdate>
<DataCacheName>Earth/Lidar</DataCacheName>
<ImageFormat>image/bil</ImageFormat>
<DataType type="Float32" byteOrder="LittleEndian"/>
<FormatSuffix>.bil</FormatSuffix>
<ExtremeElevations min="-100" max="500">
<FileName>config/SRTM30Plus_ExtremeElevations_5.bil</FileName>
</ExtremeElevations>
<DataDetailHint>0.30</DataDetailHint>
<NumLevels count="20" numEmpty="0"/>
<MissingData signal="-9999"/>
<TileOrigin>
<LatLon units="degrees" latitude="-90" longitude="-180"/>
</TileOrigin>
<LevelZeroTileDelta>
<LatLon units="degrees" latitude="20" longitude="20"/>
</LevelZeroTileDelta>
<TileSize>
<Dimension width="150" height="150"/>
</TileSize>
<Sector>
<SouthWest>
<LatLon units="degrees" latitude="52.48" longitude="12.76"/>
</SouthWest>
<NorthEast>
<LatLon units="degrees" latitude="52.7" longitude="13.4"/>
</NorthEast>
</Sector>
<SectorResolutionLimit maxLevelNum="19">
<Sector>
<SouthWest>
<LatLon units="degrees" latitude="52.48" longitude="12.76"/>
</SouthWest>
<NorthEast>
<LatLon units="degrees" latitude="52.7" longitude="13.4"/>
</NorthEast>
</Sector>
</SectorResolutionLimit>
</ElevationModel>
This works fine - as long as NumLevels are "14" or smaller. If I raise NumLevels to "20" and SectorResolutionLimit maxLevelNum to "19" (what is necessary for my 5 cm Lidar Data) it seams to have no effect. I don't get any error messages. WWJ downloads and caches tiles from level 0 till level 13 but not further. Any ideas why it is not possible to go beyond level 13 ?? Thanks a lot !! kaipi |
|
|
|
|
|
#6 |
|
Member
Join Date: Jun 2008
Location: Ljubljana, Slovenia
Posts: 51
![]() |
Try increasing the maxLevel variable of the Tessellator implementation you are using (e.g. simply by increasing the corresponding DEFAULT_MAX_LEVEL constant). IIRC it needs to be at least 18 for DEM level 14.
|
|
|
|
|
|
#7 |
|
Administrator
Join Date: May 2006
Location: Seattle
Posts: 250
![]() |
The limit is enforced by a RectangularTessellatorMaxLevel property in the config/worldwind.xml file.
<Property name="gov.nasa.worldwind.avkey.Rectangul arTessellatorMaxLevel" value="17"/> The limit 17 (for imagery layers) corresponds to 13 for elevation layers (depends on <LevelZeroTileDelta/> and number of empty levels). So , if you want to go to level 17 of elevations, you need to set RectangularTessellatorMaxLevel to 21. ALso, you *may* need to add the <DataDetailHint> to the Elevation model XML file. <DataDetailHint>0.30</DataDetailHint> <DataType type="Float32" byteOrder="LittleEndian"/> <FormatSuffix>.bil</FormatSuffix> However, I'm not sure how long WWJ team will keep <DataDetailHint> supported, it may go away soon. With these modifications you may face a significant performance slow down. And you elevation tile cache may overflow. If you will press Ctrl+Alt+LeftSHIFT AND click mouse inside WWJ view window, you will get a WWJ Dashboard popup. In the Perfrormance section you will see "Cache Szie (Kb): Elevation Tiles" - if you see it gets to maximum, and than drops, and immediatelly gets back to maximum (you may see weird artefacts on the screen), in this case you will need to increase the size of the elevation tile cache in the config/worldwind.xml file <Property name="gov.nasa.worldwind.avkey.Elevation TileCacheSize" value="10000000"/> |
|
|
|
|
|
#8 | |
|
Junior Member
Join Date: Oct 2009
Posts: 3
![]() |
Quote:
|
|
|
|
|
|
|
#9 |
|
Administrator
Join Date: May 2006
Location: Seattle
Posts: 250
![]() |
Excellent!
Can you post some screenshots? I would love to see the 15 cm elevation resolution.... |
|
|
|
|
|
#10 | |
|
Junior Member
Join Date: Oct 2009
Posts: 3
![]() |
Quote:
Thanks, kaipi |
|
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SQUID configuration to cache WMS server responses | garakl | Server Discussion | 1 | 08-08-2011 02:16 PM |
| WMS Layer for the online ArcGIS WMS | jgib | Development Help | 1 | 03-25-2010 09:52 AM |
| Relief overlay of WMS data. | globpat | WorldWind General | 2 | 07-03-2007 08:47 PM |
| WMS Browser Problem | armin | Technical Support | 1 | 03-20-2007 04:41 PM |