**Histograms**

Even if we will use Geostatiscal Analyst tools from ArcGis as a base, you will find similar tools in other GIS software (SAGA tools in QGis …).

The AEDS histogram tool provides a univariate description (one variable) of your data. The tool displays the frequency distribution for the data set of interest and calculates the statistical summary. The primary objective is to validate the fact that the distribution of the values of each variable observes a random phenomenon.

**Frequency distribution**

Frequency distribution is a bar graph that indicates the frequency observed by values in certain ranges or classes. You specify the number of classes of equal width that should be used in the histogram. The relative proportion of data that falls into each class is represented by the height of each bar. For example, the histogram above shows the frequency distribution (10 classes) for a data set.

The main characteristics of a distribution can be summarized by some statistical values that describe its distribution, spreading and shape.

**Measures distribution **

The values of the distribution provide an idea of where the center and other parts of the distribution are. In terms of our goal, validating a random distribution, these values provide very little. However, they inform us about the data set in order to better understand its characteristics. If we want to make a class symbology, it is very useful to thoroughly understand these values.

** The average** is the arithmetic mean of the data. The average provides a measure of the center of the distribution.

** The median value** corresponds to a cumulative proportion of 0.5. If the data is ranked in ascending order, 50% of the values would be below the median and 50% of the values would be above the median. The median provides another measure of the center of the distribution.

** The first and third quartiles** represent a cumulative proportion of 0.25 and 0.75, respectively. If the data were ranked in ascending order, 25% of the values would be below the first quartile and 25% of the values would be above the third quartile.

If you want a classification, into four classes of equal importance (number of points), you just need to use the first quartile, the median and the third quartile as boundaries. You will have 25% of your data in each class.

**Spread measurement**

The difference in points around the average value is another characteristic of the displayed frequency distribution. The variance of the data is the mean squared deviation from the mean of all the values. The units are the square of the units of the original measures and, because they imply squared differences, the calculated variance is sensitive to abnormally high or low values.

The standard deviation is the square root of the variance. It describes the distribution of data on the average in the same units as the original measurements.

In the previous example, the average value is 0.22705 and the standard deviation is 0.083076. Roughly speaking, this means that 68% of our data will be within the range 0.14 to 0.30.

The larger the standard deviation, the flatter the distribution curve. The smaller the standard deviation, the sharper the curve. The problem on a day-to-day basis is that this applies to each type of data and that there is no point in comparing the standard temperature difference with the standard deviation of the sea ice surface, as the units have no connection.

It’s much simpler to look at the look of the distribution, you’ll see right away if you’re facing a flattened or sharp distribution!

**Shape measures**

The frequency distribution is also characterized by its shape. And it is here that we have the most important elements to determine whether the distribution of our data follows a normal distribution or not.

** The asymmetry coefficient (Skewness)** is a measure of the symmetry of a distribution. For symmetric distributions, the asymmetry coefficient is zero. The mean is larger than the median for positive asymmetric distributions, and vice versa for negatively skewed distributions. The figure below shows a positively biased distribution.

In the case of a normal distribution, the value of the asymmetry coefficient is 0. But if it is not a perfect match, how should we interpret the result? In our first histogram example the asymmetry coefficient is -0.17. Is it significantly different from 0?

There are many ways to answer this question. Let’s remember here the simplest, without any additional calculations. This is the table found in the book *“*Probability, data analysis and statistics” G. Saporta (Technip edition) p. 587. This table indicates, for a certain number n of values of the histogram, the values not to be exceeded.

Values are given for risks of 1% and 5% for *n* between 7 to 5000. In our example, considering a sample of 450 observations and an error risk of 5%, the coefficient must be between -0.188 and 0.188 to consider that the distribution is indeed symmetrical.

We are fine in this case.

** The flattening coefficient (kurtosis)** is based on the height of the edges (or tails) of a distribution and provides a measure of the probability for the distribution to produce outliers, ie values that deviate significantly from the mean .

The kurtosis of a normal distribution is equal to 3. The distributions with relatively thick edges are called “Leptokurtiques” and have a kurtosis value greater than 3. Distributions with relatively thin edges are called “Platykurtiques” and have a kurtosis value less than 3. In the figure below, a normal distribution is given in red, and a leptokurtic distribution (thick edges) in black

On the data set corresponding to the black curve, it will be more difficult to know if the higher or lower values are outliers, ie measurement errors.

In summary: if the kurtosis is less than 3, you will be encouraged to search for outliers, for example using the Voronoi polygons (which we will discuss in a later article), if it is greater than 3, it will be more difficult.

Depending on the tool used, you can calculate another value instead of kurtosis, the excess of kurtosis. It is simply the kurtosis minus 3. Since the value 3 is the central value, the excess of kurtosis makes it possible to immediately recognize the platikurtic curves (negative values of the excess) of the leptokurtiques (positive values).

**Interpretation of histograms**

Some kriging methods work best if the data is approximately normally distributed (the bell-shaped curve).

In particular, quartile and probability maps using ordinary, simple and universal kriging assume that the data come from a normal distribution.

As we discussed in the previous article, kriging is also based on the hypothesis of stationarity. This assumption requires, partially, that all data values originate in distributions that bear the same variability. Usually, we observe in nature that as the values increase, their variability increases as well. The ** transformations** of the data source can be used to make your data normally distributed and satisfy the assumption of equal variability for the whole set.

In the Geostatistical Analyst histogram tools, you will find several types of transformations, including the Box Cox (also known as exponential transformation), logarithmic and arc sinus.

The simple observation (plus the Skewness value significantly differs from 0 according to the overflow table) indicates that the distribution is not normal.

If we select a Box Cox transformation with a parameter value (exponential function power) of O.55 we have

The Skewness is now practically 0 (0.0077).

It will be enough to transform the input data with this function so that the geostatistical tools work properly. In Geostatistical Analyst, there is no need to transform the input data. Just indicate the transformation to be done and the data will be transformed automatically before performing the geostatistical calculations, then the results will be transformed with the inverse transformation automatically.

If you wonder how we found the value 0.55, it is not complicated. Each time you change the value of the parameter, the display is recalculated. You immediately see the value of Skewness. By iterations, you will approach the value 0.

In the next article we will discuss another tool of the exploratory analysis of spatialized data: the QQ-plots (quartile-quartile diagrams).

]]>

Among the different alternatives offered, Google and Esri worked closely together to provide a replacement software as well as training to all users of Google Earth Enterprise and Google Maps Engine technology.

ESRI, published a free software called “ArcGIS Earth” in December 2015, which is an interesting alternative to the not quite free option of ArcGIS Online. The product is an office application freely available and installable, which enable 2D and 3D visualization easily .

Beta version was made available for downloading.

**Downloading** **ArcGis** **Earth**

To download the Beta version, go to the website ArcGIS Earth Beta Program . The Beta version is public, but you will, however, need to create an account , if you haven’t already set one on the ArcGIS Online platform .

Go to https://www.arcgis.com/home/signin.html and click the **Create** **a** **public** ** account **button

- Once your account is created, start the connection .
- Go to http://www.esri.com/landing-pages/arcgis-earth and click
**Sign in for Beta.** - Download and install ArcGis Earth.

**Launching** **ArcGis** **Earth**

Launch the application.

arcgis earth

Login by clicking ** Sign in** . Enter your ArcGIS Online account connection data .

If you are correctly connected, your account appears instead of ** Sign in** and you are ready to run the software.

**The ArcGIS** **Earth** **Interface**

**The toolbar**

The toolbar offers the following features:

- Adding data
- Drawing tool
- Measurement Tool
- Screenshot
- Send by email
- Printing
- Maps selection

Most of the options are very explicit. Here we will discuss the available maps and the option Add Data.

**The** **available** **maps**

In the beta version, the available maps are:

- Topography

The topographic map includes administrative boundaries, cities, hydrographic and physiographic features, and parks, points of interest, transportation networks and buildings.

- Imagery

The Imaging world map is a detailed aerial image layer, designed as a base map for different maps and applications.

- Imaging and labels

Same layer but with display of place names

- streets

I have not yet found information about the data source used for this base map.

- Canvas Dark Grey

Map background “rear – neutral plan” to superimpose and enhance other data layers.

- Grey scale

Same as the previous but in shades of light grey.

- National Geographic

General background map concerning educational and informative features

- Oceans and bathymetry

When you need something more specific than a flat blue representing the sea and the oceans .

- Land with tags

This is the 3D base map, the ArcGis Earth DTM .

- OpenStreetMap

By default and without having to install plugins? ESRI would have included the OSM interest?

**Add** **data** **to ArcGIS Earth**

Click the + tool to open the dialog to add data.

The first option allows adding data on line (via URL). Entering the URL allows you to specify an available source on line (ArcGis Portal).

The second option allows adding local data. Adding Files allows you to view KML / KMZ / SHP files present on your hard disk or any other media .

The third option allows adding ArcGIS Online data.

]]>Now we will discuss the system used for the North African theater.

The only ones detailed maps available for the Maghreb countries (Morocco, Algeria, Tunisia) were the French pre- war maps (1920-1936).

The problem of these maps was basically the mesh in grades relative to the meridian of Paris, very French feature. The simplest solution found was to overprint on the original maps a mesh in meters, calculated relative to the Greenwich meridian.

Therefore we find in these maps an original mesh in black colour (not to be used), and the mesh used during the conflict 1939-45 in purple. The latter is the one used for georeferencing these maps.

**NW Africa Grid projection** **management** **in** **ArcGIS**

You will not find this projection within the available as standard with ArcGis.

Once the projection is created, it will not be necessary to enter the transformation methods towards the usual systems (WGS84, NTF, and RGF93) for other projections of the conflict. Indeed, the maps of the Maghreb of that period are based on the Clarke 1880 ellipsoid, as well as the metropole projections (Lambert I, II, etc.). Therefore we will be able to use the NTF processing for these maps.

The parameters of the NW Africa Grid projection are as follows :

**False_Easting** **1,000,000.0**

**False_Northing** **500,000.0**

**Central_Meridian** **0 ° E**

**Standard_Parallel_1 34 ° N**

**Scale_Factor** **0.9994**

As for the geodesic system, the parameters are those of the present data in the ArcGis list:

**Name: GCS_NTF**

**Angular Unit:** **Degrees**

**Prime Meridian: Greenwich**

**Datum: Clarke_1880_IGN1**

**Spheroid: Bessel 1841**

**Semi major** **Axis: 6378249.2**

**Semi minor** **Axis: 6356515.0**

**Inverse Flattening: 293.4660212936265**

Click on the following link to download a file . prj with all the necessary definitions.

To assign this projection to the data block or to a GIS layer, open the window for defining coordinate systems and click on the import button:

**Setting** **up transformations** **in** **ArcMap**

The transformation of the GCS_NTF datum is done through a standard transformation available in ArcMap.

Click on the transformations button and select the desired transformation.

**NW Africa Grid projection** **management** **in** **QGis**

Technically with QGis it’s much more simple than with ArcGis. If you download one of the maps with the NW Africa Grid available in the Maps page, you won’t have to do anything else.

QGis reads the file .aux of ArcGIS present in the download and automatically creates the corresponding custom projection. If you open the menu *Preferences**->**Custom*** projection** you will see:

NW Africa Grid projection war generated from the Arcgis file .aux

You could be satisfied with such a result, but in a few days, the title *SRC* *Generated* followed by a set of parameters won’t mean much to you.

Therefore, you should save the parameters with a more explicit name:

- click the
**+**button (addition of a projection) - in
**Name**return*NW Africa Grid / NTF* - in
**Settings**copy and paste those of the created SRC - + proj = lcc + lat_1 = 34 + lat_0 = 34 + lon_0 = 0 + k_0 = 0.9994 + x_0 = 1000000 + y_0 = 500000 + a = 6378249.2 + b = 6356515 + units = m + no_defs
- click OK

In the list of available screenings you can enter NW Africa Grid in the filter and find simply the location of this projection.

**ATTENTION**! **The downloaded** **files** **have** **a** **georeferencing file** **(World) with** **the extension.** **jgwx** **(** **generated** **by ArcGis).** **QGis, for** **the time being, does** **not** **recognize** **this** **extension.** **You** **must** **modify it** **to** **jgw** **,** **before** **loading** **an** **image, so that the** **georeferencing** **is** **taken** **into** **account** **.**

]]>

Let’s analyse here a tiny part, scanning the base map of the German Army during World War II (2800 documents) and how to integrate it in your preferred GIS (ArcGis or QGis).

**Access** **to documents**

Go to http://www.davidrumsey.com/luna/servlet/view/all and start by registering. Do not panic, you enter a name, a password, an email address, and that’s done . No confirmation email or other data to provide.

On the left banner, you can click to select a part of the collection.

If you click on Generalstab des Heeres you will have the subset corresponding to the Military High Command (2824 documents):

Now if you click on another element (the banner has been updated according to your selection ), for example Military, you will only have 155 military maps within Generalstab des Heeres documents. And so on: if you click on Leeds, you will only have maps of the city of Leeds.

So much for navigation. Now, to recover the corresponding raster, for example for the city of Sunderland:

Click the ** Export** button

Select the largest definition. A message tells you to wait …

Then the file is available for downloading . Do not forget to change the default in *Save**the**file**…*

And, your file is available in your download directory.

However, the image is not georeferenced. To be able to integrate the image in your GIS you have to georeference from the grids present on a map. But first, you have to define the coordinate system.

**The** **Gauss-Kruger** **3** **degrees** **system**

For any information, you have this framed on the map:

Translation : Gauss- Krugger mesh zone 119.

The Gauss- Krugger projection is similar to the UTM projection. However, it can have time zones from 3 or 6 ° of amplitude. During the Second World War, Germany used the 3 ° time zones.

Here is a small synthetic table of 3 ° time zones for Europe :

The top line gives the central meridian of the zone, the line below the zone number.

Among the available maps you will find maps made with the time zone 119 and the time zone 0.

The parameters for the time zone 119 are

For the time zone 0, you have to replace the “central meridian : 357.0” with 0.

This is for the projection. Now let’s deal with the ellipsoid. This information is not provided in the maps, but I give it to you: Bessel 1841

The parameters of this ellipsoid are

- a = 6,377,397.155 m
- f = 1 / 299,152 815 351 323 3 (0.003 342 773 154 ± 0.000 005)
- b = 6,356,078.963 m

Last problem, the geodesic system. The geodesic system used is the German triangulation. To transform this triangulation into WGS84, we must transform 3 parameters

delta X = 631

delta Y = 27

delta Z = 446

As expected, the average processing error is approximately 20m. Do you do not expect miracles. With the folds of the paper cards and other sources of error, it is likely to get a hundred meters of difference .

**Gauss-Kruger 3** **degrees** **projection** **with ArcGis**

Projection files do not exist by default in ArcGis. We need to create them.

Open ArcMap

Right click on the data block, open the Properties window, tab coordinate system.

Click the *Add**Coordinate**System**-> New ->**coordinate**systems**projected*

Give a meaningful name with the time zone number, select Gauss Kruger (Or Universal Transverse Mercator) in the list of projections, and enter 500,000 as ** False_easting** and 357 as

Click the ** Edit** … button

and select the system *Deutsches*** Hauptdreiecksnetz** ( German triangulation network ).

Click **OK** and **OK.**

Your document is ready to georeference your image.

Load the image in ArcMap and activate the toolbar “georeferencing” if this is not already done. Click OK on the warning message for the absence of coordinate system.

You will return at least four points, in the four corners of the map, at the crossroads of the map’s grid.

For the upper left corner, for example, click on the tool “add a calibration point” of the “georeferencing” toolbar, then click on the crossing of the lines on the map and click with the right button. A window opens to enter manually the XY coordinates.

For X the coordinates, the map’s label reads 119600. This figure is broken down in two parts: the first 119 is the number of the time zone, the second 600, is the X coordinate of the point, in km. As we work with units in meters you must make the following transformation 600km to m = 600000.

in the case of the Y coordinates , the labels are expressed in km. Here 6089. We return this value in m: 6089000.

Repeat this operation with the other 3 points. Then, in the georeferencing toolbar, from the drop-down menu, click Rectify to create a new georeferenced image in tif format.

Now you can load this image in your different projects. When you perform this task, since the geodesic system is different from the one of your projects (WGS84 or assimilated), a warning message will appear.

Click on the button “transformations” to enter the transformation parameters between the Deutsches Hauptdreiecksnetz and the GCS WGS84 system

Click on New, and then enter the three parameters of the geocentric transformation : 631, 27, and 446. Then OK and OK.

Your image is displayed now in your document and is superimposed on the current layers.

**Gauss-Kruger 3** **degrees** **projection with QGis**

** **

Using QGis, the projection management is much simpler. Just create your custom projection that contains all elements: projection, geodesic system, transformation.

Before loading or georeferencing your image, create your two custom projections for the 0 and 119 time zones.

Click Preferences -> Custom Projection menu

Click the + button to add a new projection.

In the field name enter, for example, ** Gauss_kruger_3degres_119** for the time zone 119.

In the Settings field, return

*+**Proj**=**tmerc**+ lat_0 = 0 + lon_0 = 357 + k = 1 + x 0 = 500000 + Y_0 = 0 +**=**ellps**bessel**+ units = m +**no_defs**+ towgs84 = 631,27,446,0,0,0,0*

Click OK.

Repeat the operation for the time zone 0 in returning ** Gauss_kruger_3degres_0** for the name and

*+**Proj**=**tmerc**+ lat_0 lon_0 = 0 + = 0 + k = 1 + x 0 = 500000 + Y_0 = 0 +**=**ellps**bessel**+ units = m +**no_defs**+ towgs84 = 631,27,446,0,0,0,0*

for the parameters .

It’s ready! You can load your georeferenced image or open the Referencing tool (Raster -> georeferencing -> geo-reference)

Indicate the projection to use (one of the two that you just created) and return the same four control points as those we have seen above with ArcMap.

]]>

The QSGis2Web plugin provides an easy way to distribute and visualize your QGIS work as a web map using OpenLayers or LeafLet without having to master them.

With this plugin, in a few clicks you export your QGis project as an html page. You create a directory containing the index.html page and sub directories with everything needed to visualize your map, as well as the data used.

A typical QGIS project contains different data: vector and raster. QGIS2WEBf exports vector layers in GeoJSON format, creates the base of the web map using the current version of Leaflet or OpenLayers (optional). In addition, the plugin adds raster data as an overlay of images with an opacity cursor.

Install the **QGis2Web** plugin from the plugin manager ( ** Extensions -> Manage / Install Extensions** ).

The plugin is accessible from the ** Internet** menu

You can choose from several base map layers and define the initial extent of the map, as well as the dimensions of the map in your HTML document. To make it easier to export bulky layers, you can disable the automatic data loading option in your QGis project, or uncheck the layer view. Since the generated web map has a display control layer, you will be able to activate it once the creation of the map has been completed. If your layer has more than 1000 records, it will not be displayed in the preview window, but it will be included in the exported data.

You will find 4 panels, 3 tabs and a tool bar.

Let’s start with the last one

The plugin has two options for the code library to generate the HTML page. If you intend to use the plugin to create a base map and you intend to enrich or modify it later, you will obviously choose the option that suits you best. If not, it depends on the characteristics of your project. Indeed, the plugin tries to reproduce as best as possible your project (symbology, labels, transparency, …). But when using it, you will notice that not everything can be reproduced. ** Leaflet and OpenLayers** do not have the same possibilities, depending on the case your project will be better reproduced by one or the other.

If you change the option in the interface, the view of the preview window is updated automatically, and you will see the result with the new code library. On the other hand, for all the other modifications in the other panels, the preview update will only be performed if you click on the ** Update preview** button .

The ** Export** button generates the html page and exports the data as Json.

You can see a preview of the final return in this window. Do not forget to click the Update preview button to see the changes made to the plugin settings. Not all elements will necessarily be on the final scale. As you can see in the previous image, the legend bar has the final size, but not the map itself.

This window is not just an image, it responds as the final page will do (clicks, highlights, etc …)

This panel allows you to configure two things:

- the fact that the layer can be displayed by default or not: if you check the Visible box, the layer will be displayed as soon as the HTML page is loaded. If the box is not checked, your layer will appear in the legend bar and you will have to check its box in the HTML page to display it.
- the popup return windows with entity attributes: this option will only be applied in case you check
in the plugin general settings panel.*Show popups on hover*

Group management does not always work. If you have gathered the layers and you do not see them in this panel, separate the layers in your project.

The three options for shaping tool tips provide the following results:

You can export the result either to a directory on your computer, on an ftp site on your server. According to the case considered, click on the button… to define either the directory or the connection parameters.

The Mapping library location allows you to load the OpenLayers or Leaflet library into the directory that will be created, or to put a line of call for these libraries online. The first option is more bulky but safer for operation.

The ** Minify GeoJson files** option eliminates unnecessary spaces in GeoJson files. If your data is bulky, it’s a way to reduce their size.

The other way to reduce the size of the data is to play on the level of detail of the geometries. ** Precision** option allows generalizing geometries of line and polygon type. The

** Extent** allows you to define the dimension of the map when it is displayed.

** Max and min zoom level** define the zoom range allowed for the map.

** Restrict to extent**, if checked, prevents it from exiting the defined frame of the map.

adds a field to enter an address and position the map on it, using address geocoding.*Add address search*adds the layer legend bar.*Add layers list*user places a button that allows, by clicking on it, to center the map on the position of the user. Be careful, with Chrome this option only works if your map is hosted in HTTPS.*Geolocate*Highlights entities when you move the mouse.*Highlight on hover*allows you to configure a search field on an attribute of one of the layers. Once a value is entered in this field, if the value is found in the attribute table, the map is centered on the entity*Layer search*set the coordinate system of the output map. If the box is checked, the system used by the map will be the same as that of the QGis project. By default, if the box is not checked, it is the spherical Mercator system (EPSG: 3857) that will be applied.*Match project CRS*adds a measurement tool to the resulting map.*Add measure tool*if checked, displays a tool tip with attributes*Show popups on hover,*allows you to choose the output map template. The full-screen option will create a map that will have the size of the user’s screen; canvas-size will create a map of the same size as your map window in your QGis project. You can add other templates to the user / name / .qgis2 / qgis2web / templates directory.*Template*

This panel allows you to define one or more base maps. You can make a multiple selection by pressing the CTRL key and clicking an item of the list. The result on the map produced will be a block in the legend to activate the desired background.

Part of the returning final map must be prepared directly in your QGis project.

**In the Project-> Project Properties-> General tab** you have three properties of the map to configure: project title, highlight color and background color.

The title will only appear if you select Leaflet as your library

**In** Layer **Properties -> General** you can change the name text of the layer, which will appear in the legend bar of your map, to make it more understandable, as well as define the scales between which the layer will be displayed.

**In** Layer **Properties -> Style** you can set the style of your layer among a single, categorized or graduated symbol. According to the designers of the plugin, the 2.5D style should also work, but I did not succeed … To follow.

**In properties of the layer-> fields** you can define the name that will be displayed for each field, filling the column Alias.

*The Edit Tool field* controls what will appear in the tool tips if you select the ** Show popups on hover setting**. If you click on the value of a box in the

You can choose one of the following three options (the others have no effect on the generated map):

- Hidden: the field will not appear in the tool tip
- Edit text: the default option, displays the value of the attribute field in the tool tip
- Photo: If your field contains a link to an image, the image will be included in the tool tip.

An example of the last option is shown here:

Finally, the labeling of your QGis project will be exported to the resulting map, with some limitations:

- The expressions for labels are not supported,
- The buffers around labels are only exported with OpenLayers 3,
- The backgrounds and borders are only exported with Leaflet
- The export indicates the font used, but does not include them in the exported directory. If the user does not have the font used, the label will not appear.

]]>

” *The sub-soil of our cities has become a real Gruyere whose holes serve as pathway to a growing number of networks.*

*Power supply, telephone, heating, gas, optical fiber, water … All these networks intertwine, coexist, overlap and some have been there for so long that even the memory is lost and their managers do not know the exact location.* *To open a trench on the public road becomes more and more risky.* *So much so that after very serious accidents, the MEEDTL has decided to put in place a very large reform.* *A special agency will list all the network managers, contacts and ultimately the areas of implementation.* *It will be consulted for work project declarations (DT) and declarations of intent to start a new work (Dict).*

*In the process, the regulation of these declarations is redesigned.* *All new network works will be georeferenced and subject to three accuracy classes.*

*The goal is simple: to reach by 2019 an accurate knowledge of the location of everything that runs under our feet … For more security and reliability.* “

All the operators of the various networks are required, from January 2019 to respect the obligation of setting a georeferenced map of the underground networks in urban units. For networks outside urban areas, the deadline is January 1st 2026.

The job seems simple at first glance. Three classes have been defined:

Definition of the three network classes

**Class A**

A structure or section of a structure is classified as class A if the maximum uncertainty of location indicated by its operator is less than or equal to 40 cm if it is rigid, or to 50 cm if it is flexible. The maximum uncertainty is raised to 80 cm for underground civil engineering works attached to installations intended for the circulation of rail transport vehicles or guided when these structures were built before January 1^{st}, 2011.

**Class B**

A structure or section of a structure is classified as class B if the maximum uncertainty of location indicated by its operator is greater than that relative to class A and less than or equal to 1.5 m.

**Class C**

A structure or section of a structure is classified as class C if the maximum uncertainty of location indicated by its operator is greater than 1.5 m, or if its operator is not able to provide the corresponding location

Let’s leave aside, for the time being, the technical aspects of measuring uncertainty and move on to the first major problem of this project. In short “** if the maximum uncertainty of the location cited by its operator is greater …**” .

**Definition of LOCALIZATION.**

Everyone understands this sentence without having to think about it. If I have a gas pipe under the sidewalk, parallel to the edge, I can classify this pipe in class A if its position is known with less than 40 cm of uncertainty. In front of me the sidewalk is 70cm wide, so necessarily the pipe can be classified as class A. It would be so simple, only if it were true!

First thing that should put us in the ear: why in the example above ask 40 cm of precision for a measure that everyone can do with a centimeter with a precision of at least 1cm?

The answer is much more complicated than the question. To know what the meaning of the word localization is we should dig deeper.

But I can give you part of the answer immediately: the localization of the pipe is not a function of the sidewalk, or any other remarkable element near the pipe.

First text to be aware of:

The text defines two types of objects, point objects and linear or polygon type objects. For these second, the localization concerns the identifiable points which define the lines or the polygons. The localization of a point, according to this decree, is as follows:

Locating a network point

7.1. Punctual geographical objects

If indicated by the specifications, some geographical objects can be considered as punctual. Therefore they are determined by the planimetric coordinates and if needed by the altimetric coordinates of their point of reference. The accuracy class applies to the difference between the coordinates obtained for each point by a control measure and the coordinates provided for those points; the possible support and contour points included in the survey being excluded from the points tested.

Our sidewalk has disappeared and we have to provide planimetric coordinates. In other words, we must provide the latitude / longitude of the points constituting our conduct, projected on a plane.

With regard to the accuracy of these coordinates, the text points out:

Precision measurement of the localization

6.1. Total accuracy class

The precision class defined above applies to the differences between the coordinates provided for each point and those obtained for the control measures. The total error results from the arrangement of the internal errors, the errors of attachment, and the error specific to the legal reference network. Therefore, the total error cannot be less than one of these three sources of error, and, in particular, the error of the legal reference network, as specified or as a result of the discrepancies noted when attaching.

There I feel that I’m losing you! The text speaks of three types of error:

- internal errors: these are measurement errors, for example the accuracy of the GPS used.
- the errors of attachment: these are, for example, the errors of seizure during the integration in the database of the network.
- the error specific to the legal reference network: it is the positioning error due to the projection of the geographic coordinates (latitude / longitude) in planimetric coordinates (X / Y).

The legal reference network is defined by the following decree:

Decree No. 2000-1276 of December 26^{th},2000 implementing Article 89 of Law No. 95-115 of February 4^{th}, 1995, as amended, for the planning and development of the territory relative to the conditions of execution and publication of survey plans undertaken by public services – Article 1

This article defines the planimetric coordinate system to be used by all utilities:

Planimetric reference systems

The national reference system of geographic, planimetric and altimetric coordinates cited in article 89 of the aforementioned law of February 4^{th}, 1995 is defined as follows:

- – Geographic and planimetric reference systems:

ZONE | GEODETIC SYSTEM | ELLIPSOID ASSOCIATES | PROJECTION |

Metropolitan France | RGF93 | IAG GRS 1980 | Lambert 93.
Conic compliant 9 zones. |

Guadeloupe, Martinique | WGS84 | IAG GRS 1980 | UTM North time zone 20. |

Guyana | RGFG95 | IAG GRS 1980 | UTM North time zone 22. |

Reunion | RGR92 | IAG GRS 1980 | UTM South time 40. |

Mayotte | RGM04 | IAG GRS 1980 | UTM South time 38. |

In the table above, the “9-zone compliant conic” are added to the list of projections, as far as it concerns metropolitan France.

**First trap: the change of coordinates**

The definition of the Lambert 93 projection as a reference system is not anecdotal. It is part of a process of moving from local coordinate systems to global coordinate systems. For more details on these systems, you can read Precision, uncertainty and linear alteration of geographic data (1) and (2) .

Let’s remember that the Lambert system 93 (global or 9 zones) has a network-specific error of the order of 10 cm, well below the uncertainty associated with the network class A.

On the other hand, the Lambert 1,2,3 and 4 projections as well as the UTM / WGS84 projections have a network-specific error of the order of one meter, well above the uncertainty of the network class A.

It is this difference of error that motivated the transition of all public utility data to Lambert 93 a decade ago.

The problem is that not all utilities have abandoned these reference systems internally. There are still some who have treatment networks and work with Lambert 1, 2, 3 or 4, but transform to Lambert 93 when they have to exchange with other services. As surprising as it may seem, I have already heard several geomatics managers saying that they respected the requested accuracy (<40cm) since they converted their Lambert 1 or 2 data to Lambert93.

In the articles cited above you will find numerical examples proving that this does not reflect the reality of things. Let’s take a comparison here with other types of measurement.

You use a scale calibrated in kilograms, or a thermometer in degrees. Can you guarantee a weighing to the nearest gram or a temperature of one tenth of a degree? Of course not. The uncertainty related to the Lambert 1 to 4 projections is metric, that is to say that everything to the right of the comma is false. Can you guarantee a localization to the nearest decimeter? Well, no.

As for the total error mentioned above, which cannot be less than one of the three sources of errors, in a processing chain the total error for the result cannot be less than the maximum error of one of the stages of treatment.

Warning!

Since you include a step in Lambert 1, 2, 3 or 4 in your process, the resulting processing error will be at least equal to one meter, even if you provide this result in Lambert 93.

Therefore it is impossible to classify as an A network elements using at one time or another an old Lambert projection.

**Second trap: focusing on linear alteration.**

No projection can keep all distances. We, then, introduce the notion of linear alteration to measure the distortion of distances caused by the different projections.

*Linear Alteration = (projected distance – ellipsoid distance) / ellipsoid distance*

Linear alteration is expressed in centimeters per kilometer.

For example, the 4 Lambert area projections specific to the NTF, were calculated so that the linear alteration is better than 1 per 1000, ie less than 1 meter per kilometer. For the Lambert 93, the linear alteration is from -1 m / km to +3 m / km.

The linear alteration is local and variable in each point of the map.

To avoid this quite wide range and reduce to values below 1m / km, the IGN has set up 9 areas called CC42 to 50.

These projections were introduced to reduce sharply the linear alteration induced by the large width of the Lambert application zone93.

Therefore their use assumes measures expected to be more accurate on a blueprint.

It is not justified for plans whose accuracy is lower than the linear alteration, or for the digital surveys, for which the linear alteration can be entirely corrected in a simple way.

On the contrary, the border discontinuities of the nine zones complicate digital applications and can generate significant additional costs compared to a solution using Lambert93, in particular with data in image mode.

Is linear alteration a source of uncertainty for our data in the information system? This is only the case if we do not use high-performance GIS tools. The main software used (ArcGis, QGis, …) allow to choose how to measure distances: either on the projected or the ellipsoid plan. Simply choose the second option to remove the linear alteration of our measurements.

In any case, the linear alteration introduces no uncertainty for the localization of network objects. Therefore it is completely independent of the class of objects. It intervenes on distance measurement on a blueprint but never on the localization of objects.

]]>

The simplest way is to use an example. We have geometries that share the occupation of space

A spatial relationship function, such as ** st_intersects** , will answer the question “do these geometries intersect ?” TRUE or FALSE?.

A spatial processing function, such as ** ST_Intersection,** will extract the common part of the geometries returning as result a geometry :

Let’s suppose that we have two tables: rectangles and circles, and that we want to retrieve the result from this image. How does one design the adequate SQL query ?

By adopting the same approach as described in the second article of this series :

- which is the data I want to obtain ?: I want the resulting geometries originating in the intersection of circles and rectangles-> SELECT clause:

*SELECT**st_**intersection**(**circles.geometry, rectangles.geometry**) as geometry*

- where are they stored ? : in the circles and rectangles tables-> FROM clause:

*FROM*** circles**,

- which are the conditions I want to apply , spatial or not? select only entities that occupy common space -> WHERE clause:

* **WHERE**st_**intersects**(**circles.geometry, rectangles.geometry**)*

What makes the request :

*SELECT**st_**intersection**(**circles.geometry, rectangles.geometry**) as geometry*

*FROM**circles, rectangles*

*WHERE**st_intersects**(**circles.geometry, rectangles.geometry**)*

You can omit the WHERE clause and get the same result, except that it will take a lot more time. It is logical to limit the operation intersection of st_intersection to places where the geometries intersect.

Before discussing the spatial processing functions in detail, let’s do a little parenthesis. In office GIS, such as ArcGis, you, usually, work with two groups of different tools according to what you are going to process (a layer as a whole or a specific entity).

When processing the layer as a whole, you use the tools in the Toolbox. When processing the specific entities you use the ArcMap interactive tools.

An advantage of SQL is that you work with only one tool. Let’s return to the previous query to apply it at the intersections between a layer map_ risks ( in beige) and flooding areas ( in blue)

We can use the query :

*SELECT**st_**intersection**(**map_risk.geometry, flooding_zones.geometry**) as geometry*

*FROM**map_risk, flooding_zones*

*WHERE**st_intersects**(**map_risk.geometry, flooding_zones.geometry**)*

To intersect all the present entities in the risk map with flooding areas:

Where only the area with a Maximum risk for flood areas

*SELECT**st_**intersection**(**map_risk.geometry, flooding_zones.geometry**) as geometry*

*FROM**map_risk, flooding_zones*

*WHERE**st_intersects**(**map_risk.geometry, flooding_zones.geometry*** )** AND

map_risk.zone = ‘max’

The only difference is in the **WHERE** clause where we add ” *AND*

*map_risk.zone*** = ‘max’** «

If you take a look to the help page of ArcGis Overlay tools ( https://pro.arcgis.com/fr/pro-app/tool-reference/analysis/an-overview-of-the-overlay-toolset.htm ) you will find a description of a series of spatial processing functions:

They are seven: Erase, Identity, Intersection, Spatial joint, Symmetric difference, Aggregation and Update.

In SQL we will use only three functions: st_difference , st_intersection and ST_Union to build the equivalent queries.

Firstly, let’s discuss these three functions and their equivalent in the ArcGis Toolset , then we will discuss how to get the equivalence with others tools from the Toolset combining the three basic functions .

It bears the form st_ difference (geometry A, geometry B). This function returns the A geometry part that does not intersect the B geometry.

In the risk mapping and flood zones example we can wish, for example, to see the part of the classified areas as maximum risk that are not floodable:

SELECT ST_ Difference (map_risk.geometry, flooding_zones.geometry) as geometry

FROM flooding_zones, map_risk

WHERE map_risk.zone = ‘max’

The result of the query appears in yellow.

It bears the form ST_ intersection geometry, B geometry). This function returns the part of the A geometry that intersects the B geometry.

We have already detailed the query

*SELECT**st_**intersection**(**map_risk. geometry, flooding_zones.geometry**) as geometry*

*FROM**map_risk, flooding_zones*

*WHERE**st_intersects**(**map_risk.geometry, flooding_zones.geometry**)*

in the previous paragraph dealing with batch and interactive functions. But we will complete the use of functions with another element. In the examples used so far we get as result of the query only geometries. But most of the time we, also, need to recover the attributes of the concerned entities.

For example, in the resulting entities of the query we want to know the version of “flooding zones” as well as the risk level. We add these fields in the SELECT part of the query

**SELECT** flooding_zones.version , map_risk.zone , st_ intersection ( map_risk.geometry , flooding_zones.geometry ) as geometry

**FROM** map_risk, flooding_zones

**WHERE** st_intersects (map_risk.geometry , flooding_zones.geometry )

and the result will be:

Attributes fields are added in the resulting table. Each geometry will have the value of the attribute of the geometries that intersect at that place.

It bears the form st_ union ( A geometry, B geometry). This function take each A geometry and merging with the B geometry/es by merging the points that compose them.

If you have x geometries in A, you will have the same number of geometries in the result. It’s not the number that changes but the geometry of each entity of A that associates with the space occupied with the B geometry (ies).

This SQL function is confusing, especially in English, with the operation Union (in French Aggregation) of the ArcGis Toolset. Let’s see immediately this one to avoid any misunderstanding.

This function allows recovering all the space that is occupied by the A and B geometries:

- areas in which the geometries intersect
- areas where only A geometries are present
- areas where only B geometries are present

The following scheme shows, by imputing a layer A with two rectangles, and a layer B with a circle .

The result of the union of these two layers includes 5 geometries:

- the two parts of the rectangles that do not intersect with B
- the two parts of the rectangles that intersect with the circle
- the part of the circle that does not intersect with the rectangles

We have seen that the function ST_Union keeps the same number of A geometries A in the result. With Union Toolset, there is always more geometries in the result than in the layer A, the number depending on the intersection areas of the two layers.

We have discussed the three SQL basic functions for spatial processing. In the next article we will see how to combine these basic functions to get functions such as Identity , Aggregation and Update .

]]>Before discussing the different functions we must remember what we are going to work on. The different functions have, as parameters, two different geometries. But the geometries are not of the same type (we also refer to dimensions): we have three major types (point, line, surface) and three derived types (multipoint, multiline, multisurfaces). The distinction is important because the functions work on the determination, for each entity (geometry) of what is considered inside as well outside the entity. In the case of a layer of polygons you see right away what we are talking about and you will have no problem distinguishing the interior polygons from their outside.

In the case of points, it starts to get tough because the inside of a point is a little harder to design. And it becomes almost metaphysical when we talk about the interior of a multipoint entity.

This image can represent three point entities, in the case of a layer of points, or a single entity constituted by three points, in the case of a multipoint layer. But in both cases, the interior consists of the point or points alone. For example, in the following figure, does the line cross the geometry of the multipoint layer?

The answer is NO. To traverse a given geometry, there must be a common “internal” part to both geometries.

In the following figure, however, the answer is YES, the line crosses the multipoint entity.

You must understand that the interior of a line is the line itself, as for the points.

It is possible to separate the spatial relationship functions into two major groups: those that apply to all types of geometry and those that apply only to certain types.

For a detailed description of the functions, refer to the Postgis documentation: https://postgis.net/docs/manual-1.5/reference.html#Spatial_Relationships_Measurements

** **

The intersection, the difference, both of area surface or content and the touch functions accept both parameters of the function regardless the type of geometry (basic or multiple). We can therefore calculate the intersection of a multipoint layer with a polyline layer, polygons and multipolygons, etc.

This is the most generic function. It returns TRUE if the inside of a geometry occupies the same place as another inner point of the second geometry, in other words if they have at least one point of space in common. If other functions such as st_Crosses, st_Overlaps, st_touches, st_Within, or st_Contains return a TRUE value, st_Intersect will also return a TRUE value.

The following example shows the result of the query to find the plots that are affected by a flood zone of maximum risk:

SELECT plots. *

FROM plots, map_risk

WHERE ST_Intersects (plots.geometry, map_risk.geometry)

AND map_risk.zone = ‘max’

Any parcel that shares even one point in the space with the flood zone is selected.

Is the reverse function of st_intersect. It returns TRUE if the inside of a geometry does not occupy the same place as another internal point of the second geometry, in other words if they have no point in common.

The same result is obtained with the st_intersects command with the query:

SELECT plots. *

FROM plots, map_risk

WHERE ST_Disjoint (plots.geometry, map_riskgeometry) = false

AND map_risk.zone = ‘max’

It’s a little far-fetched to make a reverse query, but if you’re really looking for disjointed geometry, it’s better to use st_Intersects = false, because a query using st_intersect is performed with spatial indexes while st_disjoint traverses sequentially all the entities, therefore response times will be significantly different!

These two functions test whether a geometry is totally inside another. st_Within (geomA, geomB) returns TRUE if the first geometry (geomA) is completely included in the other (geomB).

st_Contains (geomA, geomB) returns TRUE if the second geometry (geomB) is completely contained in the first one (geomA).

The following example shows the result of the query to find plots that are totally included in a flood zone of maximum risk:

SELECT plots. *

FROM plots, map_risk

WHERE ST_Within (plots.geometry, map_risk geometry)

AND map_risk.zone = ‘max’

Only plots with all points within the flood zone are selected.

We get exactly the same result with the query

SELECT plots. *

FROM plots, map_risk

WHERE ST_Contains (map_risk.geometry, plot.geometry)

AND map_risk.zone = ‘max’

We have discussed an example of this function in the previous article. This function returns TRUE if both geometries have at least one point in common but their interiors do not intersect. In other words, only the outlines have one or more points in common.

**The suitable functions according to the type of geometry**

St_Equals only works on geometries of the same type. It returns TRUE if the two geometries share all the points of the space, ie if all the XY coordinates of the first geometry are identical to the coordinates of the second geometry. The order of the entities in the layer does not intervene at all in the comparison.

St_Crosses does not apply to all combinations of geometries. It applies to the following combinations:

The layers of points are excluded. The function returns TRUE if the result of the intersection is found inside the two geometries

If we go back to our previous example, the following figure shows the result of the query to find plots which are partially affected by a flood zone of maximum risk:

SELECT plots. *

FROM plots, map_risk

WHERE ST_Overlaps (plot.geometry, map_risk.geometry)

AND map_risk.zone = ‘max’

Only plots with points inside AND outside the flood zone are selected.

Unlike other functions, this function does not return TRUE or FALSE but the value of the smallest calculated distance between the two geometries.

If a part (or all) of A geometry is inside the B geometry, the calculated distance will be 0.

The following example shows the result of the query to find plots within 200 meters of a flood zone of maximum risk:

SELECT plots. *

FROM plots, map_risk

WHERE ST_Distance (plots.geometry, map_risk.geometry) <200

AND map_risk.zone = ‘max’

But this function is mostly used to calculate distances between geometries because it does not use spatial indexes and does a sequential processing that takes much longer. To obtain the same result as in this figure we use the function St_DWithin.

The function takes the form St_DWithin (geomA, geomB, Distance). It returns TRUE if the smallest distance between geomA and geomB is less than or equal to Distance.

For the previous example the query takes the form:

SELECT plots. *

FROM plots, map_risk

WHERE ST_Distance (plots.geometry, map_risk geometry, 200)

AND map_risk.zone = ‘max’

And we get the same map result.

This function is very useful for answering a question such as “How many plots are in a buffer of 200 meters around this stream? or that road?”, without having to calculate the buffer. We simply test the distance between the geometries.

I left for the end these two functions which are almost equivalent to St_Contains and St_Within. The result will almost always be the same except in some very special cases. It’s a little bit twisted, but we must go back to the notion of the beginning of this article, the inside and outside of a geometry.

When we have a polygon, the inside is the space contained by the edges of the polygon. But this imaginary line that serves as an outline is not part of the interior, nor of the exterior either. It’s a limit.

When we have a line, even if it does not have a dimension “thickness”, the line is considered to be the “inside” the geometry.

For example, if we have a regional administrative boundary, and this limit is a road that is contained in a layer of polylines, the function st_contains (polygon, line) will return FALSE because the inner area of the line will not be inside the polygon (it will be on the contour).

The st_Covers function works differently. It will find that the boundary of the polygon “covers” the stretch of road. The st_CoveredBy function tries to find out if the geometry A is covered by the geometry B and works in the same way as st_Covers.

]]>The SQL language has been a victim of the GIS software deficiencies for decades. The “flagship” GIS format between1970 and 2000, the ESRI shape file applied a reduced version of the standard SQL. It was impossible to perform sub-queries using other tables; we were confined to the fields of just one table.

To that end we must add the SQL wizards put in place by the different software , such as the ArcGis wizard:

In fact, we have reduced the SQL language to, just, the WHERE clause proposing an ultra- simplistic version that was supposed to free the user from being knowledgeable with the SQL language.

During the last couple of years this situation has clearly improved. Do not quote as example anything but the QGis database manager:

which allows to use all the scope of SQL, of its extensions such as Postgis, and to recover the query result and to display it in the window QGis map cartographic window .

This assertion is true … only if you do not know the basics of SQL at all!

Consider the SQL query of the final example of the previous article:

**SELECT** **sum (** **prize_terrain** **) :: numeric :: money,** **propertyclass**

**FROM** **plots** **,** **flood zone**

**WHERE** **st_intersects** **(** **plots.geometry, flood_zone.geometry** **)**

**GROUP BY** **propertyclass** **;**

As with all SQL queries you have two compulsory lines:

**SELECT**and an information list that we wish to have as result**FROM**and a list tables list where the information is located

Then an optional line

**WHERE**and the conditions to extract the outcome information

and finally one or more lines that format the outcome information (GROUP BY, ORDER BY, …)

If you take the time to answer these four questions before you start writing an SQL query, you will realize that the writing is quite intuitive:

- which is the data I want to obtain ? (-> SELECT clause)
- where is it stored ? (-> FROM clause)
- which are the conditions I want apply whether spatial or not? (-> WHERE clause)
- which format do I want for the results? (-> GROUP BY, ORDER BY …)

Let’s discuss an example: I want the addresses of all the plots bordering mine.

To build the query I ask myself the following questions:

- which is the data that I want to obtain?: I want the address of the plots (number and street) -> SELECT clause:

*SELECT**num_call**||**‘|**|**address*

- where is this information stored ? : in the plot table -> FROM clause:

*FROM**plots*

- which are the conditions I want to apply , spatial or not? Just select plots that affect the plot with the plot_id = 1144-> WHERE clause:

* **WHERE**ST_**keys**(plots.geometry,** **??????)*

The spatial order tests whether two geometries touch each other. In terms of plots.geometry it will browse the whole table to test whether each record touches the second part of the order .

We build this second part following the same method :

- which is the data I want get? I want the geometry of a plot -> SELECT clause:

*SELECT geometry*

- where is it stored ? : in the plot table -> FROM clause:

*FROM**plots*

- which are the conditions I want to apply , spatial or not? the plot with the identifier 1144-> WHERE clause:

WHERE plot_id = 1144

We write this second part between brackets and replace the ?????? in the first part of the query

*SELECT**num_call**||**‘|**|**address*

*FROM**plots*

*WHERE**ST_Touches**(plots.geometry, (SELECT FROM geometry**plots**WHERE**plot_id**= 1144))*

If we execute this request in the database manager QGis:

We obtain the list of researched addresses, and if we load the result of the query in QGis we have:

The plot the 1144 plot in in yellow, plots blue are those returned by the request , with their respective addresses .

If you want to be completely convinced that SQL is actually intuitive and therefore saves you time , I invite you to get the same result to the one displayed here, but by using the classic QGis tools (non sql ) or those from ArcGis .

In the next article we will discuss the PostGIS spatial operators. We will neither use the usual path. As a rule, we start with the geometries defining operators, the definition of the SRC, etc.

But similarly as when we want to learn operations with numbers, in SQL, you do not start with the transformation into imaginary numbers but with the basic operators: addition, subtraction, division, multiplication … we will discuss the small group of basic spatial functions. They are, just, around ten among the thousand available functions with Postgis. A good understanding of these functions allows you to embark, without problems, in the spatial analysis with SQL. And regarding functions on rarely used numbers (such as BIT_count or MOD or OCT), you will, only, look for, when you really have the need to.

]]>

Now let’s look at some SQL queries, starting with an extremely simple example and, gradually, making it more complex. Suppose that the ultimate goal is to know the price of the plots, by type of property class, which are located in the flood zone.

Here, firstly, a simple request on the ** plots** table

With the query ** SELECT * FROM plots** we obtain as result all the records with all the fields of the table.

A little more complex, select only two fields of the table: the type of property and the price of the land:

Therefore, for each plot we have the value of the land and the type of property class.

** Let’s add** a little more: we can get the land total price with the query

For a more untestandable display you can convert the result to a monetary number with the following modification of the query: *SELECT sum (prix_terrain) :: numeric :: money FROM parcels;*

Now we have the total price of the plots in euros.

By modifying the query and adding a GROUP BY clause we can have the total price of each property class:

The result is the total price per property class, for all records in the parcel table.

But what if we wanted this result only for plots located in the flood zones?

**SQL request “spatial”**

The request:

**SELECT sum (prize_terrain) :: numeric :: money, propertyclass**

**FROM plots**

**GROUP BY propertyclass;**

can be modified by adding the flood zones table to the FROM clause

**SELECT sum (prize_terrain) :: numeric :: money, propertyclass**

**FROM plots, uninhabited areas**

**GROUP BY propertyclass;**

and a plot selection clause to retain only those whose geometry intersects the flood zones:

**SELECT sum (prize_terrain) :: numeric :: money, propertyclass**

**FROM parcels, uninhabited areas**

**WHERE st_intersects (parcels.geometry, zones_inondables.geometry)**

**GROUP BY propertyclass;**

We have the result we were looking for. Now I leave you the task to see all the operations to do with your favorite GIS software to get the same result.

You will agree that it’s much faster by writing this query.

Before going further, we must stop on an essential notion to perform the spatial analysis with SQL. What’s more complicated with this notion is that we all think we have it but, if we think it over, we realize how far we are from applying it in our everyday work.

If we list the possible data types in a database, we immediately think of numbers, strings, date type, and so on.

If I tell you now “geometry”, you will say, yes, of course, there is also this type of data. But somehow we place it a little apart. Yet it’s good when we understand that it is exactly one type of data as any other related to spatial analysis.

You will be able to perform a full spatial analysis with SQL when you discover that:

- if you can add two numbers you can just as well intersect two geometries;
- If you can cut (trim) a string, you can cut a geometry with another geometry;
- If you can find a date between two other dates, you can find a geometry covered by another.

When you want to perform an operation between numbers in SQL, the different operators come to you right away. Similarly, when you want to process a text string, a set of operations will appear to you. The purpose of this series of articles is to provide you with the equivalent for dealing with the geometries: a series of similar operations to text functions or arithmetic operators.

If you can clearly see all the operations that can be performed on the geometry type, you are ready to do spatial analysis with SQL and save valuable time.

]]>