1 / 41

Toolkits for GeoScience Visualization

Toolkits for GeoScience Visualization. Dave Nadeau, John Moreland SDSC. Tools for custom visualization. Lots of great GeoVis tools out there What if you need something custom? Convert to/from a custom file format Analyze and filter data Custom visualization and interaction

york
Télécharger la présentation

Toolkits for GeoScience Visualization

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Toolkits forGeoScience Visualization Dave Nadeau, John Moreland SDSC

  2. Tools for custom visualization • Lots of great GeoVis tools out there • What if you need something custom? • Convert to/from a custom file format • Analyze and filter data • Custom visualization and interaction • Let’s look at some toolkits for building tools

  3. Tools for custom visualization • Java Image I/O • GeoTIFF • Java OpenGL • GeoTools • WorldWind • NetCDF

  4. Java Image I/O • Sun Java toolkit for image file read/write • Many formats • BMP, GIF, PNG, JPEG, JPEG2000, TIFF • Also use advanced imaging toolkit for filtering • Standard part of Java http://java.sun.com/

  5. Java Image I/O example • Get an image reader: ImageInputStream stream = ImageIO.createImageInputStream(file); Iterator<ImageReader> it = ImageIO.getImageReaders(stream); ImageReader reader = it.next(); reader.setInput(stream);

  6. Java Image I/O example • Read the image: • Display the image: BufferedImage image = reader.read(0); ImageIcon icon = new ImageIcon(image); Jlabel label = new Jlabel(icon); frame.add(label,BorderLayout.CENTER);

  7. Java Image I/O example

  8. GeoTIFF • TIFF image format with Geo tags • Coordinate space, position, extent • Readable by TIFF tools (Java Image I/O) • GeoTIFF metadata adapter understands tags • Open Source http://remotesensing.org/geotiff/ http://gelbin.org/code/

  9. GeoTIFF example • Get a TIFF image reader (same!): ImageInputStream stream = ImageIO.createImageInputStream(file); Iterator<ImageReader> it = ImageIO.getImageReaders(stream); ImageReader reader = it.next(); reader.setInput(stream);

  10. GeoTIFF example • Read the image (same!): : • Display the image (same!): : BufferedImage image = reader.read(0); ImageIcon icon = new ImageIcon(image); Jlabel label = new Jlabel(icon); frame.add(label,BorderLayout.CENTER);

  11. GeoTIFF example • Get the GeoTIFF metadata: IIOMetadata meta = reader.getImageMetadata(0); GeoTiffIIOMetadataAdapter ameta = new GeoTiffIIOMetadataAdapter(meta); String value = ameta.getGeoKey(key);

  12. Available keys: GTModelTypeGeoKey GTRasterTypeGeoKey GTCitationGeoKey GeographicTypeGeoKey GeogCitationGeoKey GeogGeodeticDatumGeoKey GeogPrimeMeridianGeoKey GeogPrimeMeridianLongGeoKey GeogLinearUnitsGeoKey GeogLinearUnitSizeGeoKey GeogAngularUnitsGeoKey GeogAngularUnitsSizeGeoKey GeogEllipsoidGeoKey GeogSemiMajorAxisGeoKey GeogSemiMinorAxisGeoKey GeogInvFlatteningGeoKey GeogAzimuthUnitsGeoKey ProjCenterLongGeoKey ProjCenterLatGeoKey ProjCenterEastingGeoKey ProjCenterNorthingGeoKey ProjScaleAtNatOriginGeoKey ProjScaleAtCenterGeoKey ProjAzimuthAngleGeoKey ProjStraightVertPoleLongGeoKey VerticalCSTypeGeoKey VerticalCitationGeoKey VerticalDatumGeoKey VerticalUnitsGeoKey GeoTIFF example • ProjectedCSTypeGeoKey • PCSCitationGeoKey • ProjectionGeoKey • ProjCoordTransGeoKey • ProjLinearUnitsGeoKey • ProjLinearUnitSizeGeoKey • ProjStdParallel1GeoKey • ProjStdParallel2GeoKey • ProjNatOriginLongGeoKey • ProjNatOriginLatGeoKey • ProjFalseEastingGeoKey • ProjFalseNorthingGeoKey • ProjFalseOriginLongGeoKey • ProjFalseOriginLatGeoKey • ProjFalseOriginEastingGeoKey • ProjFalseOriginNorthingGeoKey

  13. GeoTIFF example

  14. Java OpenGL (JOGL) • Sun Java toolkit for OpenGL 3D drawing • Uses native OpenGL to 3D graphics hardware • Integrates with rest of Java toolkit • Not part of Java distribution, but easily added https://jogl.dev.java.net/

  15. Java OpenGL (JOGL) • Draw points, lines, polygons • Control point & line size, line patterns, polygon fill, color, texture • Control 3D lighting • All done at hardware speeds

  16. JOGL example: polygons • Set a drawing color: • Draw a polygon: gl.glColor3f(r,g,b); gl.glBegin(GL.GL_POLYGON); gl.glVertex3f(x,y,z); ... gl.glEnd();

  17. JOGL example: polygons

  18. JOGL example: images • Create texture from graphics context: • Draw shape using texture: Texture tex= TextureIO.newTexture(file,false); gl.glEnable(GL.GL_TEXTURE_2D); tex.bind(); tex.enable(); gl.glTexCoord2f(s,t); gl.glVertex3f(x,y,z);

  19. JOGL example: images

  20. GeoTools • Toolkit implementing OGC GeoAPI • Read/write many file formats • Features, images, geometry, coord spaces • WMS, WFS • Open source http://geotools.codehaus.org/

  21. GeoTools example: Shapefile • Create a data store to read a file: • Get the first feature source: DataStore dataStore = FileDataStoreFinder.getDataStore(url); String[] names = dataStore.getTypeNames(); FeatureSource source = dataStore.getFeatureSource(names[0]);

  22. GeoTools example: Shapefile • Create a map context: • Add feature source to context: CoordinateReferenceSystem crs = CRS.decode(“EPSG:4326”); DefaultMapContext context = new DefaultMapContext(crs); context.addLayer(source,new BasicLineStyle());

  23. GeoTools example: Shapefile • Draw the map context: MapContextPanel panel = new MapContextPanel(); panel.setContext(context); frame.add(panel,BorderLayout.CENTER);

  24. GeoTools example: Shapefile

  25. NetCDF Network Common Data Form File format & toolkit to read/write multidimensional data (eg: Volumes) Support for many programming languages (such as Java) University Corporation for Atmospheric Research (UCAR) / UNAVCO http://www.unidata.ucar.edu/software/netcdf/

  26. NetCDF Variables hold multidimensional data values char, byte, short, int, float, double Attributes hold meta-data Units, names, scale factors, etc. Attributes can be global or associated with each variable

  27. NetCDF example Open a NetCDF file: Get data variables: NetcdfFile ncfile = NetcdfFile.open(file); List variables = ncfile.getVariables(); Variable var = (Variable)variables.get(i); Array array = var.read();

  28. NetCDF example Get variable dimensions: Get voxels: int rank = var.getRank(); int[] shape = array.getShape(); double voxel = ((ArrayDouble.D3)array).get(i,j,k);

  29. NetCDF example Get global or variable attributes: Get attribute type and value: List glist = ncfile.getGlobalAttributes(); List vlist = var.getAttributes(); Attribute attrib = vlist.get(i); DataType type = attrib.getDataType(); Number num = attrib.getNumericValue(i); String str = attrib.getStringValue(i);

  30. NetCDF example Build an image: BufferedImage image = new BufferedImage(w,h); int gray = (int)(voxel * 255); int rgba = (gray<<24) | (gray<<16) ...; image.setRGB(row,col,rgba);

  31. NetCDF example

  32. NASA World Wind (NWW) “Open-Source Google Earth” Toolkit (modular library for building applications) Versions for .NET (Windows) and Java (Mac, Windows, UNIX) Tiled Terrain and Images, WMS, Plug-in Layers, 3D Rendering (JOGL) NASA / ARC (Ames Research Center) http://worldwind.arc.nasa.gov/

  33. Create a canvas: Set a data model: Add canvas to your application interface: NWW HelloWorldWind example WorldWindGLCanvas c = new WorldWindGLCanvas(); c.setModel( new BasicModel() ); frame.add( c );

  34. NWW HelloWorldWind output

  35. Create a surface image: Make it semi-transparent: Add the image to a renderable layer: NWW LayerDemo example SurfaceImage si = new SurfaceImage( “Map.png”, Sector.fromDegrees(35, 45, -115, -95) ); si.setOpacity( 0.7 ); RenderableLayer rl = new RenderableLayer(); rl.addRenderable( si );

  36. Get the LayerList from the model: Add our image layer: NWW LayerDemo example LayerList layers = model.getLayers( ); layers.add( layers.size(), rl );

  37. NWW LayerDemo output

  38. Create a WMS Layer: Get the LayerList from the model: Add the WMS layer: NWW WmsDemo example OpenStreetMapLayer os=newOpenStreetMapLayer(); LayerList layers = model.getLayers( ); layers.add( layers.size(), os );

  39. NWW WmsDemo output

  40. Conclusions • Lot’s of good Java toolkits available… • Image I/O Sun Java Image I/O • Image filtering Sun Java Advanced Imaging • GeoTIFF GeoTools, WorldWind, GeoTIFF adapter • Movie I/O Sun Java Media Framework • Shapefile I/O GeoTools • Volume I/O NetCDF, HDF • Metadata Sun Java Metadata Interface • GUIs Sun JDK, SwingX • 3D Sun JOGL, Sun Java3D • Projections GeoTools, SRI GeoTransform • GML, WFS GeoTools • WMS GeoTools, WorldWind • Net protocols Sun JDK, Apache Commons net, Apache HTTP components • Web protocols Sun Metro, Apache Web Services • … lots more …

  41. Open Earth Framework • Services architecture • Server-side data management, filtering, pre-processing • Client-side presentation, interaction • Java toolkit • Integrates other toolkits • Adds missing GeoVis functionality • In development…

More Related