Commit graph

102 commits

Author SHA1 Message Date
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