Spatialite and Unity3d

199 views
Skip to first unread message

Daniel Tenbrock

unread,
Sep 5, 2015, 12:22:18 PM9/5/15
to SpatiaLite Users
So I need to get Spatialite working udner Unity3d (University work ).
So far i have run into a Brickwall. The Problem is that i cant get sqlite3_enable_load_extensions() to true. It doesnt help that i run a 64bit Pc and Unity doesnt let me work wioth 32bit dll.
My last attempt to get this working was  

[DllImport("Assets\\Plugins\\x86_64\\sqlite3.dll")]
public static extern int sqlite3_enable_load_extension(int onoff);

...
sqlite3_enable_load_extension(1);

but now Unity just crashes. Im getting really desperate cause im already on a pretty short timetable(loads of unexpected problems before) and if this draggs on I wont be able to meet the Bachelor deadline.
 
 

a.fu...@lqt.it

unread,
Sep 6, 2015, 1:15:37 PM9/6/15
to spatiali...@googlegroups.com
On Sat, 5 Sep 2015 09:22:17 -0700 (PDT), Daniel Tenbrock wrote:
> So I need to get Spatialite working udner Unity3d (University work).
>

Hi Daniel,

when I've read your post for the first time I've fallen victim
of a trivial misunderstanding, because I've wrongly assumed you
were intending this Unity software:

https://en.wikipedia.org/wiki/Unity_%28user_interface%29

only after this initial mishap I've finally guessed that you
really intended this second Unity (sorry, I ignored at all
that two different and completely unrelated packages could
share the same "unity" name):

https://en.wikipedia.org/wiki/Unity_%28game_engine%29

if I remember well this is the first time in many long years
that a question about a gaming platform has been posted to
this mailing list.
the possible connections between a gaming platform and a
Spatial DBMS (usually deployed on professional GIS-like
environments) is not a so obvious one, so I'm now rather
curious to learn more details about the general intentions
of your project.
It's always interesting discovering some unexpected and
probably highly unconventional new development.


> So far i have run into a Brickwall. The Problem is that i cant get
> sqlite3_enable_load_extensions() to true.
>

please note: not all binary versions of libsqlite3 do necessarily
support the extension loading mechanism.
if the library was initially compiled by declaring the
SQLITE_OMIT_LOAD_EXTENSION
optional flag the resulting binary will completely lack all
the code implementing the extension loading, this including the
total suppression of the sqlite3_enable_load_extensions() API;
I ignore absolutely anything about Unity, but this could easily
be your case.
several distributions usually suppress at all the extension
loading capability for security reasons.
and if this one really is your case, it really is a brick wall;
you can't do absolutely nothing in order to circumvent this
limitation without breaking the security requirements imposed
by your vendor.

> It doesnt help that i run a 64bit Pc and Unity doesnt let
> me work wioth 32bit dll.
>

this is not a limit specific to Unity; mixing altogether
32 and 64 bit components always is a forbidden operation,
because two radically different memory addressing spaces
can never coexists in the same process.
any 32 bit framework always requires 32 bit DLLs, exactly
as a 64 bit framework strictly requires 64 bit DLLs.


> Im getting really desperate cause im already on a pretty short
> timetable(loads of unexpected problems before) and if this draggs
> on I wont be able to meet the Bachelor deadline.
>

Have a good luck.
but it seems very probable that you are the first human
being on the earth attempting to load SpatiaLite into Unity.

bye Sandro

Daniel Tenbrock

unread,
Sep 6, 2015, 2:03:48 PM9/6/15
to SpatiaLite Users
Finally after one point five weeks (around 12-15 hours a day) I made progress.
By using the Sqlite4Unity3d.dll (https://github.com/codecoding/SQLite4Unity3d) i was able to enable extensions and load libspatilite-2.dll (or so it seams).
Problem is that i will havt to rewrite all what i have done before. I do not completly Undersand the dll / I find it unecessary complicated and finally I still cant get my Stuff out of the database.
When i run the Select asText(geom) geometry from polygon command it returns an empty GeometryCollection.

So why am I doing all this.
The institut where I am writing my Bachelorthesis(spatialite + unity) works quiet a bit with Citygml. 
So they decided they wanted a interactive viewer for mobile Smartphones.
So I wrote a Parser and a Databse and was advised to use Spatiallite. 
Now I want to get the data out and draw it. Well since Deadline is the 30  September and im still fighting with getting stuff out of the Database, I think it will all come down to a new Projekt and a second and last try on an Baechlor Thesis

Daniel Tenbrock

unread,
Sep 6, 2015, 2:13:57 PM9/6/15
to SpatiaLite Users
Wuhu god it. 
Know i simply have to recode everything understand the dll and get allt the drawing and option Menus done. In 2 Weeks this seems easy:( . Well at least im still running.


Am Samstag, 5. September 2015 18:22:18 UTC+2 schrieb Daniel Tenbrock:

a.fu...@lqt.it

unread,
Sep 6, 2015, 2:35:31 PM9/6/15
to spatiali...@googlegroups.com
On Sun, 6 Sep 2015 11:03:47 -0700 (PDT), Daniel Tenbrock wrote:
> So why am I doing all this.
> The institut where I am writing my Bachelorthesis(spatialite + unity)
> works quiet a bit with Citygml. 
> So they decided they wanted a interactive viewer for mobile
> Smartphones.
> So I wrote a Parser and a Databse and was advised to use
> Spatiallite. 
> Now I want to get the data out and draw it.
>

Hi Daniel,

all right, now it makes perfect sense.
thanks for the clarification.


> Well since Deadline is the
> 30  September and im still fighting with getting stuff out of the
> Database, I think it will all come down to a new Projekt and a second
> and last try on an Baechlor Thesis
>

don't despair, reality is not so dark as it could appear :-D

1. I see you are using an incredibly obsolete spatialite-2.2;
you simply have to throw this venerable (and completely
useless) fossil relic into the dustbin as soon as possible.
then install a more recent DLL from here:
http://www.gaia-gis.it/gaia-sins/windows-bin-x86/
http://www.gaia-gis.it/gaia-sins/windows-bin-amd64/

2. have a quick glance at the more recent documentation:
http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.3.0.html
https://www.gaia-gis.it/fossil/libspatialite/wiki?name=4.3.0+doc

after this you could probably have some pleasant surprise, and
may be you'll discover that your immediate future is not so
terrifying as you are currently expecting ;-)

bye Sandro

tutorial24

unread,
Dec 31, 2015, 7:19:03 AM12/31/15
to SpatiaLite Users
Dear Daniel,

I intend to use Spatialite within in Untiy3d also.
Could You give me an idea/example how You got it to work?

Stefan
PS:
Auf deutsch geht auch, bin aus Westfalen!
Reply all
Reply to author
Forward
0 new messages