Hi all,<div><br></div><div>I need to buffer a set of point features by using a radius column which indicate the buffer radius for each point in kilometers.</div><div><br></div><div>I tried to first create points in lat/long WGS 84, then use the st_transform and buffer using ECKERT VI which should be equal area meter as far as i know.</div>
<div>However, it does not turn out correctly.</div><div>Any idea what i do wrong in the script below?</div><div><br></div><div>I first inserted the SRID reference:</div><div>INSERT into spatial_ref_sys (srid, auth_name, auth_srid, proj4text, srtext) values ( 953010, 'esri', 53010, '+proj=eck6 +lon_0=0 +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs ', 'PROJCS["Sphere_Eckert_VI",GEOGCS["GCS_Sphere",DATUM["Not_specified_based_on_Authalic_Sphere",SPHEROID["Sphere",6371000,0]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Eckert_VI"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],UNIT["Meter",1],AUTHORITY["EPSG","53010"]]');</div>
<div><br></div><div>My script for buffering (ignore the python syntax, it is done using PyGresql):</div><div><br></div><div><div>import pg</div><div>db1 = pg.connect('postgis', 'localhost', 5432, None, None, 'postgres', 'G83rec')</div>
<div><br></div><div># Copy csv file into database</div><div>dropafr = "DROP TABLE IF EXISTS afr;"</div><div>db1.query(dropafr)</div><div>createtable = "CREATE TABLE afr (id int, year int, lat decimal, long decimal, radius decimal, confsite varchar, confterr varchar, version varchar);"</div>
<div>db1.query(createtable)</div><div>copyfromcsv = "COPY afr FROM 'c:/prio_grid/source/confsite/africa.csv' DELIMITER ';';"</div><div>db1.query(copyfromcsv)</div><div>addgeomfield = "SELECT addgeometrycolumn('public', 'afr', 'centroid', 4326, 'POINT', 2);"</div>
<div>db1.query(addgeomfield)</div><div>fillgeomfield = "UPDATE afr SET centroid=ST_SetSRID(ST_MakePoint(long, lat), 4326) WHERE long != -99 OR lat != -99;"</div><div>db1.query(fillgeomfield)</div><div>addprimkey = "ALTER TABLE afr ADD column gid serial primary key;"</div>
<div>db1.query(addprimkey)</div><div><br></div><div># Create list for for loop</div><div>yearlist = range(1989, 2009, 1)</div><div>for x in yearlist:</div><div>    dropsplit = "DROP TABLE IF EXISTS afr"+str(x)+";"</div>
<div>    db1.query(dropsplit)</div><div>    splittable = "SELECT * INTO afr"+str(x)+" FROM afr WHERE year = "+str(x)+";"</div><div>    db1.query(splittable)</div><div>    addgeom = "SELECT addgeometrycolumn('public', 'afr"+str(x)+"', 'buffer', 953010, 'POLYGON', 2);"</div>
<div>    db1.query(addgeom)</div><div>    updatebuffer = "UPDATE afr"+str(x)+" SET buffer = ST_Buffer(ST_Transform(centroid, 953010),radius) WHERE radius > 0;"</div><div>    db1.query(updatebuffer)</div>
</div><div><br></div><div>Andreas</div><div><br></div>