Luis, I forgot to mention. If you want to output this as KML and save yourself some work in your script code, you may want to look into using AsKML instead of AsText function. I think AsKML exists in version 1.2 and up or somewhere around that vicinity.
Hope that helps, Regina -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Obe, Regina Sent: Friday, October 19, 2007 7:56 AM To: PostGIS Users Discussion Subject: RE: [postgis-users] Buffer generation & drawing problem Luis, I'm not sure if anyone has answered your question, but I didn't see one so here is my answer. I think the problem you are having is that you are working in degree coordinates so when you say buffer 0.1 that actually isn't a constant radius. If you can - the best way to fix the problem is to transform your data to cartesian coordinates and then back, but this may or may not be easy depending on where you are. In general its best to keep your data in some sort of cartesian coordinate (if you are interested in a relatively small area) since there are not too many functions in postgis as of yet to deal with geodetic data and then transform back to 4326 as the need arises. Below I will try to give a fairly generic solution that will solve your problem regardless of where on earth your data is located. If you look on this page - http://postgis.refractions.net/support/wiki/index.php?plpgsqlfunctions You will see a function very useful function called utmzone that takes a point and returns the SRID of the utmzone it belongs to. Load that function. Now to get real circles first figure out the radius of the circle you want in meters. I will choose 100 meters. SELECT astext(transform(buffer(transform(the_geom, utmzone(centroid(the_geom))), 100), 4326)) FROM mytable Note since you are dealing with points you can replace centroid(the_geom) with the_geom. The reason I needed to do that is that the utmzone function only deals with point geometries. Hope that helps, Regina -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Luis Floreani Sent: Tuesday, October 16, 2007 4:29 PM To: [email protected] Subject: [postgis-users] Buffer generation & drawing problem Hi, this my situation, I'm using postgis to generate buffers in order to draw them in google or yahoo maps. The problem is that when they are drawn, they are elliptical (taller) instead of plain circles. The column is named 'the_geom', it's a 2D Point and its SRID is 4326. Here's the SQL: select astext(buffer(the_geom, 0.1)) from mytable where ... note: 0.1 is related with the size of the buffer. here's a typical output: "POLYGON((-82.600775 27.902917,-82.6026964719596 27.8834079677989,-82.6083870467484 27.8646486567645 ...... etc etc))" I parse this string in my script language and generate a proper KML containing all the points of the buffer, but when I open it with google earth, google maps or even yahoo maps (use another structure of XML), the buffer is a little elliptical instead of being a simple perfect circle. any clue on this? Thanks in advance, Luis _______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users ----------------------------------------- The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer. _______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users _______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
