[postgis-users] ERROR: rt_raster_from_two_rasters:
Jason Mathis
jmathis at redzonesoftware.com
Thu Jun 5 08:51:48 PDT 2014
Guido!!
I believe you have solved this. I switched the st_union and st_clip and reworked the query a bit and voila all the queries that were failing before now work. This is great!
Re: alignment problem. I loaded 14 states with a python script that looped through each shape file that did the same exact commands to each one. So unless the data I got is bad I still do not see how one raster can be aligned differently from another. Can no_data pixels be an issue? They would overlap into other states but the states align perfectly.
Again I am fairly new to postgis/gdal/postgres but not databases/sql so maybe I am not understanding something.
Thanks for the help hopefully this issue with not come up again.
On June 5, 2014 at 1:25:31 AM, Guido Lemoine (guido.lemoine at jrc.ec.europa.eu) wrote:
Jason,
I would swap the ST_UNION and ST_CLIP, which would be more logical (though assuming you store the rasters in small tiles).
You would first ST_UNION all tiles that are in the transformed polygon and clip that result (again with the transformed polygon).
On the other hand, the alignment problem probably comes from different rasters from different Western US states, which are not aligned (you could test for a polygon which if fully within a single state). I guess that could be resolved (only?) by gdal_merge.py the US State rasters first to a single raster and push that into the database. Would make sense if all have the same projection (5070).
GL
Guido Lemoine
European Commission, Joint Research Centre
Institute for Environment and Sustainability, Monitoring Agricultural Resources Unit
TP 266 – 21027 Ispra, Italy, T. +39 0332 786239, F. +39 0332 785162
E-mail: guido.lemoine at jrc.ec.europa.eu URL: http://ec.europa.eu/jrc
From: postgis-users-bounces at lists.osgeo.org [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of Jason Mathis
Sent: 04 June 2014 22:08
To: PostGIS Users Discussion; Hugues François
Subject: Re: [postgis-users] ERROR: rt_raster_from_two_rasters:
Hey,
I want to see if anyone has more suggestions for this issue.
Please let me know, Thanks!
-jason
On May 30, 2014 at 10:12:34 AM, Jason Mathis (jmathis at redzonesoftware.com) wrote:
Well I appreciate your response I don’t think this is what I am clocking for. Correct me if I am wrong.
I am reprojecting the vectors (4326) to match the raster (5070). So I am still confused why i sometimes get the error and other times I do not.
Thanks!
On May 30, 2014 at 2:12:35 AM, Hugues François (hugues.francois at irstea.fr) wrote:
Hi,
When you reproject rasters, pixels from different tiles may not have the same alignment and union is not possible. Since version 2.1 you may give a reference raster to get the right alignment (see variant 3 here http://postgis.net/docs/RT_ST_Transform.html)
Hugues.
De : postgis-users-bounces at lists.osgeo.org [mailto:postgis-users-bounces at lists.osgeo.org] De la part de Jason Mathis
Envoyé : jeudi 29 mai 2014 20:45
À : postgis-users at lists.osgeo.org
Objet : [postgis-users] ERROR: rt_raster_from_two_rasters:
I loaded a bunch raster data into separate tables. One for each us western state. I thought it maybe handy to query a view instead of the individual tables. Anyways everything seemed ok but I started to get errors on a few ids I was testing. I knew what table it should be pulling from so I queried the table and no issues. So i must assume the error is because of the “union all” in the view. Can anyone confirm this and why? I am on postgres 9.2.8 and postgis 2.1.2.
thanks,
jason
query>>>
SELECT
report_id, incident_id,
ST_SummaryStats(
ST_UNION(
ST_Clip(c.rast, 1,
ST_Transform(w.geom, 5070), true)
),
1
) as hdesc
FROM rasters c
JOIN w_reports w
ON ST_Intersects(c.rast, ST_Transform(w.geom, 5070))
where w.incident_id = 5443
group by incident_id, report_id
error>>>
ERROR: rt_raster_from_two_rasters: The two rasters provided do not have the same alignment
********** Error **********
ERROR: rt_raster_from_two_rasters: The two rasters provided do not have the same alignment
SQL state: XX000
This transmission contains confidential and privileged information intended solely for the party identified above. If you receive this message in error, you must not use it or convey it to others. Please destroy it immediately and contact the sender at (303) 386-3955 or by return e-mail to the sender.
_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
This transmission contains confidential and privileged information intended solely for the party identified above. If you receive this message in error, you must not use it or convey it to others. Please destroy it immediately and contact the sender at (303) 386-3955 or by return e-mail to the sender.
_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
--
This transmission contains confidential and privileged information intended
solely for the party identified above. If you receive this message in
error, you must not use it or convey it to others. Please destroy it
immediately and contact the sender at (303) 386-3955 or by return e-mail to
the sender.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20140605/8768252c/attachment.html>
More information about the postgis-users
mailing list