-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathexample_BGS.html
188 lines (162 loc) · 10.1 KB
/
example_BGS.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<!DOCTYPE >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Earth Demo</title>
<link rel="stylesheet" type="text/css" href="css/x3dom.css" />
<link rel="stylesheet" type="text/css" href="css/earthservergenericclient.css" />
<link rel="stylesheet" type="text/css" href="js-ext/jquery-ui/themes/base/jquery-ui.css">
<script type="text/javascript" src="js-ext/x3dom-full.js"></script>
<script type="text/javascript" src="js-ext/jquery-ui/jquery-1.9.1.js"></script>
<script type="text/javascript" src="js-ext/jquery-ui/ui/jquery-ui.js"></script>
<script type="text/javascript" src="js/EarthServerClient_DailyBuild.js"></script>
<script type="text/javascript">
// basic setup:
EarthServerGenericClient.MainScene.setTimeLog(false);//TimeLogging: outputs time of loading and building the models to the console
EarthServerGenericClient.MainScene.addLightToScene(true);//Adds a light into the scene
// background of the render window
EarthServerGenericClient.MainScene.setBackground("0.8 0.8 0.95 0.4 0.5 0.85 0.3 0.5 0.85 0.31 0.52 0.85","0.9 1.5 1.57","0.8 0.8 0.95 0.4 0.5 0.85 0.3 0.5 0.85 0.31 0.52 0.85","0.9 1.5 1.57");
// custom viewpoints:
//"Name","Position","orientation"
EarthServerGenericClient.MainScene.addCustomViewPoint("VP1","2055.40031 1493.57514 1595.16861","-0.50542 0.84759 0.16166 1.02493" );
EarthServerGenericClient.MainScene.addCustomViewPoint("VP2","-1591.06055 1190.31804 -2247.59188","0.00992 0.97582 0.21834 3.72105");
/* Add custom key mapping: "command","key"
* "ViewPointX": While x is a number between 1-6. Goes to viewpoint x.
* "ShowViewPoint": Prompts the current viewpoint.
* "LightDown"/"LightUp": changes the intensity of the light source.
* "ElevationDown"/ElevationUp": changes the global elevation.
*/
EarthServerGenericClient.MainScene.setShortCut("Viewpoint1","1"); // change to viewpoint 1 with "1"
EarthServerGenericClient.MainScene.setShortCut("ShowViewPoint","b"); // gives an info window with the current viewpoint
EarthServerGenericClient.MainScene.setSubSetting(true);
// See http://doc.x3dom.org/tutorials/animationInteraction/navigation/index.html for reference
EarthServerGenericClient.MainScene.setNavigation("EXAMINE","");
// Onclick function example
EarthServerGenericClient.MainScene.OnClickFunction = function(modelIndex,hitPoint)
{
console.log( EarthServerGenericClient.MainScene.getSubSettingValues() );
};
// create the models:
$(document).ready(function()
{
// Using v9 server need to set axis labels
var BGS = new EarthServerGenericClient.Model_WCPSDemWCPS();
BGS.setName("BGS 2x WCPS");
BGS.setURLs("http://earthserver.bgs.ac.uk/rasdaman/ows");
BGS.setCoverages("bgs_rs", "os_dtm");
BGS.setAreaOfInterest(400000,500000,450000,550000);
//X and Z axis labels will default to 'x' and 'y' if not set
//This was the default with rasdaman v8 but with v9 the labels
//depend on the coverage's coordinate reference system.
BGS.setXAxisLabel("E");
BGS.setZAxisLabel("N");
BGS.setResolution(500,500);
BGS.setOffset(0,0.2,0);
BGS.setScale(1,0.3,1);
BGS.setCoordinateReferenceSystem("http://www.opengis.net/def/crs/EPSG/0/27700");
BGS.setSidePanels(true);
var BGS_LOW = new EarthServerGenericClient.Model_WCPSDemAlpha();
BGS_LOW.setName("BGS Low Resolution");
BGS_LOW.setURL("http://earthserver.bgs.ac.uk/rasdaman/ows");
BGS_LOW.setCoverages("bgs_rs", "os_dtm");// can be referenced as "$CI" and "$CD" in the WCPS Query
BGS_LOW.setAreaOfInterest(400000,500000,450000,550000);
BGS_LOW.setXAxisLabel("E");
BGS_LOW.setZAxisLabel("N");
BGS_LOW.setCoordinateReferenceSystem("http://www.opengis.net/def/crs/EPSG/0/27700");
BGS_LOW.setScale(1.0,0.2,1.0);
BGS_LOW.setOffset(0,0.8,0);
BGS_LOW.setResolution(200,200);
//If you set a custom query using the setWCPSFor... methods you must
//hard code the axis labels as there currently aren't $ variables that
//will get replaced by the model values you may have set with
//setXAxisLabel...
//BGS_LOW.setWCPSForChannelRED('scale(trim($CI.red, {x:$CRS($MINX:$MAXX), y:$CRS($MINY:$MAXY) }), {x:"CRS:1"(0:$RESX), y:"CRS:1"(0:$RESZ)}, {});');
//BGS_LOW.setWCPSForChannelGREEN('scale(trim($CI.green, {x:$CRS($MINX:$MAXX), y:$CRS($MINY:$MAXY) }), {x:"CRS:1"(0:$RESX), y:"CRS:1"(0:$RESZ)}, {});');
//BGS_LOW.setWCPSForChannelBLUE('scale(trim($CI.blue, {x:$CRS($MINX:$MAXX), y:$CRS($MINY:$MAXY) }), {x:"CRS:1"(0:$RESX), y:"CRS:1"(0:$RESZ)}, {});');
//BGS_LOW.setWCPSForChannelALPHA('(char) (((scale(trim($CD , {x:$CRS($MINX:$MAXX), y:$CRS($MINY:$MAXY)}), {x:"CRS:1"(0:$RESX), y:"CRS:1"(0:$RESZ)}, {})) / 1349) * 255)');
var Bedrock = new EarthServerGenericClient.Model_WMSDemWCPS();
Bedrock.setName("Bedrock geology on ground surface");
Bedrock.setURLs("http://ogc.bgs.ac.uk/cgi-bin/BGS_Bedrock_and_Superficial_Geology/wms", "http://earthserver.bgs.ac.uk/rasdaman/ows");
Bedrock.setCoverages("GBR_BGS_625k_BLS", "os_dtm");
Bedrock.setAreaOfInterest(254750.0,659824.9,265250.0,670024.9);
Bedrock.setXAxisLabel("E");
Bedrock.setZAxisLabel("N");
Bedrock.setWMSCoordinateReferenceSystem("CRS","EPSG:27700");
Bedrock.setWCPSCoordinateReferenceSystem("http://www.opengis.net/def/crs/EPSG/0/27700");
Bedrock.setScale(1.0,0.3,1.0);// Size within the cube 100%width, 30%height and 100%length
Bedrock.setOffset(0,1.0,0);
Bedrock.setResolution(256,256);// Resolution of the model
var glasgow_witi_t = new EarthServerGenericClient.Model_WCPSDemWCPS();
glasgow_witi_t.setName("Wilderness Till Formation");
glasgow_witi_t.setURLs("http://earthserver.bgs.ac.uk/rasdaman/ows", "http://earthserver.bgs.ac.uk/rasdaman/ows");
glasgow_witi_t.setCoverages("glasgow_witi_t", "glasgow_witi_t");
glasgow_witi_t.setAreaOfInterest(254750.0,659824.9,265250.0,670024.9);
//Setting the axis labels below currently has no effect as we are
//using a custom query and there are no substitution variables for
//axis labels.
glasgow_witi_t.setXAxisLabel("E");
glasgow_witi_t.setZAxisLabel("N");
glasgow_witi_t.setCoordinateReferenceSystem("http://www.opengis.net/def/crs/EPSG/0/27700");
glasgow_witi_t.setScale(1.0,0.3,1.0);// Size within the cube 100%width, 30%height and 100%length
glasgow_witi_t.setOffset(0,0.4,0);
glasgow_witi_t.setResolution(105,102);// Resolution of the model
// This value will be considered as NODATA in the DEM. Vertices with that value will not be used and gaps are left.
glasgow_witi_t.setDemNoDataValue(0,4);
// The user can set the height of the model manually to make sure multiple models have the same scaling.
// Per default this value will be determined by the difference between the dems's min and max values.
glasgow_witi_t.setHeightResolution(100);
var query = 'for i in ( $CI ) ';
query += 'return encode( ';
query += '{ ';
query += 'red: (unsigned char) 0; ';
query += 'green: (unsigned char) scale((i != -340282346638528859811704183484516925440.0) * 240, {E:"CRS:1"(0:$RESX), N:"CRS:1"(0:$RESZ)}, {}); ';
query += 'blue: (unsigned char) 0 ';
query += '} ';
query += ', "png", "nodata=0,0,0")';
glasgow_witi_t.setWCPSImageQuery(query);
demquery = 'for i in ( glasgow_witi_t ) ';
demquery += 'return encode( ';
demquery += ' scale((i != -340282346638528859811704183484516925440.0) * i, {E:"CRS:1"(0:$RESX), N:"CRS:1"(0:$RESZ)}, {}) ';
demquery += ', "csv" )';
glasgow_witi_t.setWCPSDemQuery(demquery);
// Child model hierarchy
// important: use the name of the parent model
BGS_LOW.addAsChildOf( "BGS 2x WCPS" );
Bedrock.addAsChildOf( "BGS 2x WCPS" );
// add models to the scene
EarthServerGenericClient.MainScene.addModel(BGS);
EarthServerGenericClient.MainScene.addModel(BGS_LOW);
EarthServerGenericClient.MainScene.addModel(glasgow_witi_t);
EarthServerGenericClient.MainScene.addModel(Bedrock);
// create the scene: Cube has 60% height compared to width and length
EarthServerGenericClient.MainScene.createScene('x3dScene','theScene',1,0.6,1 );
EarthServerGenericClient.MainScene.createAxisLabels("Latitude","Height","Longitude");
});
document.onload = function()
{
// register a progressbar (you can register your own or just delete this lines)
var pb = new EarthServerGenericClient.createProgressBar("progressbar");
EarthServerGenericClient.MainScene.setProgressCallback(pb.updateValue);
// create the UI
EarthServerGenericClient.MainScene.createUI('x3domUI');
// starts loading and creating the models
// here the function starts as soon as the html page is fully loaded
// you can map this function to e.g. a button
EarthServerGenericClient.MainScene.createModels();
};
</script>
</head>
<body id="body">
<div id="x3dom">
<div id="progressbar"></div>
<X3D id="x3d" showlog="false" showstat="false">
<scene id="x3dScene">
<group id="root">
<group id="theScene" DEF='theScene'></group>
</group>
</scene>
</X3D>
<div id='x3domUI'></div>
</div>
</body>
</html>