Commit graph

64 commits

Author SHA1 Message Date
Bborie Park b38040201b Code cleanup of uncorrected statement from r7170
Associated ticket is #954


git-svn-id: http://svn.osgeo.org/postgis/trunk@7171 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-17 15:01:54 +00:00
Bborie Park 18509923f6 refactored code that attempted to modify a function parameter as PostgreSQL 8.4 sets all function parameters as CONSTANT, unlike PostgreSQL 9.0
git-svn-id: http://svn.osgeo.org/postgis/trunk@7170 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-17 14:46:37 +00:00
Bborie Park a9bb6bd489 refactored usage of snprintf to use explicit string sizes rather than what is a gcc specific implementation where the return value of snprintf is the ideal size of the string
git-svn-id: http://svn.osgeo.org/postgis/trunk@7168 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-17 14:04:14 +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 e51d3d161d removed duplicative ST_Histogram function
git-svn-id: http://svn.osgeo.org/postgis/trunk@7159 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-16 19:56:32 +00:00
Bborie Park 19af7ff735 Add ST_AsPNG
- added SQL functions for ST_AsPNG
	- added regression tests

Associated ticket is #342


git-svn-id: http://svn.osgeo.org/postgis/trunk@7158 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-16 19:54:11 +00:00
Bborie Park bbc3449804 Add ST_AsJPEG function
- added SQL functions for ST_AsJPEG
	- added regression tests

Associated ticket is #340


git-svn-id: http://svn.osgeo.org/postgis/trunk@7157 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-16 19:52:12 +00:00
Bborie Park 3df41bb1ec Add ST_AsTIFF function
- add SQL functions for ST_AsTIFF
	- add regression tests

Associated ticket is #341


git-svn-id: http://svn.osgeo.org/postgis/trunk@7156 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-16 19:50:38 +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 028ad6126a Added ST_MinMax function
- added SQL functions for ST_MinMax
	- added regression tests

Associated ticket is #902


git-svn-id: http://svn.osgeo.org/postgis/trunk@7151 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-16 19:34:01 +00:00
Bborie Park e8f6b54e70 Added ST_StdDev function
- added SQL functions for ST_StdDev
	- added regression tests

Associated ticket is #932


git-svn-id: http://svn.osgeo.org/postgis/trunk@7150 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-16 19:32:16 +00:00
Bborie Park 4b63289341 Added ST_Mean function.
- added SQL functions for ST_Mean to rt_pg/rtpostgis.sql.in.c
	- added regression tests

Associated ticket is #931


git-svn-id: http://svn.osgeo.org/postgis/trunk@7149 b70326c6-7e19-0410-871a-916f4a2858ee
2011-05-16 19:30:20 +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 29a2c7a778 -Fix for #651. Replace "scale" parameter for "pixelsize".
git-svn-id: http://svn.osgeo.org/postgis/trunk@7040 b70326c6-7e19-0410-871a-916f4a2858ee
2011-04-15 18:06:59 +00:00
Jorge Arévalo 2f6f61231e palloc return value doesn't need to be checked, because if out of memory, function ends with elog(ERROR). It never returns NULL.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7032 b70326c6-7e19-0410-871a-916f4a2858ee
2011-04-14 16:29:21 +00:00
Jorge Arévalo 2abf24ed59 Context freed. It's not necessary.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7026 b70326c6-7e19-0410-871a-916f4a2858ee
2011-04-13 19:53:58 +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
Jorge Arévalo 3955185051 Some memory freed. Related ticket #851.
git-svn-id: http://svn.osgeo.org/postgis/trunk@7008 b70326c6-7e19-0410-871a-916f4a2858ee
2011-04-07 18:02:25 +00:00
Jorge Arévalo e3dba3f6ca Raster testing added to core testing. Related ticket #762.
git-svn-id: http://svn.osgeo.org/postgis/trunk@6994 b70326c6-7e19-0410-871a-916f4a2858ee
2011-04-01 05:18:45 +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
Pierre Racine 15c1570955 -Fixxed a bug getting toindex band index
-Classified one function declaration

git-svn-id: http://svn.osgeo.org/postgis/trunk@6967 b70326c6-7e19-0410-871a-916f4a2858ee
2011-03-24 22:56:55 +00:00
Pierre Racine 7170e03400 -ST_AddBand should add the new band as the last band if no band index is apecified
git-svn-id: http://svn.osgeo.org/postgis/trunk@6966 b70326c6-7e19-0410-871a-916f4a2858ee
2011-03-24 22:55:47 +00:00
Pierre Racine 685272bf03 -Return NULL if raster is NULL in RASTER_addband
-Warn if first raster is NULL in RASTER_copyband and return NULL

git-svn-id: http://svn.osgeo.org/postgis/trunk@6964 b70326c6-7e19-0410-871a-916f4a2858ee
2011-03-23 22:09:59 +00:00
Pierre Racine db4225f0b1 -Reordered/classified function declaration
-Renamed index and nband to bandindex in many functions
-Better handling for NULL in RASTER_setBandNoDataValue following ticket #883. Return original raster if can't set nodata value



git-svn-id: http://svn.osgeo.org/postgis/trunk@6963 b70326c6-7e19-0410-871a-916f4a2858ee
2011-03-23 22:01:10 +00:00
Pierre Racine cfbfb9c77a -Better handling of NULL for ST_SetValue. Return the original raster when band, X or Y are NULL instead of an error or NULL. See #883.
git-svn-id: http://svn.osgeo.org/postgis/trunk@6961 b70326c6-7e19-0410-871a-916f4a2858ee
2011-03-23 20:51:41 +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 a635b4ecaf Semicolon missed.
git-svn-id: http://svn.osgeo.org/postgis/trunk@6959 b70326c6-7e19-0410-871a-916f4a2858ee
2011-03-23 18:15:33 +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
Jorge Arévalo b303571514 Two ST_AddBands missing variants added. Related tickets #858, #792.
git-svn-id: http://svn.osgeo.org/postgis/trunk@6944 b70326c6-7e19-0410-871a-916f4a2858ee
2011-03-20 14:01:23 +00:00
Pierre Racine c7c2a32330 -Standardized the way we write "nodata" from "NODATA" to "nodata"
-My editor remove a lot of trailing space and convert tab to 4 spaces. Please set your editor to do the same.



git-svn-id: http://svn.osgeo.org/postgis/trunk@6921 b70326c6-7e19-0410-871a-916f4a2858ee
2011-03-18 14:11:02 +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 f529a4ef48 Added a new variant for ST_AddBand, taking 2 rasters as input. Needs doc.
git-svn-id: http://svn.osgeo.org/postgis/trunk@6833 b70326c6-7e19-0410-871a-916f4a2858ee
2011-02-16 19:12:25 +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 d27525c417 Added header for RASTER_setBandIsNoData.Related ticket #593.
git-svn-id: http://svn.osgeo.org/postgis/trunk@6738 b70326c6-7e19-0410-871a-916f4a2858ee
2011-01-26 16:57:08 +00:00
Jorge Arévalo 7c5624530e Added function ST_SetBandIsNoData with tests and doc. Deleted isnodata checking
for loader. Related ticket #593.


git-svn-id: http://svn.osgeo.org/postgis/trunk@6736 b70326c6-7e19-0410-871a-916f4a2858ee
2011-01-26 16:08:02 +00:00
Pierre Racine b440f9cf66 -Fix for ticket 606: ST_Value now return NULL for nodata value and ST_SetValue accept NULL values (if there is a nodata value in the band).
ST_Value accept a boolean parameter which, when set to false, have the function to return nodata values as their true value instead of null. 

git-svn-id: http://svn.osgeo.org/postgis/trunk@6680 b70326c6-7e19-0410-871a-916f4a2858ee
2011-01-20 23:29:16 +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 f31fd8b185 Functions ST_BandHasNodataValue and ST_SetBandHasNodataValue deleted. Related ticket #602.
git-svn-id: http://svn.osgeo.org/postgis/trunk@6621 b70326c6-7e19-0410-871a-916f4a2858ee
2011-01-13 21:36:43 +00:00
Mateusz Loskot 3c9511aea1 [raster] Cleaned and updated copyright notice.
git-svn-id: http://svn.osgeo.org/postgis/trunk@6608 b70326c6-7e19-0410-871a-916f4a2858ee
2011-01-12 22:02:35 +00:00
Jorge Arévalo a64e1a766c Deleted gserialized check. It's safe to use geometry_gist_sel. Related ticket #758.
git-svn-id: http://svn.osgeo.org/postgis/trunk@6586 b70326c6-7e19-0410-871a-916f4a2858ee
2011-01-10 14:21:23 +00:00
Jorge Arévalo c359a861cc Added code for ST_IsEmpty and ST_HasNoBand functions. And test code for the
first one. Related tickets #592, #593.


git-svn-id: http://svn.osgeo.org/postgis/trunk@6555 b70326c6-7e19-0410-871a-916f4a2858ee
2011-01-03 16:07:53 +00:00
Jorge Arévalo 713fb69eba Changed information return by postgis_raster_build_date and
postgis_raster_lib_version, to match the PostGIS build date and version. Related
ticket #653


git-svn-id: http://svn.osgeo.org/postgis/trunk@6554 b70326c6-7e19-0410-871a-916f4a2858ee
2011-01-03 11:53:42 +00:00
Jorge Arévalo 8f14e6c7ed Renamed accessors and editors of 'PixelSize' to 'Scale', including tests.
Related ticket #654.


git-svn-id: http://svn.osgeo.org/postgis/trunk@6552 b70326c6-7e19-0410-871a-916f4a2858ee
2011-01-03 10:46:41 +00:00
Jorge Arévalo 172f9cd444 Temporarily include postgis/gserialized.h file in raster/rt_pg/rtpostgis.sql.in.c to get access to GSERIALIZED_ON and avoid error with gserialized enabled
git-svn-id: http://svn.osgeo.org/postgis/trunk@6550 b70326c6-7e19-0410-871a-916f4a2858ee
2011-01-01 15:35:54 +00:00