| previous
next
contents |
![]() |
GeoVRML 1.1 Specification |
![]() |
This sections contains a number of VRML examples that use the GeoVRML nodes described in the Nodes section. N.B. in order to browse these examples in a VRML browser, you will require the GeoVRML run-time to be installed on your machine. Please refer to the Sample Implementation section for details. The following table provides a summary of the examples presented below.
Example A.1 GeoElevation example A.2 Animated GeoViewpoint A.3 On demand inlining A.4 Georeferencing VRML object A.5 Using a GeoOrigin
This example shows the use of the GeoElevationGrid and the GeoViewpoint nodes. We supply an 18 degree resolution grid of height values that are georeferenced to the latitude/longitude grid. These are then transparently transformed into a round-earth (geocentric) representation and then passed to the VRML renderer. In this example, we exaggerate the height values by a factor of 200 so that these are perceptible. Even at this coarse scale, the Himalaya are evident as a large protrusion. We specify a GeoViewpoint node to provide a good initial view of the world. It is located 10,000 km above the ellipsoid, looking directly down at the location 35 deg north by 70 deg east.
URL: http://www.geovrml.org/1.1/doc/examples/exagearth.wrl
#VRML V2.0 utf8
EXTERNPROTO GeoElevationGrid [
exposedField SFNode color
exposedField SFNode texCoord
exposedField SFNode normal
field SFBool ccw
field SFBool colorPerVertex
field SFFloat creaseAngle
field SFNode geoOrigin
field MFString geoSystem
field SFString geoGridOrigin
field MFFloat height
field SFBool normalPerVertex
field SFBool solid
field SFInt32 xDimension
field SFString xSpacing
field SFFloat yScale
field SFInt32 zDimension
field SFString zSpacing
] [ "urn:web3d.org:vrml97:node:GeoElevationGrid"
"file:///C:/Program%20Files/GeoVRML/1.1/protos/GeoElevationGrid.wrl"
"http://www.geovrml.org/1.1/protos/GeoElevationGrid.wrl" ]
EXTERNPROTO GeoViewpoint [
eventIn SFBool set_bind
eventIn SFString set_position
eventIn SFString set_orientation
exposedField SFFloat fieldOfView
exposedField SFBool headlight
exposedField SFBool jump
exposedField MFString navType
field SFString description
field SFNode geoOrigin
field MFString geoSystem
field SFString position
field SFRotation orientation
field SFFloat speedFactor
eventOut SFTime bindTime
eventOut SFBool isBound
] [ "urn:web3d.org:vrml97:node:GeoViewpoint"
"file:///C:/Program%20Files/GeoVRML/1.1/protos/GeoViewpoint.wrl"
"http://www.geovrml.org/1.1/protos/GeoViewpoint.wrl" ]
Group {
children [
Background {
skyAngle [ ]
skyColor [ 0.1 0.1 0.8 ]
}
GeoViewpoint {
geoSystem [ "GD" ]
position "35.0 70.0 30000000"
orientation 1 0 0 -1.57
description "Initial GeoViewpoint"
}
Shape {
appearance Appearance {
material Material { diffuseColor 0.3 1.0 0.3 }
}
geometry GeoElevationGrid {
geoSystem [ "GD" ]
geoGridOrigin "-90 -180 0"
xDimension 21
zDimension 11
xSpacing "18"
zSpacing "18"
yScale 200
height [
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 3135 2976 2529 2135 3449 2899 3190 2375 0
0 3086 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 25 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 142 792 0 0 0 969 0 0 0 0 0 495 276 0
0 0 0 0 0 0 320 46 60 0 0 0 588 0 0 0 0 0 0 34 0
0 0 0 0 0 0 0 0 0 0 301 601 837 627 0 880 0 0 0 0 0
0 0 0 0 202 1 0 0 0 0 1241 385 6 582 468 215 5201 529 0 0 0
0 0 0 0 1304 427 365 374 0 0 0 1977 345 22 132 325 2072 1256 171 0 0
0 0 706 1896 464 134 0 0 2563 0 0 0 143 11 784 88 498 307 108 1707 0
0 0 0 0 0 0 600 378 1378 339 0 0 0 0 0 0 0 0 0 0 0
]
}
}
]
}
A.2 Animated GeoViewpoint
This example illustrates how to animate the camera with a GeoViewpoint node. We display a flat model of the earth using a GeoElevationGrid node and then set up a GeoPositionInterpolator to interpolate between the latitude/longitude locations for London, Paris, and New York. The output of the interpolator is routed into the GeoViewpoint and the result is an animated viewpoint that smoothly pans between all three cities.
URL: http://www.geovrml.org/1.1/doc/examples/viewanim.wrl
#VRML V2.0 utf8
EXTERNPROTO GeoViewpoint [
eventIn SFBool set_bind
eventIn SFString set_position
eventIn SFString set_orientation
exposedField SFFloat fieldOfView
exposedField SFBool headlight
exposedField SFBool jump
exposedField MFString navType
field SFString description
field SFNode geoOrigin
field MFString geoSystem
field SFString position
field SFRotation orientation
field SFFloat speedFactor
eventOut SFTime bindTime
eventOut SFBool isBound
] [ "urn:web3d.org:vrml97:node:GeoViewpoint"
"file:///C:/Program%20Files/GeoVRML/1.1/protos/GeoViewpoint.wrl"
"http://www.geovrml.org/1.1/protos/GeoViewpoint.wrl" ]
EXTERNPROTO GeoPositionInterpolator [
eventIn SFFloat set_fraction
field SFNode geoOrigin
field MFString geoSystem
field MFFloat key
field MFString keyValue
eventOut SFVec3f value_changed
eventOut SFString geovalue_changed
] [ "urn:web3d.org:vrml97:node:GeoPositionInterpolator"
"file:///C:/Program%20Files/GeoVRML/1.1/protos/GeoPositionInterpolator.wrl"
"http://www.geovrml.org/1.1/protos/GeoPositionInterpolator.wrl" ]
EXTERNPROTO GeoElevationGrid [
exposedField SFNode color
exposedField SFNode texCoord
exposedField SFNode normal
field SFBool ccw
field SFBool colorPerVertex
field SFFloat creaseAngle
field SFNode geoOrigin
field MFString geoSystem
field SFString geoGridOrigin
field MFFloat height
field SFBool normalPerVertex
field SFBool solid
field SFInt32 xDimension
field SFString xSpacing
field SFFloat yScale
field SFInt32 zDimension
field SFString zSpacing
] [ "urn:web3d.org:vrml97:node:GeoElevationGrid"
"file:///C:/Program%20Files/GeoVRML/1.1/protos/GeoElevationGrid.wrl"
"http://www.geovrml.org/1.1/protos/GeoElevationGrid.wrl" ]
Group {
children [
DEF V GeoViewpoint {
geoSystem [ "GD" ]
orientation 1 0 0 -1.57
position "51.5122 -0.065 10000000"
description "Animating GeoViewpoint"
}
Shape {
appearance Appearance {
material Material { diffuseColor 0.8 1.0 0.3 }
texture ImageTexture {
url "http://www.geovrml.org/1.1/doc/images/earth.jpg"
}
}
geometry GeoElevationGrid {
geoSystem [ "GD" ]
geoGridOrigin "-90 -180 0"
xDimension 11
zDimension 11
xSpacing "36"
zSpacing "18"
creaseAngle 1.05
height [ 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 ]
}
}
DEF PI GeoPositionInterpolator {
geoSystem [ "GD", "latitude_first" ]
key [ 0.0 0.1 0.55 1.0 ]
keyValue [
"51.5122 -0.065 10000000", # London
"48.865 2.35 10000000", # Paris
"40.6698 -73.943849 10000000", # New York
"51.5122 -0.065 10000000", # Back to London
]
}
DEF TS TimeSensor {
cycleInterval 8.0
loop TRUE
}
Background { skyColor 1 1 1 }
]
}
ROUTE TS.fraction_changed TO PI.set_fraction
ROUTE PI.geovalue_changed TO V.set_position
A.3 On demand inlining
A simple example that uses the InlineLoadControl node to include a file which just contains a green cube. Click on the up arrow to send a set_load TRUE event to the InlineLoadControl node, and Click on the down arrow to send a set_load FALSE event. This examples illustrates some of the resource management features that GeoVRML 1.1 provides.
URL: http://www.geovrml.org/1.1/doc/examples/geoinline.wrl
#VRML V2.0 utf8
EXTERNPROTO InlineLoadControl [
exposedField SFBool load
exposedField MFString url
field SFVec3f bboxCenter
field SFVec3f bboxSize
eventOut MFNode children
] [ "urn:web3d.org:vrml97:node:InlineLoadControl"
"file:///C:/Program%20Files/GeoVRML/1.1/protos/InlineLoadControl.wrl"
"http://www.geovrml.org/1.1/protos/InlineLoadControl.wrl" ]
Group {
children [
DEF TestInline InlineLoadControl {
url "http://www.geovrml.org/1.1/doc/examples/box.wrl"
load FALSE # don't load inline file until TRUE event sent
}
# Two cones that are used to load and unload the URL for the box
Transform {
translation 2 1.0 0
scale 0.5 0.5 0.5
children [
DEF LoadSensor TouchSensor {}
Shape {
appearance Appearance { material Material {diffuseColor 1 0 0} }
geometry Cone {}
}
]
}
Transform {
translation 1.5 1.2 0.3
scale 0.5 0.5 0.5
children [
Shape {
geometry Text {
string "Load Cube"
fontStyle FontStyle {
size 1.0
}
}
}
]
}
Transform {
translation 2 -1.0 0
scale 0.5 0.5 0.5
rotation 1 0 0 3.1415
children [
DEF UnLoadSensor TouchSensor {}
Shape {
appearance Appearance { material Material {diffuseColor 0 0 1} }
geometry Cone {}
}
]
}
Transform {
translation 1.5 -1.5 0.3
scale 0.5 0.5 0.5
children [
Shape {
geometry Text {
string "Unload Cube"
fontStyle FontStyle {
size 1.0
}
}
}
]
}
]
}
# a couple of scripts to process the events from clicking on the cones
DEF ReturnTrue Script {
eventIn SFBool set_value
eventOut SFBool value_changed
url "javascript: function set_value( value ) {
if ( value == true ) value_changed = true; }"
}
DEF ReturnFalse Script {
eventIn SFBool set_value
eventOut SFBool value_changed
url "javascript: function set_value( value ) {
if ( value == true ) value_changed = false; }"
}
ROUTE LoadSensor.isActive TO ReturnTrue.set_value
ROUTE ReturnTrue.value_changed TO TestInline.set_load
ROUTE UnLoadSensor.isActive TO ReturnFalse.set_value
ROUTE ReturnFalse.value_changed TO TestInline.set_load
A.4 Georeferencing VRML objects
This example displays a standard VRML cone at the latitude/longitude location of Lossiemouth, Scotland. The Cone is rotated through 180 deg about the X axis to point straight down rather than up. We use the GeoElevationGrid node in order to give us a (coarse) underlying reference model of the earth. We make the Cone 500 km high and 200 km above the surface of the earth so that we can see it.
URL: http://www.geovrml.org/1.1/doc/examples/geoloc.wrl
#VRML V2.0 utf8
EXTERNPROTO GeoLocation [
exposedField SFString geoCoords
field MFNode children
field SFNode geoOrigin
field MFString geoSystem
] [ "urn:web3d.org:vrml97:node:GeoLocation"
"file:///C:/Program%20Files/GeoVRML/1.1/protos/GeoLocation.wrl"
"http://www.geovrml.org/1.1/protos/GeoLocation.wrl" ]
EXTERNPROTO GeoElevationGrid [
exposedField SFNode color
exposedField SFNode texCoord
exposedField SFNode normal
field SFBool ccw
field SFBool colorPerVertex
field SFFloat creaseAngle
field SFNode geoOrigin
field MFString geoSystem
field SFString geoGridOrigin
field MFFloat height
field SFBool normalPerVertex
field SFBool solid
field SFInt32 xDimension
field SFString xSpacing
field SFFloat yScale
field SFInt32 zDimension
field SFString zSpacing
] [ "urn:web3d.org:vrml97:node:GeoElevationGrid"
"file:///C:/Program%20Files/GeoVRML/1.1/protos/GeoElevationGrid.wrl"
"http://www.geovrml.org/1.1/protos/GeoElevationGrid.wrl" ]
EXTERNPROTO GeoViewpoint [
eventIn SFBool set_bind
eventIn SFString set_position
eventIn SFString set_orientation
exposedField SFFloat fieldOfView
exposedField SFBool headlight
exposedField SFBool jump
exposedField MFString navType
field SFString description
field SFNode geoOrigin
field MFString geoSystem
field SFString position
field SFRotation orientation
field SFFloat speedFactor
eventOut SFTime bindTime
eventOut SFBool isBound
] [ "urn:web3d.org:vrml97:node:GeoViewpoint"
"file:///C:/Program%20Files/GeoVRML/1.1/protos/GeoViewpoint.wrl"
"http://www.geovrml.org/1.1/protos/GeoViewpoint.wrl" ]
Group {
children [
Background { skyColor 1 1 1 }
GeoViewpoint {
geoSystem [ "GD", "latitude_first" ]
position "51.5122 -40.0 10000000"
orientation 1 0 0 -1.57
description "Initial GeoViewpoint"
}
Shape {
appearance Appearance {
material Material { diffuseColor 0.8 1.0 0.3 }
texture ImageTexture {
url "http://www.geovrml.org/1.1/doc/images/earth.jpg"
}
}
geometry GeoElevationGrid {
geoSystem [ "GD" ]
geoGridOrigin "-90 -180 0"
xDimension 11
zDimension 11
xSpacing "36"
zSpacing "18"
creaseAngle 1.05
height [
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 ]
}
}
GeoLocation {
geoSystem [ "GD" ]
geoCoords "57.7174 -3.286119 200000" # Lossiemouth, Scotland, elev 200km
children [
Transform {
rotation 1 0 0 3.1415926
children [
Shape {
appearance Appearance { material Material { diffuseColor 1 1 0 }}
geometry Cone { bottomRadius 100000 height 500000 }
}
]
}
]
}
]
}
A.5 Using a GeoOrigin
This example illustrates how to use a GeoOrigin node in order to provide accurate geospatial positioning and remove the camera jitter caused by reduced floating-point precision. We use two GeoLocation nodes to place two spheres next to each other on the surface of the earth. The spheres have radii of 2 meters and are placed 4 meters apart in an UTM spatial reference frame. We define a GeoOrigin node located between both of these spheres so that all the coordinates in the scene will lie within single-precision range. Note that all of the GeoVRML nodes in this example use the same GeoOrigin definition.
URL: http://www.geovrml.org/1.1/doc/examples/geoorigin.wrl
#VRML V2.0 utf8
EXTERNPROTO GeoLocation [
exposedField SFString geoCoords
field MFNode children
field SFNode geoOrigin
field MFString geoSystem
] [ "urn:web3d.org:vrml97:node:GeoLocation"
"file:///C:/Program%20Files/GeoVRML/1.1/protos/GeoLocation.wrl"
"http://www.geovrml.org/1.1/protos/GeoLocation.wrl" ]
EXTERNPROTO GeoViewpoint [
eventIn SFBool set_bind
eventIn SFString set_position
eventIn SFString set_orientation
exposedField SFFloat fieldOfView
exposedField SFBool headlight
exposedField SFBool jump
exposedField MFString navType
field SFString description
field SFNode geoOrigin
field MFString geoSystem
field SFString position
field SFRotation orientation
field SFFloat speedFactor
eventOut SFTime bindTime
eventOut SFBool isBound
] [ "urn:web3d.org:vrml97:node:GeoViewpoint"
"file:///C:/Program%20Files/GeoVRML/1.1/protos/GeoViewpoint.wrl"
"http://www.geovrml.org/1.1/protos/GeoViewpoint.wrl" ]
EXTERNPROTO GeoOrigin [
exposedField SFString geoCoords
exposedField MFString geoSystem
field SFBool rotateYUp
] [ "urn:web3d.org:vrml97:node:GeoOrigin"
"file:///C:/Program%20Files/GeoVRML/1.1/protos/GeoOrigin.wrl"
"http://www.geovrml.org/1.1/protos/GeoOrigin.wrl" ]
Background { skyColor [ 1 1 1 ] }
GeoViewpoint {
geoOrigin DEF ORIGIN GeoOrigin {
geoSystem [ "UTM", "Z11" ]
geoCoords "8167769.0 258117.0 0" # (0,0,0)
}
geoSystem [ "UTM", "Z11" ]
position "8167769.0 258117.0 10" # (0,0,10)
orientation 1 0 0 -1.57
description "Adjacent Spheres"
}
GeoLocation {
geoSystem [ "UTM", "Z11" ]
geoCoords "8167769.0 258115.0 0" # (0,-2,0)
geoOrigin USE ORIGIN
children Shape {
appearance Appearance {
material Material { diffuseColor 1 0 0 } # Red
}
geometry Sphere { radius 2 }
}
}
GeoLocation {
geoSystem [ "UTM", "Z11" ]
geoCoords "8167769.0 258119.0 0" # (0,2,0)
geoOrigin USE ORIGIN
children Shape {
appearance Appearance {
material Material { diffuseColor 0 0 1 } # Blue
}
geometry Sphere { radius 2 }
}
}
![]()
Questions or comments.
Copyright 2002, SRI International.