[postgis-users] shp2pgsql: Where are x,y-coordinates stored?

Bruce Rindahl rindahl at lrcwe.com
Mon Aug 7 16:01:52 PDT 2006


I simple terms the x,y coordinates are stored together in a big blob.
Polylines and Polygons are stored in bigger blobs.  The secret to PostGIS is
the blobs have a very specific form and there are lots of functions to do
what you want.
To prove it run the SQL command 

SELECT X(the_geom), Y(the_geom) from yourtablename

Where yourtablename is the name you specified.   You should get a table with
the x,y coordinates of your data.

The functions X() and Y() are PostGIS functions to get the x and y
coordinates from a point stored in your table.  Apparently QGIS knows how to
do this already from your e-mail but GRASS does not.  There are lots of GIS
functions in PostGIS - that's why you were told to look at the documentation
since nobody knows exactly what you want to do.  I don't know what GRASS
needs to have to import the data so I can't help you there.

Bruce Rindahl

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of H.Lekin
Sent: Monday, August 07, 2006 4:46 PM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] shp2pgsql: Where are x,y-coordinates stored?

Seems rather impossible to reply properly to the all-in-one digest; hope
it looks OK:


> well, does your shapefile contain coordinates? If it doesn't, then you
> will have to create them. See the postgis documentation for the syntax
> for retrieving geometry.

The shapefile contains coordinates, as does PostgreSQL/PostGIS after
importing the shapefile. I can access the latter via QGIS and it is
displayed correctly.

For GRASS' v.in.db I have to specify the x,y column names, what QGIS
seems to do automatically. I listed the geometry_colums attributes. The
table looks exactly like stated in the PostGIS Manual (which I do not
find too helpful yet), but does not contain x,y coordinates.
Meanwhile I found the OpenGIS Simple Features Specification For SQL Rev
1.1 - http://www.opengeospatial.org/docs/99-049.pdf -, where Chapters
2.2 and 3.1.4.2 look promising as well as really complicated.

It would be very helpful and time saving, if s.b. could roughly outline
the basic steps how to access x,y coordinates.

Many thanks,
H.L.
_______________________________________________
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