Re: [postgis-users] How to locate adjacent polygons?
thanks all for replies my apologies for confused replies and stringing the thread out Nick No that wasnt me at stackexchange. altho the graphic shows a similar scenario, except mine are a little bit more evenly sized and distributed. Brett yea thats pretty much where I'm at... except I hadnt considered dropping to foreach vertex. Altho even then I can see that there might well be cases where count would be 2 for all vertexes in 'adjacent' polygons. Steven Re your diagram: Only A would be considered a neighbour of E And I agree only a raytracing type solution will give a complete solution. But its not justified. I think extending my current solution with Brents suggestion of foreach(vertex) is the best compromise. I feel there are sufficient vertices to identify a high percentage of neighbours. And since 99% is prob OK for this project, I guess thats the way to go. thanks all -- Colin On Wed, 16 Feb 2011 10:13 -0800, pcr...@pcreso.com wrote: Hi Colin, Given your definition of adjacent, you are probably better off with a script using sqls to retrieve data/write result the script to implement the logic, iterating through the polygons: foreach polygon (a) foreach different polygon (b) foreach a.vertex foreach b.vertex get count of polygons intersected by a line between a.vertex and b.vertex if count 2 then (a) and (b) are not adjacent next b.vertex next (a) vertex write result next (b) polygon next (a) polygon This would define adjacency as having no intervening polygons between any two polygons, partial adjacency (where parts of two polygons are other parts are separated) would require a slight change in the logic, so if any a.vertex b.vertex have no intervening polygons, then (a) and (b) are adjacent. How you define implement adjacency is up to you. As is the choice of scripting language :-) HTH, Brent Wood Subject: Re: [postgis-users] How to locate adjacent polygons? To: postgis-users@postgis.refractions.net Date: Thursday, February 17, 2011, 2:09 AM sorry for double post - working from dodgy pda Hi Steve / Brent Thanks for replies Steve: Yes I did look at buffer but I discounted it because a small number of the polys are at distances well outside the mean and I didnt see any easy way of including them. Brents solution with st_distance and a tolerance factor might suffer from the same problem And in fact the definition of adjacent doesnt include distance - its simply that no other polygon crosses some path between any 2 I also have the centroids calced and stored so in my spatial innocence i devised a solution which almost works and uses ST_Crosses(ST_MakeLine something like this: select a.id, b.id, ST_Crosses(ST_MakeLine(a.centroid, b.centroid), b.geom) as stcrosses from a, b where a.id = nnn and a.id!=b.id order by stcrosses I run this per id from program code. I then filter the return to give adjacents I'm not at my dev machine right now and I suspect thats not exacty right(at all!) but what I have isnt affected by distance and almost works - except occasionally for the very complex and where there are larger gaps between polys. so maybe a combination of these methods? Or since the data wont change often, maybe I just plot them in qgis and do it manually! ;-) Colin On 02/16/2011 05:12 AM, Stephen Woodbridge wrote: Colin, Did you look at buffer? Not tested but something like this might work where b.id are the adjacent id's to a.id with the distance of tolerance. select a.id, b.id from mypolys a, mypolys b where a.id != b.id and buffer(a.geom, tolerance) b.geom and intersects(buffer(a.geom, tolerance), b.geom) -Steve On 2/15/2011 5:38 PM, Colin wrote: Hi I'm quite new to postgis and spatial databases. competent with sql and db's My problem: How to locate adjacent polygons. I have around around 2k irregular polygons. They've have been calculated as alpha / concave hulls from point sets. They're saved into pg as multipolygons id | description | geom The polygons dont have any regularity with regard to location and interaction the majority are close to a neighbour, but not touching. Typically within +/- 1 - 5% of polygon max dim a small number slightly overlap 1 or more neighbours, usually to quite a small extent their irregular shape can include 'undercuts' I need to identify the adjacent neighbours for each polygon I looked at various methods that might allow me to do this but I cant get a 100% solution Can anyone suggest methods that might work thanks Colin -- [1]http://www.fastmail.fm - IMAP accessible web-mail ___ postgis-users mailing list postgis-users@postgis.refractions.net
Re: [postgis-users] Retrieve the portion of line external to polygon
Hi strk, sorry to disturb your discussion, but I am interested in this st_snap() function you mention. I did not found it - is this something in PostGIS 2.0? Regards, Birgit. On 16.02.2011 19:18, strk wrote: On Wed, Feb 16, 2011 at 07:08:03PM +0100, strk wrote: On Wed, Feb 16, 2011 at 06:47:53PM +0100, Andrea Peri wrote: Look this simple example the difference between the line and the same line intersected with the polygon is equal to the line :) select 1, ST_Difference(ST_GeomFromText('LINESTRING(10.9 2, 11 8)'),ST_Intersection(ST_GeomFromText('LINESTRING(10.9 2, 11 8)'), ST_GeomFromText('POLYGON((12 2, 10 10, 20 21, 21 5, 12 2))'))) the trick is that in the intersection point between polygon and line, the vertex added move the line so the difference fail to remove the internal portion. Ok, I think I know what's going on. The original linestring isn't noded with the polygon boundary. When computing the intersection, a node is added. Such a node will NOT fall on the original line anymore, due to precision constraints. See this: CREATE TABLE a AS SELECT 'LINESTRING(10.9 2, 11 8)'::geometry as g; CREATE TABLE b AS SELECT 'POLYGON((12 2, 10 10, 20 21, 21 5, 12 2))'::geometry as g; CREATE TABLE c AS SELECT ST_Intersection(a.g, b.g) FROM a, b; SELECT ST_Covers(a.g, ST_StartPoint(c.g)) FROM a,c; -- false SELECT ST_Covers(a.g, ST_EndPoint(c.g)) FROM a,c; -- true What you could do is _snap_ the original line to the intersection, or to node the input before proceeding. For a working example: select st_covers(a.g, st_startpoint(st_snap(a.g,c.g,1e-10))) from a,c; --strk; () Free GIS Flash consultant/developer /\ http://strk.keybit.net/services.html ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
[postgis-users] ¡Lee tu mensaje antes de que sea borrado!
¡Lee el mensaje de Frank antes de que sea borrado! Para leer el mensaje, haz click en este link: http://us1.badoo.com/01143997419/in/APy1rkk8fwE/?lang_id=7 Más gente que también te está esperando: Luigui Marsall (Bogotá, Colombia) Shirley (Cúcuta, Colombia) Diego (Cúcuta, Colombia) http://us1.badoo.com/01143997419/in/APy1rkk8fwE/?lang_id=7 Si al hacer click sobre el enlace, no funciona, copia y pega la dirección en tu barra del navegador. Este email es parte del sistema de envío de mensajes enviados por Frank. Si has recibido este email por error, por favor, ignóralo. Será borrado de nuestro sistema en poco tiempo. ¡Diviértete! El Equipo de Badoo Has recibido este email porque un usuario de Badoo te ha dejado un mensaje en Badoo. Este mensaje es automático. Las respuestas a este mensaje no estan controladas y no serán contestadas. Si no quieres recibir más mensajes de Badoo, háznoslo saber: http://us1.badoo.com/impersonation.phtml?lang_id=7mail_code=65email=postgis-users%40postgis.refractions.netsecret=invite_id=572062user_id=1143997419___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Retrieve the portion of line external to polygon
Hello, st_snap() function is in the 2.0 future release. You find informations about this function in the trunk documentation http://postgis.refractions.net/documentation/manual-svn/reference.html and for the particular function you're looking for http://postgis.refractions.net/documentation/manual-svn/ST_Snap.html Regards ThomasG GIS specialist ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] ¡Lee tu mensaje antes de que sea borrado!
Spam from badoo? In Spanish? 2011/2/17 Badoo nore...@badoo.com See this email in Englishhttp://us1.badoo.com/01143997419/in/APy1rkk8fwE/?lang_id=3, Deutsch http://us1.badoo.com/01143997419/in/APy1rkk8fwE/?lang_id=5, Français http://us1.badoo.com/01143997419/in/APy1rkk8fwE/?lang_id=6, Italiano http://us1.badoo.com/01143997419/in/APy1rkk8fwE/?lang_id=8, Português http://us1.badoo.com/01143997419/in/APy1rkk8fwE/?lang_id=61 or 21 other languageshttp://us1.badoo.com/01143997419/in/APy1rkk8fwE/?lang_id=7 . ¡Lee el mensaje de Frank antes de que sea borrado! http://us1.badoo.com/01143997419/in/APy1rkk8fwE/?lang_id=7 *Lee tu mensaje... http://us1.badoo.com/01143997419/in/APy1rkk8fwE/?lang_id=7* -- Más gente que también te está esperando: http://us1.badoo.com/01143997419/in/APy1rkk8fwE/?lang_id=7 Luigui Marsall Bogotá, Colombia http://us1.badoo.com/01143997419/in/APy1rkk8fwE/?lang_id=7 Shirley Cúcuta, Colombia http://us1.badoo.com/01143997419/in/APy1rkk8fwE/?lang_id=7 Diego Cúcuta, Colombia Si al pulsar el enlace de este mensaje no funciona, copia y pégalo en la barra de tu navegador: http://us1.badoo.com/01143997419/in/APy1rkk8fwE/?lang_id=7 Este email es parte del procedimiento del sistema para el envío de mensajes enviados por Frank. Si has recibido este mensaje por error, ignora este email. Tras un corto periodo de tiempo, será eliminado del sistema. ¡Diviertete! El equipo de Badoo Has recibido este email porque un usuario de Badoo te ha dejado un mensaje en Badoo. Este mensaje es automático. Las respuestas a este mensaje no están controladas y no tendrán respuesta. Si no quieres recibir más mensajaes de Badoo, háznoslo saberhttp://us1.badoo.com/impersonation.phtml?lang_id=7mail_code=65email=postgis-users%40postgis.refractions.netsecret=invite_id=572062user_id=1143997419 .. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users -- Jorge Arévalo Internet Mobilty Division, DEIMOS jorge.arev...@deimos-space.com http://es.linkedin.com/in/jorgearevalo80 http://mobility.grupodeimos.com/ http://gis4free.wordpress.com http://geohash.org/ezjqgrgzz0g ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Retrieve the portion of line external to polygon
Thanks, ThomasG!! On 17.02.2011 11:12, Thomas Gratier wrote: Hello, st_snap() function is in the 2.0 future release. You find informations about this function in the trunk documentation http://postgis.refractions.net/documentation/manual-svn/reference.html and for the particular function you're looking for http://postgis.refractions.net/documentation/manual-svn/ST_Snap.html Regards ThomasG GIS specialist ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
[postgis-users] configure on HP-UX
I've build and installed postgis on Mac and linux boxes without issue, but am having a hell of a time on HP-UX 11.11; it's choking on a test for libgeos_c. I've built and installed xml2, proj, and geos into /WX/wXstation/local and postgres in /WX/wXstation/pgsql, and all their associated *config scripts run fine. My configure line is: ./configure --with-projdir=/WX/wXstation/local --with-geosconfig=/WX/wXstation/local/bin/geos-config --with-pgconfig=/WX/wXstation/pgsql/bin/pg_config --with-xml2config=/WX/wXstation/local/bin/xml2-config Below are sections from configure's output and config.log. LPATH, LDPATH, SHLIB_PATH, and LD_LIBRARY_PATH are all set (to the same thing) and include /WX/wXstation/local/lib. I hope someone can help me out. Scott -- snip configure output -- Using user-specified pg_config file: /WX/wXstation/pgsql/bin/pg_config checking PostgreSQL version... PostgreSQL 8.4.2 checking libpq-fe.h usability... yes checking libpq-fe.h presence... yes checking for libpq-fe.h... yes checking for PQserverVersion in -lpq... yes Using user-specified xml2-config file: /WX/wXstation/local/bin/xml2-config checking libxml/tree.h usability... yes checking libxml/tree.h presence... yes checking for libxml/tree.h... yes checking libxml/parser.h usability... yes checking libxml/parser.h presence... yes checking for libxml/parser.h... yes checking libxml/xpath.h usability... yes checking libxml/xpath.h presence... yes checking for libxml/xpath.h... yes checking libxml/xpathInternals.h usability... yes checking libxml/xpathInternals.h presence... yes checking for libxml/xpathInternals.h... yes checking for xmlInitParser in -lxml2... yes Using user-specified geos-config file: /WX/wXstation/local/bin/geos-config checking GEOS version... 3.2.2 checking geos_c.h usability... yes checking geos_c.h presence... yes checking for geos_c.h... yes checking for initGEOS in -lgeos_c... no configure: error: could not find libgeos_c - you may need to specify the directory of a geos-config file using --with-geosconfig -- end snip -- -- snip config.log -- configure:15323: result: checking GEOS version... 3.2.2 configure:15334: checking geos_c.h usability configure:15334: gcc -c -g -O2 -I/WX/wXstation/local/include conftest.c 5 configure:15334: $? = 0 configure:15334: result: yes configure:15334: checking geos_c.h presence configure:15334: gcc -E -I/WX/wXstation/local/include conftest.c configure:15334: $? = 0 configure:15334: result: yes configure:15334: checking for geos_c.h configure:15334: result: yes configure:15346: checking for initGEOS in -lgeos_c configure:15371: gcc -o conftest -g -O2 -I/WX/wXstation/local/include/libxml2 c onftest.c -lgeos_c -L-L/WX/wXstation/local/lib 5 /usr/ccs/bin/ld: Unsatisfied symbols: geos::geom::GeometryFactory::createPoint(geos::geom::CoordinateSequence*) con st(first referenced in /WX/wXstation/local/lib/libgeos_c.a(libgeos_c_la-geos_ts_ c.o)) (code) geos::geom::GeometryFactory::createGeometryCollection(std::vectorgeos::geom: :Geometry*, std::allocatorgeos::geom::Geometry* *) const(first referenced in /WX/wXstation/local/lib/libgeos_c.a(libgeos_c_la-geos_ts_c.o)) (code) __gxx_personality_v0 (first referenced in /WX/wXstation/local/lib/libgeos_c.a (libgeos_c_la-geos_c.o)) (code) a lot more of these std::basic_stringchar, std::char_traitschar, std::allocatorchar ::appen d(char const*, unsigned long)(first referenced in /WX/wXstation/local/lib/libgeo s_c.a(libgeos_c_la-geos_ts_c.o)) (code) collect2: ld returned 1 exit status configure:15371: $? = 1 configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME | #define PACKAGE_TARNAME | #define PACKAGE_VERSION | #define PACKAGE_STRING | #define PACKAGE_BUGREPORT | #define PACKAGE_URL | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_UNISTD_H 1 | #define HAVE_DLFCN_H 1 | #define LT_OBJDIR .libs/ | #define POSTGIS_MAJOR_VERSION 1 | #define POSTGIS_MINOR_VERSION 5 | #define POSTGIS_MICRO_VERSION 2 | #define YYTEXT_POINTER 1 | #define HAVE_IEEEFP_H 0 | #define PWDREGRESS 1 | #define HAVE_ICONV 1 | #define HAVE_LIBPQ 1 | #define POSTGIS_PGSQL_VERSION 84 | #define HAVE_LIBXML_TREE_H 1 | #define HAVE_LIBXML_PARSER_H 1 | #define HAVE_LIBXML_XPATH_H 1 | #define HAVE_LIBXML_XPATHINTERNALS_H 1 | #define HAVE_LIBXML2 1 | #define POSTGIS_LIBXML2_VERSION 2.7.8 | /* end confdefs.h. */ | | /* Override any GCC internal prototype to avoid an error. |Use char because int might match the return type of a GCC |builtin and then its argument prototype would still apply. */ | #ifdef __cplusplus | extern C | #endif | char initGEOS (); | int | main () | { | return initGEOS (); | ; | return 0; | } configure:15380: result: no configure:15390: error: could not find libgeos_c - you may need to specify the d irectory of a
Re: [postgis-users] X3D Export Command
This works was a proof of concept stuff, and was not maintaned anymore. Future PostGIS 2.0 will implement (properly) this 3D types. But not yet planned to have export X3D features in 2.0 HTH, -- Olivier Thanks Oliver for replay, I hope that postgis upgrade quickly and all can enjoy X3D export features. If I have another questiosn I'll post here. Best regaerds, Leo ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users