Tag Info

New answers tagged

1

In addition to an answer over in SO, the inverse geodetic solution is not easy with near-antipodal points, as your question has. The inverse geodetic problem is solved iteratively using Vincenty's 1975 algorithm, which fails to converge for near antipodal points. However, the problem is still solvable using a different approach. See page 40 of Rapp RH ...


0

The API for setDataSource says it is void QgsDataSourceURI.setDataSource( schema, table, geometryColumn, sql, keyColumn) So parameter 2 requires a tablename. Parameter 5 with the name sql can be misleading, as it does not accept a full SQL string but just a WHERE clause, so there is no way to accomplish exactly what you want just like that. If you ...


2

For an answer on the geodesic, your example 2 is the closest, but when you ran it you should have seen a couple warnings, NOTICE: Coordinate values were coerced into range [-180 -90, 180 90] for GEOGRAPHY NOTICE: Coordinate values were coerced into range [-180 -90, 180 90] for GEOGRAPHY because your input coordinates are not in lon/lat, they are in web ...


2

The ST_Split PostGIS function is probably what you want. To get a single line split by multiple points, you could use something like this multipoint wrapper plpgsql function. I've simplified it just to the "split (multi)lines with (multi)points" case below: DROP FUNCTION IF EXISTS split_line_multipoint(input_geom geometry, blade geometry); CREATE FUNCTION ...


1

Best I could find by briefly looking at the PostGIS code was, that these kind of exceptions are raised by GEOS. So I would recommend you to look at their wiki, sources etc. like http://trac.osgeo.org/geos/wiki/TopologyExceptions


1

I haven't the whole answer for you, but ST_Line_Locate_Point takes a line and a point as arguments, and returns a number between 0 and 1 representing the distance along the line to the position that is closest to the point. ST_Line_Substring takes a line and two numbers, each between 0 and 1, as arguments. The numbers represent positions on the line as ...


0

On the surface of a sphere, all lines are "horizontal lines" by definition. But you mean something else! If you refer to lines parallel to the equator (parallels of latitude), then they are all oriented E-W, i.e., have 0 or 270 azimuths. Any line, including those parallels, whose azimuth is unchanged at all points along it, is called a loxodrome (or rhumb ...


2

First, be careful with phrasing. Your "the angle between two locations" is unclear. Keeping things to a simple sphere, the azimuth of any oblique great circle route depends entirely on where you measure it. It can range all the way from 0 to 360 and be correct. You probably seek the starting azimuth of a great circle route from a certain point to another ...


1

PROJ.4 uses the position vector method for its 7 parameter transformations. The ArcGIS transformation that you're referring to uses the coordinate frame method. They use different conventions for the rotation values, so switch the signs on the rotation values and retry. General information: To change the direction of a 7-parameter transformation ...


1

The elevation service on ArcGIS Online includes ready to use worldwide data, and also a built in raster function to generate aspect. It's also pretty simple to filter simultaneously for a range of aspect values (290-250 degrees) as well as elevation (e.g. 0 to 10 meters, depending on how you define a beach - or perhaps you already have the beaches ...


1

For PostGIS, make sure you are following the hard upgrade procedure: pg_dump -h localhost -p 5432 -U postgres -Fc -b -v -f file.backup thedatabase This way it can be restored in the existing database, or it can be discovered with a future version of PostGIS using the postgis_restore.pl command. For Windows, you need to tailor a simple BAT file described ...


0

My problem was that I could not find the pg_dump command. I thought it was a subcommand of psql command. You nead to add c:\program files\postgresql\9.3\bin> to path(system variables) of windows or use its direct executable file: eport: c:\program files\postgresql\9.3\bin> pg_dump.exe -U postgres test2 >"d:\backup.sql" import: c:\program ...


2

The pair that you want is PG_Dump and PG_Restore... I use PG_Dump on a scheduled task to backup our PostGIS databases in a format that can be restored easily - and more importantly will work! pg_dump.exe --file=c:\Your\path\BACKUP_Name.Backup -Fc -Z9 -o DatabaseName Custom format Z9 compression (to save space) Include objectIDs and then to restore on ...


1

The query is the following: "SELECT row_to_json(f) As feature \ FROM (SELECT 'Feature' As type \ ,ST_AsGeoJSON(%s)::json As geometry \ , row_to_json((SELECT l FROM (SELECT id AS feat_id) As l)) As properties \ FROM shapefile_feature As l WHERE l.id = %s ) As f;" % (geometryField, feature.pk) output: { u'geometry':{ ...


1

I fix it, just have to use first of all the function st_linemerge, then use the function st_makeline and finally use ST_line_interpolate_point. ST_line_interpolate_point(st_makeline(st_linemerge(geom)),fraction);


1

As many have already said, the availability of drivers in rgdal in R for both raster and vector data always depends on the underlying GDAL installation. If that has the driver, then it will work on readGDAL/writeGDAL or readOGR/writeOGR. If it does not have it, you need to upgrade your own GDAL and reinstall rgdal. Most questions about drivers come from ...


0

You may download the source file and build it by yourself: Install GEOS(for topology support) wget http://download.osgeo.org/geos/geos-3.3.9.tar.bz2 tar xfj geos-3.3.9.tar.bz2 cd geos-3.3.9 ./configure make sudo make install cd.. Install PostGIS 2.0 wget http://download.osgeo.org/postgis/source/postgis-2.0.6.tar.gz tar xfz postgis-2.0.6.tar.gz cd ...


0

This is how pg_routing works. If you want to have route from specified points not from start or end of edge you have to perform some post-processing. I've answered similar question here. I think this could be what you're looking for.


0

I guess you are talking about curves? What parameters do you want as input? If you use ST_Shortestline with a point at some distance from your curve/linestring, you will get a line perpenicular from your linestring/curve to the point.


0

Don't buffer to find intersections—it's expensive. Use a distance-based function instead, like ST_DWithin. To get the points you want: SELECT aa_points.int_id FROM aa_points, road_ln WHERE road_ln.st_nam IN ('EPPING FOREST', 'POINT NO POINT') AND ST_DWithin(aa_points.the_geom_webmercator, road_ln.the_geom_webmercator, 10);


3

To begin with you might consider using ST_DWithin instead of creating a buffer and using ST_Intersects. It will be faster and simpler. That being said, to get all the points that are in one buffer but not in both buffers you need to get the symmetric difference of both sets. Symmetric differences look something like this: (a EXCEPT b) UNION (b EXCEPT ...


0

You do not appear to be comparing like with like. See what happens when you make it do more: select st_astext (point), st_astext (point2), round (st_distance (point, point2)), round (point <#> point2) round (st_distance (point::geometry, point2::geometry)), round (point::geometry <#> point2::geometry) from testgeo2 limit 5


2

ST_ClosestPoint will find the closest point on a linestring. For example, locating a point on a road that is closest to a point-of-interest off to one side: SELECT ST_AsText(ST_ClosestPoint(road, poi)) FROM (SELECT 'LINESTRING (10 10, 20 20)'::geometry AS road, 'POINT (14 10)'::geometry AS poi ) AS f; st_astext -------------- POINT(12 12) (1 row) ...


1

IN your query with "ST_Intersects(...)='t'" you are getting what you expect because each village is tested against all wetlands, and when any intersection is found, the name is returned. In the first query "ST_Intersects = 'f' ", villages are again tested against all wetlands, and if any one of them is false, the village name is returned. Each village is ...


1

Try this: select distinct v.name from villages v left join wetland w on st_dwithin(w.geom,v.geom, 0) where w.<some_attribute> is null; The left join will return a record for everything in villages, but you will only get attributes populated when you have a st_dwithin match. So if you limit to the null's, you should have the items that do not ...


1

I would say that the ideal situation is to store everything in one table, with the same srid. However if that is not ideal in this case, I would consider creating a view that does an st_transform on the geometry to the srid you want and then use that to view in qgis.


1

The ST_ConvexHull function is implementing the Simple Features specification portal.opengeospatial.org/files/?artifact_id=13228 which says that "simple features are based on 2D geometry with linear interpolation between vertices". Therefore you get a flat polygon as a result.


2

See the Discrete Global Grids site, specially their software and the grids they've pre-generated. These generate the grids as vectors and you should be able to import them into postgres.


0

I have installed postgis by configure using source. Download the latest PostGIS source and compile it wget http://download.osgeo.org/postgis/source/postgis-2.1.0.tar.gz tar xzvf postgis-2.1.0.tar.gz cd postgis-2.1.0 ./configure make checkinstall For more details visit , Thanks


1

OpenJUMP has since version 1.6 a read/write support for PostGIS out-of-the-box without a need to install an additional plugin. This German tutorial is still up-to-date for the current OpenJUMP version 1.7.1 http://iweb.dl.sourceforge.net/project/jump-pilot/Documentation/OpenJUMP%201.6%20Docs/PostGIS_Tutorial_20.pdf. Tutorial has lots of screen captures so ...


1

The documentation is a bit wrong. It does work for polyhedral surfaces as well (but without sfcgal it treats those as surfaces not volumetric). I'll correct the documentation on that. user30184 regarding your question it says Not Disjoint (not not Distinct). Disjoint is the opposite of intersects so that is right. Tsolmon, If you treat your surface as an ...


0

Rather than thinking about merging A/B and trying to avoid merging A/E, merge them all together into a single lake polygon (I'm hoping here your data model does at least include a unique code for the lakes) with ST_Union. Then, use ST_DumpRings() to get just the rings. Then add the skeleton lines for just that lake to the collection. Then use ST_Polygonize() ...


0

Andre, This is a bug in our make that it doesn't give a warning that you are pointing at an invalid path for sfcgal. The --with-sfcgal should be the path to the sfcgal-config file.


1

Perhaps you may need to think through the data type for sites. What is it for? It seems that geometry is defined as geometry(PolygonZ,4326), which I think is a bit silly. A polygon could be expressed as a 3D object if all the linear rings are coplanar (like a triangle or a lake). However, if it were, for example, the border of Nepal, why keep elevations ...


0

I'm using both, each for its own purpose. I believe that most simple filtering queries you can make on PostGis have an equivalent on MongoDB (within, near, intersection). MongoDB has the additional advantage of being capable to ingest a sparse schema and nested properties (sure, pg can do this too, but you need to k ow beforehand which properties you will ...


1

You can use St_GeomFromText to add geometries in WKT format UPDATE sites SET geometry = st_geomfromtext('POLYGON((0 0, 1 1, 2 2, 3 3, 0 0))') WHERE ID = 1123


1

You may want to use the ST_Envelope() function. Specifically, see the 2nd example using a LINESTRING geometry. Given a LINESTRING composed of two vertices that represent your points, you should be able to get back a Polygon geometry which might be more useful to you.


1

You should use rgdal, specifically writeOGR (which is for vector data) to write the table to Postgis. Note that you must have a spatialdataframe as designated by the sp package (autoloaded with rgdal), I suspect your results of rasterToContour are the correct format. #R code assumes library(rgdal) writeOGR(x, "PG:dbname='BDDMeteo' user=user ...


0

You might try a system like rpostgresql which allows you to simply connect to your postgresql / postgis database rather than exporting the tables out of your database. Another link: http://cran.r-project.org/web/packages/RPostgreSQL/index.html Database interface and PostgreSQL driver for R This package provides a Database Interface (DBI) compliant ...


0

Answer pulled from a related question: Pretty easy assuming you have the lat/lngs. Convert lat/lng to the osm data srid Compute the distance to all POIs that you care about in the database. Pick the row with the smallest distance. Additionally, you may want to limit your search to a radius of interest (say 5 KM..) As an example, let's find 5 closest ...


0

I had the same exact problem. I have points that represent vehicles and would like to get the closest road to within some error tolerance. In my case, the data I have is in SRID 900913 while the submitted points are lat,lng. Here's the query that's working for me: SELECT osm_id, name, ST_XMin(line.way), ST_XMax(line.way), ...


0

Which version of Mapnik are you using? I think you should update the Mapnik version to 2.x and build again from source.


0

I don't think OpenGeo ships with pgRouting so I'm guessing you copied the pgRouting files from http://postgis.net/windows_downloads? The question is which ones did you copy. As someone else noted you say you have 9.3 but yet you are copying into a 9.2 folder. Those definitely are incompatible. You need to use 9.3 binaries with 9.3 install and 9.2 with ...


4

To use [FULL|INNER|LEFT|RIGHT|OUTER|CROSS] JOIN syntax supported by PostgreSQL, the query would still need ST_Within(). I've never seen any spatial database use IS WITHIN, since there could be parameters for the spatial relation, such as ST_DWithin. It should look like this: SELECT p.*, b.polyname FROM points p INNER JOIN shapes s ON ST_Within(p.the_geom, ...


0

You most probably don't want to invent your own geocoder because this is a really tricky task. Addresses in OSM are rarely stored as a full, complete set for every single object. Instead, pre-calculations have to be done in order to add administrative information like cities, municipalities, countries and so on. Instead try to use one of the already ...


0

Long question, short answer :) ad. 1 - Yes ad. 2 It would be better if you have this two datasets in one database, database have to be spatially enabled. Postgis extension gives you lots of functions to access, create, edit and compare spatial data e.g. select * from hh_2po_4pgr routing join planet_osm_polygon poly on poly.boundary = 'administrative' and ...


0

Don't use a TIN for this, use a polyhedral surface, and the ST_3DDistance function to test for containment tests.


1

Hey first you should try to dump your database using pg_dump (http://www.postgresql.org/docs/9.3/static/app-pgdump.html) before you do anything else. This at least should give you a copy of the current non working data, which you can revert back to. Also make a copy of your data dir ...


1

This function code could be (it's an example - did not check if it's working) : CREATE OR REPLACE FUNCTION give_me_cost(source integer, target integer) RETURNS decimal(8,2) AS $BODY$ with subset as ( SELECT seq, id1 AS node, id2 AS edge, cost FROM pgr_dijkstra( 'SELECT gid as id, source, target, st_length(geom) as cost FROM roadnetwork', $1, $2, ...


1

Probably the first thing to do is to import your data again after you have read about addresses in OSM from http://wiki.openstreetmap.org/wiki/Addresses. Why you should do import again is that the default osm2pgsql style file does not import all the keys which will likely need, for example addr:street ...



Top 50 recent answers are included