1

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();
?>
1

What computer? If Ubuntu/Debian, try:

sudo apt-get install libspatialite-dev
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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