<html style="direction: ltr;">
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<style>body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
</head>
<body style="direction: ltr;"
bidimailui-detected-decoding-type="latin-charset" bgcolor="#FFFFFF"
text="#000000">
On 02/24/2012 09:38 PM, Gerhardus Geldenhuis wrote:
<blockquote
cite="mid:CAATm_0qWj-nSMq7k1kqzOjizKYmj803iko19VSTjM3CgMS4ddg@mail.gmail.com"
type="cite">Hi
<div>I am doing this in drip and draps which is why my questions
have a little bit of repeat in them... hopefully I can finalise
my map work this time.</div>
<div><br>
</div>
<div>I have created a SpatiaLite database and then using the
QSpatiaLite plugin have managed to successfully import my csv
file as a table into the database. </div>
<div><br>
</div>
<div>When I now try to add a new spatialite layer I can only see
the test01 table that I had to create in order to create the
database. The csv file that I have imported using the plugin is
not visible. I believe this is because it does not have the
right fields. To make it easy all my data is points, so how do I
convert my imported table into a compatible table that I will be
able to see in QGIS when I am adding a new spatialite layer and
connecting to my db?</div>
<div><br>
</div>
</blockquote>
<br>
In order for QGIS too "see" a spatialite table as a spatial layer,
the layer must have a Geometry column, it must be registered in the
geometry_columns (metadata) table, and it must have a primary key of
type integer. The first two conditions you fill by using the
AddGeometryColumn() [1] function in spatialite. The third should be
in your table design.<br>
<br>
Here's a post [2] regarding importing an Excel table and making it
into a spatial layer. The principle for a CSV file is pretty much
the same.<br>
<br>
<blockquote
cite="mid:CAATm_0qWj-nSMq7k1kqzOjizKYmj803iko19VSTjM3CgMS4ddg@mail.gmail.com"
type="cite">
<div>As a next question... I have created a view on the testtable
and was expecting it to show up as an additional table to select
from when trying to create a new spatialite layer. The view is
however not showing up, why is this? My logic is that I would
rather create different views and have the different spatialite
layers connect to the various "views". The alternative is to
just run a custom query in the QGIS interface for each
spatialite layer that connect to the database so the difference
being that the "filter/view" is in QGIS rather than in the
spatialite db.</div>
<div><br>
</div>
</blockquote>
In order for a database views to appear as spatial in QGIS it also
must have a metadata entry in the views_geometry_columns table. See
[3] for details<br>
<br>
HTH<br>
<br>
[1]
<a class="moz-txt-link-freetext" href="http://www.gaia-gis.it/spatialite-2.4.0-4/spatialite-cookbook/html/new-geom.html">http://www.gaia-gis.it/spatialite-2.4.0-4/spatialite-cookbook/html/new-geom.html</a><br>
[2] <a class="moz-txt-link-freetext" href="http://www.surfaces.co.il/?p=1112">http://www.surfaces.co.il/?p=1112</a> <br>
[3]
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a
href="http://www.gaia-gis.it/spatialite-2.4.0-4/spatialite-cookbook/html/sp-view.html">http://www.gaia-gis.it/spatialite-2.4.0-4/spatialite-cookbook/html/sp-view.html</a><br>
<br>
<br>
<blockquote
cite="mid:CAATm_0qWj-nSMq7k1kqzOjizKYmj803iko19VSTjM3CgMS4ddg@mail.gmail.com"
type="cite">
<div>Regards<br clear="all">
<div><br>
</div>
-- <br>
Gerhardus Geldenhuis<br>
</div>
<br>
This mail was received via Mail-SeCure System.<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a>
This mail was received via Mail-SeCure System.
</pre>
</blockquote>
<p><br>
</p>
<br>
<pre class="moz-signature" cols="72">--
Micha Silver
GIS Consultant, Arava Development Co.
<a class="moz-txt-link-freetext" href="http://www.surfaces.co.il">http://www.surfaces.co.il</a></pre>
</body>
</html>