Re: [postgis-users] st_closespoint weridness

2012-10-05 Thread Nicklas Avén
I am not sure I understand what you get and what you expect. Is your input point inside the polygon? Regards Nicklas On Fri, 2012-10-05 at 20:10 +0100, Dave Potts wrote: > just tried a > > select st_closestpoint(poly,point) and got the result point > > The point is within a the closed polygo

Re: [postgis-users] One server, several map projections

2012-05-04 Thread Nicklas Avén
Hallo > Which is the best solution to cope with the different map projections? > - Several databases with the same map projection each one? No, then you will get problems when quering tables in differnt databases. > - One database in WGS84, and reprojecting data each time people use > each projec

Re: [postgis-users] Is it easy to convert a PostGIS Data Model into an ArcGIS Server one?

2012-05-04 Thread Nicklas Avén
Can you not just register the POstGIS table in sde? I think so, and then you will get all extra tables and overhead that sde can offer. /Nicklas On Fri, 2012-05-04 at 14:04 +0200, Mac Wind wrote: > Hi. > > Using the last version of postGIS, I've got dozens of layers. > > I wonder if it os poss

Re: [postgis-users] Intersection query help

2012-05-02 Thread Nicklas Avén
how about: CREATE TABLE intersections AS (SELECT ST_Intersection(table1.geom, table2.geom) as inter, table2.gridref FROM table1, table2 WHERE table2.gridref = 'NN') :-) HTH Nicklas On Wed, 2012-05-02 at 10:21 +0100, White, Richard wrote: > Hi, > > The following query works and returns a

Re: [postgis-users] Use of tolerances in topology

2012-04-17 Thread Nicklas Avén
ST_Dwithin is not only brute force, at least in theory. The faster distance algorithm is used in the range when the expanded bounding boxes intersect but not the geometries own bounding boxes intersect. First the && operator checks if the expanded bounding boxes intersects, if not the answer is f

Re: [postgis-users] st_length problem

2012-03-22 Thread Nicklas Avén
No it is not meters. What you can do is casting to geography type on the fly, something like: select o.osm_id, ST_AsText(ST_Transform(o.way,4326)), ST_Length(ST_Transform(o.way,4326)::geography) The you will get your answer in meters. I think that cast will work, but I havenot tried. HTH Nick

Re: [postgis-users] Problems with st_distance

2012-03-13 Thread Nicklas Avén
, like PostGIS geography knows how to calculate distances on a sphere or spheroid which for instance google maps doesn't do since it is a flattened globe. HTH Nicklas On Tue, 2012-03-13 at 12:50 +0100, Nicklas Avén wrote: > Sorry, wrong from me > > Something is wrong of course if

Re: [postgis-users] Problems with st_distance

2012-03-13 Thread Nicklas Avén
Sorry, wrong from me Something is wrong of course if the answer is 1179 compared to 1800. My brain was on vaccation /Nicklas On Tue, 2012-03-13 at 12:48 +0100, Nicklas Avén wrote: > The geography type distance calculations gives answers in meters from > unprojected data (4326). > &

Re: [postgis-users] Problems with st_distance

2012-03-13 Thread Nicklas Avén
The geography type distance calculations gives answers in meters from unprojected data (4326). I see no erason to belive that the postgis answer is wrong, especially not when Stuart says he knows the distance is 1800 meters and he gets 1179.61 meters from PostGIS. I don't know anything about that

Re: [postgis-users] Point cloud load

2012-03-08 Thread Nicklas Avén
Sorry, I forgot the link: http://opengeo.org/technology/postgis/coredevelopment/pointclouds/ On Fri, 2012-03-09 at 08:46 +0100, Nicklas Avén wrote: > Hallo > > What is the precision of your points? > > Are they integer or double precision? > > If it is just integer I thi

Re: [postgis-users] Point cloud load

2012-03-08 Thread Nicklas Avén
Hallo What is the precision of your points? Are they integer or double precision? If it is just integer I think PostGIS might give you quite a big overhead. Here is some thoughts (from Paul I guess?) on the topic. /Nicklas On Fri, 2012-03-09 at 08:19 +0100, Ed Linde wrote: > Hi All, > I have

Re: [postgis-users] ST_Overlaps and performance

2012-03-08 Thread Nicklas Avén
Hallo If your query below is not the fastest of the different approaches I think you are going into a classical trap. It is probably notthe query that takes a long time but the output of the result. Find out by not returning all the resulting geometries but instaed just count them. Instead of u

Re: [postgis-users] Problem in using Postgis 2.0.0b3 with raster

2012-03-08 Thread Nicklas Avén
Hallo try giving the full path to the raster2pgsql binary. /Nicklas On Thu, 2012-03-08 at 00:36 -0800, Giannis Giakoumidakis wrote: > Hi, is there any step-by-step guide showing how to enable PostGis > 2.0.0beta3SVN in my database and loading raster images? > > > I install it properly, as th

Re: [postgis-users] distance between 2 polygons

2012-02-16 Thread Nicklas Avén
Hallo Does A distance of 0 mean that the polygons touch each other or it means that their bounding box touch each other? From ST_Distance distance 0 menas that they are touching or overlapping each other What does a distance of 100 mean?. Is it the shortest distance between the 2 polygons o

Re: [postgis-users] Point to Polygon edge ST_DWithin

2012-02-16 Thread Nicklas Avén
Hallo What you do is htat you use the linestrings defining the polygons instead of the polygon instead in the ST_Dwithin statement. Then you can also us ST_Closestpoint to find a line between the point and the closest point on the edge. This line can you use in ST_Azimuth. If your polygons

Re: [postgis-users] split donut polygons

2012-02-15 Thread Nicklas Avén
Hallo If I understand that "DonutBridgeBuilder" picture right, what it does is making corridors to make all interior rings being part of the outer ring. That seems like a very bad idea and will most likely result in invalid geometries in many cases. Invalid because they are self intersecting. What

Re: [postgis-users] Efficiency of <

2012-02-06 Thread Nicklas Avén
Hallo Jan On Mon, 2012-02-06 at 15:25 +0100, Jan Hartmann wrote: > Hi, > > I am working on an interactive application to add and remove points > from a map. When removing, the user clicks on the map and should get > back the nearest point in the database. Normally, I would do this with > somethin

Re: [postgis-users] slow sql queries in postgis

2012-01-12 Thread Nicklas Avén
Hallo 1) what do you mean by slow? How many milliseconds or seconds are we talking about? 2) What do you get from : SELECT sum(npoints(the_geom)), avg(npoints(the_geom)) from mangrove That will tell us about how much materia the function have to deal with 3) What do you get from : SELECT sum(n

Re: [postgis-users] speeding up simple pt-in-poly lookups

2011-12-20 Thread Nicklas Avén
Martin, Stephen In intersect testing the winding number algorithm is used. Stabbing line algorithm is used in distance calculations in PostGIS. Puneet Is it geometry type you are using or is it geography. I have no idea about the algorithms in geography functions. It sounds very much with 200 s

Re: [postgis-users] Extract boundary from multipoint

2011-06-07 Thread Nicklas Avén
Hallo What is not working? ST_ConvexHull only calculates in 2D but since it passes the z-values to the result it should work if your plane is coplanar and not vertical. If it is a vertical plane only one point per 2d point will be considered. But as long as each point has its own representaion

Re: [postgis-users] Point as Index

2011-03-30 Thread Nicklas Avén
ht through I hope :-) /Nicklas On Wed, 2011-03-30 at 16:01 +0200, Nicklas Avén wrote: > Sorry, I was too fast on the keys. > > before I saw the comparasion with your own index > > /Nicklas > > On Wed, 2011-03-30 at 14:40 +0100, Ioannis Anagnostopoulos wrote: >

Re: [postgis-users] Point as Index

2011-03-30 Thread Nicklas Avén
Sorry, I was too fast on the keys. before I saw the comparasion with your own index /Nicklas On Wed, 2011-03-30 at 14:40 +0100, Ioannis Anagnostopoulos wrote: > The precise numbers are as follows: > > Total Rows in the table: 45922415 > > if I use: > select > pos_lat, > pos_lon > fro

Re: [postgis-users] Point as Index

2011-03-30 Thread Nicklas Avén
Hallo printing out that many row take a lot of time. try: select count(*) from feed_all.common_pos_messages where st_contains(ST_GeomFromText('POLYGON((0.00433541700872238 51.6875086022247,1.4450615615687 51.6875086022247,1.4450615615687 51.2018083846302,0.00433541700872238 51.2018083846302

Re: [postgis-users] Point in Poly Speed

2011-03-25 Thread Nicklas Avén
On Thu, 2011-03-24 at 20:18 -0400, Stephen Woodbridge wrote: > Also you want to try reversing you arguments to st_dwithin( and put the > polygon first as there may be some caching ot the first parameter that > might speed things up. The order will make no difference. It is up to the planner to

Re: [postgis-users] postgis 2 installation failing

2011-03-18 Thread Nicklas Avén
: > On Mar 18, 2011, at 8:40 AM, Nicklas Avén wrote: > > > > >> Does postgis2.0 have dependencies on particular library versions? like > >> geos? > > > > Yes. You must use latest GEOS trunk with PostGIS trunk. > > > > I think the latest chang

Re: [postgis-users] postgis 2 installation failing

2011-03-18 Thread Nicklas Avén
> Does postgis2.0 have dependencies on particular library versions? like geos? Yes. You must use latest GEOS trunk with PostGIS trunk. I think the latest changes in GEOS needed for PostGIS trunk is less than a month old. /Nicklas ___ postgis-users m

Re: [postgis-users] Illegal Byte Sequence

2011-03-14 Thread Nicklas Avén
Hallo Andreas May I guess you are running the trunk version. I think it is related to tichet #808 http://trac.osgeo.org/postgis/ticket/808 One workaround is described in the ticket by creating the .sql file without any encoding parameters and then change the first row of the sql file to SET CL

Re: [postgis-users] Improving ST_DWithin Query Performance

2011-03-11 Thread Nicklas Avén
Hallo Robert Welcome as a new user :-) What is the other ways you have tried to do this? I can see no reason that your function should speed things up. I think what you are doing is just forcing some of the query planners decisions. After creating the spatial index, did you run vacuum analyze?

Re: [postgis-users] st_contains() function with polygon doesn´t work

2011-03-11 Thread Nicklas Avén
Hallo What is the error message that you got? I don't think this is a PostGIS issue but an issue when building the string. If I don't misunderstand this, what you are sending to the database is: select attribute1, the_geom from table1 where st_contains(st_geomfromtext('POLYGON($stringPolygonCoo

Re: [postgis-users] Increase query performance

2011-03-08 Thread Nicklas Avén
Andreas just a thought. I would be a little suspicious about the grid. Could it be that your grid doesn't consist of just 4 corner cells. As I understood from your other post it was created in python. I have not experienced it in postgis, but in other software that when you have played enough with

Re: [postgis-users] Multi version Postgres/PostGIS installation on Ubuntu 10.04

2011-02-20 Thread Nicklas Avén
Hallo I think you are experiencing this bug that is still around in trunk :-( http://trac.osgeo.org/postgis/ticket/635 /Nicklas On Sun, 2011-02-20 at 22:40 +0100, Matthias Ludwig wrote: > I tried to setup the following configuration on a Ubuntu 10.04 server: > - PostgreSQL 9 Server from PPA (p

Re: [postgis-users] How to locate adjacent polygons?

2011-02-16 Thread Nicklas Avén
Hallo Colin Is it you that has this question at gis.stackexchange.com? http://gis.stackexchange.com/questions/6098/how-do-you-produce-a-output-table-containing-distances-between-mineral-grains-at Or at least I saw some similarity in the questions. >From what you write here, if I understand you

Re: [postgis-users] postgis/mapserver

2011-02-14 Thread Nicklas Avén
An more lightweight and probably faster alternative to GeoServer for WFS-T is tinyows, found at http://www.tinyows.org /Nicklas On Mon, 2011-02-14 at 10:26 -0800, pcr...@pcreso.com wrote: > The appropriate protocol for a data editing capability is WFS-T which > is not supported by Mapserver. Se

Re: [postgis-users] ERROR: Operation on two GEOMETRIES with different SRIDs (again)

2011-02-14 Thread Nicklas Avén
Hallo You have two problems here first You don't transform the geometr to another srid with set_srid, you just tell what srid the geometry has. use ST_Transform instead second. Do your transformation into a new table or at least into a new column to don't get in trouble with srid-constraints.

Re: [postgis-users] efficiently testing for points near polygons

2011-02-08 Thread Nicklas Avén
Hallo The overall performance will be better if you use ST_Dwithin instead of buffer and intersects. But if the buffer is done once and will never happen again maybe there is not much gain from that. The bounding boxes is very important here. The index works by first finding overlapping bounding

Re: [postgis-users] multipolygom

2011-02-08 Thread Nicklas Avén
nk you. > How can i store it in geograpgy type? > thx > Marcel > > - Ursprüngliche Mail - > Von: "Nicklas Avén" > An: "PostGIS Users Discussion" > Gesendet: Dienstag, 8. Februar 2011 12:46:14 > Betreff: Re: [postgis-users] multipolygom > > T

Re: [postgis-users] multipolygom

2011-02-08 Thread Nicklas Avén
To get the distance in meters you can use the geography type instead. something like: SELECT * FROM zip_polygon WHERE ST_DWithin(geom::geography, ST_GeogFromText('4326;POINT(13.171982 52.52646)'), 2); But to get it working fast you should store in geograpgy type and build your spatial index n

Re: [postgis-users] Inefficient query with QGIS?

2011-01-30 Thread Nicklas Avén
Hallo I have no answer to your question but I know that QGIS doesn't require a representation in geometry columns table. /nicklas - Original message - > I noticed this really inefficient query when QGIS was importing a Postgis > layer: > *select distinct case when geometrytype("the_geo

Re: [postgis-users] Strange behavior with a polygon and line that claim to intersect ....

2011-01-25 Thread Nicklas Avén
Well, I looked at it in QGIS and the line seems to cross the border of the polygon. I have attached the part of the polygon where it crosses, with the line in violet and the intersecting part in green. /Nicklas On Tue, 2011-01-25 at 15:00 -0500, Bryan Montgomery wrote: > Hello, > Is there a way t

Re: [postgis-users] org.postgresql.util.PSQLException: ERROR: operator does not exist: geometry && character varying

2011-01-24 Thread Nicklas Avén
Hallo There seems to be a geometry not included in the query. The second query is represented by "?" That makes postgresql try to make a bounding box compare between this.the_geom and ? which is not possible. So the problem seems to be earlier. Iinvestigate why the second geometry is missing.

Re: [postgis-users] Why use C procedurals for Postgres

2011-01-21 Thread Nicklas Avén
Hallo You should not need do change any security settings that is default in PostgreSQL to run PostGIS. But if there is some security setting that that is customized to not allow C-langage functions there will be problems since PostGIS is written in C. But if you have not customized any security

Re: [postgis-users] Help with a multipolygon filtering function

2011-01-20 Thread Nicklas Avén
I should ignori it, but I had to correct a typo, the last query I think should be: Select st_collectionextract(st_collect(whole_table.the_geom), 3) from (Select (st_dump(the_geom)).geom as the_geom,(st_dump(the_geom)).path as the_path, id from myTable) as whole_table left join (SELECT a.the_path

Re: [postgis-users] Help with a multipolygon filtering function

2011-01-20 Thread Nicklas Avén
Oops, I saw your ignore note too late :-) /Nicklas On Thu, 2011-01-20 at 09:20 +, Ross Lawley wrote: > Hi, > > > Please ignore my post, must have been tired last night because on > reflection it doesn't make sense on its own and I would need more > logic to determine which polygons if any t

Re: [postgis-users] Help with a multipolygon filtering function

2011-01-20 Thread Nicklas Avén
As I understand it you want to find (and remove) parts of multipolygons that has no neighbour multi part within a certain distance. First, in your code you are usin the geometry instead of the double value as teh last parameter in ST_DWithin to get a list of all polygons in a multipolygon you use

Re: [postgis-users] ORDER BY id and distance

2011-01-20 Thread Nicklas Avén
SELECT * from myTable order by mapid, ST_Distance(the_geom, 'POINT(Xcoord, Ycood)'::geometry); HTH Nicklas On Thu, 2011-01-20 at 08:38 +, Malm Paul wrote: > Hi, > I wonder how I can order a result depending on two arguments. > First:mapid (objects are connected to a mapid) and > second:with

Re: [postgis-users] Calculation distance between two points

2011-01-19 Thread Nicklas Avén
Hallo Eike The issue here is, latitude-longitude vs longitude-latitude. In PostGIS the order is longitude latitude So if you reverse the order of the coordinates you will get about 539 meters. What is right or wrong depends on which one is longitude and which one is latitude. Another way to w

Re: [postgis-users] left outer join not working as expected with ST_Contains

2011-01-12 Thread Nicklas Avén
Hallo Arne As I understand you, you say two different things here. First: I think you are misunderstanding how left join works. left join is an inner join plus all remaining records of the left table. That means you cannot use the left join in your case to only get one result from many point-pol

Re: [postgis-users] Difference beetween ST_ClosestPoint and ST_Intersection

2011-01-11 Thread Nicklas Avén
Hallo Andrea The two functions is very different but behave the same way in a few specific situations. St_Intersection I guess you know how works. ST_Closestpoint is actually a distance function. It is the forst point of ST_Shortestline. The pupose of those functions is to use on geometries not

Re: [postgis-users] Count the roads that do not intersect with any other roads in the shpefile.

2011-01-10 Thread Nicklas Avén
and to get the number found, just use count() /Nicklas On Mon, 2011-01-10 at 11:23 +0100, Nicklas Avén wrote: > Hallo Nicholas > > I assume you mean that you hae your data in a postgis table not in > shapefile. > > to find all roads that doesn't intersect any other ro

Re: [postgis-users] Count the roads that do not intersect with any other roads in the shpefile.

2011-01-10 Thread Nicklas Avén
Hallo Nicholas I assume you mean that you hae your data in a postgis table not in shapefile. to find all roads that doesn't intersect any other road you find all roads that do intersect and than catch the ones didn't find any intersecton. something like SELECT a.gid, a.the_geom FROM mytable a L

Re: [postgis-users] Computational Efficiency and Query Design Questions

2011-01-08 Thread Nicklas Avén
Hallo Tom I will make a try answering as much as I can :-) On Sat, 2011-01-08 at 12:11 -0600, Tom Kessler wrote: > Hello to all, > > I'm developing some spatial queries and have these questions: > > 1) When one makes an Explain Select request, is there any > consideration given to the computat

Re: [postgis-users] [postgis-devel] 3D distance functions

2010-12-29 Thread Nicklas Avén
s > sometime later this week. > > I think a wiki page would be a great idea. Keep up the good work! > > Thanks, > Regina and Leo > http://www.postgis.us > > > > > -Original Message- > From: postgis-devel-boun...@postgis.refractions.net > [mailto

Re: [postgis-users] query help - streets near/around a state

2010-12-22 Thread Nicklas Avén
Hallo Charles I don't really get why you do that test : AND ns.gid in ( SELECT nns.gid from streets_nj s, streets_ny nns WHERE s.the_geom && nns.the_geom AND st_dWithin(s.the_geom, nns.the_geom, 0.001) It also looks from your distances that you are working in a lat lon projection. That means tha

Re: [postgis-users] Signal 11

2010-12-20 Thread Nicklas Avén
Hallo Martin I get this error, but no crash. NOTICE: TopologyException: found non-noded intersection between LINESTRING (-73.6737 41.0346, -73.6731 41.0339) and LINESTRING (-73.6734 41.0342, -73.6733 41.0341) at -73.6734 41.0342 ERROR: GEOS difference() threw an error! ** Error *

Re: [postgis-users] postgres case(conditional)statement problem

2010-12-04 Thread Nicklas Avén
Hallo I think what you want to do is something like: SELECT price, CASE WHEN 200http://www.postgresql.org/docs/9.0/interactive/functions-conditional.html#AEN15488 I guess you can just put the case expression in the update-query the same way, but if there is just one case where you want to chang

Re: [postgis-users] Measure distance to nearest border

2010-10-21 Thread Nicklas Avén
untry.> >> What i need to solve is how to limit the distance to measuring only to neighbouring countries of the country the cell is located.> >> Thanks for your help Nicklas.> >> > >> 2010/10/21 Nicklas Avén <nicklas.a...@jordogskog.no> > > >hmm,

Re: [postgis-users] Measure distance to nearest border

2010-10-21 Thread Nicklas Avén
AND b.gwsyear <= 2008 AND b.gweyear >= 2008 GROUP BY a.gid LIMIT 1;> >> DROP TABLE IF EXISTS borddist2008;> CREATE TABLE borddist2008 AS> SELECT pgfinal2008.cell, borddisttest2.gid, MIN(borddisttest2.distance) FROM borddisttest2, pgfinal2008 WHERE borddisttest2.gid = pgfinal2008.

Re: [postgis-users] Out of memory error with BOX3D

2010-10-20 Thread Nicklas Avén
Try St_Extent3D instead without st_collect. Then PostGIS can handle 1 point at a time and not all the 17 millions. So try:SELECT ST_Extent3D(punkte) FROM rohdaten WHERE id=109; ConvexHull is only working in 2D. It will keep the third dimension but not include it in the calculations (not 100% su

Re: [postgis-users] How to select points within circle

2010-10-19 Thread Nicklas Avén
Yes, sorry Should have been select gid, the_geom, floorarea from "building" as m where ST_DWithin(m.geom,'POINT(306404701 6755737)'::geometry, 200.0); /Nicklas 2010-10-19 zhang zhe wrote: Hello, > > Thanks. I try to run your query, and it saids > parse error-invalid geometry. point (306404701

Re: [postgis-users] How to select points within circle

2010-10-19 Thread Nicklas Avén
Your syntax is a little backwards an it is better to use st_dwithin instead: select gid, the_geom, floorarea from "building" as m where ST_DWithin(m.geom,'POINT(306404701,6755737)'::geometry, 200.0); HTHNicklas 2010-10-19 zhang zhe wrote: Hello, > > I have one table called building.sql which

Re: [postgis-users] Measure distance to nearest border

2010-10-13 Thread Nicklas Avén
s far more advanced. ST_Shortestline only works for geometry type. /Nicklas 2010-10-13 Andreas Forø Tollefsen wrote: Hi> >> Thanks,> I will give it a try.> The reason I used the geography types in the distance query, were to get the distance in meters instead of degrees.> >&g

Re: [postgis-users] Measure distance to nearest border

2010-10-13 Thread Nicklas Avén
Hi As I understand you you want to get the distance from each cell to the closest neighbour country. Then, why don't you just query the distance from your cell to closest country with other gwcode?Maybe something like: Create table borddisttest asSelect ST_Distance(st_collect(b.the_geom), c.cent

Re: [postgis-users] Collect overlapping polygon IDs

2010-09-30 Thread Nicklas Avén
Something like this should work: SELECT count(*) as number_of_conflicts, array_agg(b.id) as id_of_conflicts FROM conflict_zoones a , vector_grid b WHERE ST_Intersects(a.the_geom, b.the_geom) GROUP BY b.id; array_agg will give you an array looking something like:{13, 23, 54} HTHNicklas 2010

Re: [postgis-users] geos proj stats modules all=v.1

2010-09-28 Thread Nicklas Avén
great that it is working now :-) /Nicklas 2010-09-28 Rebecca Cooper wrote: Just to let you know, third time's a charm... I reinstalled PostgreSQL and PostGIS and it didn't error when re-installing this time. I can now buffer my geometries. phew > >Thank you for the quick response Nicklas, it'

Re: [postgis-users] geos proj stats modules all=v.1

2010-09-28 Thread Nicklas Avén
Hallo I get the same answer for postgis_version()I just tells that postgis is compiled with geos and proj try postgis_full_version instead, what do you get then? /Nicklas 2010-09-28 Rebecca Cooper wrote: Hi, > >I have recently tried installing postgesql 8.4 with PostGIS 1.5 ( now clean >insta

Re: [postgis-users] Difference between ST_Intersects and && operator

2010-09-23 Thread Nicklas Avén
As said before the && operator only calculates which bounding boxes that intersects. The bounding box is the smallest box that can contain the geometry. It is a box made of the maximum and minimum x any y values found in the geometry. So, when the bounding boxes intersect it says nothing about if

Re: [postgis-users] Programmatically generate maps zoomed to extent of shapes?

2010-09-22 Thread Nicklas Avén
I think it looks like a job for mapserver to produce the images. then you can decide both output extent on the fly and decide the input extent by a query or a bounding box or whatever. but that will just give you images. How to make the layout I don't know. /Nicklas2010-09-23 John Poole wrot

Re: [postgis-users] Assistance with st_convexhull

2010-09-16 Thread Nicklas Avén
If I understand you right something like this should work: INSERT INTO convexIMU SELECT ST_Convexhull(ST_Collect(the_geom) ) as convexIMU_geom FROM pointTable GROUP BY projectid; HTH/Nicklas 2010-09-16 Appel Tony wrote: > Greetings. I have a newbie question today. I have been usin

Re: [postgis-users] ST_Union vs ST_Collect

2010-09-11 Thread Nicklas Avén
Hi Loretta In the documentation of ST_Collect there is a note explaining the difference. http://postgis.org/documentation/manual-1.5/ST_Collect.html As an example you can compare the output of the first and the second column in: SELECT st_AsText(ST_Collect(a, b)) as collected, st_AsText(ST_U

Re: [postgis-users] Nearest Neighbour on a polygon gemeotry to a given point

2010-09-07 Thread Nicklas Avén
hi take a look at ST_Shortestline and ST_closestpoint if you have version 1.5 of postgis. they will do what you want directly on the polygon. HTH Nicklas 2010-09-07 David Potts wrote: >I have a series of x/y values that represent towns and a coastline that >that is encoded as a Polygon. > >I

Re: [postgis-users] Error checking trunk version

2010-09-04 Thread Nicklas Avén
The difference is 1 extra digit in the expected result compared to Andreas result. I get the same result as Andrea on PostGISonline which is 32 bit Ubuntu. The result in "expected" I had from a 64 bit ubuntu box. The isolated number that differs shows in SELECT ST_Y(ST_Endpoint(ST_3DShortestline

Re: [postgis-users] Difference polygon sets

2010-08-27 Thread Nicklas Avén
Hallo Espen ST_Difference cuts in the polygons to give the difference. It looks like your dissolved polygons contains one or more original polygons, not just parts of them. Then it is enough to find what original polygons is used in the dissolve. You can find those polygons with a query like th

Re: [postgis-users] FOSS4G Spatial Database BoF

2010-08-24 Thread Nicklas Avén
Let's talk Big Picture on spatial data storage, what does the future hold? > Sounds great/Nicklas >http://wiki.osgeo.org/wiki/FOSS4G_2010_Breakout_Sessions#Spatial_Databases_BoF > >P. >___ >postgis-users mailing list >postgis-users@postgis.refractions.

Re: [postgis-users] Trunk 2.0.0 seem slow on Linux 64 bit

2010-08-22 Thread Nicklas Avén
Hallo First your question about index-handling of multi-geometries. The index handles the whole geometry as one big so in your case where the multi-parts are spread you will get a lot better performance if you use st_dump to split the multi to several rows of single polygons and build an index on

Re: [postgis-users] tweaking a query to use less memory

2010-08-21 Thread Nicklas Avén
and David, don't forget to have a working spatial index in place for queries like this. st_dwithin needs it badly when there is a lot of geometries around. /Nicklas On Fri, 2010-08-20 at 19:26 -0400, Paragon Corporation wrote: > David, > > Don't use ST_Intersects and buffer. That is really slo

Re: [postgis-users] ST_equals not using index ?

2010-08-13 Thread Nicklas Avén
Hallo This is a little messy story. As I know it, some one correct me if I'm wrong. In PostGIS 1.4 ST_Equals don't uses index but then you can instead use ~= that uses index But in PostGIS 1.5 the ~= operator has changed meaning and now only compares bounding boxes (have to do with avoiding rec

Re: [postgis-users] Get the bounding box?

2010-07-19 Thread Nicklas Avén
Hallo ST_Expand should do the trick. http://postgis.org/documentation/manual-1.5/ST_Expand.html /Nicklas 2010-07-20 Michael A. Peters wrote: First, thank you to the developers. Until about a week ago, my code for >range map generation was ugly and complex and broke frequently, and now >that I am

Re: [postgis-users] MULTIPOINT

2010-07-13 Thread Nicklas Avén
Hallo It seems like PostGIS reads both and makes no difference of them from:select st_equals('MULTIPOINT(1 1, 2 2)'::geometry,'MULTIPOINT((1 1), (2 2))'::geometry); It also seems like the output in both cases are in the form 'MULTIPOINT(1 1, 2 2)' from this:select st_astext('MULTIPOINT(1 1, 2

Re: [postgis-users] Round up coordinates?

2010-06-24 Thread Nicklas Avén
Hallo The problem is that even if you round your coordinates with ST_SnapToGrid, the edges between the vertexes will cross "not rounded land". So the intersection will most likely fail without the buffer if the intersection is expected somewhere between the rounded vertex points. Another way o

Re: [postgis-users] Geometry operation: split polygon using a linestring

2010-06-10 Thread Nicklas Avén
The new ST_Split function can also be tested at postgisonline.org. If you add version=trunk to the web address you get a database with postgis 2.0 as it looks in the trunk. I have used the ST_Split function to show the functionality. It is not yet in the documentation of the site how to get th

[postgis-users] FOSS4G and Barcelona

2010-06-10 Thread Nicklas Avén
Hallo I'm trying to choose what hotel to stay at in Barcelona during FOSS4G conference. I see there are plenty of hotels quite close to the conference as I understand it when looking at http://www.hotels.com and most of them is much cheaper than Catalonia Barcelona Plaza, the only option not fu

Re: [postgis-users] Check identical point

2010-05-22 Thread Nicklas Avén
2.the_geom)<=0.1; /Nicklas 2010-05-22 Nicklas Avén wrote: Hallo > >The ST_DWithin fuction will only check the 2d distance and not care it the >points are far from each other in z direction. > >If you need to also check they are close in z-direction I guess the easiest >way is to

Re: [postgis-users] Check identical point

2010-05-22 Thread Nicklas Avén
Hallo The ST_DWithin fuction will only check the 2d distance and not care it the points are far from each other in z direction. If you need to also check they are close in z-direction I guess the easiest way is to calculate the 3d distance between the points with Pythagorean theorem. The clean

Re: [postgis-users] using "&&" oprerator

2010-05-10 Thread Nicklas Avén
Hi Liem The && operator is not for checking overlapping geometries, just the bounding boxes. The bounding boxes can overlap even if the geometries doesn't. The operator is used to do a first fast (index-based) filtering before doing the real calculation if geometries are overlapping. To find i

Re: [postgis-users] st_max_distance - This function is unimplemented yet

2010-04-07 Thread Nicklas Avén
Hallo Birgit The max distance function was actually not implemented until version 1.5There were some ideas about the function earlier that by some reason made the sql-part of the function exist.But now it is there, so the recomendation is, upgrade to PostGIS 1.5.1. The function has also changed

Re: [postgis-users] Postgres/Postgis query very slow

2010-04-01 Thread Nicklas Avén
Hallo Here ST_DFulltwithin will give wrong result. It is easily done to think wrong about this function. It will cause a measuring from the point to the furthest part of the line instead of the closest. In this case it will cause a measure like the first illustration in the documentation of ST_

[postgis-users] PostGIS online

2010-03-28 Thread Nicklas Avén
do that will soon be found in the document area of the site. I have written a few words about it here http://blog.jordogskog.no/2010/03/28/postgis-online/ Welcome Nicklas Avén http://blog.jordogskog.no___ postgis-users mailing list postgis

Re: [postgis-users] php/postgresql trouble

2010-03-11 Thread Nicklas Avén
What do you mean by "seeing" the data. Fysically it is stored where you have your tablespace. The default is the data-folder in your postgresql-installation. But there is nothing to see. You see your data through some application with sql or you can in pgAdmin choose to get the table presented

Re: [postgis-users] php/postgresql trouble

2010-03-11 Thread Nicklas Avén
Hi when you are using capitals in column name you have to use " around column name: I am not good in php so I don't remember if it is ok to just double the " sign inside a string like $sql = "INSERT INTO countries (""CountryID"", ""CountryName"", ""President"") VALUES . What I use to d

Re: [postgis-users] Finding polygons outside other polygons

2010-03-08 Thread Nicklas Avén
Hallo Martin I guess I just try to answer a part of your question. I don't know what your exception comes from. If I understand things right your approach won't work because what you are doing is joining your houses with every city exept the one it eventually is intersecting. You have do get i

Re: [postgis-users] Import geometry problems

2010-02-27 Thread Nicklas Avén
Hallo Tim What do you mean by "not working". That the cell seems to be empty is just something pgAdmin does for big geometries.It still is there. You can test it by running for example:select ST_Length(the_geom) from "infra"."linienverlauf_gis_temp"; If you get a length value for each row ther

Re: [postgis-users] Query for shapes completely within a circle

2010-02-06 Thread Nicklas Avén
Hallo You have at least two options here. 1.instead of expand use st_buffer to make a circle and then use st_within the way you have done, something like:SELECT id, geom FROM geospatial WHERE ST_Within(geom, ST_Buffer(geomPt,radius) ) This is also an approximation since st_buffer defults to bu

Re: [postgis-users] brake MPolygon to polygons

2010-02-01 Thread Nicklas Avén
Hallo If I understand you right you have multipolygons representing countries that you want splitted to single polygons. That is no problem but they will not fit in the same table since you will get additional rows. If you want to make a new table with this country polygons as single polygons yo

Re: [postgis-users] Find none overlapping spot

2010-01-29 Thread Nicklas Avén
s the_geom from (select st_union(st_expand(the_geom,2)) as the_geom from t) a) b /Nicklas 2010-01-29 Nicklas Avén wrote: >Maybe something like this:> >If your polygons are not rotated this should be >fast.>1) expand all old polygons with half the size of the new polygon in yo

Re: [postgis-users] Find none overlapping spot

2010-01-29 Thread Nicklas Avén
Maybe something like this: If your polygons are not rotated this should be fast.1) expand all old polygons with half the size of the new polygon in your example 10 now, if your new polygon have any part in the empty room between the expanded polygons it should be okto find a placement like that

Re: [postgis-users] Connecting uDig to PostGIS .

2010-01-24 Thread Nicklas Avén
Hallo Anders Can you check if all tables is represented in table geometry_columns in public schema, or maybe if only those that you can load is represented. If so the quick fix is to run Select Populate_Geometry_Columns();if your tables are big it might take some time because it will look throu

Re: [postgis-users] Finding if a polygons is fully covered by others

2010-01-18 Thread Nicklas Avén
Yes, sorry, I see I missunderstood you in my last answer. I was confused, because:Is the area-solution working at all. If there is many overlapping bbox-polygons in the table isn't that going to give a too big area. If I'm not still on wrong trac I guess you can easily get negative answers from

Re: [postgis-users] Finding if a polygons is fully covered by others

2010-01-18 Thread Nicklas Avén
Hallo look at ST_CoveredBy, ST_Covered, ST_Contain and ST_ContainProperlyin dochttp://www.postgis.org/documentation/manual-1.4/ They all handle this questions in slightly different ways.I think all of them will use any potential index, but look in doc to be sure. Hope that helpsNicklas 2010-

Re: [postgis-users] Huge query, out of memory

2010-01-15 Thread Nicklas Avén
for GIS users. Nicolas. > > De : postgis-users-boun...@postgis.refractions.net [mailto:postgis-users-boun...@postgis.refractions.net] De la part de Nicklas Avén >Envoyé : jeudi 14 janvier 2010 14:38 >À : PostGIS Users Discussion >Objet : Re: [postgis-users] Huge qu

Re: [postgis-users] calculate distance between points

2010-01-14 Thread Nicklas Avén
Hallo To just get the distance between the points you could do with something like select ST_Distance(a.the_geom, b.the_geom) as dist from pointtable a inner join pointtable b on a.gid = b.gid+1 if your gid value is in integer and ordered chronlogically But I guess that what you want is the len

  1   2   >