[postgis-users] SRID not matching error
Jayson Gallardo
jaysontrades at gmail.com
Thu May 22 12:58:32 PDT 2014
I think you may be correct. My laziness/inexperience was bound to catch up
with me sooner or later. I came to the realization immediately after
sending my previous message, and wrapped ST_Geom with a ST_Transform, just
as you are suggesting, and it worked.
Thanks for all the help.
-Jayson
On Thu, May 22, 2014 at 11:43 AM, Åsmund Tokheim <asmundto at gmail.com> wrote:
> Hi
>
> Am I correct in assuming that you previously ran PostGIS 2.0 and now use
> 2.1? I'm only speculating as I'm not that familiar with the raster
> features, but according to the docs (
> http://postgis.net/docs/RT_ST_Clip.html), st_clip was rewritten in C for
> the 2.1 version, and the change in behavior probably stems from that. While
> such undocumented changes between versions are unfortunate, I personally
> think that explicitly calling the transform function is more in the spirit
> with how the rest of the PostGIS functions handle srid mismatches.
>
> Åsmund
>
>
> On Thu, May 22, 2014 at 5:14 PM, Jayson Gallardo <jaysontrades at gmail.com>wrote:
>
>> Well, the thing is, that's how it's been for the last year and has worked
>> fine. The difference now is that our server was rebuilt from scratch and I
>> had to reload a dump of our database. The other difference is that the
>> previous database was on PostgreSQL 9.1, and now we're on 9.3.
>>
>>
>> On Wed, May 21, 2014 at 6:45 PM, Åsmund Tokheim <asmundto at gmail.com>wrote:
>>
>>> Hi
>>>
>>> It seems like you transformed the polygon used in the st_intersects
>>> function, but the polygon used in the st_clip function still has the 3857
>>> srid.
>>>
>>> Åsmund
>>>
>>>
>>> On Thu, May 22, 2014 at 1:04 AM, Jayson Gallardo <jaysontrades at gmail.com
>>> > wrote:
>>>
>>>> I was finally able to restore my database dump today. However, upon
>>>> testing, I get this error:
>>>>
>>>>
>>>> production=# SELECT ST_AsGDALRaster(ST_CLIP(ST_Union(rast),
>>>> ST_GeomFromText('POLYGON((-10366992.073461 5117898.5805526,-10366635.506271
>>>> 5117898.5805526,-10366635.506271 5118206.0551587,-10366992.073461
>>>> 5118206.0551587,-10366992.073461 5117898.5805526))',3857)),'GTiff') FROM
>>>> "dem_elevation" WHERE ST_Intersects(rast,
>>>> ST_Transform(ST_GeomFromText('POLYGON((-10366992.073461
>>>> 5117898.5805526,-10366635.506271 5117898.5805526,-10366635.506271
>>>> 5118206.0551587,-10366992.073461 5118206.0551587,-10366992.073461
>>>> 5117898.5805526))',3857),4269));
>>>> NOTICE: Geometry provided does not have the same SRID as the raster.
>>>> Returning NULL
>>>>
>>>>
>>>> However, all my DEMs are in the raster with SRID 4269. My DEMs have
>>>> been partitioned however, but the restore should have restored all that
>>>> back into place, right?
>>>>
>>>> This is what I have for dem_elevation in pgAdmin:
>>>>
>>>> -- Table: dem_elevation
>>>>
>>>> -- DROP TABLE dem_elevation;
>>>>
>>>> CREATE TABLE dem_elevation
>>>> (
>>>> rid integer NOT NULL,
>>>> rast raster,
>>>> CONSTRAINT dem_elevation_pkey PRIMARY KEY (rid)
>>>> )
>>>> WITH (
>>>> OIDS=FALSE
>>>> );
>>>> ALTER TABLE dem_elevation
>>>> OWNER TO postgres;
>>>> GRANT ALL ON TABLE dem_elevation TO postgres;
>>>> GRANT SELECT, REFERENCES, TRIGGER ON TABLE dem_elevation TO
>>>> postgis_reader;
>>>>
>>>> And one of the dependents:
>>>>
>>>> -- Table: dem_elevation_n33w090
>>>>
>>>> -- DROP TABLE dem_elevation_n33w090;
>>>>
>>>> CREATE TABLE dem_elevation_n33w090
>>>> (
>>>> rid serial NOT NULL,
>>>> rast raster,
>>>> CONSTRAINT dem_elevation_n33w090_pkey PRIMARY KEY (rid),
>>>> CONSTRAINT enforce_height_rast CHECK (st_height(rast) = 50),
>>>> CONSTRAINT enforce_max_extent_rast CHECK
>>>> (st_coveredby(st_convexhull(rast),
>>>> '0103000020AD1000000100000005000000863D2B1A098056C03B126100F5FE3F40863D2B1A098056C09578563412804040CA451840BD3F56C09578563412804040CA451840BD3F56C03B126100F5FE3F40863D2B1A098056C03B126100F5FE3F40'::geometry)),
>>>> CONSTRAINT enforce_num_bands_rast CHECK (st_numbands(rast) = 1),
>>>> CONSTRAINT enforce_out_db_rast CHECK (_raster_constraint_out_db(rast)
>>>> = '{f}'::boolean[]),
>>>> CONSTRAINT enforce_pixel_types_rast CHECK
>>>> (_raster_constraint_pixel_types(rast) = '{32BF}'::text[]),
>>>> CONSTRAINT enforce_same_alignment_rast CHECK (st_samealignment(rast,
>>>> '010000000097C6CEA0C845183F97C6CEA0C84518BF863D2B1A098056C0957856341280404000000000000000000000000000000000AD10000001000100'::raster)),
>>>> CONSTRAINT enforce_scalex_rast CHECK (st_scalex(rast)::numeric(16,10)
>>>> = 0.000092592592593::numeric(16,10)),
>>>> CONSTRAINT enforce_scaley_rast CHECK (st_scaley(rast)::numeric(16,10)
>>>> = (-0.000092592592593)::numeric(16,10)),
>>>> CONSTRAINT enforce_srid_rast CHECK (st_srid(rast) = 4269),
>>>> CONSTRAINT enforce_width_rast CHECK (st_width(rast) = 50)
>>>> )
>>>> INHERITS (dem_elevation)
>>>> WITH (
>>>> OIDS=FALSE
>>>> );
>>>> ALTER TABLE dem_elevation_n33w090
>>>> OWNER TO postgres;
>>>> GRANT ALL ON TABLE dem_elevation_n33w090 TO postgres;
>>>> GRANT SELECT, REFERENCES, TRIGGER ON TABLE dem_elevation_n33w090 TO
>>>> postgis_reader;
>>>>
>>>> -- Index: dem_elevation_n33w090_rast_gist
>>>>
>>>> -- DROP INDEX dem_elevation_n33w090_rast_gist;
>>>>
>>>> CREATE INDEX dem_elevation_n33w090_rast_gist
>>>> ON dem_elevation_n33w090
>>>> USING gist
>>>> (st_convexhull(rast));
>>>>
>>>> Thanks for your help in advance,
>>>> Jayson
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> postgis-users mailing list
>>>> postgis-users at lists.osgeo.org
>>>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>>>>
>>>
>>>
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users at lists.osgeo.org
>>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>>>
>>
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at lists.osgeo.org
>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20140522/308e3a27/attachment.html>
More information about the postgis-users
mailing list