Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am creating an application using spatialite database. I checked couple of tutorial from internet. Most of them explains the same. But the problem is I need "libspatialite.so" extension library. I do not know how to get it.

So whenever i run my code it shows the following warning and error....

[Warning: SQLite3::query() [sqlite3.query]: Unable to prepare statement: 1, no such module:]
[Fatal error: Call to a member function fetchArray() on a non-object]

But my code looks OK. It looks like because of i could not load the extention "libspatialite.so"

I have given bellow, my code.

<?php

$db = new SQLite3('sixcommunes.sqlite'); 

$db->loadExtension('libspatialite.so'); 

$db->exec("SELECT InitSpatialMetadata()");

$rs = $db->query('SELECT sqlite_version()');

while ($row = $rs->fetchArray()) {
    print "<h3>SpatialLite version: $row[0]</h3>";
}

$sql = "SELECT KOM_NAMN FROM '6communes_SWEREF99TM'";

$rs = $db->query($sql);
$msg = "";
while($row = $rs->fetchArray()){
        $msg = $row[0];
    print "<h3>$msg</h3>";
}
$db->close();
?>
share|improve this question

2 Answers 2

up vote 1 down vote accepted

What computer? If Ubuntu/Debian, try:

sudo apt-get install libspatialite-dev
share|improve this answer
    
My computer is windows 7. It this case what should I do? –  Shahjalal Mar 21 '12 at 9:51
    
.so files are for Unix-like systems. For Windows, you need to find a DLL equivalent. –  Mike T Mar 21 '12 at 10:58
    
Thanks for help. I have the windows dll. I do not know how should I configure my wampserver. Could you please read the following question, if you can help me somehow. gis.stackexchange.com/questions/22064/… –  Shahjalal Mar 21 '12 at 22:26

Get it from http://www.gaia-gis.it/gaia-sins.

share|improve this answer
    
Thanks for your link. I am new with spatialite. could you please tell me exactly what should I do? It will be very helpful for me if you can give me any tutorial link. –  Shahjalal Mar 21 '12 at 10:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.