Tag Info

Hot answers tagged

7

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


6

A really easy, but not fantastic measure is to get the Hausdorff distance between each combination, which is done with the ST_HausdorffDistance function. Using approximate LineStrings from your figure, these are all shown in blue, and the Hausdorff distance is shown for one of the pairs of lines in red: And the query to sort the 6 combinations in ...


5

If you don't have an attribute, you should first find a polygon feature class with the boundaries of Greece (e.g. on gadm.org). Then you have two solutions : You want the roads to be cut at the boundaries of you area of interest : use some clip tools (in QGIS : Vector -> Geoprocessing -> Clip ) You want to keep the two sides of a road when it crosses a ...


4

Since you're not worried about simultaneous edits on features, I'd say that in theory you have nothing to worry about. The main danger w/ QGIS is that simultaneous editors can stomp on each other's edits without noticing ("last edit wins"). For data under active editing with multiple users you might want to at least keep track of history, which you can do ...


4

EDIT: Update, having belatedly realized this is a Map Server question. In general, to get the convex hull, you will want to group by id/gid, as producing the hull(s) is an aggregate operation. So, without the Mapserver part, the query would look like: SELECT id, ST_ConvexHull(ST_Collect(the_geom)) as the_geom from xyz group by id; Now, to get MapServer ...


4

Your data looks like it's Mercator (big negative X's). I'll assume web mercator, but that could be wrong, and may lead to meter-level inaccuracies (if it's "real" mercator, use 3395). shp2pgsql -c -d -D -W LATIN1 -s 3857 -I 'path/to/shapefile.shp' my_table | psql -d mydb Now flip the coordinates to geographics inside the database ALTER TABLE my_table ...


3

So you're saying that you installed the PostGIS extension ? (CREATE EXTENSION postgis;) If so, you have to add a column geometry whith the following function: AddGeometryColumn(varchar table_name, varchar column_name, integer srid, varchar type, integer dimension, boolean use_typmod=true); So if your table is named myTable: SELECT ...


3

I don't have access to PostGres/PostGIS, but here is how I would go about it in ArcGIS (or other). Calculate the length of the original lines into a static column Buffer your lines according to how you define "similar". Do not dissolve buffers. Resulting buffers will have FID equal to original line. Intersect buffers and original lines. Resulting layer ...


3

The function returns a table with typed columns (a schema) and rows (values). The .* at the end means "all columns from the table." It's a bit like SELECT * FROM X, but acts as syntactic sugar so you don't have to wrap the function call in a (SELECT * FROM function()).


2

The documentation you are referencing (see the proposed answer below) from the Census Bureau's site refers solely to the Landview 6 product (released in 2003). The Census Bureau does not release information about specific addresses, including the exact location, due to Title 13 of the US Code. The TIGER/Line Shapefiles and the Census Geocoder documentation ...


2

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


2

Here is a good tutorial that helped me a lot: http://pythongisbook.com/blog/2013/04/11/creating-a-postgresql-connection-from-a-qgis-layer-datasource/ update The above link has expired... :( Here is my code that I use in my QGIS plugin: from PyQt4.QtSql import * db = QSqlDatabase('QPSQL') if db.isValid(): # string db.setHostName('your_host') # ...


2

I do not know of a Commercial Service, but the US Census Tiger Dataset has a lot of City Boundary information that is current as of 2014. These are supplied as Shape Files which could be loaded into a PostGres/PostGIS database You would need to implement a Reverse GeoCode Lookup (this is a link to Google's service) to obtain a Latitude/Longitude for the ...


2

You need to cast from the output of ST_MAKE() which is a geometry to the geography data type. This casting is done by using the :: operator. The following command should work: UPDATE customer_campaign set geom=ST_MakePoint(customer_campaign.long, customer_campaign.lat)::geography;


2

You can also use a polygon to select the roads you want (in the top menu bar, the icon with the white arrow and the dotted lines). Then click on the layer containing the roads >> save as shapefile. If you make sure the box 'only save selected feautures' is thicked, you're new shapefile should only contain the selected roads.


2

The PostgreSQL Manual explains how to add the path to binaries to the PATH environment variable. This procedure depends on your OS distribution and how you installed PostgreSQL and/or PostGIS. Otherwise, if you want to run a program like shp2pgsql without adding it to PATH, the path to the binary needs to be specified: /usr/local/pgsql/bin/shp2pgsql ...


2

I'm not sure a natural ordering really exists for a geometry, given that it is two-dimensional and can start from any point in its outer linear ring. However, to answer the second part of your question, the following will order by the left-most x coordinate of every geometry. Select * from island_table order by ST_XMin(ST_Envelope(geom)); EDIT: As pointed ...


2

I think the best approach is to go with Mapserver or Geosever (since you are new, Geoserver will look a lot easier) Once you set a WMS service with geoserver, you can add the resulting WMS to your OpenLayers project. Geoserver automatically returns only the information in the extent of the current view, also you can set the range of visible scales on your ...


2

Finnish Airports Isochrones using the Interpolation plugin Site analyses can benefit greatly from using “drive-time” isochrones to define the study area. Drive time isochrones are often significantly different from simple buffer areas which disregard natural barriers such as rivers or slow roads. ...


2

You should use osm2pgrouting to import the osm data into you DB, it's a command line tool that will automatically create the appropriate graph for pgrouting. http://www.pgrouting.org/docs/tools/osm2pgrouting.html


2

It looks like you're trying to get a unique integer field for QGIS to use as a key. I've had luck using the row_number window function for this. The basic syntax is: SELECT row_number() OVER () As vid, ... That will give each row a sequential integer starting with 1.


2

This is more of a PostgreSQL question rather than a PostGIS question, but sill a good one. Functions like ST_PixelAsPoints, ST_PixelAsPolygons, and ST_PixelAsCentroids return a set of composite record data type, which have several fields. This is very similar to ST_Dump, described here. To gain access to all the returned fields from these composite data ...


1

What are looking for is an OpenLayers strategy. You do not use this directly, but one of the subclasses, such as BBOX or Cluster or Fixed. The cluster strategy does as it says and combines point that are close together into clusters, based on a threshold, which will lead to much faster rendering times when you have many points in view. Unfortunately, the ...


1

I tried your commands and changed filename raster, to filename char(250), , assuming you meant to use a string for that (and declaring it as a raster is a typo??). The commands seem to work without -C. With -C, I got some warnings/notices about numeric field overflow and no_data. But I guess that's just something in my data. What I tried is: echo ...


1

Let's assume that your 'deg' columns are +ve for North/East and -ve for South/West, and that all other metrics are +ve only, then making decimal degrees is straightforward. SELECT AddGeometryColumn('population', 'latlongeo', 4326, 'POINT', 2); UPDATE population SET latlongeo = ST_SetSRID(ST_MakePoint( sign(long_deg) * (abs(long_deg) + long_min/60 + ...


1

The file osm2po.config, which can be obtained from the downloads tab on the osm2po page, contains a table with four column, defined as: 1) concurrent order 2) class (1-127) 3) default speed in kmh 4) allowed transportation type (optional) - since v4.5.30 And here are some sample rows, which I think explain where the 12, 51, etc, you are ...


1

If you are into Java and want Flexibility, Graphhopper is an excellent alternative. Peter, the project lead, actively encourages extensions and changes and the community is very responsive. Graphhopper works differently to Pgrouting (I use both) and it is extremely fast. Instead of using a PostGis database, Graphhopper builds its graphs direct form the .pbf ...


1

I think the set of PostgreSQL drivers you downloaded are incomplete, and here's why: ArcGIS Server was installed as an x64 (bit) app, while the ArcGIS 10.2 Desktop client is an x86 (32-bit) app. So, referencing this ESRI documentation means the 64-bit postgreSQL libraries (libeay32.dll, libintl.dll, libpq.dll, and ssleay32.dll) go into the Server ...


1

To investigate an error in a script file with psql, it may help to identify the first error by stopping the script on the first error with: \set ON_ERROR_STOP on This is off by default, which is why you might see repeated noise messages "ERROR: current transaction is aborted, commands ignored until end of transaction block" With an error like: ...


1

Try running the query in a terminal window or pgAdmin3 to see if it works there. If you want to visualize the routing query in QGIS look at the workshop: Create a database connection and add the “ways” table as a background layer. Add another layer of the “ways” table but select Build query before adding it. Then type the following into the SQL where ...



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