Re: [postgis-users] Find n Nearest Neighbors for given Point using PostGIS?

2011-02-24 Thread Stephen Woodbridge
Scholle, The only way you can do nearest neighbor searches the are fast is to write a stored procedure that expands the search if you fail to get the number of results you want. So in pseudo code something like: radius := 0.01; -- assuming degrees loop select into cnt count(*) from mytabl

Re: [postgis-users] Find n Nearest Neighbors for given Point using PostGIS?

2011-02-24 Thread Scholle
Great, didn't consider the geometry/degree difference I drastically decreased the value for the third parameter of ST_DWithin function and its sufficiently fast now... Ben Madin-3 wrote: > > Have you tried EXPLAIN to see where the slow part is? > > But at a guess - consider that st_dwith

[postgis-users] SPAM blocking on postgis server

2011-02-24 Thread Ben Madin
G'day all, I just tried to send a response, and my ISP (who's SMTP I normally use) rejected it : Reason:5.7.1 Service unavailable; Client host [61.9.189.137] blocked using dnsbl.sorbs.net; Currently Sending Spam See:http://www.sorbs.net/lookup.shtml?61.9.189.137 I doubt my ISP really care

Re: [postgis-users] Find n Nearest Neighbors for given Point using PostGIS?

2011-02-24 Thread Ben Madin
Have you tried EXPLAIN to see where the slow part is? But at a guess - consider that st_dwithin uses the geometry unit for it's calculations - so you are searching for everything within 300 degrees (more than halfway around the planet). You may want to try searching a smaller set of data before

[postgis-users] Find n Nearest Neighbors for given Point using PostGIS?

2011-02-24 Thread Scholle
I am trying to solve the problem of finding the n nearest neighbors using PostGIS: Starting Point: - Table geoname with geonames (from geonames.org) containing latitude/longitude (WSG-84) - Added a GeometryColumn geom with srid=4326 and datatype=POINT - Filled geom with values: UPDATE geoname

Re: [postgis-users] regarding count query on multiple column in one go

2011-02-24 Thread Paragon Corporation
Yamini, The first way that comes to mind is just wrap that in a subselect. SELECT orig.* FROM hydro_net As orig INNER JOIN ( select hyd_name, count(*) from hydro_net group by hyd_name having count(*) > 1) As dupes ON (orig.hyd_name = dupes.hyd_name) Leo http://www.postgis.us

[postgis-users] Sponsorship for OSGeo Montreal Code Sprint 2011

2011-02-24 Thread Daniel Morissette
Dear PostGIS users, OSGeo's Montreal Code Sprint 2011 is going to take place on March 15-18, 2011. A group of over 20 OSGeo project developers and contributors will meet in Montreal for 4 days of work on their respective projects... for the advancement of the software that you use everyday.

Re: [postgis-users] ST_Value from Polygon

2011-02-24 Thread Pierre Racine
You should just divide the area of your polygon by the area of one of your pixel. I want to investigate this example a little bit further. What is the size of your raster in pixels? I understand that you did not tile it. Did you? Pierre From: postgis-users-boun...@postgis.refractions.net [ma

[postgis-users] regarding count query on multiple column in one go

2011-02-24 Thread Yamini Singh
Hi All, I have a table hydro_net in PostGIS database. The table has following schema: CREATE TABLE public.hydro_net (hid integer NOT NULL DEFAULT nextval, f_code_des varchar(254), hyd_desc varchar(254), hyd_name varchar(254), geom geometry, I have more than 3000 records in

Re: [postgis-users] ST_Value from Polygon

2011-02-24 Thread Andreas Forø Tollefsen
Great. Thank you so much. I should have noticed that these were unioned numbers. Btw. are there any way of getting the count of pixels within a polygon without actually aggregating them or union them? Andreas 2011/2/24 Paragon Corporation > Andreas, > Sorry should have recognized what you're d

Re: [postgis-users] ST_Value from Polygon

2011-02-24 Thread Paragon Corporation
Andreas, Sorry should have recognized what you're doing. The intersection returns a polygon which is a union of the clipped raster pixel squares. So you need to use Sum of area instead and then divide by the area of a pixel to get the equivalent of your count. So SELECT gid, SUM(ST_Area((foo

Re: [postgis-users] Problem transferring geometries from 1.5 to 1.3

2011-02-24 Thread Laurent Jégou
Hello, i was able to solve the problem. With the help of Fred Lehodey i found that the geometries were not valid, some inner rings intersections (with isvalidreason(the_geom)). I used the very neat function from Regina Obe : http://postgis.refractions.net/pipermail/postgis-users/2009-March/023064.

Re: [postgis-users] ST_Value from Polygon

2011-02-24 Thread Andreas Forø Tollefsen
Thanks! That solved it. This will probably take a lot of time. I have 259200 polygons measuring 0.5 x 0.5 decimal degrees while the raster dataset is of global cover and has a pixelsize of 0.00278x0.00278. Andreas 2011/2/23 Paragon Corporation > Andrea, > > Try > > SE

[postgis-users] Problem transferring geometries from 1.5 to 1.3

2011-02-24 Thread Laurent Jégou
Hello, i stumbled into a problem when i tried to insert geometries from an 1.5 installation to a postgis 1.3. The 1.5 is my local test server, the 1.3 the distant production server, to which i only have a FTP access, so i'm uploading geometries with the help of a PHP script reading a big csv (text

Re: [postgis-users] st_intersects() returns false with point and polygon that obviously intersect

2011-02-24 Thread Craig de Stigter
Thanks for the confirmation. Created #845 On Thu, Feb 24, 2011 at 9:41 PM, Sandro Santilli wrote: > On Thu, Feb 24, 2011 at 09:35:44AM +0100, Sandro Santilli wrote: > > On Thu, Feb 24, 2011 at 12:58:24PM +1300, Craig de Stigter wrote: > > > Hi list > > >

Re: [postgis-users] st_intersects() returns false with point and polygon that obviously intersect

2011-02-24 Thread Sandro Santilli
On Thu, Feb 24, 2011 at 12:58:24PM +1300, Craig de Stigter wrote: > Hi list > > This query returns false, but the box and point intersect: > > select st_intersects('POINT(169.69960846592 -46.5061209281002)'::geometry, > > 'POLYGON((169.699607857174 -46.5061218662,169.699607857174 > > -46.50611959