GIS development into the pit (1)--GeoServer releases DEM topographic maps

1. Download terrain data

Use Tuxin Earth 4 to download the DEM digital elevation model. The elevation terrain data uses SRTM3 data with a resolution of 90 meters. Select the map frame to download, set the save path, and the file format is tiff bitmap. Topographic maps of several provinces in South China are used here as an example.
insert image description here
Wait for the download to complete, sometimes it will be stuck, and the progress bar will not move. You can also use Baidu Netdisk or browser to download.
insert image description here

2. Add data storage

Open the GeoServer management interface, select "Data - Data Storage - Add New Data Storage".
Select "Raster Data Source - GeoTIFF".insert image description here

Select a workspace (if there is no workspace, create a new workspace first), enter the data source name, and select the connection parameter to point to the tif file path.
insert image description here

Click Save. Then follow the same steps to create data sources for other terrain files (one terrain file corresponds to one data source, of course, multiple terrain files can also be spliced ​​into one, this is something later, I won’t go into details here).

3. Create layers

After the data source is created, select "Data - Layer - Add New Resource", and select the data source created in the previous step from the drop-down box. Click Publish.
insert image description here
Enter a layer title and name.
insert image description here
Choose a coordinate reference system and automatically calculate bounding boxes
insert image description here

Save to confirm. Continue creating layers following the steps above.

4. Add styles to the layer

After adding a layer, you can preview it. However, because GeoTIFF distinguishes height information by color grayscale, it is dark and not good-looking. In order to better present the effect, it is necessary to add styles to the layer.
insert image description here

Select "Data—Styles—Add a new style" to add styles to the layer.
insert image description here

Enter the style name, select the workspace, enter the style code in the edit box, save and submit after the verification is successful.
insert image description here

The style code is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/sld
http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd" version="1.0.0">
  <NamedLayer>
    <Name>DEM-HeatMap</Name>
    <UserStyle>
      <Title>A raster style</Title>
        <FeatureTypeStyle>
         <Rule>
           <RasterSymbolizer>
              <ColorMap>
                <ColorMapEntry color="#2851CC" quantity="0" opacity="0.5"/>
                <ColorMapEntry color="#211F1F" quantity="50" opacity="0.8"/>
                <ColorMapEntry color="#EE0F0F" quantity="100" opacity="0.8"/>
                <ColorMapEntry color="#AAAAAA" quantity="200" opacity="0.8"/>
                <ColorMapEntry color="#6FEE4F" quantity="300" opacity="0.8"/>
                <ColorMapEntry color="#3ECC1B" quantity="450" opacity="0.8"/>
                <ColorMapEntry color="#886363" quantity="700" opacity="0.8"/>
                <ColorMapEntry color="#5194CC" quantity="1000" opacity="0.8"/>
                <ColorMapEntry color="#2C58DD" quantity="1500" opacity="0.8"/>
                <ColorMapEntry color="#DDB02C" quantity="2000" opacity="0.8"/>
              </ColorMap>
           </RasterSymbolizer>
         </Rule>
       </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

The meaning of this style is that the color changes with the height change. The key is the ColorMapEntry in the ColorMap, which corresponds to the color, elevation value, and transparency.
Select "Data-Layer", select the layer added in the previous step to edit, select the tab "Publish" on the layer editing page, and select the default style in the layer settings.
insert image description here
insert image description here

5. Create layer groups

Since a terrain file corresponds to a data source, and a layer corresponds to a data source, when multiple layers need to be used at the same time, a layer group is required.
Select "Data-Layer Group-Add New Layer Group", enter the name and title of the layer group, select the workspace, and click "Generate Boundary".
insert image description here
Add a layer, set the style for the layer, and save it.
insert image description here

6. Preview terrain map

Open "Data—Layers Preview", select the preview of the created layer group, the effect is as follows (click on the map to view the attribute information):
insert image description here

Guess you like

Origin blog.csdn.net/lordwish/article/details/126068887