#POSTGIS IRC Log - 2009-06-22

For logs after Feb 3, 2007, all times are GMT-8. Prior logs are GMT-9.
Back to Logs
06:13:42 sigq: geosfeed: Ticket #264 ( task updated ): Discrete Hausdorff distances exposed in C API <http://trac.osgeo.org/geos/ticket/264#comment:1>
08:57:18 KBlade: ogr2ogr - violates check constraint .. what cause this ?
09:18:34 KBlade: if i use -nlt geometry, will there be any impact to mapfile for wms
10:57:29 CIA-4: strk * r2596 /trunk/source/headers/geos/operation/buffer/BufferParameters.h: Fix bug in BufferParameters::setMitreLimit
11:09:36 CIA-4: strk * r2597 /trunk/tests/unit/capi/GEOSBufferTest.cpp: Add tests for limited mitre join ( now working )
11:11:52 TJCRI: is there a way to find out what version of postgis is installed to a database?
11:14:06 strk: select postgis_full_version( );
11:14:26 TJCRI: thankyou
11:38:35 strk: urwlcm
12:32:21 TJCRI: does anyone have a good example of ST_Contain? I have a table full of polygons and trying to figure out if a point falls within any of those polygons ( presumably it would only fall in one ). I am also assuming ST_Contain is the function I want? but not 100% sure on that
12:32:33 TJCRI: ST_Contains
12:33:10 strk: ST_Contains( poly, poi );
12:33:26 strk: a point on the boundary does *not* "contain" it
12:33:33 strk: but might be wrong, double check me
12:33:43 strk: could be confusing with ST_Within
12:34:24 TJCRI: ok I understand that I am just having trouble conveying the query
12:34:54 TJCRI: I am assuming I need to select * from the_geom to test all the polygons within the table
12:36:03 strk: it depends on what you need exactly
12:36:11 TJCRI: well I have a point
12:36:37 TJCRI: and need to find out if that point is within a zip code
12:36:39 strk: and need to know if *any* polygon in your table contains it ?
12:36:43 TJCRI: yeah
12:36:46 TJCRI: its a table of zip codes
12:37:06 TJCRI: so I geocoded an address and obtained x,y
12:37:16 strk: select zip_code from myTable where myPolygon && makePoint( x, y );
12:37:51 strk: uhm...
12:38:01 strk: AND ST_Contains( myPolygon, makePoint( x,y ) )
12:38:25 strk: try also to leave the && part out
12:38:30 strk: as it might be redundant
12:39:16 strk: confirmed, it is redundand from postgis 1.2.2 up
12:40:44 TJCRI: oh wow
12:40:46 TJCRI: I got it
12:40:48 TJCRI: hah
12:40:58 strk: eureka time : )
12:41:19 TJCRI: select zip from ziptable where the_geom && makePoint( 12772002.935912, 536029.010965596 ) and ST_Contains ( the_geom,makePoint( 12772002.935912, 536029.010965596 ) );
12:41:36 strk: now take off the '&&' part
12:41:38 TJCRI: the question I have though is thos:
12:41:47 TJCRI: previously I reprojected into a point
12:41:50 strk: select zip from ziptable where ST_Contains( the_geom,makePoint( 12772002.935912, 536029.010965596 ) );
12:41:59 TJCRI: using: select st_astext( st_transform( st_setsrid( 'POINT( $long $lat )',4326 ),2898 ) );
12:42:24 TJCRI: so that gives me a result of: POINT( 12772002.935912 536029.010965596 )
12:42:34 strk: fpm
12:42:45 TJCRI: but there is no , in that result
12:42:45 strk: don't use text form
12:42:53 TJCRI: ahhh ok
12:43:37 TJCRI: yay the shorter query works too : ) same result
12:43:42 strk: select zip from ziptable where ST_Contains( the_geom, st_transform( st_setsrid( makePoint( $long, $lat ), 4326 ), 2898 ) );
12:43:43 TJCRI: and its a valid result cause it was my own work address
12:44:21 strk: w/out the st_ prefix will be even shorter ! ( just to check effects of the statement on pramsey back from the sun : )
12:44:50 TJCRI: oh that gave me this error: ERROR: Operation on two geometries with different SRIDs
12:45:11 strk: select unique( st_srid( the_geom ) ) from ziptable; ?
12:45:27 strk: nope, wrong SQL : )
12:45:34 strk: select distinct st_srid( the_geom ) from ziptable;
12:46:00 TJCRI: that gave me -1
12:46:03 pramsey: contains( ) does not include an && overload, whereas st_contains( ) does
12:46:44 strk: TJCRI: do you know the Spatial ref sys of the geoms in your table ?
12:46:57 TJCRI: its 2898
12:47:06 strk: update the values then
12:47:16 strk: better not having -1 SRIDed values around
12:47:40 strk: better in the DB than in your brain : )
12:48:02 TJCRI: how do I do that? is it done when the shape file is created from shp2pgsql ?
12:48:13 TJCRI: I am excited cause I actually get to learn this stuff finally : )
12:48:18 strk: update ziptable set the_geom = setsrid( the_geom, 2898 );
12:48:58 TJCRI: ERROR: new row for relation "ziptable" violates check constraint "enforce_srid_the_geom"
12:49:07 strk: a-ha!
12:49:15 strk: I'm sure there's an utility function for that
12:49:20 strk: I've read it in a book : )
12:49:44 TJCRI: well if I can do it when creating the .sql from shp2pgsql then I can incorporate it into my process for coverting shape files to db tables
12:49:45 strk: UpdateGeometrySRID
12:49:54 strk: <catalogue>, <schema>, <table>, <column>, <srid>
12:50:06 strk: will also take care of fixing constraints and the entry in geometry_columns
12:50:25 strk: of course it'll be best to do at load time
12:50:31 ue: there is a -s options for shp2pgsql to force a srid
12:50:34 TJCRI: yikes thats a bit over my head right now hehe
12:50:48 TJCRI: the UpdateGeometrySRID part that is
12:51:09 strk: select UpdateGeometrySRID( '', '', 'ziptable', 'the_geom', 2898 );
12:51:11 strk: ^^^ that simple : )
12:51:22 TJCRI: oh the catalogue part threw me off
12:51:23 : * strk hopes, at least
12:51:50 strk: empty strings for defaults... ( or database name for catalogue, the schema for the schema )
12:52:07 TJCRI: ok cool that worked!
12:52:19 strk: the function actually throws away the catalogue argument now that I look closer : )
12:53:01 TJCRI: yay now that complex query worked!
12:53:10 TJCRI: so because it was -1 for SRID it didn't like it?
12:53:28 strk: you can't compare apples with bananas
12:53:45 TJCRI: I know but what was strange is I reprojected from lat long to 2898
12:53:45 strk: not yet
12:53:58 strk: you reprojected the point, not the polygons
12:53:59 TJCRI: then took that answer, and used it in the query and it came up with a result
12:54:12 strk: that's weird indeed
12:54:14 TJCRI: ahh
12:54:23 strk: worth a closer look ( there might be a pending bug )
12:54:32 TJCRI: cool : ) Im good at finding bugs haha
12:54:58 TJCRI: just about every thing I touch I find something wrong with it, I guess thats my contribution to society haha
12:56:09 TJCRI: I have a few more tables to upload so I will try to get them in 2898 with the -s but I probably wont get to that til tomorrow cause my bus leaves in 10mins
12:56:48 strk: get your contribution to the society, try again your old and new queries
12:57:00 strk: compare and see if there's an inconsistency with that SRID exception
12:57:20 strk: pramsey: there's no automatic projection yet right ?
12:58:00 TJCRI: strk: ok so I can try to duplicate the problem and report back to you tomorrow
12:58:11 strk: me or someone else..
12:58:54 pramsey: no, there's no automatigic.
13:00:54 TJCRI: ok and I am using 1.3.6 too so im not on an outdated version
13:01:11 TJCRI: thankfully I am fairly decent at documenting on my wiki so I should be able to repeat this no problem
13:02:53 strk: 1.4 is coming out, to check if you really find a bug in 1.3.6
13:03:39 TJCRI: yeah I have 5 more tables to upload so I should be able to check that out
13:08:10 TJCRI: ok im out but will report back tomorrow, thanks to strk for all the help
16:24:22 LeoSh: has anyone here gotten MaxMind GeoIP working on windows?
17:42:02 PerryMason: how do I get st_transform to return meters as units?
17:42:35 PerryMason: I'm using st_distance to get the distance between two points, and would like to get the distance in meters
17:54:32 sigq: geosfeed: Ticket #265 ( defect created ): Free the WKB-memory allocated by GEOS <http://trac.osgeo.org/geos/ticket/265>
17:56:33 sigq: geosfeed: Ticket #265 ( defect closed ): Free the WKB-memory allocated by GEOS <http://trac.osgeo.org/geos/ticket/265#comment:1>
18:50:52 sigq: geosfeed: Ticket #266 ( defect created ): free memory block allocated by GEOSGeomToWKB_buf( ) <http://trac.osgeo.org/geos/ticket/266>
18:56:54 sigq: geosfeed: Ticket #266 ( defect closed ): free memory block allocated by GEOSGeomToWKB_buf( ) <http://trac.osgeo.org/geos/ticket/266#comment:1>
20:19:22 sigq: geosfeed: Ticket #266 ( defect updated ): free memory block allocated by GEOSGeomToWKB_buf( ) <http://trac.osgeo.org/geos/ticket/266#comment:2>
22:27:34 simplexio: PerryMason: use srid that uses meters
22:42:18 PerryMason: simplexio: did that : )
22:42:38 PerryMason: simplexio: you still there or already on the road?