[postgis-users] Insert record using SRID

Paul Ramsey pramsey at opengeo.org
Thu May 7 08:34:21 PDT 2009


INSERT INTO spl_points (the_geom)
 VALUES ( ST_GeomFromText('POINT(115.64 -33.34)', 4326) );

On Thu, May 7, 2009 at 8:24 AM, benton101 <Ben.Davies at dec.wa.gov.au> wrote:
>
> Hi,
>
> I want to insert a record into a table with a specific SRID. The SRID value
> I want to use is 4283 which should be Geographic Coordinates. I then want to
> use ST_Transform to change the SRID to 28350 which should be Map Grid
> Australia coordinates. I have posted a message with reference to a
> ST_Transform problem I am having which I have'nt resolved yet and so in an
> attempt to resolve that question I thought I would create a test for what I
> am inserting, but now I have run into more problems. This is what I have
> done to insert a record in Geographic Coords ...
>
> DROP TABLE spl_points;
>
> CREATE TABLE spl_points
> (
>  gid serial NOT NULL
> )
> WITH (OIDS=FALSE);
> ALTER TABLE spl_points OWNER TO postgres;
>
> ALTER TABLE "spl_points" ADD CONSTRAINT spl_points_pkey PRIMARY KEY (gid);
>
> ALTER TABLE spl_points OWNER TO postgres;
>
> -- Add geometry column
> SELECT AddGeometryColumn('','spl_points','the_geom','4283','POINT',2);
>
>
> INSERT INTO spl_points (the_geom)VALUES ( 'POINT(115.64 -33.34)');
>
> But this returns the following error ...
>
> ERROR:  new row for relation "spl_points" violates check constraint
> "enforce_srid_the_geom"
>
> I don't know why this wont work when I change the value from 4283 to -1 it
> takes the record no problems but as far as I understand this is no use for
> me when I want to transform the record.
>
> Ben
>
> --
> View this message in context: http://www.nabble.com/Insert-record-using-SRID-tp23428534p23428534.html
> Sent from the PostGIS - User mailing list archive at Nabble.com.
>
> _______________________________________________
> 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