#POSTGIS IRC Log - 2008-06-26

For logs after Feb 3, 2007, all times are GMT-8. Prior logs are GMT-9.
Back to Logs
01:28:48 Snadder: Anyone know what kinda indexes postgis uses for spatial data?.. Are they using z-curves or something?
01:35:14 ue: GisT indexes
03:37:00 sigq: geosfeed: Ticket #189 ( defect updated ): Build problems with Sun Studio compiler ( on Solaris x86 & Sparc ) <http://trac.osgeo.org/geos/ticket/189#comment:1>
03:46:20 sigq: geosfeed: Ticket #192 ( defect created ): configure.in assumes gcc / autogen.sh assumes GNU which <http://trac.osgeo.org/geos/ticket/192>
18:14:29 lbracher: hi there! i have a absolute newbie question... i have a database, and i know its srid is 31983. how can i set the srid of this database?
18:26:08 springmeyer: lbracher: your database holds tables with are the spatial objects
18:26:48 springmeyer: so, you need to set the srid of you data either 1 )when it is imported into your database or 2 ) once it is inside
18:26:58 springmeyer: i'll dig up the syntax in one sec...
18:29:32 springmeyer: set ST_SetSRID here: http://postgis.refractions.net/docs/ch06.html#id2594749
18:29:34 sigq: Title: Chapter 6. PostGIS Reference ( at postgis.refractions.net )
18:30:53 springmeyer: so if your table is called 'table' then....
18:30:59 springmeyer: Select ST_SetSRID( the_geom_field_name, 31983 ) from t;
18:34:31 lbracher: springmeyer: thanks! : )
18:34:54 lbracher: and thereīs a difference between this and AddGeometryColumn?
18:34:57 springmeyer: how did your data get into postgis?
18:35:46 lbracher: i used a geodb template and put a sql dump into.
18:36:15 springmeyer: AddGeometryColumn is for creating a spatial table so it includes the setting of the SRID, but its for when you don't have a geometry column yet
18:36:23 lbracher: ah, ok! : )
18:36:42 springmeyer: what was in the sql dump... or where did you get it?
18:37:54 lbracher: hmmm... i dont know... i lost my client machine ( the sqls were there ), and all I have is the server now...
18:38:13 lbracher: a friend sent me and told me the srid
18:38:20 springmeyer: you should try loading some sample data into postgis using the sh2pgsql tool
18:38:36 springmeyer: shp2pgsql I mean
18:38:42 lbracher: hum, but i have no shapes...
18:38:47 springmeyer: that is a binary command line program that comes with postgis
18:38:55 springmeyer: you are in Brazil?
18:39:10 lbracher: yes
18:39:29 springmeyer: what about the country outline or something simple like that?
18:39:33 lbracher: i did a select * from geometry_columns; , but this table is empty
18:39:49 lbracher: country outline?
18:39:55 lbracher: borders?
18:40:20 springmeyer: yes.
18:41:03 lbracher: i donīt have it either! : )
18:41:52 lbracher: springmeyer, why i canīt just use AddGeometryColumn?
18:42:04 lbracher: should i get a problem doing this?
18:42:17 springmeyer: here: for some sample data you could try: http://www.intactforests.org/download/shp/world_ifl_block22.zip
18:42:34 springmeyer: forest data for brazil and surrounds....
18:42:36 springmeyer: http://www.intactforests.org/download/shp_download.htm
18:42:37 sigq: Title: SHP download ( at www.intactforests.org )
18:43:04 springmeyer: lbracher: oh yes AddGeometryColumn is fine... but all is add is a column
18:43:13 springmeyer: no data is added by 'AddGeometryColumn'
18:43:25 springmeyer: you want to play with some data right? to learn how to use postgis?
18:44:24 springmeyer: the easiest ways to get data into postgis are to load an .sql dump ( like it sounds like your friend gave you ) or load in data from a shapefile using shp2pgsql
18:46:18 lbracher: and to just use transform( ) function to get lat/lon from utm coordinates? what is the easiest way to do? the points are in my database in utm, srid 31983, and i just want to make this transformation...
18:46:30 lbracher: what is the easiest way to do? : )
18:46:42 springmeyer: oh, I see, sorry
18:46:45 springmeyer: hmm..
18:46:52 lbracher: np! : )
18:46:59 springmeyer: what is your table name?
18:47:09 lbracher: points. : )
18:47:28 springmeyer: can you paste at dpaste.com the output of this command:
18:47:29 lbracher: and i have table "roads" too
18:48:16 springmeyer: \d points
18:48:32 springmeyer: that is in the psql interpreter you should paste that...
18:49:30 lbracher: ok
18:49:32 lbracher: http://dpaste.com/59391/
18:49:33 sigq: Title: dpaste: #59391 ( at dpaste.com )
18:49:40 lbracher: i put the output from 2 tables
18:50:01 lbracher: trechos_log ( roads ) is the table i got from that dump
18:50:16 lbracher: pontos ( points ) is the one i made.
18:50:28 lbracher: i think i made it wrongly
18:50:41 lbracher: i mean, the CREATE TABLE command
18:53:00 springmeyer: okay... cool
18:53:05 springmeyer: so try this query first:
18:53:10 springmeyer: select gid, log_cod, sentido, ST_Transform( the_geom, 31983 ) from trechos_log limit 1;
18:53:44 lbracher: Input geometry has unknown ( -1 ) SRID
18:53:48 springmeyer: note: the 'limit 1' will restrict the results to 1 record so it is a fast test...
18:53:53 lbracher: ok
18:54:03 lbracher: it returned unknown drid
18:54:05 lbracher: srid
18:54:08 springmeyer: okay... just like you said, right...
18:54:09 springmeyer: so...
18:55:02 springmeyer: select gid, log_cod, sentido, ST_Transform( ST_SetSRID( the_geom,31983 ), 4326 ) from trechos_log limit 1;
18:55:36 springmeyer: now paste your error : )
18:56:02 lbracher: http://dpaste.com/59392/
18:56:03 sigq: Title: dpaste: #59392 ( at dpaste.com )
18:57:22 springmeyer: okay... so it worked without error....
18:57:43 springmeyer: now we need to 'see' if it is actually in lat/log geographic coordinates...
18:57:50 springmeyer: try:
18:58:18 springmeyer: select gid, log_cod, sentido, ST_AsEWKT( ST_Transform( ST_SetSRID( the_geom,31983 ), 4326 ) ) from trechos_log limit 1;
19:00:12 lbracher: http://dpaste.com/59393/
19:00:13 sigq: Title: dpaste: #59393 ( at dpaste.com )
19:02:27 lbracher: ok, i think i got it! : )
19:03:55 springmeyer: hey, that looks pretty good
19:03:59 springmeyer: you did get it!
19:04:17 springmeyer: hey is this data just north of San Paulo?
19:04:25 lbracher: yes! and google earth found correctly the point.
19:04:28 lbracher: yes.
19:04:49 lbracher: what you see here is the State University of Campinas
19:05:20 lbracher: second most important in San Paulo
19:05:32 springmeyer: right: just looking at: http://openaerialmap.org/map/?zoom=10&lat=-22.81409&lon=-47&layers=BT
19:05:33 sigq: Title: OpenAerialMap ( at openaerialmap.org )
19:06:02 springmeyer: okay. so now you can do:
19:06:46 springmeyer: SELECT gid, log_cod, sentido, ST_AsEWKT( ST_Transform( ST_SetSRID( the_geom,31983 ), 4326 ) ) INTO new_table FROM trechos_log;
19:07:06 springmeyer: if you want to save the result of that query to a new table...
19:08:24 lbracher: nice! : )
19:08:35 lbracher: thanks, springmeyer!
19:09:28 springmeyer: np
22:24:57 MrNaz: after reading through the postgis docs, i see lots of reference to "bounding boxes" and geometric objects that exist in the euclidean space... does this mean that postgis cannot be used for large scale mapping of the earth's surface?
22:25:49 MrNaz: say i want to keep a DB of points of interest around the world, and i want to find out which ones are within 10,000km of a particular point... can that be done using postgis effectively?
22:58:48 springmeyer: MrNaz: see ST_distance_spheroid( point, point, spheroid ) from http://postgis.refractions.net/docs/ch06.html
22:58:49 sigq: Title: Chapter 6. PostGIS Reference ( at postgis.refractions.net )