Tag Info

Hot answers tagged

17

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


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


9

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


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

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


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

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

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


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

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

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

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


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

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

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

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

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

You won't be able to fix this with "Save As..." because there is no way to control the geometry type in that dialog. It only lets you enter Data Source Creation Options(-dsco) and Layer Creation Options(-lco). You will have to either use the DBManager or ogr2ogr command line. I get this error when trying to mix geometry types when importing data to a ...


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


3

What you display is not the relation, but the closed way http://www.openstreetmap.org/way/55075809 (look for the id field). This way has no tags, because they are in the relation http://www.openstreetmap.org/relation/552092. The OSM plugin import lacks full relation support as it is done by osm2pgsql. With that, relations get a negative ID to distinguish ...


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

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.


2

Ah, that's different: SELECT count(*) AS "Number of Points", SUM(some_field) AS "Sum of Some Field" FROM points WHERE (PtDistWithin(points.geometry, MakePoint(x,y, 4326), 30000)=TRUE); Read the documentation about the PtDistWithin function to understand the spheroid option. (For a 30 km radius, I think it won't make any significant difference.)



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