Tag Info

Hot answers tagged

15

Shapefiles are the lowest common denominator of GIS vector data file exchange: send an archive of shapefiles, and you can pretty much guarantee that someone will be able to build a basic GIS from it. SpatiaLite's advantages include: everything's in one file; none of the shp/shx/dbf/idx/prj per layer mess. logic as well as data can be included, in the form ...


15

Shapefiles are bound to one type of geometry, so you get a bunch of files for a single project. The field names are restricted too due to using an antiquarian database format. In spatialite, you can hold the whole project data in one file; and name the fields how you want (well, almost). The only disadvantage of spatialite is the fast update cycle, making ...


8

In the documentation, it is alluded to that you cannot edit data in a SQLite database from ArcMap: You can connect from ArcGIS to an SQLite database to create maps and perform spatial analysis on your data. However, the only place this appears to be explicitly stated by Esri is in the ArcGIS Discussion Forum: Yes; you cannot edit data in a SQLite ...


7

In addition to scruss' answer, shapefiles has some limitations: max field name length is 10 characters maximum file size (.dbf / .shp) is 2GB numeric attributes are stored as characters (integers/floats), causing potential problems with rounding etc NULL values are interpreted differently between systems


7

The reference work I use for expectations of spatial operators is the Clementini paper ("A Small Set of Formal Topological Relationships Suitable for End-User Interaction", Eliseo Clementini, Paolino Di Felice, and Peter van Oosterom, 1993). It lays out the theory behind the operators with respect to interiors, exteriors, and dimensionality, which eliminates ...


6

In SQLite, and thus also in SpatiaLite, there's no date type per se. See Datatypes In SQLite. When a string column is saved in the format "YYYY-MM-DD" then you can apply some date functions to it, such as strftime() to get the date formatted in other ways. However, if you've saved your dates in any other way, they are NOT recognized as dates. What I would ...


6

I have reproduced your example with shapefiles. You can use Shapely and Fiona to solve your problem. 1) Your problem (with a shapely Point): 2) starting with an arbitrary line (with an adequate length): from shapely.geometry import Point, LineString line = LineString([(point.x,point.y),(final_pt.x,final_pt.y)]) 3) using shapely.affinity.rotate to ...


6

That should not happen (4236 uses degrees) . AsText() returns WKT geometry always in current srid, so you probably use wrong srid. You can set correct srid using UPDATE table SET geom = SetSrid(geom, 3857) assuming that your data really is in google mercerator. If you need to transform geometry then you can use UPDATE table SET geom = Transform(geom, 4326) ...


6

You're looking for the "Dimensionally Extended 9 Intersection Matrix" or DE-9IM for short. DE-9IM by FME That FME link has great examples of the spatial operators you listed above. It breaks it down into a 3x3 true/false matrix with examples and descriptions of each predicate attribute.


5

You should proceed as if you are working with a polygon with multiple parts. Start editing your layer; Add a point; Enter the attributes in the form and press ok; Select that point with any selection tool; Click on "Add part", in the Advanced Digitalizing toolbar; After that you can add as many point as you want to your multipoint feature, without the ...


5

The sqlite file from NE is in FDO-OGR format, not the native spatialite geometry. If you're willing to do some manual labor, here's a way to convert to a spatialite db: First make a new, empty spatialite database (I call it "nev.sqlite"), then in a separate terminal session open the original natural_earth_vector.sqlite with spatialite. (I used the newer ...


5

Spatialite could be interesting because it is fast for local use. You can load it directly into the RAM of your machine and it is only one file, so it is really portable and shareable. You can create R-tree indexes on geometry. Just like PostGIS, Spatialite follows OGC standards and much of its functions are similar to PostGIS's and usable in SQL. It is ...


5

When talking about geographic locations, we usually say and use Lat-long. This has been codified in the ISO 6709 standard. When dealing with Cartesian coordinate geometry, we generally use X-Y. Many GIS systems, work with a Geographic Location as a special case of a 2 D coordinate point, where the X represents the longitude and Y represents the Latitude. ...


4

If you don't want to compute the distances between all the point combinations, you can use a spatial index on one of the table : SELECT A.id , B.myValue, MIN(Distance(A.Geometry, B.Geometry)) AS distance FROM tableOne AS A, tableTwo AS B WHERE A.ROWID IN ( SELECT ROWID FROM SpatialIndex WHERE f_table_name = 'A' AND search_frame = ...


4

This feature was added to the master branch of QGIS about 4 months ago, but only for PostgreSQL/PostGIS databases, not Spatialite. The series of commits could be squashed down to provide a concise view of how to add such support for Spatialite. Please submit a feature request, and link to this page. Interesting side note, Spatialite 4.1+ offers a new ...


4

For sake of posterity, the short answer is that MapInfo and FDO (AutoDesk technology) are far removed from any development with SQLite, compared to the members of the SQLite Consortium. MapInfo and FDO (AutoDesk) would be contributing binary to their downstream users, via their products and services. Spatialite is specked under a triumvirate of ...


4

Here's something you might try: You can create buffers around all the points at a "reasonable" distance that you choose based on the clustering. Then merge the circular buffers together. That should give you polygons enclosing the clusters of points. In spatialite you would do: Create a polygon table for the buffers and a second one for the merged circles: ...


4

You can connect to Spatialite via Python using the latest version of pysqlite instead of pyspatialite. Spatialite is just the spatial enablement of SQLite so this works, but if you are connecting in this way (via pysqlite) you need to load the libspatialite extension to be able to use the spatial functionality of Spatialite. from pysqlite2 import dbapi as ...


4

If you're familiar with SQL, probably the easiest way is to use the capabilities of the underlying SQLite database to "mount" one database onto another (or perhaps both source databases onto a new target database. The SQLite SQL command for this is ATTACH. Conceptually, you'd then SELECT / UPDATE from the source database table(s) into the target table. The ...


3

The biggest advantage, for me, is the relational database system in a single file format. Among the many benefits is the use of spatial functions to create views. Consider a case where you were given a set of points and your methodology is to buffer the points base on an attribute, and then test coincidence of those buffers with other geographic features. ...


3

QGIS 1.8 does not (and probably will not) support databases created with Spatialite 4.0. It requires rebuilding QGIS and setting the SPATIALITE flag to the 4.0 library which you must have already installed. And all the developers and packagers are focusing in the coming QGIS 2.0 rather than rebuilding 1.8. I believe that this next release of QGIS will use ...


3

SpatiaLite support was added to ArcGIS for Desktop at the 10.2 release: You can connect from ArcGIS to an SQLite database to create maps and perform spatial analysis on your data. You connect directly to the SQLite database file from your ArcGIS client. It is not possible to use layers based on SQLite/SpatiaLite for editing with the core ...


3

The spatialite OSM tools write to a spatialite v4 database. Unfortunately, QGIS 1.8.0 is not able to read this database version. You can try spatialite_convert from this page to convert the database back to v3, which should be readable with QGIS. See also Can't open Spatialite db from openstreetmap in Quantum GIS Why are layers imported into a DB ...


3

You can't really do this at the SQLite / SpatiaLite / QGIS level. You can do it at the filesystem level (e.g. by setting permissions or access control lists on the file) by only allowing one user (typically the file owner) to write to it, and everyone else only read access. How to do that isn't really a GIS question, but for completeness: On Linux or ...


3

Assuming you have a spatialindex created already on the polygon layer 'blayer', then your query would be: UPDATE strlayer SET fromBland =( SELECT name FROM blayer AS n, strlayer AS s WHERE strlayer.strid = s.strid AND n.blevel = 4 AND within(startpoint(s.geometry),n.geometry) AND s.ROWID IN ( SELECT ROWID FROM SpatialIndex WHERE ...


3

Sure you can use pyspatialite or even the Qt QSqlDatabase Using pyspatiailite (from http://www.gaia-gis.it/spatialite-2.4.0-4/splite-python.html) from pyspatialite import dbapi2 as db # creating/connecting the test_db conn = db.connect('test_db.sqlite') # creating a Cursor cur = conn.cursor() # testing library versions rs = cur.execute('SELECT ...


3

QGIS uses the Geospatial Data Extraction Library (GDAL) for raster works. So you must work with GDAL library and its functions. From QGIS menus open the Raster > Translate > Translation (Convert format) tool. With this tool you can convert raster formats. Firstly look at the bottom of the windows. This area shows the conversion parameters. We need to change ...


3

ST_Length() (which is an alias for GLength(), but I prefer the consistent naming) can take a second parameter which is a flag to tell it to use the WGS84 ellipsoid rather than the sphere, at the cost of computation speed. Naturally, only WGS84 coordinates are allowed with this second function, so if your coordinates are in EPSG:3857, you'll need to transform ...


3

If the only reason you're contemplating adopting a new system is "'cause there's a shiny new system", don't do it. Until and unless you actually run into problems with the limitations of shapefiles, or want to take advantage of some specific features of postgis/spatialite/whatever, there's no need to change. Keep designing and producing maps. Sooner or ...


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 ...



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