/Projet-WebMapping-with-Geoserver-Openlayers-and-Postgres

This project shows how to develop simple Web GIS application using Geoserver, Openlayers,postgis and pgAdmin4.

Primary LanguageJavaScript

Context

Through the use of Geoserver,which is a map server, this project covers the following aspects:

  • Storing the vector and raster data in PostGIS/PostgreSQ.
  • Discover the publication on the web of spatial data in the form of cartographic services.
  • Loading and publishing of vector and raster data.
  • Definition of vector data publication styles (SLD).
  • HTML/JavaScript web programming of a geographical map using jQuery , Bootstrap and JSON
  • The use of Openlayers 6 geolocation API as WEB mapping API

The data used in this project relate to Côte d'Ivoire.

gis

Then I applied the same work on the data related to Tunisia.

gis2

Getting started

Prerequisites

You should have installed on your machine the following software:

  • Geoserver 2.21.2
  • PostgreSQL 11.18.1
  • PostGIS 2.3.2
  • pgAdmin 4
Pipeline

This project is brought down into 3 main steps:

gis3

  1. PostGIS/PostgreSQL:

Database for data storage that is used to store the Shapefiles layers of Côte d'Ivoire into PostgreSQL. gis4 As we can see the layers are stored in a PostgreSQL called Geoserver_db and we can visualize the their content with the through the SQL Query tool available in pgAdmin4 SELECT * FROM civ_admbnda_adm1_cntig_ocha_itos_20180706;

  1. Geoserver:

Geoserver is used for the publication of data in a PostGIS - PostGIS Database warehouse gis5

  1. OpenLayers:

OpenLayers for data visualization (webmapping)

Geometries in PostGIS

The main task is to save a polygon,point or a line that was drawn in Openlayers into the PostGIS database. For example assuming that you already have a list of coordinates that describe your polygons (the result from the console.log ) and also assuming you are using WGS84 projection and SRID=4326 (SRID, Spatial Reference Identifier) then a simple query using ST_GeomFromText(text, srid) should do the job. You should before that create a polygones relation in your PostGIS database t store the coordinates of the drown polygon as well as for the points relation and the line relation. poly

Drowing a point or line or polygon geometry and sending their coordinates to the server to be saved in the database with a POST request, the drown geometries are identified with a unique ID and then we can extract them from the database with a GET request to the server as shown in the pictures below :

2 3 4 1