43

I don't know what version of PostGIS you are using but on >2.0 I first login using psql: psql -U postgres Then I create a database: CREATE DATABASE example_gis; Then I move into this database: \connect example_gis; And then I run the commend: CREATE EXTENSION postgis; This creates all the spatial functions, and object types in this database.  


21

I made a test for you: PostgreSQL 9.3 PostGIS 2.1 Windows 7 i7 3770@3.4 GHz processor GDAL 2.0-dev 64-bit shapefile of 1.14 million polygons, file size 748 MB Ogr2ogr command: ogr2ogr -f PostgreSQL PG:"dbname='databasename' host='addr' port='5432' user='x' password='y'" test.shp --config PG_USE_COPY YES -nlt MULTIPOLYGON Total time:1 minute 30 ...


17

Short and sweet: Install changeDataSource plugin. Right-click on the layer in the Layers Panel and select Change vector datasource. In the dialog box that appears, just hit OK without changing any of the settings. Basically, you are "changing" the vector datasource to what it already was, but this forces QGIS to reload the layer definition. Tested in QGIS ...


14

For displaying purposes it is always good to use a spatial index. It will improve speed of both rendering and spatial queries. However, if you plan to update large quantities of objects, it might be wise to remove the spatial index during the update. Otherwise the update process will become significantly slower, because with every update the spatial index ...


14

select st_asgeojson(st_transform(ST_SetSRID(geom, XXXX), 4326)) AS geojson FROM ptable where level_1='Built Up' Try setting SRID beforehand by replacing XXXX with the code of your SRID.


13

Why use a database? Because it's not necessarily the case, especially with larger datasets, that you can expect to be able to push the entire thing to the client. If you're talking thousands of points, then sure, but for millions of points you probably don't want each and every one represented in RAM on your end users' client. Not everyone has a super fast ...


13

It is definitely possible to pull all the layers into one database, although in a multiuser environment, this will be best if most users will only be reading (not editing) the data. The easiest way to quickly convert a large number of shapefiles to a single SpatiaLite database is to use ogr2ogr. Make sure your shapefiles are in a single folder (e.g. ...


11

Figured this out! (also asked here) A record in a spatial table (Shapefile, PostGIS, Spatialite) that has no geometry can have geometry added by adding a 'part' to the feature using the advanced digitizing toolbar. Here's the workflow: Bring table containing the geometry-missing feature into QGIS Select the layer from the layers panel and start an edit ...


11

After the suggestions of user30184, Paul Ramsey and my own experiments. I decided to answer this question. I failed to mention in this question that I am importing data to a remote server. (although it is described in the blog post I refer to). Operations such as inserts, over the internet are subject to a network latency. Perhaps it is not irrelevant to ...


9

Here is one way to do that: Components used: Leaflet PouchDB (a framework that uses indexedDB in your browser) XHR2 (XMLHTTP) to fetch the files, since JQUERY does not yet support binary blob XMLHTTP KendoUI (an HTML5 web control library) Running the Demo: http://codepen.io/DrYSG/pen/hpqoD Delete any old DB (Press the Delete Button) Reload the page ...


9

The following snippet works for me: uri = "file:///C:/testdata/somecsv.csv?delimiter=%s" % (";") lyr = QgsVectorLayer(uri, 'New CSV','delimitedtext') QgsMapLayerRegistry.instance().addMapLayer(lyr) For reference, if you wanted to add it with geometry: uri = "file:///C:/testdata/somecsv.csv?delimiter=%s&crs=epsg:4326&xField=%s&yField=%s" % (";",...


8

You can easily coerce your data.frame to an sp SpatialPointsDataFrame object. coordinates(datosmerged) <- ~XCOORD+YCOORD class(datosmerged) Assuming that "shape" is a polygon, you can then use the "over" function to identify overlap between the two feature classes. An alternative is "gIntersects" in the "rgeos" package but it a bit overkill for you ...


7

In newer versions of QGIS you can right click the layer and select properties. In the first tab there is a section about layer information with the options for data source encoding. You can select UTF-8 there. Sorry for the German screen shot but since the question was about German characters...


7

Finally I found the service best shoot my need, Here MAP API. They support mulitiple language and has good zh-hant/zh-hans matching; eventhough, they don't have compelete translate, but well matched, better then Google Map Serivce. Update Google map is still the best one; during my using the HERE MAP API, I found a lot of cities are missmatched in Chinese ("...


6

I would suggest something like PostGreSQL with PostGIS. The benefit of this is that you can store your entire data (including the geometries). You can then use SQL to query either just the non spatial Attributes, or you could also include the Geometry if required. Besides PostGreSQL, I have also stored data in Oracle Spatial, but there is just too much ...


6

I think you need to build another table that defines all the routes in is as combinations of other routes. Then you query this table and join to the actual routes to get the geometry. If the query is for 'from station' to 'to station' and each section has a 'from station and 'to station'. But you want to include routes that take in multiple sections, you ...


6

Oracle DBMS is is capable of storing spatial data either through custom formats (like Esri) or native (Oracle Spatial). This means it is worth learning for GIS Analyst because you will be able to interact with the DBMS either by using SQL/PLSQL/spatial SQL functions (for analysis and data retrieval, and you can do a lot with those spatial functions without ...


6

An .mxd file specifies one particular way of rendering some data. The .mxd file references your data (by file name, by IP address, by URL, etc, depending on the data). But it does not contain the data. In the ArcGIS world, an .mxd file is often simply called "a map". (The acronym "MXD" stands for "map document".) And yes, you can create as many ...


6

Regarding your code sample, there is really simple bug. I believe it's so obvious there is no need for further explanation; correct code would be: function getfeatures(){ var writer = new ol.format.GeoJSON(); var geojsonStr = writer.writeFeatures(vectorSource.getFeatures()); document.getElementById("demo").innerHTML = geojsonStr; }


6

The types geometry and geography are PostGIS data types, whereas point, line, path, etc. are native PostgreSQL data types. The native types offer very little functionality compared to the PostGIS types, and have relatively poor support by client applications. On the other hand, the native storage types use less storage space and may be faster for the few ...


6

All PostGIS types and functions are optional; if you do not use them, you will not notice them. You can simply switch it on and off with CREATE EXTENSION postgis; and DROP EXTENSION postgis;, so it is easy to test.


5

Pros: It's a high performance and flexible key/value that can be indexed and queried. I have a complex schemaless web GIS that uses an HStore column for storing the features properties. Cons: Most WMS/WFS tools like Mapserver, Geoserver and similars can't understand and work with HStore columns, so you end up creating hard coded SQL Views (In Geoserver ...


5

First of all: No, SDE does not have any built in feature of event triggered processing. As far as I know you can probably do something working with the CASE Tools where you can implement your own types of featureclasses with their own behaviour, but that means ArcObjects programming. I think database triggers can be used for this, and this wouldn't be too ...


5

On large databases or a database with may changes it can be very important to have spatial indexes in place and updated regularly. (Keeping it simple here) For example for Oracle Spatial indexing capabilities into the Oracle database engine is a key feature of the Spatial product. A spatial index, like any other index, provides a mechanism to limit ...


5

Following @novicegis's link, this worked for me with postgis 1.5: db=gis sudo -su postgres <<EOF createdb --encoding=UTF8 --owner=ubuntu $db psql -d $db -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql psql -d $db -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql psql -d $db -f /usr/share/postgresql/9.1/contrib/...


5

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


5

You've hit on the major difference between CartoDB and MapBox. CartoDB provides an in-browser geodatabase that you can store your data in, and interact with easily via API. MapBox (if you're making your own custom layers) requires you to create tiles in TileMill, and you can interact with those pre-made tiles, but you can't access or change the underlying ...


5

You could use an OGR Virtual Format. This link has a section called "Reading CSV containing spatial information" which shows how to create a VRT file that reads a CSV file with a lat/lon column. This example is a basic template but could be manipulated to suit your case. Basically you copy the code below into a text file and save it with a file extension ...


5

Arcpy has a built-in function to do this kind of conversion: Convert Time Field. It's mentioned in the first ArcGIS Help link in your question. It can take an ArcGIS date field and convert it to several datatypes, including integer. Here's the syntax: ConvertTimeField_management (in_table, input_time_field, {input_time_format}, output_time_field, {...


5

Wow. Way simpler than I expected. Should not have supposed that 'ogr' wouldn't be able. someTableLayer = QgsVectorLayer(ministryOf.csv, 'sillyWalks', 'ogr') QgsMapLayerRegistry.instance().addMapLayer(someTableLayer)


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