Commit graph

167 commits

Author SHA1 Message Date
Bborie Park e20f3d0a60 Refactored rt_band_get_min_value() to call new function rt_pixtype_get_min_value(). Addition of function rt_util_extent_type().
git-svn-id: http://svn.osgeo.org/postgis/trunk@8011 b70326c6-7e19-0410-871a-916f4a2858ee
2011-10-27 14:08:24 +00:00
Bborie Park 709dc2d8a9 Added rt_raster_set_geotransform_matrix() to provide quick setting of a raster's geotransform based upon the matrix
git-svn-id: http://svn.osgeo.org/postgis/trunk@8000 b70326c6-7e19-0410-871a-916f4a2858ee
2011-10-21 21:42:12 +00:00
Bborie Park 4c7dbc99ce Corrected rt_raster_same_alignment() and RASTER_sameAlignment() to behave as an end-user would expect it to. So intead of errors when parameters don't match, return false.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7999 b70326c6-7e19-0410-871a-916f4a2858ee
2011-10-21 19:10:53 +00:00
Bborie Park 8864196bef Changed rt_raster_has_no_band to use 0-based band index instead of 1-based. Removed function prototype ST_HasNoData(raster) as the other prototype ST_HasNoData(raster, nband) now uses the default value of 1 for nband.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7998 b70326c6-7e19-0410-871a-916f4a2858ee
2011-10-21 18:11:46 +00:00
Bborie Park b9ab21eabb Changed those functions that is 1-based for band index to 0-based in rt_core. This leaves only rt_raster_has_no_band, which may have other issues as well.
Associated ticket is #754


git-svn-id: http://svn.osgeo.org/postgis/trunk@7997 b70326c6-7e19-0410-871a-916f4a2858ee
2011-10-21 14:53:29 +00:00
David Zwarg 41b8676733 Implemented raster map algebra with user functions/callbacks. (#860)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7980 b70326c6-7e19-0410-871a-916f4a2858ee
2011-10-14 18:11:27 +00:00
Bborie Park 49ca7588dd Added additional error checking and error messages to ST_SameAlignment function
git-svn-id: http://svn.osgeo.org/postgis/trunk@7959 b70326c6-7e19-0410-871a-916f4a2858ee
2011-10-07 00:29:40 +00:00
Bborie Park d911b1ee21 Implements ST_SameAlignment.
Associated ticket is #589.


git-svn-id: http://svn.osgeo.org/postgis/trunk@7951 b70326c6-7e19-0410-871a-916f4a2858ee
2011-10-05 23:03:19 +00:00
Bborie Park a3abb76533 As per Bryce's comments in ticket #1174, reduce the number of calculations when doing rt_raster_geopoint_to_cell by using an inverse geotransform matrix. Unlike the patch attached to the ticket, this commit does not change the structure of the rt_raster struct. It may be worth changing the rt_raster struct eventually, but will cost us the single memcpy when serializing rt_raster. Also, changes for testing SRID as "unknown" if value is lte SRID_UNKNOWN (presently 0).
Associated ticket is #1174.


git-svn-id: http://svn.osgeo.org/postgis/trunk@7949 b70326c6-7e19-0410-871a-916f4a2858ee
2011-10-05 18:49:11 +00:00
Bborie Park b5c044ab3d Removed hackish use of POSTGIS_GDAL_VERSION in postgis/sqldefines.h.in and postgis/postgis.sql.in.c. Added conditional compilation of extent resizing based upon GDAL version in rt_api.c
git-svn-id: http://svn.osgeo.org/postgis/trunk@7948 b70326c6-7e19-0410-871a-916f4a2858ee
2011-10-05 04:54:00 +00:00
Bborie Park 54d6bc0265 Adds postgis_gdal_version() function as per ticket #1225.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7945 b70326c6-7e19-0410-871a-916f4a2858ee
2011-10-04 22:38:46 +00:00
Bborie Park 295c02be84 Changed adjustment of extent by half-pixel to full-pixel for points and linestrings to ensure compatibility with GDAL 1.6, 1.7 and 1.8. GDAL 1.9 (current trunk) appears to work fine with half-pixel adjustments.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7944 b70326c6-7e19-0410-871a-916f4a2858ee
2011-10-04 20:51:10 +00:00
Bborie Park 2bbfeb294e For linestrings, use same logic for points where extent is increased by half a pixel to catch geometries on the edges.
Associated ticket is #1213


git-svn-id: http://svn.osgeo.org/postgis/trunk@7941 b70326c6-7e19-0410-871a-916f4a2858ee
2011-10-04 19:50:54 +00:00
Bborie Park 167c3b8c9d Changed function ST_Intersects(raster, raster, int, int) to ST_Intersects(raster, raster). Added additional comments to rt_raster_geopoint_to_cell().
Associated ticket is #1212


git-svn-id: http://svn.osgeo.org/postgis/trunk@7919 b70326c6-7e19-0410-871a-916f4a2858ee
2011-09-29 18:33:27 +00:00
Bborie Park 9b3d2c21a7 Removed unnecessary typedef for fmin and fmax on windows. Possible fix to #1207.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7890 b70326c6-7e19-0410-871a-916f4a2858ee
2011-09-25 14:48:57 +00:00
Bborie Park b443689cf4 Tweaks to makefiles due to linker symbol errors in OSX. Hopefully this can also resolve the issue with #1207.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7889 b70326c6-7e19-0410-871a-916f4a2858ee
2011-09-24 19:05:10 +00:00
Bborie Park c5d7903487 Further tweaks to rt_raster_gdal_rasterize to correctly handle auto-computed extents of multipoints. Addition of ST_Intersects for two rasters. Refactored the one raster and one geometry version of ST_Intersects.
Associated ticket is #1176


git-svn-id: http://svn.osgeo.org/postgis/trunk@7884 b70326c6-7e19-0410-871a-916f4a2858ee
2011-09-22 15:07:25 +00:00
Bborie Park 008e749e4d additional code cleanup of rt_raster_gdal_rasterize
git-svn-id: http://svn.osgeo.org/postgis/trunk@7870 b70326c6-7e19-0410-871a-916f4a2858ee
2011-09-19 21:28:40 +00:00
Bborie Park a43ebe1780 fixups and code cleanups for the rt_raster_gdal_rasterize to better handle point and linestring geometries
git-svn-id: http://svn.osgeo.org/postgis/trunk@7857 b70326c6-7e19-0410-871a-916f4a2858ee
2011-09-16 13:32:22 +00:00
Bborie Park 152a2d6786 Added optimizations and shortcuts for rt_band_get_quantiles_stream
git-svn-id: http://svn.osgeo.org/postgis/trunk@7802 b70326c6-7e19-0410-871a-916f4a2858ee
2011-09-02 01:54:43 +00:00
Bborie Park f9bfa6f17e Added solaris define for UNIX using patch provided by rroliver.
Associated ticket is #1171.


git-svn-id: http://svn.osgeo.org/postgis/trunk@7790 b70326c6-7e19-0410-871a-916f4a2858ee
2011-08-26 14:47:07 +00:00
Bborie Park ee104cbad7 Tweaked memory allocation in RASTER_quantileCoverage.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7789 b70326c6-7e19-0410-871a-916f4a2858ee
2011-08-26 00:04:40 +00:00
Bborie Park aba77a3674 Fixed the function rt_band_get_summary_stats rt_core/rt_api.c to correctly handle the situation where a band's values are all nodata
git-svn-id: http://svn.osgeo.org/postgis/trunk@7788 b70326c6-7e19-0410-871a-916f4a2858ee
2011-08-25 23:23:46 +00:00
Bborie Park 56791ce3b5 Fixed the problem where having configure detect that GDAL has the GDALFPolygonize function does not cause the code to use GDALFPolygonize. This is due to the macro GDALFPOLYGONIZE not being set anywhere. So, it is now being set in raster_config.h.in and included in rt_core/rt_api.h. Had to update testapi.c as the geometries generated differ depending on whether or not GDALFPolygonize is used.
Associated ticket is #650


git-svn-id: http://svn.osgeo.org/postgis/trunk@7785 b70326c6-7e19-0410-871a-916f4a2858ee
2011-08-25 14:44:55 +00:00
Bborie Park 3ac670b992 Refactored ST_ValueCount and ST_ValuePercent to be a C function rather than a plpgsql function.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7778 b70326c6-7e19-0410-871a-916f4a2858ee
2011-08-23 22:41:22 +00:00
Bborie Park 4c3dac62a8 More fixups for the quantile coverage function. Fixes segfault that seems to only occur on OSX.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7771 b70326c6-7e19-0410-871a-916f4a2858ee
2011-08-20 17:51:04 +00:00
Bborie Park 71aa64ee59 Added forgotten explicit freeing of memory and some code cleanup
git-svn-id: http://svn.osgeo.org/postgis/trunk@7766 b70326c6-7e19-0410-871a-916f4a2858ee
2011-08-19 22:57:51 +00:00
Bborie Park 28797da0e1 Adds coverage table version of ST_Quantile and ST_ApproxQuantile. Function implemented using the algorithm discussed in
A One-Pass Space-Efficient Algorithm for Finding Quantiles (1995)
  by Rakesh Agrawal, Arun Swami
  in Proc. 7th Intl. Conf. Management of Data (COMAD-95)
  http://www.almaden.ibm.com/cs/projects/iis/hdb/Publications/papers/comad95.pdf

Also refactored the regression test for rt_histogram due to unnecessary columns in output


git-svn-id: http://svn.osgeo.org/postgis/trunk@7765 b70326c6-7e19-0410-871a-916f4a2858ee
2011-08-19 19:08:36 +00:00
Bborie Park 768deb55a9 Removed unnecessary code from rt_band_get_summary_stats. Fixed incorrect comment for rt_band_get_value_count.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7751 b70326c6-7e19-0410-871a-916f4a2858ee
2011-08-15 22:43:13 +00:00
Sandro Santilli 6b454dc401 Use proper PROJ4 flags when linking against liblwgeom. See ticket #1158. [RT-SIGTA]
git-svn-id: http://svn.osgeo.org/postgis/trunk@7749 b70326c6-7e19-0410-871a-916f4a2858ee
2011-08-15 11:36:59 +00:00
Bborie Park 33352aacb5 Consolidated various struct declarations from rt_api.c into rt_api.h as these structs are duplicatively redeclared in rt_pg.c and testapi.c
git-svn-id: http://svn.osgeo.org/postgis/trunk@7745 b70326c6-7e19-0410-871a-916f4a2858ee
2011-08-13 18:10:44 +00:00
Bborie Park 09a73008c6 Rewrote the code for the coverage table versions of ST_SummaryStats and ST_Histogram. So instead of plpgsql, it is now in C within rt_pg/rt_pg.c
git-svn-id: http://svn.osgeo.org/postgis/trunk@7730 b70326c6-7e19-0410-871a-916f4a2858ee
2011-08-11 21:01:45 +00:00
Bborie Park ed8d71db19 Addition of ST_AsRaster function to provide the ability to convert geometries into rasters.
Associated ticket is #1141.


git-svn-id: http://svn.osgeo.org/postgis/trunk@7675 b70326c6-7e19-0410-871a-916f4a2858ee
2011-07-25 15:52:36 +00:00
Bborie Park 1ce3904dda Cleaned the grid alignment code to remove unnecessary cruft in rt_raster_gdal_warp
git-svn-id: http://svn.osgeo.org/postgis/trunk@7658 b70326c6-7e19-0410-871a-916f4a2858ee
2011-07-21 17:31:07 +00:00
Bborie Park 29686bbbfa Fixed floating point issue with the remainder returned from the function modf in rt_api.c. Updated messages in rt_pg.c. Corrected expected regression results in rt_resample_expected.
Associated ticket is #1114


git-svn-id: http://svn.osgeo.org/postgis/trunk@7657 b70326c6-7e19-0410-871a-916f4a2858ee
2011-07-21 16:20:36 +00:00
Bborie Park 05542d6519 Bug fix of deallocating array using wrong index variable
git-svn-id: http://svn.osgeo.org/postgis/trunk@7654 b70326c6-7e19-0410-871a-916f4a2858ee
2011-07-19 22:20:40 +00:00
Bborie Park fa708f255c - tweaked the rt_resample regression test to use SRIDs under 1000000
- changed the computation of width and height when aligning to a grid


git-svn-id: http://svn.osgeo.org/postgis/trunk@7652 b70326c6-7e19-0410-871a-916f4a2858ee
2011-07-18 23:29:54 +00:00
Bborie Park 7c3a02f55f Minor comment updates to correct details
git-svn-id: http://svn.osgeo.org/postgis/trunk@7644 b70326c6-7e19-0410-871a-916f4a2858ee
2011-07-15 21:07:32 +00:00
Bborie Park 2ad776d498 Complete refactoring of code from ST_Transform to ST_Resample. There are four new functions as of this revision: ST_Resample, ST_Rescale, ST_Reskew and ST_SnapToGrid. ST_Transform is still present but points to ST_Resample.
Associated ticket #1114


git-svn-id: http://svn.osgeo.org/postgis/trunk@7633 b70326c6-7e19-0410-871a-916f4a2858ee
2011-07-13 19:33:12 +00:00
Bborie Park 652f506bb8 Cleaned up the large number of floating point equality tests with a function-like macro
git-svn-id: http://svn.osgeo.org/postgis/trunk@7617 b70326c6-7e19-0410-871a-916f4a2858ee
2011-07-07 18:28:58 +00:00
Bborie Park 31ffec859f Refactored how user-specified upperleft corner coordinates are handled
git-svn-id: http://svn.osgeo.org/postgis/trunk@7614 b70326c6-7e19-0410-871a-916f4a2858ee
2011-07-06 23:15:13 +00:00
Bborie Park 36c00735b1 Changed expressions for pixel byte boundaries in assert tests of rt_raster_serialize and rt_raster_deserialize in rt_api.c. The changed expressions are based upon relative values rather than the original absolute values. This should resolve the problem defined in ticket #1061. It may also help with the crashing in ticket #1066.
Associated tickets are #1061 and possibly #1066.


git-svn-id: http://svn.osgeo.org/postgis/trunk@7597 b70326c6-7e19-0410-871a-916f4a2858ee
2011-07-06 05:18:50 +00:00
Bborie Park dd906264f7 removed accidental commit of some debug testing
git-svn-id: http://svn.osgeo.org/postgis/trunk@7528 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-30 17:16:02 +00:00
Bborie Park c2bd42d810 fixed logic issues in ST_AsJPEG
git-svn-id: http://svn.osgeo.org/postgis/trunk@7527 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-30 13:28:47 +00:00
Bborie Park 1266f72050 - wrote function getSRTextSPI to create one code for getting the srtext of a SRID from the spatial_ref_sys table.
- removed plpgsql function _ST_srtext with addition of getSRTextSPI.

The regression failure in ticket #1064 should be resolved as a side-affect of the new function as the srtext returned through SPI is copied to an interval variable.


git-svn-id: http://svn.osgeo.org/postgis/trunk@7506 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-27 21:35:14 +00:00
Mark Cave-Ayland a39bc622f8 Edit rt_band_get_pixel() so that the warning message contains the out-of-bound coordinates being accessed.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7496 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-27 16:47:17 +00:00
Bborie Park 48ff0b2940 Modified ST_Transform to permit specification of projected raster's scale. This is due to the scale change that occurs when a raster is being reprojected.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7482 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-25 19:20:23 +00:00
Bborie Park 67ce832591 Added sanitization of the algorithm parameter of ST_Transform. Refactored the regression test for ST_Transform.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7471 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-24 21:20:04 +00:00
Bborie Park 04bbd059b2 Removed rt_raster_transform from rt_api.c and any calls to it since rt_raster_gdal_warp has same results for reprojections.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7455 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-23 20:46:32 +00:00
Bborie Park 6ebb8e7534 Addition of rt_raster_gdal_warp function in rt_api.c. This was written based upon GDAL's gdalwarp utility to provide a flexible means to reproject, change the scale of, adjust the skew (deskew) of and shift the origin of a raster. RASTER_transform in rt_pg.c has been adjusted to make use of rt_raster_gdal_warp instead of rt_raster_transform. Regression te
sts confirm that resulting rasters from rt_raster_gdal_warp are identical to that of rt_raster_transform.

The abilities to change a raster's scale, skew and origin have yet to be tested and have no user-accessible SQL functions as of this revision.  This will occur in future revisions.

The function rt_raster_transform will be removed in a future revision.


git-svn-id: http://svn.osgeo.org/postgis/trunk@7454 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-23 20:29:51 +00:00
Bborie Park e10aa96ecb Added value for nBandCount attribute of GDALWarpOptions in rt_raster_transform function.
This is based upon the discussion found at:

http://lists.osgeo.org/pipermail/gdal-dev/2011-May/028730.html

Related ticket is #1015



git-svn-id: http://svn.osgeo.org/postgis/trunk@7399 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-15 14:29:20 +00:00
Bborie Park cfdb07ccca Fixed memory leak in RASTER_asGDALRaster of rt_pg.c and left note in comments of rt_raster_to_gdal
git-svn-id: http://svn.osgeo.org/postgis/trunk@7390 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-13 21:47:27 +00:00
Bborie Park b2ca472ea1 Added function parameter "header_only" to rt_raster_deserialize. This instructs the function to only extract the raster header.
All functions calls to rt_raster_deserialize in rt_pg.c and testwkb.c have been modified to account for the "header_only" parameter.  In addition, functions that can use PG_DETOAST_DATUM_SLICE have been modified to use it.

Associated tickets are #867 and #985.

Now to work on valgrinding rt_pg.c


git-svn-id: http://svn.osgeo.org/postgis/trunk@7376 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-11 19:26:44 +00:00
Bborie Park e5062e5dc9 Refactored rt_raster_replace_band in rt_api.c to return the replaced band.
Additional memory cleanups in testapi.c due to segfault and leaks.


git-svn-id: http://svn.osgeo.org/postgis/trunk@7372 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-11 04:59:19 +00:00
Bborie Park c093bd3940 Fixed bunch of memory leaks in rt_api.c and testapi.c. Will need to valgrind the regression tests to clean up the leaks in rt_pg.c
git-svn-id: http://svn.osgeo.org/postgis/trunk@7369 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-11 00:05:53 +00:00
Bborie Park 34a1aa8855 Refactored how GDAL warp options are freed. I believe I was prematurely freeing the options.
Associated ticket #1015


git-svn-id: http://svn.osgeo.org/postgis/trunk@7367 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-10 23:01:50 +00:00
Pierre Racine 34f97a500c Getting pixel value at out of range coordinate should only return a warning. Was broken at r7106. Added a check.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7366 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-10 19:49:29 +00:00
Bborie Park 5399f6502d Explicitly set GDALWarpOptions element padfSrcNoDataImag as it seems some folks are having regression error. Based upon the GDAL code, explicitly setting padfSrcNoDataImag and padfDstNoDataImag should eliminate the error message that is occurring.
Associated tickets are #925 and #1015.


git-svn-id: http://svn.osgeo.org/postgis/trunk@7364 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-10 18:14:51 +00:00
Bborie Park 7e143b23c8 Rewrote how the standard/sample deviation is computed in ST_SummaryStats for coverage tables. It now extends the existing use of a single-pass standard deviation calculation to be able to do the calculation for a coverage table.
Associated ticket #985.


git-svn-id: http://svn.osgeo.org/postgis/trunk@7342 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-08 21:10:11 +00:00
Bborie Park 60c2a10862 Added support for coverage tables to ST_Histogram. This entailed adding the ability to explicitly specify the min and max values in the underlying C function rt_band_get_histogram. The min and max parameters should ONLY be used by the established coverage table handling ST_Histogram functions as the returned percent element of the histogram type is changed from returning the percentage to returning the sum of counts for that histogram.
Associated ticket is #934.


git-svn-id: http://svn.osgeo.org/postgis/trunk@7339 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-07 22:59:23 +00:00
Bborie Park 4752433c0d Add ST_Transform function that achieves the primary purpose of reprojecting a raster to a new projection system. This makes use of the GDAL Warp API function GDALAutoCreateWarpedVRT(). In the future, the underlying C function is expected to be refactored to support skewing and pixel scaling at the same time the raster is reprojected.
Really minor changes to rt_pg/rt_pg.c adding initilization values to variables for eliminating compile warnings in Windows (thanks Pierre).

Fixed variable "status" in rt_raster_from_gdal_dataset() of rt_core/rt_api.c

Associated ticket is #925


git-svn-id: http://svn.osgeo.org/postgis/trunk@7338 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-07 18:21:34 +00:00
Bborie Park 9b588d5bc9 bug fix of r7325 where the wrong variable is used in the "for" loop at line 5442
git-svn-id: http://svn.osgeo.org/postgis/trunk@7326 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-05 21:49:51 +00:00
Bborie Park 621954071c - added additional function parameters "bandNums" and "count" to rt_raster_to_gdal_mem so that the GDAL dataset created only contains those bands specified
- any calls to rt_raster_to_gdal_mem function was refactored for the new function parameters
- refactored rt_raster_dump_as_wktpolygons to make use of rt_raster_to_gdal_mem so as to reduce duplicate code and improve cleanliness


git-svn-id: http://svn.osgeo.org/postgis/trunk@7325 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-05 20:52:48 +00:00
Bborie Park 8e1a828f0f Added rt_raster_from_gdal_dataset function to rt_core/rt_api.c. This function provides the functionality needed to convert a GDAL dataset into a PostGIS Raster object.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7317 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-03 17:02:57 +00:00
Jorge Arévalo 6c38bd8437 Check for new GDALFPolygonize function. If it isn't present, the old GDALPolygonize is called. Related ticket #650.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7316 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-03 15:19:40 +00:00
Jorge Arévalo f007bac333 Fixed ticket #650. You need to update your GDAL copy to a release up to 22476 to make it work.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7308 b70326c6-7e19-0410-871a-916f4a2858ee
2011-06-01 23:50:14 +00:00
Bborie Park 12d22e5d9a additional code refactoring in rt_raster_from_band
git-svn-id: http://svn.osgeo.org/postgis/trunk@7303 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-31 22:54:18 +00:00
Bborie Park 47629e9ccd code refactored and added copying of raster attributes to new raster in rt_raster_from_band
git-svn-id: http://svn.osgeo.org/postgis/trunk@7302 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-31 22:47:33 +00:00
Bborie Park 87502fbee8 renamed all instances of "hasnodata" function argument to "exclude_nodata_value" in SQL functions (and underlying code where appropriate) ST_SummaryStats, ST_Count, ST_Sum, ST_Mean, ST_StdDev, ST_MinMax, ST_Quantile, ST_Histogram, ST_ValueCount and ST_ValuePercent
git-svn-id: http://svn.osgeo.org/postgis/trunk@7294 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-30 14:53:11 +00:00
Bborie Park be8b1278c3 changed name "proportion" to "percent" for ST_Histogram to stay consistent with ST_ValuePercent
git-svn-id: http://svn.osgeo.org/postgis/trunk@7257 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-26 20:09:50 +00:00
Bborie Park 29fd8cc4f1 Addition of ST_ValuePercent, sibling of ST_ValueCount. This function provides the ability to determine the percentage of a raster's band that is of a user-specified value.
Assocated ticket is #990

Also specified STRICT for functions with "searchvalue" (the singular) argument.


git-svn-id: http://svn.osgeo.org/postgis/trunk@7256 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-26 20:04:12 +00:00
Bborie Park 43f42cd6b8 Adds ST_ValueCount to count the number of times a user-provided value or all values occurs in a raster's band.
Associated ticket is #953


git-svn-id: http://svn.osgeo.org/postgis/trunk@7252 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-26 04:23:54 +00:00
Bborie Park 80b01a2bcc - taking a suggestion from strk in #958, all regression tests for functions related to ST_SummaryStats has been rounded to 3 decimal places
- added additional argument checks for pgraster to rt_pg.c
- changed floating point comparisons in rt_pg.c and rt_api.c


git-svn-id: http://svn.osgeo.org/postgis/trunk@7196 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-18 23:33:05 +00:00
Bborie Park 616b91bc70 ST_SummaryStats returns the sum as part of the summary stats.
_ST_SummaryStats(rastertable, rastercolumn) function changed to make use of the sum and compute a straight mean (sum / count) rather than computing a weighted mean.


git-svn-id: http://svn.osgeo.org/postgis/trunk@7193 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-18 14:18:15 +00:00
Bborie Park f3506fad22 - fixed usage of function parameter "hasnodata" to follow standardized interpretation
- added copyright notices for work done by Bborie Park funded through the Regents of the University of California


git-svn-id: http://svn.osgeo.org/postgis/trunk@7160 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-16 22:01:10 +00:00
Bborie Park a10cbcfa4d Add ST_AsGDALRaster function and helper functions ST_GDALDrivers and ST_srtext
- added rt_raster_to_gdal, rt_raster_gdal_drivers and rt_raster_to_gdal_mem functions to rt_core/rt_api.c and rt_api.h
	- added test cases to test/core/testapi.c
	- added RASTER_asGDALRaster and RASTER_getGDALDrivers to rt_pg/rt_pg.c
	- added SQL functions
	- added regression tests

Associated ticket is #901


git-svn-id: http://svn.osgeo.org/postgis/trunk@7155 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-16 19:48:20 +00:00
Bborie Park 6eb30cd262 Added ST_Reclass function
- added rt_band_reclass and rt_raster_replace_band to rt_core/rt_api.c and rt_api.h
	- added test case to test/core/testapi.c
	- added RASTER_reclass to rt_pg/rt_pg.c
	- added SQL functions for ST_Reclass
	- added regression tests

Associated ticket is #903


git-svn-id: http://svn.osgeo.org/postgis/trunk@7154 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-16 19:43:10 +00:00
Bborie Park 581c2dd9c3 Added ST_Quantile functions
- added function rt_raster_get_quantiles to rt_core/rt_api.c and rt_api.h
	- added test case to test/core/testapi.c
	- added function RASTER_quantile to rt_pg/rt_pg.c
	- added SQL functions for ST_Quantile
	- added regression tests

Associated ticket is #935


git-svn-id: http://svn.osgeo.org/postgis/trunk@7153 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-16 19:39:41 +00:00
Bborie Park cbaaeda73b Added ST_Histogram functions.
- added function rt_band_get_histogram to rt_core/rt_api.c and rt_api.h
	- added test case to test/core/testapi.c
	- added function RASTER_histogram to rt_pg/rt_pg.c
	- added SQL functions for ST_Histogram
	- added regression tests

Associated ticket is #934


git-svn-id: http://svn.osgeo.org/postgis/trunk@7152 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-16 19:36:55 +00:00
Bborie Park bffadd2c76 Addition of ST_SummaryStats function.
- added function rt_band_get_summary_stats to rt_core/rt_api.c and rt_api.h
	- added test case to test/core/testapi.c
	- added function RASTER_summaryStats to rt_pg/rt_pg.c
	- added SQL functions for ST_SummaryStats to rt_pg/rtpostgis.sql.in.c
	- added regression tests in test/regress

Associated ticket is #930.


git-svn-id: http://svn.osgeo.org/postgis/trunk@7148 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-16 19:17:15 +00:00
Bborie Park 41ca87ef01 Addition of ST_Band functionality.
- added function rt_raster_from_band to rt_core/rt_api.c and rt_api.h
	- added test case to test/core/testapi.c
	- added function RASTER_band to rt_pg/rt_pg.c
	- added SQL functions for ST_Band to rt_pg/rtpostgis.sql.in.c
	- added regression tests in test/regress

Associated ticket is #339 and attached patch st_band.3.patch


git-svn-id: http://svn.osgeo.org/postgis/trunk@7147 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-16 19:11:21 +00:00
Jorge Arévalo f0ebd104a7 Trailing spaces removed from raster files.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7107 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-06 14:29:04 +00:00
Jorge Arévalo 6f16c2bfcb Changes in raster memory management:
- Only calling function memory context is used, except in SRF functions, where
multi_call_memory_ctx is used.
- rt_context internals hidden. The memory management and error reporting is
performed by rtalloc/rterror family functions. They simply call rt_context
struct fields as requested. Same philosophy here than in liblwgeom.
- Now rt_context memory is statically allocated. Before this, new memory for
rt_context was allocated in every function call. And the memory was allocated
outside the calling function (in fcinfo->flinfo->fn_mcxt postgres memory
        context).


git-svn-id: http://svn.osgeo.org/postgis/trunk@7106 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-06 12:06:29 +00:00
Pierre Racine b04bb1d01d -The minimum for float and double are -FLT_MAX & -DBL_MAX
-Stacked some CASE options

git-svn-id: http://svn.osgeo.org/postgis/trunk@7041 b70326c6-7e19-0410-871a-916f4a2858ee
2011-04-15 20:30:52 +00:00
Jorge Arévalo 731d665c71 Fixed bug from ticket #837. Some other improvements in RASTER_mapAlgebra. Minor bug fixed in rt_raster_serialized_size.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7025 b70326c6-7e19-0410-871a-916f4a2858ee
2011-04-13 19:44:48 +00:00
Pierre Racine d6fe9d1e8d -Minimal value for float is -FLT_MAX, not FLT_MIN
git-svn-id: http://svn.osgeo.org/postgis/trunk@6983 b70326c6-7e19-0410-871a-916f4a2858ee
2011-03-28 23:10:51 +00:00
Jorge Arévalo 5f7d1f9ee9 Missed check added again.
git-svn-id: http://svn.osgeo.org/postgis/trunk@6981 b70326c6-7e19-0410-871a-916f4a2858ee
2011-03-28 22:52:59 +00:00
Jorge Arévalo 465ed8d6d6 Some bugs related with ticket #870 solved. Added more test for polygonize function.
git-svn-id: http://svn.osgeo.org/postgis/trunk@6980 b70326c6-7e19-0410-871a-916f4a2858ee
2011-03-28 22:49:00 +00:00
Pierre Racine b17a7e3127 -Changed message not proper when just setting pixel value
git-svn-id: http://svn.osgeo.org/postgis/trunk@6979 b70326c6-7e19-0410-871a-916f4a2858ee
2011-03-28 22:10:18 +00:00
Pierre Racine 390a83406c -Transformed many error into warning (or notice)
-Removed function name in message for warnings
-Added doc about rules when to return notice or error
-Removed commented out notices
-removed warning when passed raster is null. Just return null
-Get band number with PG_GETARG_INT32 instead of PG_GETARG_UINT16 which was converting values < 0 to something > 0

git-svn-id: http://svn.osgeo.org/postgis/trunk@6978 b70326c6-7e19-0410-871a-916f4a2858ee
2011-03-28 20:31:08 +00:00
Jorge Arévalo 853075f77f Raster polygonization optimized using a layer filter to avoid NODATA values. Related ticket #870.
git-svn-id: http://svn.osgeo.org/postgis/trunk@6975 b70326c6-7e19-0410-871a-916f4a2858ee
2011-03-28 18:01:03 +00:00
Pierre Racine 08d41a641c -General review of ST_AddBand following ticket 871
-Moved some warning in the core
-Renamed the parameters to make more explicit which one is "to" and which one is "from"
-Fixed confusion in parameter order.
-Set many rtpostgis.sql.in.c functions to STRICT
-Removed check for null in RASTER_getPixelValue since st_value is now strict. More might follow.
-Removed (or moved) some documentation from rt_api.c already present in rt_api.h


git-svn-id: http://svn.osgeo.org/postgis/trunk@6960 b70326c6-7e19-0410-871a-916f4a2858ee
2011-03-23 19:52:34 +00:00
Jorge Arévalo e444592ee6 Server crash reported in ticket #837 partially solved. SPI_finish causes server to crash. Commented in this commit, but it's not a good solution, I think.
This guy had the same problem 10 years ago. No responses: http://www.mail-archive.com/pgsql-general@postgresql.org/msg18558.html


git-svn-id: http://svn.osgeo.org/postgis/trunk@6958 b70326c6-7e19-0410-871a-916f4a2858ee
2011-03-23 02:57:33 +00:00
Paul Ramsey c9485aa440 Fix build fail when DEBUG = 1.
git-svn-id: http://svn.osgeo.org/postgis/trunk@6923 b70326c6-7e19-0410-871a-916f4a2858ee
2011-03-18 15:52:15 +00:00
Pierre Racine 6b917c2436 -Fix for ticket 792: Clamp double to known values when pixeltype is other than double in rt_band_set_nodata, rt_band_set_pixel & rt_raster_generate_new_band
-Added function name to many error messages
-Standardized the way we write "nodata" from "NODATA" to "nodata"
-Moved some documentation to the header file
-My editor remove a lot of trailing space and convert tab to 4 spaces. Please make your editor do the same.
-Removed declarations of many unused variable


git-svn-id: http://svn.osgeo.org/postgis/trunk@6920 b70326c6-7e19-0410-871a-916f4a2858ee
2011-03-18 14:06:55 +00:00
Jorge Arévalo 13357fffa4 Deleted empty rt_raster_map_algebra function from rt_core. MapAlgebra
implemented at PostgreSQL level.


git-svn-id: http://svn.osgeo.org/postgis/trunk@6911 b70326c6-7e19-0410-871a-916f4a2858ee
2011-03-16 18:48:39 +00:00
Jorge Arévalo 1fcfb1f7c0 - One raster core implementation of MapAlgebra (related ticket #588, needs
documentation).
- RASTER_addBand code moved to core level. The new RASTER_addBand function calls
the core one (rt_raster_generate_new_band).
- Added regression tests for MapAlgebra.
- Deleted lexer/parser at core level. Not used.
- Fixed small bug in documentation: ST_SetBandNoDataValue returns a raster, not
an integer.


git-svn-id: http://svn.osgeo.org/postgis/trunk@6832 b70326c6-7e19-0410-871a-916f4a2858ee
2011-02-16 18:19:57 +00:00
Jorge Arévalo 4b9a3ea201 Documentation updated for ST_BandIsNodata function. Added band nodata checking
in loader script.


git-svn-id: http://svn.osgeo.org/postgis/trunk@6716 b70326c6-7e19-0410-871a-916f4a2858ee
2011-01-24 15:06:02 +00:00
Jorge Arévalo 141dd80f01 Added isnodata flag at core level and st_bandisnodata at postgresql level.
Related ticket #593. Fixed bug with debug functions at raster core level. Still
need to change the loader and the doc.


git-svn-id: http://svn.osgeo.org/postgis/trunk@6678 b70326c6-7e19-0410-871a-916f4a2858ee
2011-01-20 17:07:37 +00:00
Jorge Arévalo 54d015e2a7 Minor bug solved in debug functions.
git-svn-id: http://svn.osgeo.org/postgis/trunk@6620 b70326c6-7e19-0410-871a-916f4a2858ee
2011-01-13 20:09:57 +00:00