Versions used :
2010-03-19 10:59:59.486 testAppSpatialiteLib[2196:20b] Spatialite
version 2.3.1
2010-03-19 10:59:59.489 testAppSpatialiteLib[2196:20b] SQlite version
3.6.16
Some traces to describe my env :
(initialize verbose)
SpatiaLite version ..: 2.3.1 Supported Extensions:
- 'VirtualShape' [direct Shapefile access]
- 'VirtualText [direct CSV/TXT access]
- 'VirtualNetwork [Dijkstra shortest path]
- 'RTree' [Spatial Index - R*Tree]
- 'MbrCache' [Spatial Index - MBR cache]
- 'VirtualFDO' [FDO-OGR interoperability]
- 'SpatiaLite' [Spatial SQL - OGC]
Many thanks for you help,
Lionel.
From the documentation it seems that you can do a SELECT
load_extension(extension) to get it loaded dynamically, but this
relies onto the dynamic library mechanism that is not available on the
iPhone (only static libraries .a are available).
I'm using amalgation source files and so, I was wondering if I could
compile SQLite *AND* Spatialite in such a way that the result properly
loads the extension ?
Is this approach OK or there any other approach to get this running
onto the iPhone ?
Thanks for your help.
Cheers
Lionel.
I am very interested what you are working - running Spatialite in iPhoneOS.
I think this the part of the solution to your problem -
libsqlite3.dylib in iphone
How does one add libsqlite3.dylib to an iPhone project?
http://forums.pragprog.com/forums/83/topics/1849
Would be be able to share project to us?
Regards, Noli
> --
> You received this message because you are subscribed to the Google Groups
> "SpatiaLite Users" group.
> To post to this group, send email to spatiali...@googlegroups.com.
> To unsubscribe from this group, send email to
> spatialite-use...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/spatialite-users?hl=en.
>
>
The spatialite_init(1); actually calls the static init
init_static_spatialite that does all the extension registration
statically.
The code is properly commented at this place
/* used when SQLite initializes SpatiaLite via statically linked lib
*/
I was invoking the spatialite_init(1) but too late ! (after opening
the DB :/)
I move this spacialite_init(1); to the first line of my code and I've
been able to get the SELECT spatialite_version() returning me "2.3.1"
under iPhone :)
Just to share my happiness with you !
;)
I hope I've passed the hardest part and that I can now concentrate on
playing with spatialite !
If I'm making good progress about my use of spatialite, I think I'll
write a tutorial about how to get it running on the iPhone.
Cheers
Lionel.
When you want to use Spatialite for SQlite, you cannot rely on the one
that is part of the SDK : it's too old. You have to compile SQLite on
your own as well to get a proper version that is going to match
Spatialite.
I have a running Xcode project here :
http://bit.ly/aTKsI6
It's not the one I'm working on now (no SQL invokations in it) , but
in this one, Spatialite is already being properly compiled for iPhone
(without GEOS PROJ however).
I'm still checking my env for spatialite and it works ok, I'll share
it with the group.
Cheers
Lionel.
On Mar 19, 11:09 pm, Noli Sicad <nsi...@gmail.com> wrote:
> Lionel.
>
> I am very interested what you are working - running Spatialite in iPhoneOS.
>
> I think this the part of the solution to your problem -
> libsqlite3.dylib in iphone
>
> How does one add libsqlite3.dylib to an iPhone project?http://forums.pragprog.com/forums/83/topics/1849
>
> Would be be able to share project to us?
>
> Regards, Noli
>
But from the doc http://www.gaia-gis.it/spatialite/spatialite-sql-2.3.1.html
, invoking something such as
SELECT IsZipBlob(Geometry) FROM roads where PK_UID=894
does not seem to have any dependency to GEOS or PROJ.
So my understanding is that I shoudl be able to get this running, even
if GEOS and PROJ are omitted.
Is my asumption right / wrong ? :(
Some more information :
when I set a breakpoint into
fnct_spatialite_version (sqlite3_context * context, int argc,
sqlite3_value ** argv)
and invoke SELECT spatialite_version() from the code, I enter the
function => OK
But when I set a breakpoint into
fnct_IsZipBlob (sqlite3_context * context, int argc, sqlite3_value **
argv)
and invoke SELECT IsZipBlob(Geometry) FROM roads where PK_UID=894,
I don't enter this function :(
If anyone can confirm me or not that GEOS / PROJ4 are required to get
SQL isZipBlob running, I'd be very grateful.
Thanks,
Lionel.
On Mar 19, 11:20 pm, "Lionel G." <lionel.guegan...@gmail.com> wrote:
> I think I got it ! :p
> I dived into the code to check how the extension mechanism was
> working.
> This lost webpage (thanks google !) put me on the track :
> http://www.mail-archive.com/sqlite-us...@sqlite.org/msg46986.html
On Mar 20, 7:17 pm, "Lionel G." <lionel.guegan...@gmail.com> wrote:
> Hello again,
> I'm progressing but have trouble to sort out things...
> Depending on the king of SQL request I invoke in the code, some work,
> some others don't (most of them actually :/).
> As I didn't include PROJ and GEOS (to keep it "simple" at first) , I
> can imagine that SQL functions that rely on such libraries won't work.
> That's ok.
> When I invoke from the code :
> SELECT spatialite_version(), I get "2.3.1" =>OK
> SELECT geos_version(), I get NULL => OK
> SELECT proj4_version(), I get NULL => OK
>
> But from the dochttp://www.gaia-gis.it/spatialite/spatialite-sql-2.3.1.html
This one is KO :/ I don't have any idea why, so if someone has an idea
why such request could fail (SQL error in syntax ) even if the env
seems to be ok, thansk for sharing ! ;)
2010-03-24 22:04:59.448 testAppSpatialiteLib[69734:20b] SELECT
AsText(Geometry) FROM roads where PK_UID=894
KO :(
Lionel.
Im definitely interested, it was on my todo list
Best regards
No�l Frankinet
HOWEVER, since yesterday I'm playing with all this stuff, performing
spatial request with spatial indexes (wahou , that's fast, even on a
3G iPhone :) and I discovered that I have a different behavior
between x86 and ARM grrrrrrrr ! Actually, there's something going
wrong when manipulating SQL "double" type .
Ex : I'm performing a request such as
SELECT name, ref, Distance(Geometry, MakePoint(%f,%f,4326))*10000 AS
dist FROM ......
From the spatialite documentation the "Distance(...." returns a
double .
When I get it back on x86, the values look OK (I'm using
sqlite3_column_double(statement, 2) )
When I execute the same on ARM, I get "INF" displayed or any other big
big big value that looks very very wrong.
The rest works ok but I only get trouble with this mapping of the
double between the SQLite layer and my code.
Any hint would be fairly appreciated :)
Cheers
Lionel.
Hello Lionel,
Thank you very, it's much appreciated. I still struggling with Iphone
plaform, I'm used to windowsCE.
> HOWEVER, since yesterday I'm playing with all this stuff, performing
> spatial request with spatial indexes (wahou , that's fast, even on a
> 3G iPhone :) and I discovered that I have a different behavior
> between x86 and ARM grrrrrrrr ! Actually, there's something going
> wrong when manipulating SQL "double" type .
> Ex : I'm performing a request such as
> SELECT name, ref, Distance(Geometry, MakePoint(%f,%f,4326))*10000 AS
> dist FROM ......
>
> >From the spatialite documentation the "Distance(...." returns a
> double .
> When I get it back on x86, the values look OK (I'm using
> sqlite3_column_double(statement, 2) )
>
> When I execute the same on ARM, I get "INF" displayed or any other big
> big big value that looks very very wrong.
>
> The rest works ok but I only get trouble with this mapping of the
> double between the SQLite layer and my code.
>
> Any hint would be fairly appreciated :)
>
I had this of problem with pocketPC (also running arm or xcode). I was
devlopping a GIS application. I end up using fixed math, replacing all
double with long. I had a tremendous speeed gain.
I was told that arm processsor use software routines to handle double,
but I'm not sure.
I'll have a look to your code
Thanks again
Noel
If you want further information about my whole build process, and you
want to restart all from scratch , I can provide you the cross
compilation scripts I used for GEOS, PROJ4 and Spatialite.
Cheers
Lionel.
Yes please do Lionel. I can provide the same setup for pocket PC if
interested.
When I'm ready, I'll try to investigate your problem (maybe you use %Lf
for double value ?)
No�l
Basically you need to take care of the paths to gcc, and the SDK in it
(I'm still using leopard, and targeting 3.0 sdk).
Also don't forget to set the output paths.
Download the source files for GEOS, PROJ4, spatialite (as
amalgamation).
Put the script in the root dir (there should be a configure script in
there)
then run the script.
I'm generating the static libs and headers in libs_output.
I keep on trying to understand where the "double" bug comes from :
when I'm invoking the X(Start(POINT(.... that also returns a double,
this one works fine ! So there should be a diff between all those
methods that return double: most of them seem to fail but some
don't :/
Cheers
Lionel.
Thanks again, I'll try that.
> I keep on trying to understand where the "double" bug comes from :
> when I'm invoking the X(Start(POINT(.... that also returns a double,
> this one works fine ! So there should be a diff between all those
> methods that return double: most of them seem to fail but some
> don't :/
>
I suspect an overflow/ underflow issue, or little endian/big endian
problem, did you generated the sqlite file on a pc ?
On Apr 1, 3:38 pm, noel frankinet <noel.franki...@skynet.be> wrote:
> Lionel G. a crit :
>
>
>
You could try a simple file with a double in it, write on mac, read on
iphone ?
static void
fnct_Distance (sqlite3_context * context, int argc, sqlite3_value **
argv)
{
/* SQL function:
/ Distance(BLOBencoded geom1, BLOBencoded geom2)
Depending on how this code is compiled (or how the library on which
it relies is compiled), this may cause side effects.
Later on in the code, this goes into GEOS :
SQL Distance (as invoked in SQL) -> fnct_distance (spatialite.c) ->
gaiaGeomCollDistance (spatialite.c) -> GEOSDistance (GEOS !)
So the whole chain needs to be properly compiled to work.
Lionel
Maybe something weird in the way the blob are converted (struct
alignment maybe, I've been bitten more than once by that)
No�l
I didn't touch anything, but when I generate it for ARM, I still get
this in it :
//Defines NaN for intel platforms
//Don't forget to define infinities
#define DoubleNotANumber 1.7e-308
#define DoubleInfinity 1.7e+308
#define DoubleNegInfinity -1.7e+308
So I suppose that I should do something for ARM here :/ But I'm not
sure what ?!
Lionel.
Yes, this should checked with the arm double handling capabilities, I'm
not sure either. I google for it
//Defines NaN for intel platforms
#define DoubleNotANumber std::numeric_limits<double>::quiet_NaN()
//Don't forget to define infinities
#define DoubleInfinity std::numeric_limits<double>::infinity()
#define DoubleNegInfinity -std::numeric_limits<double>::infinity()
#define DoubleMax std::numeric_limits<double>::max()
I'm going to give a try to this release, I'll keep you informed.
Lionel.
//Defines NaN for intel platforms
#define DoubleNotANumber std::numeric_limits<double>::quiet_NaN()
//Don't forget to define infinities
#define DoubleInfinity std::numeric_limits<double>::infinity()
#define DoubleNegInfinity -std::numeric_limits<double>::infinity()
#define DoubleMax std::numeric_limits<double>::max()
I'm going to give a try to this release, I'll keep you informed.
Lionel.
--
You received this message because you are subscribed to the Google Groups "SpatiaLite Users" group.
To post to this group, send email to spatialite-users@googlegroups.com.
To unsubscribe from this group, send email to spatialite-users+unsubscribe@googlegroups.com.
Hamish
To post to this group, send email to spatiali...@googlegroups.com.
To unsubscribe from this group, send email to spatialite-use...@googlegroups.com.