Thanks Mark!! I had been looking for an example of how to do the math on this. <br><br>Chris<br><br><div><span class="gmail_quote">On 7/5/06, <b class="gmail_sendername">mark thomas</b> <<a href="mailto:javaguru@bellsouth.net">
javaguru@bellsouth.net</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>
<div>
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<br>create or replace function convertMilesToDecimalDegrees(numeric) returns numeric as $$<br>begin<br> -- $1 = radius in miles<br> -- x = ($1 * 63360) = convert to meters (
i.e. 63360 meters/mile)<br> -- x = (x * 0.0254) = convert to inches (i.e. 0.0254 inches/meter)<br> -- x = (x / 1852) = convert to nautical miles (i.e. 1852 meters/nautical mile)<br> -- x = (x / 60) = convert to decimal degrees of latitude =
<br> -- (i.e. 1 nautical mile = 1 decimal minute; therefore nautical miles/60 = decimal degrees<br> return (((($1 * 63360) * 0.0254) / 1852) / 60);<br>end;<br>$$ language plpgsql;<br><br>--function to buffer a geometry by a radius whose value is specified in miles
<br>create or replace function getBufferedGeometry(geometry,numeric) returns geometry as $$<br>declare g geometry;<br>begin<br> select Buffer($1,convertMilesToDecimalDegrees($2)) into g;<br> return g;<br>end;<br>$$ language plpgsql;
<br></pre>
<br>
Hope this helps.<br>
<br>
Regards,<br>
<br>
Mark Thomas<br>
<br>
<br>
On Tue, 2006-07-04 at 12:00 -0700, <a href="mailto:postgis-users-request@postgis.refractions.net" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">postgis-users-request@postgis.refractions.net</a> wrote:
<br>
<blockquote type="CITE">
<tt><font color="#000000">[postgis-users] Newbie questions on what geometry to use</font></tt><br>
</blockquote>
<table cellpadding="0" cellspacing="0" width="100%">
<tbody><tr>
<td>
Mark Thomas<br>
Senior Software Engineer<br>
Awarix Corporation<br>
<a href="mailto:mthomas@awarix.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">mthomas@awarix.com</a><br>
<a href="http://www.awarix.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.awarix.com</a><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>
</tbody></table>
</div>
</div><br>_______________________________________________<br>postgis-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net
</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br><br>
<br></blockquote></div><br>