Re: query help on Geography column

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tony Sansom <antonys(at)nsom(dot)org(dot)uk>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: query help on Geography column
Date: 2016-02-17 14:41:03
Message-ID: CAKFQuwYx2QJ1gRjh2pmr-atQ6NVfuJdakvf-j7oBjbLpb9Z1nQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Wed, Feb 17, 2016 at 3:28 AM, Tony Sansom <antonys(at)nsom(dot)org(dot)uk> wrote:

> HI I’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.
>
> Select stuff from MyGeoTable where
> ST_DWithin(ST_GeographyFromText(‘SRID=4326;POINT(LONG,LAT)’), geog,5000)
>
> Is not retuning all data it should be best guess there is an issue with
> the Geography column this was created from a geometry column which is a
> collection of points lines and polygons
>
> I tried to recreate the Geography thus
>
> Update MyGeoTable set geog = ­(ST_Transform(geom,4326));
>
> This gives “ERROR: Geometry type (LINSTRING) dose not match column type
> (Polygon)”
>
> My question is twofold
>
> 1st how can recreate the geography column, check it has worked?
>
> 2nd How might perform a similar query just using the geometry the 5k
> radius doesn’t have to be exact!
> ​
>
>
​This seems like a poor choice of forum for these questions. Of the
official PostgreSQL mailing lists -general would be better. But as these
types and functions are not part of the core PostgreSQL product these are a
bit off-topic for any of these lists. I presume you are using PostGIS and
so you should locate a list dedicate to discussing their product.

​-admin is mostly about DBA-related stuff like running and configuring a
PostgreSQL instance. Schema stuff could qualify (first question) but
usually usage questions (2nd question) end up in either -general or -sql if
they are agnostic enough.​

David J.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Ray Stell 2016-02-17 14:42:10 oracle db reads from postgresql
Previous Message Tony Sansom 2016-02-17 10:28:38 query help on Geography column