![]() ![]() ‘select st_astext(st_transform(geometry, 3857)) from ukraine’Ĭonverts the coordinates to EPSG:3857 Spherical Mercator (popular in mapping tools) ‘select spatialite_version() ’ –> returns ‘5.0.1’ Now the result of the ST_AsText function is better: and load file ‘mod_spatialite.dll’ from the QGIS bin directory. To solve this use Tools –> Load Extension…. If we call a spatial function on the geometry column (for example ‘select st_asText(geometry) from ukraine’) there will be an error ‘no such function’ because the tool doesn’t know about spatial functions: Now start DB Browser for SQLite, load the ‘Ukraine.sqlite’ database and in the ‘Execute SQL’ tab do a count on table Ukraine, 25 should be the result: In QGIS we can load the data using the SpatiaLite option in the browser: Using tool ogr2ogr we convert the GeoJSON file to SQLite: $ ogr2ogr -f sqlite -dsco spatialite=yes ukraine.sqlite Ukraine.json Prerequisite: Install a recent version of QGIS ( ) and add the bin directory to the system path (something like C:\Program Files\QGIS 3.22.3\bin).įirst download some data, we’ll use districts polygons in GeoJSON format from Ukraine, source Warning: This blog is written for Windows, it might work on other platforms but this is not tested. In this blog we’ll investigate how to use Spatial functions from SpatiaLite in DB Browser for SQLite ( ). The tool has an extension mechanism to add more functionality. After your database is created and your first table is added, you can add some records.DB Browser for SQLite is a popular open source tool to create, design, and edit database files. If the tool categories are “hammer,” “spanner,” and “screwdriver,” you can’t add a record of type “chisel.”Ĭlick “OK” after you add the fields you want. For example, in a database of workshop tools, you might have a table of individual tools and another table of tool categories.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |