Skip site navigation (1) Skip section navigation (2)

beginner postgis question lat/lon

From: shadrack <shadkeene(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: beginner postgis question lat/lon
Date: 2008-02-28 00:59:07
Message-ID: 73cfd63b-a83e-42eb-b5d6-2a801ecdec91@n77g2000hse.googlegroups.com (view raw or flat)
Thread:
Lists: pgsql-general
Hi,
This may seem like a very simple question...it is...but I can't find
documentation on it to help. I've seen some posts about lat/long but
none that give simple solutions on how to insert lat/long in tables.
I'm a new user to postgis...I've been using mysql for a while but
needed the spatial functions so just recently downloaded postgresql/
postgis.
How do I create a simple table with several linestrings that have
coordinates in latitude/longitude?
Eventually, I'd like to create polygons with coordinates in lat/long
and see if they intersect various linestrings, but I'm trying to start
out simple.
Here's what I've done so far...

postgis=# \d routes_geom;
         Table "public.routes_geom"
 Column |         Type          | Modifiers
--------+-----------------------+-----------
 id     | integer               |
 name   | character varying(25) |
 geom   | geometry              |
Check constraints:
    "enforce_dims_geom" CHECK (ndims(geom) = 2)
    "enforce_geotype_geom" CHECK (geometrytype(geom) =
'LINESTRING'::text OR geom IS NULL)
    "enforce_srid_geom" CHECK (srid(geom) = 4326)
postgis=# insert into routes_geom values(1, 'J084',
GeomFromText('LINESTRING(38.20 -121.00, 38.20, -118.00)', 4326));

I receive this error:
ERROR:  parse error - invalid geometry
CONTEXT:  SQL function "geomfromtext" statement 1

Do you have a good way to input lat/lon and do spatial relationships
using lat/long coords?
Thanks for any help,
Shad

Responses

pgsql-general by date

Next:From: Norman PeelmanDate: 2008-02-28 01:53:33
Subject: Re: Query meltdown: caching results
Previous:From: Gevik BabakhaniDate: 2008-02-28 00:29:43
Subject: Re: Can't start Postgres anymore

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group