[postgis-users] Postgres Polygon to Postgis Geometry

Mike Toews mwtoews at gmail.com
Tue Oct 26 18:44:47 PDT 2010


Hi Wagner,

I'm not sure what you mean by "geo" and "non-geo" .. you mean
georeferenced, like longitude/latitude?

For points, you can keep thing binary and just use ST_MakePoint(x,y).
And to assign a coordinate system, use it with ST_SetSRID:

SELECT ST_SetSRID(ST_MakePoint(p[0], p[1]), 4326)
from (
  select point '(-123.112793, 49.246293)' as p
) as foo;

I'm not sure how to do similar binary conversions for path and
polygon, or other types. You might have to cast to text, and wrangle
it into some form of WKT, then pass it to ST_SetSRID(text, integer) to
make a geometry object for PostGIS.

-Mike


On 26 October 2010 18:17, Wagner Santos <wagner.desenv at gmail.com> wrote:
> I created a Postgis Geometry from Postgres Polygon converting them  from
> string and using linefromtext to create a geometry but this information
> isn't geo.
> I have non geo points and I want to convert to my correct position and set
> SRID, for example P(70 72) to P(-54 -25), how can I do this?
> Thanks!
>
> On Tue, Oct 26, 2010 at 1:18 PM, Wagner Santos <wagner.desenv at gmail.com>
> wrote:
>>
>> Hello,
>> I'm new with postgis and I have a legacy database with Postgres Polygon, I
>> want to convert this to a Postgis Geometry. Is there a way?
>> I try to do with replace string and linefromtext with sucess, but I think
>> doesn't better solution because I can't set a valid SRID.
>> Thanks!
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>



More information about the postgis-users mailing list