New answers tagged postgis-2.0
You need to provide WKT (i.e., no comma). To easily get this out, use toText(): System.out.println(p1.toText()); or directly specify X and Y values, which is useful if you want to eventually parameterise the inserts: INSERT INTO coordinate(id, tipo, luogo) VALUES(1,'calcare', ST_SetSRID(ST_MakePoint(40.271915834122524, 17.83405351767443), 4326));
To make a view that casts one datatype to another, it's simple, just use ::newdatatype in the select part of the query: CREATE VIEW geog_from_geom_view SELECT gid, geom::geography AS geog, cola, colb FROM my_geo_table; But with the original table my_geo_table, it doesn't make any specific performance difference whether the location is stored as a ...
Installing pgRoutingfor PostGIS 2.0 works differently than described in the old post that you linked. For newer instructions check pgRouting 2.0 for Windows quick guide. Since you mention that pgRouting Layer plugin does work, I would assume that you actually installed everything correctly. If you clarify which settings you are using, we might be able to ...
This might be what you need - this is added to plugins.ini file and enables the shapefile and dbf loader. I'm using postgre 9.2 and postgis 2.0. ; ;PostGIS shp2pgsql-gui (Windows): ; Title=PostGIS Shapefile and DBF loader Command="$$PGBINDIR\postgisgui\shp2pgsql-gui.exe" -h "$$HOSTNAME" -p $$PORT -U "$$USERNAME" -d "$$DATABASE" -W "$$PASSWORD" ...
If you have a spatial index built, it should be O(log(n))
You can find the source code of osm2pgsql here: https://github.com/openstreetmap/osm2pgsql/blob/master/reprojection.c and you will find this note in line 67: /* hard-code the source projection to be lat/lon, since OSM XML always * has coordinates in degrees. */ pj_source = pj_init_plus("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"); /* ...
Here's a query that should get you what you want: SELECT a.name, b.name, ST_LENGTH(ST_Intersection(a.geom, b.geom)) FROM polygons a, lines b WHERE ST_Intersects(a.geom, b.geom);
Maybe a little bit late. This should work for the first part of your answer: WITH objects AS (SELECT name, (ST_Dump(roads.geom)).geom AS geometries FROM roads), point AS (SELECT 'SRID=4326;POINT(long lat)'::geometry AS point ); SELECT DISTINCT ON (ST_Distance(point, geometries)), objects.name FROM objects, ...
You have a pretty tough problem, because the GEOS library underneath PostGIS does not preserve M values. It does preserve Z values though, so if you can transfer your M to the Z, you can pass them through. You might have to dump points from the line, set the Z, and then makeline on them to do so. Ugly, but practical.
You must confirm the database is PostGIS not PostGres Go to pgAdmin and view your database. Open and view the DB and besides "Schemas" there will be a count of schemas available. If it says "Schemas (1)" it's probably only a PostGres DB. Inside "Schemas" there should be an entry for "topology." If there is no topology it is not a spatial database (PostGIS) ...
This is due to a bug in the GEOS library and is being discussed here. Until this bug is fixed in Qgis code, the user can avoid it by only crosses boundaries on vertices (digitize a snapped vertex on an existing one on boundary) while digitizing polygons.
From http://postgis.net/docs/ST_Distance.html --Geometry example - units in planar degrees 4326 is WGS 84 long lat unit=degrees If ST_Distance is given two geometries, it assumes those geometries are really in cartesian (or planar) coordinates. Thus, the units are the same as those in the coordinates -- usually metres or feet. Your problem seems to ...
I think this is the most frequent question on postgis list over time :-) If your data is in srid 4326 and you use geometry type the result will not give any meaning. It is in degrees. To get the result in meters just cast to geography type and st_distance will calculate the distance along the great circle instead and return in meters. ...
The function needed is ST_LocateAlong From the manual page example, I thought it just works with measures that already exists in the LinestringM but after testing, this works: SELECT ST_AsEWKT((ST_Dump(the_geom)).geom) FROM (SELECT ST_LocateAlong( ST_GeomFromEWKT('LINESTRINGM (0 0 0, 10 0 20, 12 0 40, 20 0 50, 21 0 70)'), 45) As ...
Top 50 recent answers are included