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.
Then I applied the same work on the data related to Tunisia.
You should have installed on your machine the following software:
- Geoserver
2.21.2
- PostgreSQL
11.18.1
- PostGIS
2.3.2
- pgAdmin
4
This project is brought down into 3 main steps:
Database for data storage that is used to store the Shapefiles layers of Côte d'Ivoire into PostgreSQL.
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;
Geoserver is used for the publication of data in a PostGIS - PostGIS Database
warehouse
OpenLayers for data visualization (webmapping)
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.
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 :