5 ms·
SpatiaLite: Extends SQLite core to support Spatial SQL capabilities
- infogulch 4y agoParaphrased from the docs [1]: > SpatiaLite is smoothly integrated into SQLite to provide a complete and powerful Spatial DBMS (mostly OGC-SFS compliant). Using SQLite + SpatiaLite you can effectively deploy an alternative open source Spatial DBMS roughly equivalent to PostgreSQL + PostGIS. The difference between them is mainly architecture: PostgreSQL + PostGIS uses a client/server architecture suitable for sophisticated Spatial Data infrastructures at the cost of complexity; SQLite + SpatiaLite has much simpler architecture more appropriate for desktop, stand-alone, and personal activities. > SpatiaLite supports direct SQL access to several commonly used external datasources: ESRI Shapefiles, DBF Archive Files, TXT/CSV/XLS ... > SpatiaLite actively supports many alternative standard Geometry notations: WKT [Well Known Text] and WKB [Well Known Binary], PostGIS own EWKT and EWKB [Extended WKT / WKB], GML [Geography Markup Language], KML [Keyhole Markup Language, used by Google Maps and Google Earth], GeoJSON [Geometry Java Script Object Notation], SVG [Scalable Vector Graphics]. [1]: https://www.gaia-gis.it/gaia-sins/splite-doxy-5.0.1/index.html https://www.gaia-gis.it/gaia-sins/splite-doxy-5.0.1/index.ht...
- deleted 4y ago[deleted]
- yread 4y agoThere is also a JS port https://github.com/jvail/spl.js https://github.com/jvail/spl.js
- mdp2021 4y ago> Using SQLite + SpatiaLite you can effectively deploy an alternative open source Spatial DBMS roughly equivalent to PostgreSQL + PostGIS Any info on performance differences?
- brandmeyer 4y agoI have to disagree with the "roughly equivalent" statement. Its missing core functionality relative to PostGIS. For example, the Geography type and associated operators (which is functionally distinct from Geometry) is completely absent.
- fortysixdegrees 4y agoI feel this is misleading. You can use various spatial operators which are functional on geographic CRSs. For the type of situation you would usually use this for, it handles geographic just fine. But agreed it isn't explicit like in postgis
- deleted 4y ago[deleted]
- dvisca 4y agoI prefer the GeoPackage format [1]. Very similar to SpatiaLite it is based on SQLite, but as official OGC standard I anticipate better integration and support in the long run. [1]: https://www.geopackage.org/ https://www.geopackage.org/
- clumsysmurf 4y agoIs there anything like this for time-series sensor data (temperature, humidity, etc)?
- dvisca 4y agoThere is the OGC SensorThings API spec for accessing sensor data. For storage I would assume something like GeoPackage or SpatiaLite would be sufficient.
- sideshowb 4y agoGeopandas adds gis operations to pandas, which is good with time series, if that helps. Can read and write several common formats.
- zipzappy 4y agoDoes this do spatial queries? It doesn’t seem so.
- dvisca 4y agoNo, it doesn't. It is designed as lightweight format for data storage and exchange. Usually it is used in the context of other GIS applications like QGIS. However, you can also use SpatiaLite to apply spatial functions to GeoPackage files.
- fortysixdegrees 4y agoI feel you should retract this comment so as to not mislead people. See extensive spatialite documentation on spatial operators here: http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.0.html http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.0.html
- qwertox 4y agoApparently it's also trivial to use it in Python via `pip install spatialite`[1], but the GitHub repo [2] seems to be dead. [1] https://pypi.org/project/spatialite/ https://pypi.org/project/spatialite/ [2] https://github.com/malexer/spatialite https://github.com/malexer/spatialite
- zipzappy 4y agoNo you need the library installed separately
- zipzappy 4y agoIt’s not actively developed. The nearest neighbor functionality in the released version is deprecated and both it and the development replacement have a recently filed bug that makes you worry about accuracy. The docs are also out of date
- teruakohatu 4y agoThis. I strongly recommend not using it at this point in time. SQlite really lends itself to having a spatial backend and would likely become a bit player in this space if it did, but it probably needs a major overall first.
- fortysixdegrees 4y agoStrongly recommending not using it in a blanket way is not helpful. I have used it extensively in an embedded product for many years, and it has just worked. Sure it doesn't have all the postgis goodies, but it has enough that it's not usually hard to find a good way to do the spatial queries you need. I'm quite surprised by this thread so far, given how robust it's been for me for many years using it in many different ways.
- teruakohatu 4y agoTo be specific, they changed the KNN backend, but the docs refer to the new unreleased backend. The old one is deprecated but unreleased, which is a strange confusing situation. https://www.gaia-gis.it/fossil/libspatialite/wiki?name=KNN2 https://www.gaia-gis.it/fossil/libspatialite/wiki?name=KNN2
- fortysixdegrees 4y agoFor the average HN reader spatialite is a tool which should be considered. If the KNN issues are a breaking point for someone, they are probably already in postgis territory.
- fortysixdegrees 4y ago
- skissane 4y ago> SpatiaLite is licensed under the MPL tri-license terms One of the greatest things about SQLite is its license (or should I say, lack thereof). It is a pity that so many extensions to SQLite (this included) elect not to follow that example
- birdstheword5 4y agoSpatialite is such an amazing and little talked about tool. I think most people go straight for its bigger cousin POSTGIS which is the correct decision 99% of the time. However there are situations where you don't want a full blown database server and an embedded db is better. I have seen one company just store the geometries as well known text in sqlite, then act all confused when their application runs incredibly slow.
- jokoon 4y agoI've tried it, and it works well, but setting it up is not trivial...
- henrydark 4y agoIf you understand the underlying mechanism and are willing to work more low level, then this rtree package is about x50 faster in my experience: https://github.com/tidwall/rtree.c https://github.com/tidwall/rtree.c There are python bindings for it (with absolutely no documentation) here: https://pypi.org/project/rtreecpy/ https://pypi.org/project/rtreecpy/
- mister_goo 4y agoJust adding another piece of info. R-Tree is a generic solution to spatial queries. For static datasets that don't need to update, quadtree or kd-tree is simpler to understand and implement.
- mister_goo 4y agoSpatiaLite is a great extension for spatial functions, it is very useful for implementing location-based services. And I like the idea of extending SQLite just for the simplicity of file base DB. A slightly related problem I encountered several times is reverse geocoding: given a point, a map, which polygon the point is in? I figured out that the problem is solvable via rasterization and run-length-encoding, which doesn't need a spatial library, and works efficiently with any SQL DBs without GIS/spatial extensions. I created a website (https://reverse-geocoding.com/ https://reverse-geocoding.com/) to demonstrate the idea, which has a GPS-to-country DB in SQLite format.