A Simple GIS Server

A Simple GIS Server

Sheng Zheng
4 min readFeb 27, 2019

--

GISer who use ArcGIS should know that since ArcGIS Desktop and ArcGIS Server are bundled, the whole cost is high, so only large projects dare to use these heavyweight platform software. Small projects only resort to the open source platform, and recently I have been learning super-scientific GeoServer and OpenLayer, and found that it is still too embarrassing, especially using GeoServer to publish data, various options (mostly not used, especially from a small project perspective), various agreements (OGC WMS, WFS, WMTS, a lot of so-called experts and university professors get together to do this), although the agreement and interface are very important, but the development of the current frontend In terms of XML-based WMS, WFS, and KML and GML, it is outdated. Of course, WMS, WFS, and WMTS 3.0 consider JSON-based protocols and interfaces. In summary, GeoServer is an open source GIS Server developed in Java. For web applications, it is still a bit heavy, this is like developers who promote Leaflet comparing OpenLayer with the advantage of lightweight. So, the question is, can you write a simple GIS Server to meet the web application using GIS (Leaflet) for GIS development? The answer will be answered in the series of serials. (The reason for the serialization, there is not much time to summarize and write once)

Demand And Feature

This part is very important. It is a simple server. It can’t be compared with commercial, but it is simple and simple. It is light and light. In this section, the scope of function will be roughly framed and may not be applicable.

1. The frontend supports the Leaflet API; (it was also considered to be able to use the ArcGIS JS API to call, but after trying the ArcGIS JS API to call the WFS service released by GeoServer, i give up)

2. Support GeoJSON, but will not support WMS, WFS, WMTS, KML, GML, etc., as stated in the introduction;

3. The publish format currently only supports ShapeFile. GIS format is full of hundreds of formats, but the SHP should be the most basic. Lots of GIS platform can convert other formats to this format;

4. The framework chooses NodeJS+ExpressJS. This is based on the front-end development. Therefore, the Java-based developers should continue to support GeoServer. (Two days ago, a company’s vice president of technology (Java origin) actually asked me such a question: can Node access the database? . . . . . . . . .)

5. Support static image tile, dynamic vector tile(support front-end and back-end rendering, this article is also exploring the way to explore other GIS Server implementation, please rest assured, you can implement by yourself as long as you have some node development experience, even if you are just a beginner of GIS developer).

6.Mongo database stores feature collections.

7. The coordinate system only supports wgs84 (4326), web mercator (3857)

8. Support Gaode map, Google map, temporarily will not support Baidu map (tile calculation method is different)

In addition, NodeJS+ExpressJS+Mongo and GeoJSON are also a perfect combination. If NodeJS+ExpressJS supports XML, it is not impossible. I believe that you will feel very uncomfortable.

Technical Preparations

If you want to implement it, you need to know the following technology:

1. GIS beginners or enthusiasts

2. NodeJS+ExpressJS

3. Mongo+mongoose

4. Leaflet

5. Develop IDE: WebStorm or VS Code

This series will not teach you step by step, so in the case of understanding the above technology, focus on the implementation of ideas and some key codes.

Source Code

  1. Green GIS Server, Github Repo
  2. Green GIS Manager,Github Repo

Sample And Demo

  1. publish shp (wkid=4326 or 3857)

2. GeoJSON(use leaflet geojson class to render geojson data)

3. Backend(use node-canvas render data in node)

4. Frontend(extend leaflet GridLayer to render data in browser)

5.Vector Tile(check chrome dev tools)

Series

  1. node-gdal:shapefile in and geojson out
  2. tile:generate tile to handle big data
  3. node-canvas:draw vector tile from backend
  4. leaflet gridlayer:draw vector tile from frontend
  5. cache:eat memory for faster tile

--

--