Tag Info

Hot answers tagged

8

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

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.


6

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


6

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


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


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

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


5

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

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


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

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

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

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

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

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

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

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


2

I have just tested this SQL and it works: SELECT g1.OGC_FID As id1, g2.OGC_FID As id2, MIN(ST_Distance(g1.GEOMETRY,g2.GEOMETRY)) AS DIST FROM table_01 As g1, table_02 As g2 WHERE g1.OGC_FID <> g2.OGC_FID AND ST_Contains(ST_Expand(g1.geometry,50),g2.geometry) GROUP BY id1 ORDER BY id1 As you can read here "The naive way to carry out a nearest ...


2

You can add the view as you add a normal spatialite table, if the view has field of unique integers. In the add dialog, to the right of the view name is an ID field drop down, select your unique integer field there. You could also enter your SQL statement in DB Manager's SQL window, and add the layer from there. You'll still need a unique integer field in ...


2

You can add the data from the database with Add vector layer ... in QGIS 2.0.1. But be patient, it is a lot of data. The Qspatialite plugin is unfortunately not able to deal with the data, nor the Add Spatialite layer dialogue.


2

The answer to your first question is yes, and there are more options than just 'off' and 'on.' See the journal_mode pragma. There's also this question on StackOverflow that has some useful info in the accepted answer. For your second question: yes you should be able to. It wouldn't really be that much different from loading a single shape file other than ...


2

You say you are defining two empty columns X and Y of type double, but on the screenshots they appear as integers. Also, there is no double type as numeric on sqlite: http://www.sqlite.org/datatypes.html http://www.sqlite.org/datatype3.html Which version os spatialite are you using? Can you add the columns with an sql command with the shell?


2

In the style of your layer, on the top right there is the type of rule to apply when 'virtually" merging objects of the same layer. Select "dodge" in the drop down menu. (sorry if the terms are not exact but my qgis is not in English, I will edit the post when I get to another computer)



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