#POSTGIS IRC Log - 2008-07-22

For logs after Feb 3, 2007, all times are GMT-8. Prior logs are GMT-9.
Back to Logs
03:13:01 CIA-6: robe * r2874 /trunk/doc/ ( reference.xml reference_new.xml ): move over ST_SetSRID, ST_Transform and ST_Multi. Provide examples.
03:39:12 CIA-6: robe * r2875 /trunk/doc/ ( reference.xml reference_new.xml ): Move over ST_AsText, ST_AsEWKT and provide examples. Change order of ST_Multi.
05:53:55 CIA-6: robe * r2876 /trunk/lwgeom/lwpostgis.sql.in.c: Deprecate ST_area2d
08:50:34 darkblue_B: regarding yesterday's discussion.. I just tried the test case again in the JTS test environment ( basis of GEOS ). A multipolygon that self-intersects returns FALSE for IsValid( ).
08:54:41 darkblue_B: in a publib.boulder.ibm.com/infocenter doc, it says that a Multipolygon's polys cannot intersect.. and that they may touch only at a finite number of points
08:54:49 darkblue_B: so no edges in common, I suppose
08:56:43 darkblue_B: it seems the solution to zanberdo's problem may have been to take the polys.. union them first, not multipoly, and then do the query on the result
09:01:36 darkblue_B: hey zanberdo_home
09:01:51 darkblue_B: I was just loooking at your problem again, in a different environment
09:02:27 darkblue_B: It seems that by definition, you cant have self-intersecting polys in a multipolygon
09:02:44 darkblue_B: no shared edges even
09:33:16 darkblue_B: zanberdo_home: anyone there?
09:52:32 sigq: geosfeed: Ticket #194 ( defect created ): Unbuffered geometries using negative distances <http://trac.osgeo.org/geos/ticket/194>
09:56:27 sigq: geosfeed: buffer_test.zip attached to ticket #194 <http://trac.osgeo.org/geos/attachment/ticket/194/buffer_test.zip>
10:18:45 landonf: I have a database design question I'll throw out there -- how do you deal with relations between geographic entities? A city is in a state, but that can be inferred by whether the point is encompassed by the state, rather than, say, a foreign key constraint. There's nothing to stop one from dropping the state from the database, though.
10:19:12 landonf: The use case I'm thinking of is geocoded entities, where the geocoding may be imperfect, and the only true location of the entity recorded is the actual address.
10:29:19 brough: state id should be on the city table, as an fkey, I would think. that's how I do it. use gis to associate cities with states in the first instance, although there are a few world city tables that already do this for you.
10:29:56 landonf: I was out looking for some canonical city/state-province/country tables, but then wondering about reloading that kind of bulk data.
10:30:09 brough: really you only need to use postgis for creating tables like this when you are looking for cities within areas of interest -- parks etc.
10:30:27 brough: does not take long using postgres COPY command.
10:35:46 brough: i made up a set of normalised world cities/states/regions csvs using the maxmind tables as a basis, but looks like mediafire deleted them. I can re-upload if needed.
11:00:10 darkblue_B: I found a very large worldcities db, as points...
11:01:40 darkblue_B: hmm maxmind?
11:02:06 darkblue_B: the geonames schema might be informative
11:02:17 darkblue_B: I assume they have worked through a couple of designs
11:05:04 brough: points, interesting. that's certianly not maxmind. just lat/lng, city, state and a few thousand dupes
11:05:04 brough: pretty poor table really.
11:12:29 darkblue_B: hmm annoying doc build errors on postgis trunk
11:13:15 darkblue_B: Error: no ID for constraint linkend: ST_Accum
11:13:38 darkblue_B: XRef to nonexistent id: ST_Accum
11:13:42 darkblue_B: etc...
12:13:08 landonf: *nod* I was looking at GNS for the country/city/state data
13:16:11 tbnorth: hi all - is SELECT ST_AsEWKT( ST_Envelope( ST_Collect( wkb_geometry ) ) ) from lta; the fastest way to get a bounding box?
13:16:55 : * tbnorth realizes he hasn't built indexes...
13:19:36 tbnorth: still slow, even with indexes... is there a better way to get bounds?
13:21:48 tbnorth: Taking the envelope of the collected envelopes is much better.
13:56:39 zanberdo: notice: while attempting to use st_within( some_geom, my_geom ) where my_geom is a multiploygon containing intersecting polygons, st_within will generate an error "TopologyException: side location conflict". This can be resolved by calling st_buffer( geom, 0 ) on my_geom i.e.: st_within( some_geom, st_buffer( my_geom, 0 ) )
21:05:08 darkblue_B: zanberdo: are you sure buffer( 0 ) gives you the right result?
21:06:05 darkblue_B: I have the JTS test suite open, and when I create a multipolygon with intersecting polys, buffer( 0 ) gives me the 1st poly minus all other polys as a result
21:24:46 springmeyer: darkblue_B: what is the JTS test suite exactly: I have not used it...
21:25:34 darkblue_B: hi springmeyer.. greetings from Portland
21:25:51 mleslie: springmeyer: JTS is the Java Topology Suite. GEOS, the topology library used by PostGIS, is a port of JTS.
21:26:19 darkblue_B: JTS test suite... one of the gems I found while cramming for my "Intro to PostGIS" talks at the Bay Area Postgres Users Group Meeting
21:26:31 springmeyer: mleslie: right
21:26:34 darkblue_B: it directly exercises the basis of the GEOS lib
21:26:39 springmeyer: is the 'test suite' this: http://www.vividsolutions.com/jts/JTSHome.htm
21:26:40 sigq: Title: JTS Topology Suite ( at www.vividsolutions.com )
21:26:49 darkblue_B: hmmm
21:26:58 springmeyer: or are you actually running it locally using the JTS jar?
21:27:01 springmeyer: or something...
21:27:14 darkblue_B: its a Java app.. I can run it - which is a big success for me and Java apps ( ! )
21:27:21 darkblue_B: looking
21:27:39 springmeyer: oh, interesting. is there any equivalent port for geos?
21:28:31 darkblue_B: http://dpaste.com/66866/
21:28:33 sigq: Title: dpaste: #66866 ( at dpaste.com )
21:28:48 darkblue_B: thats what I do here..
21:28:53 darkblue_B: runs on my mac
21:28:56 darkblue_B: or linux
21:29:13 darkblue_B: GUI.. nice features..no equiv for GEOS that I know of
21:29:36 darkblue_B: but I can generate and test all the JTS base cases.. in WKT
21:31:05 darkblue_B: mleslie: maybe you know.. or springmeyer
21:31:21 darkblue_B: is it not legal to have intersecting polys in a multipolygon
21:31:21 darkblue_B: ?
21:31:31 darkblue_B: I am getting IsValid( ) as false
21:31:39 darkblue_B: in the test suite
21:31:46 darkblue_B: and topology exceptions
21:31:51 darkblue_B: on the operations
21:34:39 darkblue_B: and Buffer( 0 ) of said multi poly is not at all the right thing
21:37:16 springmeyer: darkblue_B: I'm no expert in legality and validity
21:38:04 darkblue_B: did you try the JTS-1.8 thing?
21:38:09 springmeyer: but if two multipolygons intersect doesn't that mean that where they intersect is actually not a multi*?
21:38:30 darkblue_B: springmeyer: yeah, that seems like the case
21:38:44 springmeyer: nah, no time tonight, working on sanding a picture frame...
21:39:02 darkblue_B: its two polys *in* a multipolygon, to be clear
21:39:15 springmeyer: but I'm interested - I'll try it sometime soon
21:39:22 darkblue_B: ok, cool
21:39:36 springmeyer: sure... okay. well can you round up at wkt example?
21:39:42 darkblue_B: looks like vividsolutions/jts/download.htm
21:40:10 darkblue_B: I'm gonna try in PostGIS just to see what it does
21:45:29 darkblue_B: aha!
21:45:48 darkblue_B: zanberdo: I just confirmed by hand
21:46:19 darkblue_B: both JTS and PostGIS with GEOS return the minimal POLY I described when you Buffer( 0 )
21:47:02 springmeyer: so paste the geometry you are testing on...
21:47:12 darkblue_B: if there are several, overlapping Polygons in a Multipoly, the result of Buffer( 0 ) is simply the 1st Poly minus any overlap of the following Polys
21:47:20 darkblue_B: springmeyer: ok
21:48:36 darkblue_B: http://dpaste.com/66867/
21:48:37 sigq: Title: dpaste: #66867 ( at dpaste.com )
21:49:10 darkblue_B: http://dpaste.com/66868/
21:49:12 sigq: Title: dpaste: #66868 ( at dpaste.com )
21:49:42 darkblue_B: how do you draw that springmeyer ?
21:49:55 darkblue_B: I'm using that JTS java app
21:53:55 springmeyer: hey darkblue_B: stepped away for a moment...
21:54:37 springmeyer: how do I draw that? you mean how does one save that to a table to be able to view in qgis/udig/etc?
21:54:46 darkblue_B: yeah
21:58:41 darkblue_B: ohh.. you mena you routinely put it into postGIS and use an app that reads Postgres to view it
21:58:42 springmeyer: select ST_GeomFromText( 'MULTIPOLYGON( ( ( 100 320,20 220,140 140,100 320,100 320 ),( 140 280,60 140,180 60,200 260,140 280,140 280 ) ) )' ) as the_geom into test_table;
21:59:06 springmeyer: select AsText( ST_Buffer( the_geom,0 ) ) from test_table;
21:59:36 darkblue_B: and.. thats written in psql? or in your GIS app
22:00:08 darkblue_B: I've used OpenJUMP with Postgres interface a bit
22:00:13 darkblue_B: but rarely..
22:00:28 darkblue_B: I dont have qgis or udig on my mac
22:00:48 darkblue_B: its not set up for X apps - if thats needed
22:01:15 darkblue_B: mainly I've used OGR to get things in and out of PostGIS
22:01:32 darkblue_B: OGR to KML.. and a KML viewer..is common for me
22:01:54 darkblue_B: but I do far less of this than you do springmeyer
22:02:46 springmeyer: thats just sql to type into the same old psql interpreter...
22:03:14 darkblue_B: yeah.. then you read test table with a Postgres aware GIS app
22:06:55 springmeyer: ya.
22:07:18 springmeyer: udig will read that simple shape out of the box
22:07:53 springmeyer: for qgis do: select 1 as oid, AsText( ST_Buffer( the_geom,0 ) ) from test_table;
22:09:30 springmeyer: or just paste your WKT into http://openlayers.org/dev/examples/vector-formats.html
22:09:31 sigq: Title: Vector Formats ( at openlayers.org )
22:09:55 springmeyer: although those are not 'projected' coordinates are they?
22:10:12 darkblue_B: nope
22:16:23 springmeyer: anyway: i see how that buffer trick only takes the polygon fragment - seem problematic, yes
22:21:14 darkblue_B: +1
22:59:55 springmeyer: darkblue_B: do you realize that your example wkt is not valid to start with?