Terrain local server for private network

Hi everyone…

I have .terrain data using CTB-tile.
For local network(not internet), how can I make terrain server ?
Is the tutorial for building terrain server ?
Or, Is the simple solution for local server ?

thanks…

HI @jhjojhjo,

you need 2 things:

1st the javascript-code:

const terrainProvider = new Cesium.CesiumTerrainProvider({url: 'PATH/URL-OF-layer.json-FOLDER'});
const viewer = new Cesium.Viewer("cesiumContainer", {
  [...],
  terrainProvider: terrainProvider,
  [...]
});

2nd some configuration of your runtime environment:
This depends on which environment you are using. I use IIS Express and with that, you can just place a “web.config” inside the terrain folder (I just put the terrain related content here):

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <staticContent>
		    <mimeMap fileExtension=".terrain" mimeType="application/octet-stream" />
        </staticContent>
		<rewrite>
			<outboundRules>
				<rule name="Rewrite TERRAIN header" preCondition="IsTERRAIN" stopProcessing="true">
					<match serverVariable="RESPONSE_Content_Encoding" pattern=".*" />
					<action type="Rewrite" value="gzip" />
				</rule>
				<preConditions>
					<preCondition name="IsTERRAIN">
						<add input="{PATH_INFO}" pattern="\.terrain$" />
					</preCondition>
				</preConditions>
			</outboundRules>            
		</rewrite>
	</system.webServer>
</configuration>

So you have to tell the server, that terrain-files should get an header, which tells the client the files are gzip encoded.

Best, Lennart

1 Like

thanks to lennart…
I’ll try that…

thnaks. lennart.
I have two questions. i’m a novice about iis.

I 'll copy web.config to c:\inetpub\wwwroot.
Am I right ?

And the 0/0/0.terrain is not in converted data.
How can I make 0/0/0.terrain ?

Hi @jhjojhjo,

You have to look into the guides etc of your tool, but for me (I built it from this source: link) it is enough to add a “-C” flag to the command for including the level 0 tiles.

Yes, if your terrain-data is inside this folder.

Best, Lennart