<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.8.0">
</HEAD>
<BODY>
Chris, <BR>
<BR>
Don't forget that the spatial functions perform calculations in the units of the input geometries, so for example if you have a point geometry in decimal degrees and you call Buffer(the_geom, 1) it will buffer the input geometry by 1 decimal degree. You'll have to convert your input (miles) to the correct units (decimal degrees). To save you some time, here are the functions in PL/PGSQL:<BR>
<BR>
<PRE>
-- function to convert miles into decimal degrees
create or replace function convertMilesToDecimalDegrees(numeric) returns numeric as $$
begin
-- $1 = radius in miles
-- x = ($1 * 63360) = convert to meters (i.e. 63360 meters/mile)
-- x = (x * 0.0254) = convert to inches (i.e. 0.0254 inches/meter)
-- x = (x / 1852) = convert to nautical miles (i.e. 1852 meters/nautical mile)
-- x = (x / 60) = convert to decimal degrees of latitude =
-- (i.e. 1 nautical mile = 1 decimal minute; therefore nautical miles/60 = decimal degrees
return (((($1 * 63360) * 0.0254) / 1852) / 60);
end;
$$ language plpgsql;
--function to buffer a geometry by a radius whose value is specified in miles
create or replace function getBufferedGeometry(geometry,numeric) returns geometry as $$
declare g geometry;
begin
select Buffer($1,convertMilesToDecimalDegrees($2)) into g;
return g;
end;
$$ language plpgsql;
</PRE>
<BR>
Hope this helps.<BR>
<BR>
Regards,<BR>
<BR>
Mark Thomas<BR>
<BR>
<BR>
On Tue, 2006-07-04 at 12:00 -0700, postgis-users-request@postgis.refractions.net wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
<TT><FONT COLOR="#000000">[postgis-users] Newbie questions on what geometry to use</FONT></TT><BR>
</BLOCKQUOTE>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
Mark Thomas<BR>
Senior Software Engineer<BR>
Awarix Corporation<BR>
mthomas@awarix.com<BR>
http://www.awarix.com<BR>
<BR>
<I>"Commit to the Lord whatever you do, </I><BR>
<I> and your plans will succeed." - Proverbs 16:3</I><BR>
<BR>
<BR>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>