Tag Info

Hot answers tagged

6

And, after a bit more reading the ogr2ogr help I found the answer more easily than I expected. ogr2ogr -f "PostgreSQL" PG:"dbname=db" spatialitedb -sql "SELECT * FROM table" -dialect spatialite -nln new_table EDIT: As suggested by user30184 in the comments a cleaner, simpler method is: ogr2ogr -f "PostgreSQL" PG:"dbname=db" spatialitedb ...


4

Yes. It does as it appears from looking at the source code for the Spatialite Data Provider. The QgsSpatiaLiteFeatureIterator class is the one that supplies the features to the map upon sending a rectangle extent. You can just search for 'spatialIndex' in that class to see they actually use the index if available.


3

For the X and Y columns, you can use the field calculator to add those fields. Under the Geometry node, you find $X and $Y. But please consider that moving a node does not change the X and Y in the attribute table as well. It is just a static value from the moment you create the column.


3

The main advantage of Spatialite is that it comes as just one file, which you can easily share and backup. Postgis needs much more effort to port the data from one computer to another. Shapefiles have their limitations on column names, but can easily handle non-EPSG projections. Editing of larger amounts of data gets painful with simple shapefiles, so thats ...


3

now it'a available in Master and will be officially available in Qgis 2.4 http://pvanb.wordpress.com/2014/05/15/saving-layer-styles-to-your-spatialite-database/


3

SQLite operates in a last edit wins model, which leads to issues with more weight than write blocks. There is no editing session tracking in the QGIS/SQLite relationship. So, even if you did get a single writer block (SQLITE_BUSY) QGIS will simply fail to edit and just return an error then submit the change again. The below discusses the handling of this ...


3

Yes it can be done with QGis. Using the QSpatiaLite Plugin "Manage your SpatiaLite databases within QGis" After installing the plugin you can run it. You will receive a series of messages/errors stating that you do not have a spatialite db. it will step you through getting one installed (choose a location for the file) and finally converting it to ...


3

Standard OSM tiles are in Spherical Mercator (SRID=3857) so it will probably be easiest to build your grid using the same projection. If you use SM, you might store the data at the highest zoom level OSM supports, or at the highest level zoom level you'll permit users to zoom into. If coverage is sparse, use a data structure along the lines of XIndex, ...


3

The value stored in a cell from a heatmap is often normalized by its area. In this case I would rather suggest an equal area projection so that you can easily aggregate to larger scale


3

From the ogr2ogr docs, use the -nln name option to assign an alternate name to the new layer.


2

ptrv/gpx2spatialite does this remarkably well, saving timestamps for all points and deriving speed and length data for tracks. It also won't import duplicate tracks, so you can feed it a huge pile for GPX files and it will munge them appropriately. Update: usage examples, as requested: Initialize new database: gpx2spatialite_create_db db.sqlite Add a ...


2

Answer from Sandro Fueri, posted on the spatialite users group https://groups.google.com/forum/#!topic/spatialite-users/wx0RAFTA2tM Hi Pascal, the most recent versions of SpatiaLite support several interesting "advanced" functions based on LWGEOM: ST_Azimuth(), ST_MakeValid(), ST_Split() and so on. anyway enabling or not LWGEOM is a ...


2

this thread may be a bit old - but i ran into a somewhat similar issue a couple of months back i think this post was also related - Sqlite, Python 2.7 and Spatialite i ended up finding another build of libspatialite-4.dll here http://latuviitta.org/documents/Spatialite_4.0_test_with_jre_1.6.zip although it is also labeled as 'test'... after placing this ...


2

Run: SELECT RecoverGeometryColumn(<new table>, <geom column name>, <SRID>, <geom type>);


2

If you didn't use AddGeometryColumn to add your geometry, it isn't a valid SpatiaLite database. From that page: Please note well: this one is a very frequent pitfall. Many developers, GIS professionals and alike obviously feel to be much smarter than this, so they often tend to invent some highly imaginative alternative way to create their own ...


2

So given a table with four explicit columns - City, State and Country, plus geom: spatialite> CREATE TABLE MyPlaces (Country TEXT, State TEXT, City TEXT); spatialite> SELECT AddGeometryColumn("MyPlaces", "geom", 4326, 'POINT', 'XY'); AddGeometryColumn("MyPlaces", "geom", 4326, 'POINT', 'XY') 1 We want to take a source of places (I used Natural ...


2

If I'm understanding you correctly, you might try ST_Within(ST_Centroid(building_geom), other_geom) If that's not what you're asking, could you clarify what you mean by "I would like to do this on the polygon layer", as in, what the "do this" is referring to?


2

You actually need to combine your two queries into one, known as a nested query. I'm not a Spatialite user, but I think the syntax would be: select count(*) from points where PtDistWithin(points.geometry, (select geometry from points where point_id = 1), 100)`


2

In native (out of the box) Python installations extensions are disabled within sqlite3. Unfortunately this means that you will need to build the base pysqlite2 library manually and use that instead. On Windows this will mean that you need a C compiler (Visual Studio comes with one - I've used Visual Studio 2010 for this before). However (with massive props) ...


2

It was finally pretty easy to get your TatukGIS DB to show in QGIS. First good news is that GDAL finds layers from the DB >ogrinfo tatukgis.sqlite INFO: Open of `tatukgis.sqlite' using driver `SQLite' successful. 1: GEOMETRY_COLUMNS (None) 2: SPATIAL_REFERENCE_SYSTEMS (None) 3: SQLITETEST 4: SQLITETEST_FEA (None) What is best is that GDAL also ...


2

The Tatukgis.sqlite db seems to only contain 4 Points located in the NW part of Utah Meridian 26, Township 6S, Range 3E, Section 31. The layer name is Sqlitetest. The SRS is Fips 4302, Utah Stateplane Central, similar to EPSG 3569, as you listed. These are the coordinates: 1596835.7622,7263099.6599 1597709.8572,7263120.1174 1597672.6616,7261875.9269 ...


2

Ok, found at least one working solution. After finding that on Linux everything is fine suspected the default encoding in Windows. So I opened the QGIS project file (*.qgs) in PSPad and found this in layer description: <provider encoding="System">ogr</provider> So probably QGIS uses CP1250 encoding as default in Windows while the database is ...


2

I get the same nasty effect if I load the data with Add vector layer using the ogr driver: <provider encoding="System">ogr</provider> Alternatively (and the preferred way) I can load the data with Add spatialite layer. The encoding line changes to: <provider encoding="System">spatialite</provider> which is wrong ...


2

It is not the size of the database that makes it slow, it is that you select too much to render. Simplification can be a part of the solution but it will not be enough for making you happy. You can do lot of things once the data are in Spatialite. As you suggested, simplify "update lines set geometry=ST_Simplify(geometry,0.01);" Do the same but instead of ...


2

There is no direct equivalent, however you should be able to do something similar with a combination of RotateCoords() which rotates the geometry (in degrees, rather than radians), ShiftCoords() and ScaleCoords(). Here is an example, simplified from the test suite: SELECT AsText(RotateCoords(geom, 0)), AsText(RotateCoords(geom, 90.0)), ...


2

This is an answer to how you could design a heatmap. My suggestion is you look into the Quarter Degree Grid Cell system. QDGC represents a way of making (almost) equal area squares covering a specific area to represent specific qualities of the area covered. The squares themselves are based on the degree squares covering earth. Around the equator we have 360 ...


2

There is a function to reproject geometry: ST_Transform( geom Geometry , newSRID Integer ) : Geometry List of functions can be found here. Note that in case you would want to rewrite existing geometry in Geometry column with reprojected data (instead of creating new table), you will need to update geometry_columns table and enter new SRID (in srid ...


2

You are running against SQLite version 3.7.17, but Common Table Expressions (WITH clause) were not supported until 3.8.3. See change log here: http://www.sqlite.org/changes.html Unless you are trying to do a recursive query, you can either write your WITH clause as a view or use a subquery.


2

This reminds the old quiz: 5 person will shake hands with each other. How many handshakes will there be in total? Is it 20 because everybody must shake hands with 4 other person? No, because if Mike shakes hands with John, John does not need to shake hands with Mike for another time. Let's assume that you have 5 points. Point number 1 does not shake hands ...


2

give the qspatialite plugin a try (https://plugins.qgis.org/plugins/QspatiaLite/) (Create empty db, now you can select all your layers and add at one go. see screenshot 1)



Only top voted, non community-wiki answers of a minimum length are eligible