Request to add getting Started example in documentation

99 views
Skip to first unread message

सूरज गुप्ता

unread,
Jan 9, 2024, 2:59:44 AMJan 9
to SpatiaLite Users
Hi,
I recently started using spatialite and initially struggled to get started and make the first spatialite query working.

I referred to documentation, but most of it is old and not maintained, which is fine for me because I understand it takes time and effort to keep the documentation updated.

But what I am asking is that can we have a getting started page in docs, where we can show how to make first query working in spatialite.

Ex. Problems that I faced
When starting with creating a column, we have to use "AddGeometryColumn" function, but that didn't worked for me in starting because I didnt initilized spatilite with "InitSpatialMetaDataFull", because it is not mentiond in docs that first we have to initilize spatilite. It took me a whole day to figure out what i am doing wrong, becuse there is also not much content about spatialite on internet also. After wasting a day I got this group, I have to search for that error in this group, then read 3-4 chats and then understand I need to initilize spatilite.

Again the same happened with "AsGeoJSON" function. I am working with javascript, so I needed the geometry data in JSON format, while retrival of geometry columns with plain select query I used to get binary data but I needed it in JSON, again in docs I didn't found any referece for selecting data with AsGeoJSON.
In SpatiaLite Cookbook Tutorial it is docs is mentiond for Insert, Upadte, delete but not for select.
Now JSON is widely used notation, so someone other may also need it.

I am just saying can we add a page in docs in starting, that will have a code sample for getting started, where we would atleast mention to initilize spatialite and how to get output data in JSON.
And I possible any other steps that are important and required for any other initial operation, because you know it well, I am just getting stared now.

Regards,
Suraj

a.fu...@lqt.it

unread,
Jan 9, 2024, 3:54:55 AMJan 9
to spatiali...@googlegroups.com
On Mon, 8 Jan 2024 23:50:11 -0800 (PST), सूरज गुप्ता wrote:
> Hi,
> I recently started using spatialite and initially struggled to get
> started and make the first spatialite query working.
>
> I referred to documentation, but most of it is old and not
> maintained,
> which is fine for me because I understand it takes time and effort to
> keep the documentation updated.
>

this is not entirely true: SpatiaLite is essentially the
Spatial SQL extension for SQLite, i.e. ultimately it simply
is a large collection of Spatial SQL functions.
all these SQL functions are extensively documented one by one
and the documentation is regularly updated with each version
release.

please see: https://www.gaia-gis.it/gaia-sins/spatialite-sql-5.1.0.html


> But what I am asking is that can we have a getting started page in
> docs, where we can show how to make first query working
> in spatialite.
>

they are certainly a little aged, but starting from the study
of the Cookbook is always an excellent starting point.

There are even two different versions:

https://www.gaia-gis.it/gaia-sins/spatialite-cookbook/index.html
https://www.gaia-gis.it/gaia-sins/spatialite-cookbook-5/cookbook_topics.01.html


> Ex. Problems that I faced
> When starting with creating a column, we have to use
> "AddGeometryColumn" function, but that didn't worked for me in
> starting because I didnt initilized spatilite with
> "InitSpatialMetaDataFull", because it is not mentiond in docs that
> first we have to initilize spatilite.
>

This is a detail that critically depends on the software
you are using.
if you used spatialite_gui (as most users do) there would have
been no need to initialize the new DB because the app will
automatically take care of it when it is created.


>
> Again the same happened with "AsGeoJSON" function. I am working with
> javascript, so I needed the geometry data in JSON format, while
> retrival of geometry columns with plain select query I used to get
> binary data but I needed it in JSON, again in docs I didn't found any
> referece for selecting data with AsGeoJSON.
>

I'm really sorry, but I very much doubt that the majority
of SpatiaLite users are particularly interested in GeoJSON
functions, which is an interesting format only for web
developers.

I have no doubt that it is a fundamental aspect for you,
but the majority of users seem much more interested in
data processing and spatial analysis.

Tip: looking for "JSON" in the HTML list of SQL functions
would have taken you a few seconds to understand which
functions are available for this particular format and how
to use them.

Conclusion: Spatial SQL is not an easy subject, especially
for those who don't know it at all.
But experience says that with a week of methodical study
you always end up understanding how it works.

bye Sandro

सूरज गुप्ता

unread,
Jan 9, 2024, 5:31:43 AMJan 9
to spatiali...@googlegroups.com
It may be my ignorance, and I am new to spatialite so things things like asGoeJson function took some time for me,

But as for using GUI tool, I want to create sqlite db file programmatically so hence I didn't used the GUI tool for that, may be my bad luck 
But any way now it works for me.

Thanks for your quick response.

Regards,
Suraj

मंगल, 9 जन॰ 2024, 2:24 pm को <a.fu...@lqt.it> ने लिखा:
--
You received this message because you are subscribed to a topic in the Google Groups "SpatiaLite Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/spatialite-users/7kG8a9FTV4I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to spatialite-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/spatialite-users/18517aed9886e1ad0c62d36b78f4a5a1%40lqt.it.

a.fu...@lqt.it

unread,
Jan 9, 2024, 5:45:32 AMJan 9
to spatiali...@googlegroups.com
On Tue, 9 Jan 2024 15:46:09 +0530, सूरज गुप्ता wrote:
> But as for using GUI tool, I want to create sqlite db file
> programmatically so hence I didn't used the GUI tool for that, may be
> my bad luck 
>

note: trying to write SQL statements directly inside the code
of the program you are developing is certainly the slowest and
most painful method.

Testing all SQL statements one by one using any front-end is a
great habit that ultimately saves a lot of time and makes it
much easier to identify any errors.

Among all the possible front ends for spatialite, the GUI is
certainly the most convenient one to act as a companion to
code development.

I personally wrote thousands of lines of C and C++ code over
the course of a decade, but without the GUI I would feel naked.

bye Sandro

Francesco Pelullo

unread,
Jan 9, 2024, 6:05:30 AMJan 9
to spatiali...@googlegroups.com
Apart the Cookbook in the main site, you can also follow this document:

How do I do that in SQLite and Spatialite

that is freely available here:


It is not a substitute of official docs, but could be useful for a initial training.

Best regards
Francesco



--
You received this message because you are subscribed to the Google Groups "SpatiaLite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spatialite-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/spatialite-users/95eaf633e3ca102e1c18d533fa185325%40lqt.it.

सूरज गुप्ता

unread,
Mar 1, 2024, 5:41:38 AMMar 1
to SpatiaLite Users
Hi All,
As I have mentioned above, that being a web developer it was not easy for me to get started with Spatialite.

With my learnings of Spatialite, I have written a blog post for Nodejs developers on getting started and have also integrated it with a JavaScript ORM for a better developer experience and usage.

I hope it will help other developers.
Posting it here just to give a reference to any user who comes in search for that.

Thanks,
Suraj

सूरज गुप्ता

unread,
Mar 1, 2024, 5:47:15 AMMar 1
to SpatiaLite Users
Reply all
Reply to author
Forward
0 new messages