geoserver-openlayer-vector slicing 1: making vector slices

Source: Internet
Author: User
Tags tomcat tomcat server
0. Preface

In order to solve the problem of raster slicing, long slicing time, large amount of data transmission and weak style customization ability, more and more enterprise cases begin to use vector deception as the way of map loading in Webgis.  So far, the more successful and common use of vector slicing technology flow, mainly divided into the following two kinds. ArcGIS Pro makes vector tiles---arcgis Online publishing vector slicing service---ArcGIS for JavaScript to map geoserver making vector Tiles---geoserver publishing a vector slicing service---Ope Nlayer to map show two ways which is inferior to the second, this article specifically on the technical process of program 2 for detailed collation, for learning and communication. This contents mainly summarizes how to utilize the GeoServer vector slicing service


1. Basic Process

For the launch of the vector slicing service, the main workflow is shown in the following figure, which is divided into two steps: Installation preparation and map publishing.


2. Install prepare 2.1 Install JDK:

It should be noted that the Java environment variables are set successfully, in test mode, and in cmd execution java-version. In addition, GeoServer does not support Java1.9 's runningtime


2.2 Installing Tomcat (decompression version)

1) Unzip tomcat to the specified path (I pick the path C:\Program Files\apache 7)

2) Add two environment variables and add them to the system path path: Catalina_base:tomact decompression path catalina_base:tomact decompression path%catalina_home%\lib;%catalina_home %\bin;

3) Modify the access rights of the Tomcat decompression directory to ensure that the current Windows user has all the actions selected. How to: File Properties-Security-Specify user-permission "Allow all". Installation Note You can also install "install version" Tomcat, then 1) or 2) step can be done without manual Tomcat is just a container to run geoserver, or you can choose a different container


2.3 Installing Goeserver (decompression version)

1) Download the GeoServer installation war file from the GeoServer website and place it in the WebApps folder of the Tomcat server

2) Start Tomcat and extract the GeoServer war file to the Tomcat server automatically

3) Add all Geoserver-2.11.0-vectortiles-plugin.zip jar packages to XXXX and reboot Tomcat to complete the vector tile plugin loading

4) In the browser access, Localhost:8080/geoserver, if you open the following interface, the GeoServer installation is considered successful


Installation Note You can also install the "install version" GeoServer, can provide login settings and other parameters set permissions for the decompression version of the GeoServer, the default account is the admin password geoserver


3. Map Publishing
3.1 Adding map data

This step mainly includes the new workspace, two steps to create a new storage area. And these steps and ordinary geoserver data add no difference, the relevant documents are more, not in this statement. 3.2 Map Service Publishing
3.2.1 Editing Layers

Once you have finished adding data, you can edit the layer, where the edits are understood as edits to the relevant parameters of the map Publishing service, rather than the geometry or attribute edits of the layer features. 3.2.2 Specifying a coordinate reference

Here there is a need to set up local coordinate system, declare coordinate system two coordinate system, according to GeoServer official document, its function and difference is


Native SRS-The coordinate system of the local data itself declared SRS-map service when publishing the coordinate system SRS handling:-declaration Nativesrs and declared How SRS is handled at different time

3.2.3 Specifying vector slice types

If the Geoserver-2.11.0-vectortiles-plugin installation succeeds, the vector tile format shown in the Tilecaching tab in the Edit Layer page is incremented. You can select the tile format you want to provide as needed. Generally speaking, Geojson has good readability, and mapbox-vector (PBF) is the format used by ArcMap Pro. Special Note: vector tiles are a dynamic slicing process, so when the slice option is checked, GeoServer does not build the tiles immediately, but only when the slices are requested. The storage path of the vector slice is not built. In this paper, the path is found, "Installation path \geoserver 2.11.0\data_dir\gwc\ layer name". However, in the "vector slice" article, it indicates that its storage path is C:\Users\%YOUR-PC-NAME%\AppData\Local\Temp\geowebcache. The reasons for the discrepancy are unclear. Can be judged according to the actual situation by hand.
3.2.4 Add grid scheme support

The grid scheme in GeoServer can be understood as a tiling scheme or pyramid scheme in ArcMap, which describes the number of slices, resolution, and so on at each display scale. By default, GeoServer automatically adds a two grid scheme named EPSG900913 and EPSG4326 for the map service. Special attention: grid scheme is not the same as coordinate system, although grid scheme must rely on a definite coordinate system, can calculate the specified line number correctly according to coordinate information. However, it is not related to the coordinate system itself to build layers of slices, the resolution of each layer of slices, and so on.
The EPSG4326 and EPSG900913 are the GeoServer default two tiling scheme, which is based on the 4326 coordinate system and the 900913 coordinate system respectively. In addition, GeoServer also offers Globalcrs84pixel, Googlecrs84quad, Globalcrs84scale three other slicing schemes with 4326 coordinate systems for practical selection. Grid scheme relies on the coordinate system must be consistent with the map service published coordinate system declared SRS, otherwise GeoServer will not be able to correctly calculate the column number of the specified tile and map service published coordinate system is neither 4326 nor 900913, You need a user-defined build grid scheme, concrete construction method, can refer to vector tile (vector tile) Proj4js: preview of 4 map service

At this point, the vector Tile Map Service has been completely published, and once again, the production process of slicing is dynamic, there is no call to generate. If you do not make a request presentation, there will always be no slice file generation under the corresponding slice path. There are two ways to preview vector slices in general. For, just to publish the data back-end situation, the use of GeoServer provides a preview function, basically can meet the needs of the use. This feature is also briefly described here.  And for the Openlayer to customize the display, I will do another text. Use the preview features provided by GeoServer to showcase using Openlayer as a support

You can view map services for all services in the current server by selecting the Tilelayers feature in the Tile Cache toolbar on the left side of the GeoServer home page. You can preview a vector slice in a new page by selecting the preview mode as shown in the illustration.

Special Note: the types of tiles provided here are related to the type of the layer you specify to publish when editing, and if you do not specify it, you cannot preview the grid scheme here, although there are two kinds of EPSG4326 and EPSG900913, but only the grid scheme corresponding to the publishing map coordinate system, Before the vector tiles can be loaded correctly otherwise, a blank space will be shown in the preview.

The final display results are shown in the figure. Again, the corresponding slice file is generated in the corresponding slice path only after a network request or visualization is made.



finally add two points:

1. The GeoServer 2.11 used in this article, has been able to support the preview of vector tiles, and for the previous version of GeoServer, it may not support its visual display, fixed the specific version of the bug, this article is not explored.

2. In the preview mode, the developer can see the source code of the Web page in the form of the Geoservers preview function in the head tag to realize the JavaScript source (essentially based on the Openlayer implementation), no unnecessary nonsense, no reference shielding, It is also a good teaching material to learn Openlayer visualization display.


Summary

This paper introduces the technology flow of vector slicing process for geoserver server. As a result of personal knowledge, energy constraints, inevitably there are flaws, but also hope that everyone treatise. Thanks again for the author of the Http://www.cnblogs.com/escage/p/6387529.html blog, in this technical preliminary summary and collation. You can also move to this blog to further supplement the study.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.