I already tried this way: UPDATE mypoints SET the_geom = ST_SetSRID(the_geom,4326);
But I got: ERROR: Operation on two GEOMETRIES with different SRIDs And I already left clear that there's no such different SRIDs as the values are well in the range of 4326 spatial reference. Maybe.... and I am thinking out loud, the extreme values I am using are the problems. I will check later if a latitude strictly equal to -90 is a problem and a proper value must be -89.9999 for example.... On Thu, Jan 21, 2010 at 4:39 PM, Kevin Neufeld <[email protected]>wrote: > Hi Oscar, > > Yes, this is definitely possible. Using your example... > > CREATE TABLE mydistance (the_geom geometry, the_name text); > \d mydistance > Table "public.mydistance" > Column | Type | Modifiers > ----------+----------+----------- > the_geom | geometry | > the_name | text | > > > -- Insert without using an explicit SRID > > INSERT INTO mydistance (the_geom, the_name) > VALUES (ST_GeomFromText('POINT(-58.0 0.0)'),'Punto 1-1'); > > SELECT ST_SRID(the_geom), ST_AsText(the_geom) FROM mydistance ; > st_srid | st_astext > ---------+-------------- > -1 | POINT(-58 0) > (1 row) > > > -- specify the srid of all the geometries > UPDATE mydistance SET the_geom = ST_SetSRID(the_geom, 4326); > > SELECT ST_SRID(the_geom), ST_AsText(the_geom) FROM mydistance ; > st_srid | st_astext > ---------+-------------- > 4326 | POINT(-58 0) > (1 row) > > > -- update geometry_columns (inserts appropriate row and adds appropriate > constraints to your spatial table) > SELECT populate_geometry_columns('mydistance'::regclass); > \d mydistance > Table "public.mydistance" > Column | Type | Modifiers > ----------+----------+----------- > the_geom | geometry | > the_name | text | > Check constraints: > "enforce_dims_the_geom" CHECK (ndims(the_geom) = 2) > "enforce_geotype_the_geom" CHECK (geometrytype(the_geom) = 'POINT'::text > OR the_geom IS NULL) > "enforce_srid_the_geom" CHECK (srid(the_geom) = 4326) > > SELECT * FROM geometry_columns WHERE f_table_name = 'mydistance'; > f_table_catalog | f_table_schema | f_table_name | f_geometry_column | > coord_dimension | srid | type > > -----------------+----------------+--------------+-------------------+-----------------+------+------- > | public | mydistance | the_geom | > 2 | 4326 | POINT > (1 row) > > > Does this help? > Cheers, > Kevin > > > On 1/21/2010 11:08 AM, Oscar Zamudio wrote: > >> I already stated that this is only an experiment trying to solve the >> problem because my customer already loaded a >> lot of data WITHOUT expliciting SRID reference..... I mean, >> >> INSERT INTO mydistance (the_geom, the_name) VALUES >> (ST_GeomFromText('POINT(-58.0 0.0)',4326),'Punto 1-1'); >> >> Is a step without SRID value that was taken years ago on their database. >> I'm trying to avoid the reloading process >> and taking in account that there are some functions that probably can make >> the task,,, I began to explore them >> without success up to now. >> >> Regards, >> >> _______________________________________________ > postgis-users mailing list > [email protected] > http://postgis.refractions.net/mailman/listinfo/postgis-users >
_______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
