More frequently we have a cohabitation of ArcGis
with QGis. We keep ArcGis for heavy operations while
QGis is used for lighter work , even if QGis is quite capable of
assuming much more than that . Free , easier to handle, QGis is more used for portable applications.
But there’s always the
possibility of sharing the data between these two
. Towork properly with ArcGis we use geodatabases, but
is not possible to access such data from QGis.
Therefore, we choose to export a shapefile that it is easily accessible
by both software . Except that this specific format,
available for more than 30 years does not pose many problems. In
this article, we will discuss, a quite unknown option, the use of
databases SpatiaLite databases, to communicate between both
you want , first of all, to know why it’s worth
using SpatiaLite instead of a shapefile, go directly
to the paragraph Why not a shapefile?
afterwards, return here.
With QGis, we have already discuss how to work
with SpatiaLite databases ( Tutorial
databases SpatiaLite under QGis 2.8
Wien ). ArcGis uses may be surprised since the format SpatiaLite is well
by ArcGis since version 10.2.
SpatiaLite is an Open Source Spatial Data
Management Project built above the SQLite
is an excerpt from the Wikipedia SQLite article:
SQLite is a relational database management system contained in a C
programming library and SQL language. SQLite
implements in great
part of the SQL-92 standard and ACID properties
database servers, such as MySQL or PostgreSQL,
its main feature is to not reproduce
the usual client- server schema but
to be directly integrated into
programs. The entire database (reports,
tables, indexes and data) is stored
in an independent file of the platform .
D. Richard Hipp , the creator of
SQLite, chose to put this
library and its source code in
the public domain, allowing unrestricted use as
well as the
open source projects as proprietary
The creator as well as part of the SQLite’s
main features developers are
employed by American Hwaci1society.
SQLite is the most distributed database
engine in the world, thanks to its use in many
consumer software such as Firefox,
Skype, Google Gears, in some products
Apple, Adobe and McAfee and in many
standard libraries languages like
PHP or Python. By
its extreme lightness ( less
than 300 Kio2), it is also
very popular on board
systems, including on most modern smartphones: iPhone
as well as the mobile operating
systems Symbian and Android use it as
an embedded database3 . In
total, we can count over a billion
copies of known and reported to the library
« ( see
full article )
What to do to be able to use Spatialite?
NOTHING! There is no installation or
configuration. You can
and use databases Spatialite from
ArcGIS or QGis, without doing anything special .
How to create
a SpatiaLite database with ArcGis
We will use the Python console to create the database
Open the Python console by clicking on the icon
Firstly we will define
the name of the database to create ( argistest.sqlite ) in
variable ( sqlite_database )
Type the command next in
the window sqlite_database= ‘C: / qgis /arcgistest.sqlite‘
Then we create the
actual database with the following command:
a rcpy.gp.CreateSQLiteDatabase(sqlite_database, « SPATIALITY »)
the necessary tables and views for its management
Warning! The parameter
« SPATIALITY has to be in use
to communicate with QGis or any other software
. The other option, « ST_GEOMETRY » is
to ArcGis and the geometry of the created tables will not be read by QGis or
the others software .
that the base is created you
it in a standard way , with the catalogue window , to import data
Why not a shapefile?
A demonstration is
a long speech , here is a small example grouping three reasons not to
use a shapefile as an intermediate format .
Here is a class
geodatabase entities. It contains 4 attributes :
Date_and_time_take , type DATE
fields of type float r esultat_xxx
same table after an export in shapefile
Find the difference !
1- The field names are truncated and modified .
Here we only have three fields, but when
are many, there find is
. On the other hand, if the shapefile must be
after treatment , for example after correction or updated
by users, you will have
to manually make the correspondence of each field in the shapefile with the
fields of the geodatabase.
2- The null values of the attributes digital
, indicating it there
is no measure , are processed in 0.
But 0 is a possible value of measurement
. You have no more way
of knowing if analysis n / A
trace of the product or if
not take place. This change is so
3- Even if the field is called date
and time , you have only the date and you
lost the time . The sql version used
by dbf files ( those used in
shapefiles) supports only part day- month – year to date. Your
and minutes are finally passed
to the trap, and this is irreversible .
The result of the import of
the class entity
SpatiaLite base :
Look again for the difference …
There is none!!
The fields keep their name, values
null are respected
, the date contains well time .
-ci were only three examples of problems but he
are others . Why miss this solution?
In QGis there enough Now
right click on Spatialite, and connect the base created with ArcGIS.
You can then
load the layer in the window cartographic
, open the attribute table , etc …