
Welcome
Up to a certain point, the problem of displaying data on a map on the Internet can be solved with the help of fairly powerful web-mapping tools such as the Google Maps API, Yandex.Maps API, OpenStreetMap API.
When there are a lot of objects, the development rests on the client's performance, since the computational power of the computer of the person who uses the card is spent on drawing. In addition, the “artistic” capabilities of such services are not always sufficient to locate the necessary information on the map.
To solve these problems, server mapping software is used which provides more opportunities.
')
In this series of articles, we will look at the installation and configuration of a web service that will allow you to display various geo-data on the map.
Formulation of the problem
Let's take a fairly relevant and mundane task of displaying objects that are stored in the database. The data source will be a geo-field in the PostgreSQL database. On the server side, we need to generate a layer with objects and overlay it on Google Maps. It is also necessary to perform all operations on free software with the possibility of finishing it for your own needs. You also need to get away from the use of third-party map services.
Instruments
To solve our problem, it is necessary to represent the principle of operation of the whole bundle, therefore, we consider the scheme:

Depending on the Gisovsky web server, you can use different formats of incoming data. In our case, we will use MapServer which can use vector and raster data.
The data source needs to be prepared in advance, which means that you need to take coordinates from some gps device and import them into the database or into any other format that MapServer supports. In our case, we will take data from our
gps tracker M2M-mini , which, via the gprs channel, adds points to the server in the PostgreSQL database.
PostgreSQL is selected based on the fact that it has a great PostGIS gasket that allows you to perform geo queries from the database. For example, select areas that crosses the route.
In geodesy there is such a thing as a projection. Projection is a mathematically defined way of displaying the surface of an ellipsoid on a plane. Those. how the globe will be laid out on a flat map. There are a lot of projections, the data that will be imported into the database may be in one projection and we will need to display them in another, for this, together with MapServer, we will need to install the PROJ library on the server that will help us work with projections.
The MapServer itself is configured by a map file, in which we describe exactly how we need to output data, where to get it from, and how to color the map, what the roads, routes, etc. will look like.
Total it turns out that for a specific request, MapServer through PostGis using PROJ selects data from PostgreSQL and displays them in one of certain formats, ranging from a regular image and ending with WMS (which we will use to organize the web service). In this case, all this is governed by the configuration map file which tells the server what information to get from.
MapServer works in conjunction with Apache and provides information to the browser. We are interested in the operation mode MapServer - WMS. In this mode, the client program (desktop or, for example, Google API through a special function), with the help of a GET request, asks MapServer to show tiles with specific coordinates, sizes and transparency. In response to such a request, MapServer returns images that are used by the client program to overlay onto the map.
If you leave the chosen path of the service for our task, then the following tools will remain in the bottom line:

Conclusion
With the help of PostgreSQL / PostGis + MapServer + Google Maps, we can solve most of the tasks that webmasters are facing today by organizing their geo-service, and in particular our task of displaying points on Google maps.
In the second part, we will look at the installation of MapServer and PostgreSQL / PostGis, as well as their binding to each other.
Stay tuned!
gps-tracker.com.ua