query help on Geography column

From: Tony Sansom <antonys(at)nsom(dot)org(dot)uk>
To: pgsql-admin(at)postgresql(dot)org
Subject: query help on Geography column
Date: 2016-02-17 10:28:38
Message-ID: 1378709182.486284.412e6889-ac3f-48b6-a9fa-43bc9966acbf.open-xchange@email.1and1.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

<!DOCTYPE html>
<html><head>
<meta charset="UTF-8">
</head><body><p class="ox-79e96e5d2c-MsoNormal">HI I&#8217;m struggling with retuning data from the following query. It should be retuning all data within a 5k radius of a given Longitude, Latitude point.</p><p class="ox-79e96e5d2c-MsoNormal">Select stuff from MyGeoTable where ST_DWithin(ST_GeographyFromText(&#8216;SRID=4326;POINT(LONG,LAT)&#8217;), geog,5000)</p><p class="ox-79e96e5d2c-MsoNormal">Is not retuning all data it should be best guess there is an issue with the Geography column &#160;this was created from a geometry column which is a collection of points lines and polygons</p><p class="ox-79e96e5d2c-MsoNormal">I tried to recreate the Geography thus</p><p class="ox-79e96e5d2c-MsoNormal" style="margin-left: 72.0pt;">Update MyGeoTable set geog = &#173;(ST_Transform(geom,4326));</p><p class="ox-79e96e5d2c-MsoNormal">This gives &#8220;ERROR: Geometry type (LINSTRING) dose not match column type (Polygon)&#8221;</p><p class="ox-79e96e5d2c-MsoNormal">My question&#160; is twofold</p><p class="ox-79e96e5d2c-MsoNormal">1<sup style="line-height: 0;">st</sup> how can recreate the geography column, check it has worked?</p><p class="ox-79e96e5d2c-MsoNormal">2<sup style="line-height: 0;">nd</sup>&#160; How might perform a similar query just using the geometry the 5k radius doesn&#8217;t have to be exact!</p><p class="io-ox-signature">Thanx for your help<br></p></body></html>

Attachment Content-Type Size
unknown_filename text/html 1.4 KB

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message David G. Johnston 2016-02-17 14:41:03 Re: query help on Geography column
Previous Message bricklen 2016-02-17 04:59:26 Re: Ideal configuration for postgresql 9.3 config