5.10.8. Load Shape

<< Click to Display Table of Contents >>

Navigation:  5. Detailed description of the Actions > 5.10. TA - GIS - Geographical Information System >

5.10.8. Load Shape


Icon: clip1448


Function: loadShape


Property window:




Short description:

Load a .shp file.


Long Description:


This action loads a .shp file and all the related files the are typically “linked” to it (i.e. the .shx file, the .dbf file and the optional .prj file). If you want to load the same data, but without the geometry column, it’s more efficient to open the .dbf file using the clip1449  readXDF action (more details on this action in the section 5.2.30).



What’s inside a .shp file ?  


A .shp file contains a single table with a few columns. One of these columns is special: it’s the “geometry” column. Here is an example with a shape file that describes all the zip/postal codes in France (downloaded from here):




In the screenshot above, the column “lib” contains the usual name of the “postal codes” and the column “Geometry” describes the shape/geometries of each postal code. Inside a .shp file, one “Geometry” column contains a unique type of geometry (you cannot mix several types). The available geometry types inside a .shp files are:









Of course, Anatella handles all these geometry types. Inside the table in the above screenshot you see that the “Geometry” column contains a long string “AAHmEAAA4BXjM..”. This is the Base64 representation of the geometry. To see this geometry as a meaningful picture, just use the clip1451 “saveShapeGIS” action: You’ll find more details on how to visualize geoemetries in the section about the clip1451 “saveShapeGIS” action. To get more details about a specific geometry (such as its type: POINT, POLYGON, MULTIPOLYGON, etc. or its SRID), you’ll use the clip1453 GeometryInfo Action.


Inside Anatella, a geometry can be stored/represented using 5 different formats:


1.Point Coordinates "Latitude Longitude" (only for the POINT  geometry type)

This format is self-explanatory. The Latitude and Longitude must be stored in the same column, separated with a space char, in decimal degree. This is exactly what you see when you right-click on a Google Map: For example, when you right-click you see:





2.Rectangle "Latitude1 Longitude1 Latitude2 Longitude2"


This format is self-explanatory. The 4 numbers must be stored in the same column, separated with a space char, in decimal degree. This representation is only valid for RECTANGLE geometries. The first point is is the coordinate of the top-left corner of the RECTANGLE and the second point is the coordinate of the bottom-right corner of the RECTANGLE.


3.Geometry data in WKT format

“WKT” stands for “Well-Known-Text”. A WKT string can represent any type of geometry: POINT, POLYGON, MULTIPOLYGON, etc. You can create/draw WKT strings very easily using this interactive mouse-based editor:


Here is an example of WKT string that represents a single point:

POINT(3.7403 50.616)        


There is one disturbing fact about the WKT representation: the WKT representation is reversing the order of the coordinates compared to the traditional way of citing geographical coordinates: e.g. in the above WKT example, the first number (3.7403) is the longitude and, traditionally, the first number is the latitude. This is somewhat disturbing.


4.Geometry data in HEX format

This format is for compatibility with PostGreGIS. It can represent any type of geometry. You can easily recognize this format because it looks like a long string without many minuscule (small caps) letter (the only allowed chars in the string are: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F).


5.Geometry data in BASE64 format
This is the most common format inside Anatella for GIS information. You can easily recognize this format because it looks like a long string with a mixture of minuscule and majuscule letters. Inside Anatella, each different Base64 geometry inside a table can have a different TYPE (POINT, POLYGON, MULTIPOLYGON, etc.) and even a different SRID. …but it’s strongly not advised to do so because other file formats are much more limited: e.g. the .shp format only support one unique type of geometry and one unique SRID per file.


The most important parameter of the clip1455  loadShape action is the parameter P5 that is named “SRID”. The SRID is the name of the mathematical projection/transformation that is used to project the 3D coordinates on the earth (i.e. the latitude, longitude and altitude) on a planar map (that has only 2 dimensions). The most common projection/SRID is the “4326” SRID that corresponds to the standard “decimal degrees” used inside most modern on-line maps. You’ll find more details on the SRID here and inside the section 5.10.10. about the ReProject Action.

Many Anatella actions are only working with the “4326” SRID, so the parameter P6 allows to directly re-project all your geometries so that they are correctly rendered in the “4326” SRID. For this re-projection to work properly, you must first give the correct value for the parameter P5.


If your shape files are not using the “4326” SRID, you’ll need to specify their SRID using the parameter P5. You can guess the value of the parameter P5 (i.e. you can guess the original SRID of your shape files) using this 5-steps procedure:


1.Click the button P3.


2.In the toolbar of the “Spatialite Gui” tool, click the clip1456 button:



3.In the toolbar of the “Spatialite Gui” tool, click the clip1458 button:




4.Select your .SHP file inside the file explorer.


5.The guessed original SRID of your shape file is here:





Here is an example of re-projection for the map of FRANCE (click P2 to display your shape file):

























Classical view of the map of FRANCE

using the SRID=2154. The X and Y axes

are distances in meters.


Reprojection of the map of FRANCE in

the SRID=4326. The X and Y axes are longitude and latitude in decimal degree.