Say you want to set the homeCamera
for your TerriaMap, in simple.json
.
{
"homeCamera": {
"north": -8,
"east": 158,
"south": -45,
"west": 109
},
A great way is to load up a terriamap application, zoom it to the initial view that you want, and then export the homeCamera
using this hack:
- Load up http://ci.terria.io/main/ or your own TerriaMap.
- Zoom and pan the map the the initial view that you want
- Click "Share/Print" in the top right corner, and copy the sharelink that is generated:
- Edit the sharelink, remove the
#
character and replace=
with/
. Sohttp://ci.terria.io/main/#share=s-jfDtTYNWzrirJAqJ8i0Os0vLgNg
becomeshttp://ci.terria.io/main/share/s-jfDtTYNWzrirJAqJ8i0Os0vLgNg
- Paste the sharelink back in a browser (E.g. Google Chrome)
- A json file will download. This has a property called
initialCamera
, e.g.
"initialCamera": {
"west": 111.10075541006248,
"south": -28.743217852536166,
"east": 117.02473704913916,
"north": -22.885793583925707,
"position": {
"x": -2297942.36437604,
"y": 5309829.666896026,
"z": -3321174.578815482
},
"direction": {
"x": -0.07821051151218932,
"y": -0.1155917786552186,
"z": 0.9902129349772829
},
"up": {
"x": -0.4680551830939547,
"y": 0.8812384818747622,
"z": 0.06590207615810807
}
},
- Replace the
homeCamera
value in yoursimple.json
file with theinitialCamera
value. It should look something like this:
{
"homeCamera": {
"west": 111.10075541006248,
"south": -28.743217852536166,
"east": 117.02473704913916,
"north": -22.885793583925707,
"position": {
"x": -2297942.36437604,
"y": 5309829.666896026,
"z": -3321174.578815482
},
"direction": {
"x": -0.07821051151218932,
"y": -0.1155917786552186,
"z": 0.9902129349772829
},
"up": {
"x": -0.4680551830939547,
"y": 0.8812384818747622,
"z": 0.06590207615810807
}
},
"catalog": [
{
"id": "ZIdekvc10z",
"type": "wms-group",
"name": "Test",
"url": "https://programs.communications.gov.au/geoserver/ows",
"members": [
// ETC...
Save simple.json
and refresh your TerriaMap page. Should update the initial view!
NB: The properties position
, direction
, and up
are optional. You could just use this for a more simple "top down" initial view:
{
"homeCamera": {
"west": 111.10075541006248,
"south": -28.743217852536166,
"east": 117.02473704913916,
"north": -22.885793583925707
},
"catalog": [
{
"id": "ZIdekvc10z",
"type": "wms-group",
"name": "Test",
"url": "https://programs.communications.gov.au/geoserver/ows",
"members": [
// ETC...