[postgis-tickets] r14869 - Style only change: remove trailing whitespaces

Sandro Santilli strk at keybit.net
Wed Apr 27 07:45:29 PDT 2016


Author: strk
Date: 2016-04-27 07:45:28 -0700 (Wed, 27 Apr 2016)
New Revision: 14869

Modified:
   trunk/extensions/address_standardizer/analyze.c
   trunk/extensions/address_standardizer/err_param.c
   trunk/extensions/address_standardizer/export.c
   trunk/extensions/address_standardizer/gamma.c
   trunk/extensions/address_standardizer/lexicon.c
   trunk/extensions/address_standardizer/pagc_api.h
   trunk/extensions/address_standardizer/pagc_common.h
   trunk/extensions/address_standardizer/pagc_tools.c
   trunk/extensions/address_standardizer/pagc_tools.h
   trunk/extensions/address_standardizer/parseaddress-api.c
   trunk/extensions/address_standardizer/parseaddress-stcities.h
   trunk/extensions/address_standardizer/standard.c
   trunk/extensions/address_standardizer/std_pg_hash.c
   trunk/extensions/address_standardizer/test_main.c
   trunk/extensions/address_standardizer/tokenize.c
   trunk/extensions/address_standardizer/us_gaz.sql
   trunk/extensions/address_standardizer/us_lex.sql
   trunk/extensions/address_standardizer/us_rules.sql
   trunk/extensions/postgis_extension_helper.sql
   trunk/extensions/postgis_extension_helper_uninstall.sql
   trunk/extras/history_table/history_table.sql
   trunk/extras/ogc_test_suite/1_schema.sql
   trunk/extras/ogc_test_suite/2_queries.sql
   trunk/extras/ogc_test_suite/3_cleanup.sql
   trunk/extras/tiger_geocoder/census_loader.sql
   trunk/extras/tiger_geocoder/create_geocode.sql
   trunk/extras/tiger_geocoder/geocode/census_tracts_functions.sql
   trunk/extras/tiger_geocoder/geocode/geocode.sql
   trunk/extras/tiger_geocoder/geocode/geocode_address.sql
   trunk/extras/tiger_geocoder/geocode/geocode_intersection.sql
   trunk/extras/tiger_geocoder/geocode/geocode_location.sql
   trunk/extras/tiger_geocoder/geocode/interpolate_from_address.sql
   trunk/extras/tiger_geocoder/geocode/other_helper_functions.sql
   trunk/extras/tiger_geocoder/geocode/rate_attributes.sql
   trunk/extras/tiger_geocoder/geocode/reverse_geocode.sql
   trunk/extras/tiger_geocoder/geocode_settings.sql
   trunk/extras/tiger_geocoder/normalize/normalize_address.sql
   trunk/extras/tiger_geocoder/normalize/pprint_addy.sql
   trunk/extras/tiger_geocoder/normalize/state_extract.sql
   trunk/extras/tiger_geocoder/pagc_normalize/pagc_normalize_address.sql
   trunk/extras/tiger_geocoder/pagc_normalize/pagc_tables.sql
   trunk/extras/tiger_geocoder/regress/geocode_regress.sql
   trunk/extras/tiger_geocoder/regress/normalize_address_regress.sql
   trunk/extras/tiger_geocoder/regress/pagc_normalize_address_regress.sql
   trunk/extras/tiger_geocoder/tables/lookup_tables_2011.sql
   trunk/extras/tiger_geocoder/tiger_loader_2011.sql
   trunk/extras/tiger_geocoder/tiger_loader_2012.sql
   trunk/extras/tiger_geocoder/tiger_loader_2013.sql
   trunk/extras/tiger_geocoder/tiger_loader_2014.sql
   trunk/extras/tiger_geocoder/tiger_loader_2015.sql
   trunk/extras/tiger_geocoder/topology/tiger_topology_loader.sql
   trunk/extras/tiger_geocoder/upgrade_geocode.sql
   trunk/extras/tiger_geocoder/utility/set_search_path.sql
   trunk/liblwgeom/bytebuffer.c
   trunk/liblwgeom/cunit/cu_buildarea.c
   trunk/liblwgeom/cunit/cu_clean.c
   trunk/liblwgeom/cunit/cu_force_sfs.c
   trunk/liblwgeom/cunit/cu_geodetic.c
   trunk/liblwgeom/cunit/cu_in_geojson.c
   trunk/liblwgeom/cunit/cu_in_wkb.c
   trunk/liblwgeom/cunit/cu_libgeom.c
   trunk/liblwgeom/cunit/cu_measures.c
   trunk/liblwgeom/cunit/cu_minimum_bounding_circle.c
   trunk/liblwgeom/cunit/cu_out_geojson.c
   trunk/liblwgeom/cunit/cu_out_twkb.c
   trunk/liblwgeom/cunit/cu_out_wkb.c
   trunk/liblwgeom/cunit/cu_out_wkt.c
   trunk/liblwgeom/cunit/cu_out_x3d.c
   trunk/liblwgeom/cunit/cu_ptarray.c
   trunk/liblwgeom/cunit/cu_triangulate.c
   trunk/liblwgeom/cunit/cu_varint.c
   trunk/liblwgeom/effectivearea.c
   trunk/liblwgeom/effectivearea.h
   trunk/liblwgeom/g_box.c
   trunk/liblwgeom/g_serialized.c
   trunk/liblwgeom/g_util.c
   trunk/liblwgeom/liblwgeom.h.in
   trunk/liblwgeom/liblwgeom_internal.h
   trunk/liblwgeom/lwalgorithm.c
   trunk/liblwgeom/lwboundingcircle.c
   trunk/liblwgeom/lwcircstring.c
   trunk/liblwgeom/lwcollection.c
   trunk/liblwgeom/lwcompound.c
   trunk/liblwgeom/lwcurvepoly.c
   trunk/liblwgeom/lwgeodetic.c
   trunk/liblwgeom/lwgeodetic.h
   trunk/liblwgeom/lwgeodetic_tree.c
   trunk/liblwgeom/lwgeom.c
   trunk/liblwgeom/lwgeom_api.c
   trunk/liblwgeom/lwgeom_geos.c
   trunk/liblwgeom/lwgeom_geos_clean.c
   trunk/liblwgeom/lwgeom_geos_cluster.c
   trunk/liblwgeom/lwgeom_geos_node.c
   trunk/liblwgeom/lwgeom_log.h
   trunk/liblwgeom/lwgeom_median.c
   trunk/liblwgeom/lwgeom_sfcgal.h
   trunk/liblwgeom/lwgeom_transform.c
   trunk/liblwgeom/lwhomogenize.c
   trunk/liblwgeom/lwin_geojson.c
   trunk/liblwgeom/lwin_wkb.c
   trunk/liblwgeom/lwin_wkt.c
   trunk/liblwgeom/lwin_wkt_lex.c
   trunk/liblwgeom/lwin_wkt_parse.c
   trunk/liblwgeom/lwline.c
   trunk/liblwgeom/lwout_geojson.c
   trunk/liblwgeom/lwout_gml.c
   trunk/liblwgeom/lwout_kml.c
   trunk/liblwgeom/lwout_svg.c
   trunk/liblwgeom/lwout_wkb.c
   trunk/liblwgeom/lwout_wkt.c
   trunk/liblwgeom/lwout_x3d.c
   trunk/liblwgeom/lwpoint.c
   trunk/liblwgeom/lwpoly.c
   trunk/liblwgeom/lwprint.c
   trunk/liblwgeom/lwstroke.c
   trunk/liblwgeom/lwtriangle.c
   trunk/liblwgeom/lwutil.c
   trunk/liblwgeom/measures.c
   trunk/liblwgeom/measures.h
   trunk/liblwgeom/measures3d.c
   trunk/liblwgeom/measures3d.h
   trunk/liblwgeom/ptarray.c
   trunk/liblwgeom/stringbuffer.c
   trunk/liblwgeom/varint.c
   trunk/libpgcommon/gserialized_gist.c
   trunk/libpgcommon/gserialized_gist.h
   trunk/libpgcommon/lwgeom_cache.c
   trunk/libpgcommon/lwgeom_cache.h
   trunk/libpgcommon/lwgeom_pg.c
   trunk/libpgcommon/lwgeom_pg.h
   trunk/libpgcommon/lwgeom_transform.h
   trunk/loader/dbfopen.c
   trunk/loader/pgsql2shp-cli.c
   trunk/loader/pgsql2shp-core.c
   trunk/loader/pgsql2shp-core.h
   trunk/loader/safileio.c
   trunk/loader/shapefil.h
   trunk/loader/shp2pgsql-cli.c
   trunk/loader/shp2pgsql-core.c
   trunk/loader/shp2pgsql-core.h
   trunk/loader/shp2pgsql-gui.c
   trunk/loader/shpcommon.c
   trunk/loader/shpcommon.h
   trunk/loader/shpopen.c
   trunk/postgis/geography.h
   trunk/postgis/geography_inout.c
   trunk/postgis/geography_measurement.c
   trunk/postgis/geography_measurement_trees.c
   trunk/postgis/geometry_inout.c
   trunk/postgis/gserialized_estimate.c
   trunk/postgis/gserialized_gist_2d.c
   trunk/postgis/gserialized_gist_nd.c
   trunk/postgis/gserialized_typmod.c
   trunk/postgis/lwgeom_backend_api.c
   trunk/postgis/lwgeom_box.c
   trunk/postgis/lwgeom_box3d.c
   trunk/postgis/lwgeom_btree.c
   trunk/postgis/lwgeom_dump.c
   trunk/postgis/lwgeom_export.c
   trunk/postgis/lwgeom_functions_analytic.c
   trunk/postgis/lwgeom_functions_basic.c
   trunk/postgis/lwgeom_functions_lrs.c
   trunk/postgis/lwgeom_geos.c
   trunk/postgis/lwgeom_geos_prepared.c
   trunk/postgis/lwgeom_geos_prepared.h
   trunk/postgis/lwgeom_in_geojson.c
   trunk/postgis/lwgeom_in_gml.c
   trunk/postgis/lwgeom_in_kml.c
   trunk/postgis/lwgeom_inout.c
   trunk/postgis/lwgeom_ogc.c
   trunk/postgis/lwgeom_rtree.c
   trunk/postgis/lwgeom_rtree.h
   trunk/postgis/lwgeom_sfcgal.c
   trunk/postgis/lwgeom_sqlmm.c
   trunk/postgis/lwgeom_window.c
   trunk/postgis/postgis_drop_after.sql
   trunk/postgis/postgis_drop_before.sql
   trunk/postgis/postgis_module.c
   trunk/raster/loader/raster2pgsql.c
   trunk/raster/rt_core/librtcore.h
   trunk/raster/rt_core/rt_band.c
   trunk/raster/rt_core/rt_geometry.c
   trunk/raster/rt_core/rt_pixel.c
   trunk/raster/rt_core/rt_raster.c
   trunk/raster/rt_core/rt_serialize.c
   trunk/raster/rt_pg/rtpg_band_properties.c
   trunk/raster/rt_pg/rtpg_create.c
   trunk/raster/rt_pg/rtpg_gdal.c
   trunk/raster/rt_pg/rtpg_geometry.c
   trunk/raster/rt_pg/rtpg_mapalgebra.c
   trunk/raster/rt_pg/rtpg_pixel.c
   trunk/raster/rt_pg/rtpg_raster_properties.c
   trunk/raster/rt_pg/rtpg_utility.c
   trunk/raster/rt_pg/rtpostgis.c
   trunk/raster/scripts/plpgsql/_MapAlgebraParts.sql
   trunk/raster/scripts/plpgsql/st_addband.sql
   trunk/raster/scripts/plpgsql/st_areaweightedsummarystats.sql
   trunk/raster/scripts/plpgsql/st_asraster.sql
   trunk/raster/scripts/plpgsql/st_clip.sql
   trunk/raster/scripts/plpgsql/st_createindexraster.sql
   trunk/raster/scripts/plpgsql/st_deleteband.sql
   trunk/raster/scripts/plpgsql/st_geomextent2rastercoord.sql
   trunk/raster/scripts/plpgsql/st_histogram.sql
   trunk/raster/scripts/plpgsql/st_mapalgebra.sql
   trunk/raster/scripts/plpgsql/st_mapalgebra_optimized.sql
   trunk/raster/scripts/plpgsql/st_mapalgebrafctngb.sql
   trunk/raster/scripts/plpgsql/st_multibandmapalgebra.sql
   trunk/raster/scripts/plpgsql/st_pixelaspoints.sql
   trunk/raster/scripts/plpgsql/st_pixelaspolygons.sql
   trunk/raster/scripts/plpgsql/st_reclass.sql
   trunk/raster/scripts/plpgsql/st_setarray.sql
   trunk/raster/scripts/plpgsql/st_setvalues.sql
   trunk/raster/scripts/plpgsql/st_splittable.sql
   trunk/raster/scripts/plpgsql/st_summarystatsagg.sql
   trunk/raster/scripts/plpgsql/st_tile.sql
   trunk/raster/scripts/plpgsql/st_union.sql
   trunk/raster/test/cunit/cu_band_misc.c
   trunk/raster/test/cunit/cu_gdal.c
   trunk/raster/test/cunit/cu_mapalgebra.c
   trunk/raster/test/cunit/cu_misc.c
   trunk/raster/test/cunit/cu_tester.c
   trunk/raster/test/regress/box3d.sql
   trunk/raster/test/regress/bug_test_car5.sql
   trunk/raster/test/regress/check_gdal.sql
   trunk/raster/test/regress/check_raster_columns.sql
   trunk/raster/test/regress/permitted_gdal_drivers.sql
   trunk/raster/test/regress/rt_band_properties.sql
   trunk/raster/test/regress/rt_bytea.sql
   trunk/raster/test/regress/rt_dimensions.sql
   trunk/raster/test/regress/rt_dumpvalues.sql
   trunk/raster/test/regress/rt_gdalwarp.sql
   trunk/raster/test/regress/rt_georeference.sql
   trunk/raster/test/regress/rt_gist_relationships.sql
   trunk/raster/test/regress/rt_io.sql
   trunk/raster/test/regress/rt_mapalgebra.sql
   trunk/raster/test/regress/rt_mapalgebra_expr.sql
   trunk/raster/test/regress/rt_mapalgebra_mask.sql
   trunk/raster/test/regress/rt_mapalgebraexpr.sql
   trunk/raster/test/regress/rt_mapalgebrafct.sql
   trunk/raster/test/regress/rt_mapalgebrafctngb.sql
   trunk/raster/test/regress/rt_mapalgebrafctngb_userfunc.sql
   trunk/raster/test/regress/rt_neighborhood.sql
   trunk/raster/test/regress/rt_pixelsize.sql
   trunk/raster/test/regress/rt_pixelvalue.sql
   trunk/raster/test/regress/rt_rotation.sql
   trunk/raster/test/regress/rt_scale.sql
   trunk/raster/test/regress/rt_set_band_properties.sql
   trunk/raster/test/regress/rt_set_properties.sql
   trunk/raster/test/regress/rt_setvalues_array.sql
   trunk/raster/test/regress/rt_upperleft.sql
   trunk/raster/test/regress/rt_utility.sql
   trunk/regress/clean.sql
   trunk/regress/concave_hull.sql
   trunk/regress/dump.sql
   trunk/regress/dumppoints.sql
   trunk/regress/geography.sql
   trunk/regress/hausdorff.sql
   trunk/regress/in_geojson.sql
   trunk/regress/in_gml.sql
   trunk/regress/in_kml.sql
   trunk/regress/interrupt_relate.sql
   trunk/regress/isvaliddetail.sql
   trunk/regress/legacy.sql
   trunk/regress/loader/ReprojectPts-pre.sql
   trunk/regress/lwgeom_regress.sql
   trunk/regress/measures.sql
   trunk/regress/operators.sql
   trunk/regress/out_geography.sql
   trunk/regress/out_geometry.sql
   trunk/regress/polyhedralsurface.sql
   trunk/regress/regress.sql
   trunk/regress/regress_bdpoly.sql
   trunk/regress/regress_index.sql
   trunk/regress/regress_ogc.sql
   trunk/regress/regress_ogc_cover.sql
   trunk/regress/regress_ogc_prep.sql
   trunk/regress/regress_selectivity.sql
   trunk/regress/regress_sfcgal.sql
   trunk/regress/relate.sql
   trunk/regress/remove_repeated_points.sql
   trunk/regress/setpoint.sql
   trunk/regress/sfcgal/concave_hull.sql
   trunk/regress/sfcgal/geography.sql
   trunk/regress/sfcgal/legacy.sql
   trunk/regress/sfcgal/measures.sql
   trunk/regress/sfcgal/regress.sql
   trunk/regress/sfcgal/regress_ogc_prep.sql
   trunk/regress/sfcgal/tickets.sql
   trunk/regress/split.sql
   trunk/regress/sql-mm-circularstring.sql
   trunk/regress/sql-mm-compoundcurve.sql
   trunk/regress/sql-mm-curvepoly.sql
   trunk/regress/sql-mm-general.sql
   trunk/regress/sql-mm-multicurve.sql
   trunk/regress/sql-mm-multisurface.sql
   trunk/regress/sql-mm-serialize.sql
   trunk/regress/tickets.sql
   trunk/regress/typmod.sql
   trunk/regress/wkt.sql
   trunk/topology/postgis_topology.c
   trunk/topology/test/cache_geometries.sql
   trunk/topology/test/hierarchy.sql
   trunk/topology/test/invalid_topology.sql
   trunk/topology/test/load_features.sql
   trunk/topology/test/more_features.sql
   trunk/topology/test/regress/addedge.sql
   trunk/topology/test/regress/addface.sql
   trunk/topology/test/regress/addnode.sql
   trunk/topology/test/regress/addtopogeometrycolumn.sql
   trunk/topology/test/regress/createtopogeom.sql
   trunk/topology/test/regress/getnodeedges.sql
   trunk/topology/test/regress/getringedges.sql
   trunk/topology/test/regress/gml.sql
   trunk/topology/test/regress/layertrigger.sql
   trunk/topology/test/regress/sqlmm.sql
   trunk/topology/test/regress/st_addedgemodface.sql
   trunk/topology/test/regress/st_addedgenewfaces.sql
   trunk/topology/test/regress/st_addisoedge.sql
   trunk/topology/test/regress/st_addisonode.sql
   trunk/topology/test/regress/st_changeedgegeom.sql
   trunk/topology/test/regress/st_createtopogeo.sql
   trunk/topology/test/regress/st_modedgeheal.sql
   trunk/topology/test/regress/st_modedgesplit.sql
   trunk/topology/test/regress/st_newedgeheal.sql
   trunk/topology/test/regress/st_newedgessplit.sql
   trunk/topology/test/regress/st_remedgemodface.sql
   trunk/topology/test/regress/st_remedgenewface.sql
   trunk/topology/test/regress/topogeo_addlinestring.sql
   trunk/topology/test/regress/topogeo_addpoint.sql
   trunk/topology/test/regress/topogeo_addpolygon.sql
   trunk/topology/test/regress/topojson.sql
   trunk/topology/test/regress/validatetopology.sql
Log:
Style only change: remove trailing whitespaces

Modified: trunk/extensions/address_standardizer/analyze.c
===================================================================
--- trunk/extensions/address_standardizer/analyze.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extensions/address_standardizer/analyze.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,4 +1,4 @@
-/* analyze.c 
+/* analyze.c
 
 
 This file contains the routines for finding the rules that
@@ -6,7 +6,7 @@
 input to the appropriate output field. The process is
 essentially one of pattern-matching. The Aho-Corasick algorithm
 is used to match rules that map input symbols found by the tokenizer
-to output symbols. In the general case a clause tree is built left to 
+to output symbols. In the general case a clause tree is built left to
 right, matching rules of a particular class, depending on the state.
 
 Prototype 7H08 (This file was written by Walter Sinclair).
@@ -33,13 +33,13 @@
 #include "pagc_api.h"
 
 
-/* ------------------------------------------------------------ 
+/* ------------------------------------------------------------
 A lookup string with a particular standardization is prevented
-   from becoming associated with a particular output symbol 
+   from becoming associated with a particular output symbol
 ------------------------------------------------------------- */
-typedef struct def_blocker 
+typedef struct def_blocker
 {
-   char *lookup ; 
+   char *lookup ;
    char *standard ;
    SYMB output_symbol ;
    DEF *definition ;
@@ -47,7 +47,7 @@
 
 #define NUM_DEF_BLOCKERS 2
 
-/* --------------------------------------------------------------- 
+/* ---------------------------------------------------------------
 When adding to this list, increment NUM_DEF_BLOCKERS for each new
    entry. This list blocks the use of the lookup string (first entry)
    as the standardization (second entry) as an output symbol (third)
@@ -56,7 +56,7 @@
    Thus ST is blocked as STREET as a pretype. This occurs if the
    rule attempts to move ST (as SAINT) left from STREET into PRETYP.
 ---------------------------------------------------------------- */
-static DEF_BLOCKER __def_block_table__[NUM_DEF_BLOCKERS] = 
+static DEF_BLOCKER __def_block_table__[NUM_DEF_BLOCKERS] =
 {
    {"ST", "STREET", PRETYP, NULL } ,
    {"ST", "STREET", CITY, NULL }
@@ -77,7 +77,7 @@
 static void save_current_composition( STAND_PARAM * , SEG * , int , SYMB * , DEF ** ) ;
 static void scan_clause_tree(  STAND_PARAM * , int, int ) ;
 static void shallow_clause_scan( STAND_PARAM * , int , int ) ;
-static void deposit_stz( STAND_PARAM *, double , int ) ; 
+static void deposit_stz( STAND_PARAM *, double , int ) ;
 static STZ *copy_stz( STAND_PARAM * , double ) ;
 static void make_singleton( SEG * , SYMB , int , int , double ) ;
 static int lex_has_def( STAND_PARAM * , int , SYMB ) ;
@@ -106,13 +106,13 @@
 static int __tran_table__[MAX_CL][MAX_CL] = {
    { FAIL, FAIL, EXIT, FAIL, FAIL } ,
    { FAIL, EXIT, PREFIX, FAIL, MICRO_M } ,
-   { EXIT, FAIL, FAIL, FAIL, FAIL } , 
-   { FAIL, FAIL, FAIL, EXIT, FAIL } , 
-   { FAIL, FAIL, FAIL, FAIL, EXIT } 
-} ; 
+   { EXIT, FAIL, FAIL, FAIL, FAIL } ,
+   { FAIL, FAIL, FAIL, EXIT, FAIL } ,
+   { FAIL, FAIL, FAIL, FAIL, EXIT }
+} ;
 
 /* -- skew weights for each rule class -- */
-static double __weight_table__[MAX_CL] = 
+static double __weight_table__[MAX_CL] =
 {
   1.0, 0.95, 0.95, 0.8 , 0.85
 } ;
@@ -124,16 +124,16 @@
 #define VERY_LOW_WEIGHT .15
 #define START_DEPTH 0
 
-static double __load_value__[ NUMBER_OF_WEIGHTS ] = 
+static double __load_value__[ NUMBER_OF_WEIGHTS ] =
 {
-   0.00, 0.325, 0.35 , 0.375 , 0.4 , 
-   0.475 , 0.55, 0.6 , 0.65 , 0.675 , 
-   0.7 , 0.75 , 0.8 , 0.825 , 0.85 , 
-   0.9 , 0.95 , 1.00 
+   0.00, 0.325, 0.35 , 0.375 , 0.4 ,
+   0.475 , 0.55, 0.6 , 0.65 , 0.675 ,
+   0.7 , 0.75 , 0.8 , 0.825 , 0.85 ,
+   0.9 , 0.95 , 1.00
 } ;
 
 #ifdef OCCUPANCY_DEBUG
-static const char *__rule_type_names__[] = 
+static const char *__rule_type_names__[] =
 {
    "MACRO" , "MICRO" , "ARC" , "CIVIC" , "EXTRA"
 } ;
@@ -159,7 +159,7 @@
 		{
 			RET_ERR1( "install_def_block_table: Could not find def_block for %s\n", __def_block_table__[i].lookup , __err_param__ , FALSE ) ;
 		}
-		for ( __standard_def__ = __lookup_entry__->DefList ; __standard_def__ != NULL ; __standard_def__ = __standard_def__->Next ) 
+		for ( __standard_def__ = __lookup_entry__->DefList ; __standard_def__ != NULL ; __standard_def__ = __standard_def__->Next )
 		{
 			if ( strcmp( __standard_def__->Standard , __def_block_table__[i].standard ) == 0 )
 			{
@@ -167,7 +167,7 @@
 			}
             break ;
 		}
-		if ( __def_block_table__[i].definition == NULL ) 
+		if ( __def_block_table__[i].definition == NULL )
 		{
 			RET_ERR1( "install_def_block_table: Could not find def_block definition for %s\n" , __def_block_table__[i].standard , __err_param__ , FALSE ) ;
 		}
@@ -188,29 +188,29 @@
 	/* -- we're going to be re-sorting these pointers -- */
     PAGC_ALLOC_STRUC(__stz_info__,STZ_PARAM,__err_param__,NULL) ;
 	PAGC_CALLOC_STRUC(__stz_info__->stz_array,STZ *,MAX_STZ,__err_param__,NULL) ;
-	for ( i = FIRST_STZ ; i < MAX_STZ ; i++ ) 
+	for ( i = FIRST_STZ ; i < MAX_STZ ; i++ )
 	{
 		PAGC_ALLOC_STRUC(__stz_info__->stz_array[i],STZ,__err_param__,NULL) ;
 	}
 	PAGC_CALLOC_STRUC(__stz_info__->segs,SEG,MAXLEX,__err_param__,NULL) ;
-	return __stz_info__ ; 
+	return __stz_info__ ;
 }
 
 /* ====================================================================
 analyze.c (destroy_segments)
-context level cleanup 
-- called by (standard.l) close_stand_context 
+context level cleanup
+- called by (standard.l) close_stand_context
 uses macros PAGC_DESTROY_2D_ARRAY, FREE_AND_NULL
 =======================================================================*/
-void destroy_segments( STZ_PARAM *__stz_info__ ) 
+void destroy_segments( STZ_PARAM *__stz_info__ )
 {
-	if ( __stz_info__ == NULL ) 
+	if ( __stz_info__ == NULL )
 	{
 		return ;
 	}
 	PAGC_DESTROY_2D_ARRAY( __stz_info__->stz_array , STZ,MAX_STZ )
 	FREE_AND_NULL( __stz_info__->segs ) ;
-	FREE_AND_NULL( __stz_info__ ) ; 
+	FREE_AND_NULL( __stz_info__ ) ;
 }
 /* ====================================================================
 analyze.c (get_stz_downgrade)
@@ -218,7 +218,7 @@
 matching score as higher grade. This can be critical when a lower grade
 standardization produces a perfect match on the wrong reference record
 =======================================================================*/
-double get_stz_downgrade( STAND_PARAM *__stand_param__ , int request_stz ) 
+double get_stz_downgrade( STAND_PARAM *__stand_param__ , int request_stz )
 {
 	double numerator, denominator ;
 	STZ_PARAM *__stz_info__ = __stand_param__->stz_info ;
@@ -226,7 +226,7 @@
 	{
 		return 0. ;
 	}
-	if ( request_stz == 0 ) 
+	if ( request_stz == 0 )
 	{
 		return 1.0 ;
 	}
@@ -242,17 +242,17 @@
 analyze.c (get_next_stz)
 called by analyze.c (evaluator) , build.c (Build)
   build.c (transform_rows) match.c (match_records),
-calls analyze.c (check_def_block, delete_duplicate_stz) 
+calls analyze.c (check_def_block, delete_duplicate_stz)
 export.c (init_output_fields, stuff_fields)
 <remarks>
-      return FALSE if the requested stz is not there - this allows 
-      termination to a request loop when there are fewer than the maximum 
-      number on the list and also reports, on request of 0, that none were 
-      found. If the request_stz is the same as the last one done (since 
-      evaluator last initialized the last_stz_output variable) we just 
-      return rather than redo the same work. When matching we need 
-      to know the correct standardization for positioning the point along 
-      the arc 
+      return FALSE if the requested stz is not there - this allows
+      termination to a request loop when there are fewer than the maximum
+      number on the list and also reports, on request of 0, that none were
+      found. If the request_stz is the same as the last one done (since
+      evaluator last initialized the last_stz_output variable) we just
+      return rather than redo the same work. When matching we need
+      to know the correct standardization for positioning the point along
+      the arc
       2008-04-06 : This function needs to return to the 0 stz when selecting
       the best standardization for the build. To indicate that an override
       is required, we'll take FAIL as a proxy for 0.
@@ -279,7 +279,7 @@
 		/*-- Delete standardizations that contain blocked definitions --*/
 		while (( check_def_block( __stand_param__ , request_stz )) && ( __stz_info__->stz_list_size > request_stz )) ;
 		/*-- Have we reached the end of the list? --*/
-		if ( __stz_info__->stz_list_size == request_stz ) 
+		if ( __stz_info__->stz_list_size == request_stz )
 		{
 			return FALSE ;
 		}
@@ -296,8 +296,8 @@
 				return FALSE ;
 			}
 		}
-	} 
-	else 
+	}
+	else
 	{
 		request_stz = FIRST_STZ ;
 	}
@@ -332,17 +332,17 @@
 static int check_def_block( STAND_PARAM *__stand_param__ , int request_stz )
 {
 	int i, j ;
-	STZ_PARAM *__stz_info__ = __stand_param__->stz_info ; 
-	SYMB *__cur_sym_ptr__ = __stz_info__->stz_array[ request_stz ]->output ; 
-	DEF **__stz_definitions__ = __stz_info__->stz_array[ request_stz ]->definitions ; 
-	int n = __stand_param__->LexNum ; 
-	for (i = FIRST_LEX_POS ; i < n ; i++) 
+	STZ_PARAM *__stz_info__ = __stand_param__->stz_info ;
+	SYMB *__cur_sym_ptr__ = __stz_info__->stz_array[ request_stz ]->output ;
+	DEF **__stz_definitions__ = __stz_info__->stz_array[ request_stz ]->definitions ;
+	int n = __stand_param__->LexNum ;
+	for (i = FIRST_LEX_POS ; i < n ; i++)
 	{
-		for (j = 0 ; j < NUM_DEF_BLOCKERS ; j ++) 
+		for (j = 0 ; j < NUM_DEF_BLOCKERS ; j ++)
 		{
-			if (__cur_sym_ptr__[i] == __def_block_table__[j].output_symbol) 
+			if (__cur_sym_ptr__[i] == __def_block_table__[j].output_symbol)
 			{
-				if (__stz_definitions__[i] == __def_block_table__[j].definition) 
+				if (__stz_definitions__[i] == __def_block_table__[j].definition)
 				{
 					delete_stz(__stz_info__ , request_stz) ;
 					return TRUE ;
@@ -365,10 +365,10 @@
 
 	__stz_info__->stz_list_size -- ; /* -- change list count for deletion -- */
 	n = __stz_info__->stz_list_size ;
-	__stz_list__ = __stz_info__->stz_array ; 
+	__stz_list__ = __stz_info__->stz_array ;
 
 	/*-- last on list? - it just becomes inactive --*/
-	if ( request_stz == __stz_info__->stz_list_size ) 
+	if ( request_stz == __stz_info__->stz_list_size )
 	{
 		return ;
 	}
@@ -376,7 +376,7 @@
 	__stz_ptr__ = __stz_list__[request_stz] ;
 	/* ----------------------------------------------------------
 		move the rest of the list down to eliminate the duplicate.
-		The replacement entry will become the new, requested stz 
+		The replacement entry will become the new, requested stz
 		
 		if there are, for instance, n stz pointers active, stz_list_size
 		will be n. So the ordinal n-1 is the last active stz. In this
@@ -387,7 +387,7 @@
 		 0       req       n-1  n  inactive  MAX_STZ - 1
 		[ ] [ ] [ ] ...   [ ] [ ] [ ] ...   [ ]
 	----------------------------------------------------------- */
-	for ( i = request_stz ; i < n ; i ++ ) 
+	for ( i = request_stz ; i < n ; i ++ )
 	{
 		__stz_list__[i] = __stz_list__[i+1] ;
 	}
@@ -402,12 +402,12 @@
 =======================================================================*/
 static int delete_duplicate_stz(STZ_PARAM *__stz_info__, int request_stz)
 {
-	/* --------------------------------------------------------------------- 
-      if the requested_stz is identical to any earlier ones on the list, 
+	/* ---------------------------------------------------------------------
+      if the requested_stz is identical to any earlier ones on the list,
       both for definition and output symbol, or if it contains a blocked
-      definition , eliminate this entry and move the rest of the list down  
+      definition , eliminate this entry and move the rest of the list down
       one. Return TRUE if this happens, otherwise FALSE
-	  -----------------------------------------------------------------------*/ 
+	  -----------------------------------------------------------------------*/
 
 	int i ;
 	STZ **__stz_list__ = __stz_info__->stz_array ;
@@ -491,14 +491,14 @@
 			if ((__def__->Type == desired_type) || (__def__->Protect))
 			{
 				__def_marked__[i][j] = TRUE ;
-			} 
+			}
 			else __def_marked__[i][j] = FALSE ;
 		}
 		__num_defs__[i] = j ;
 	}
 	/*-- Now go through all the compositions, looking for those consisting
 		only of unduplicated defs --*/
-	do 
+	do
 	{
 		int marked ;
 		double seg_score ;
@@ -531,12 +531,12 @@
 <revision date='2006-11-02'> add STAND_PARAM arg and change calls </revision>
 <revision date='2012-07-22'> Keep track of start_state </revision>
 =======================================================================*/
-int evaluator(STAND_PARAM *__stand_param__) 
+int evaluator(STAND_PARAM *__stand_param__)
 {
 
     int state ;
 	STZ_PARAM *__stz_info__ = __stand_param__->stz_info ;
-	__stz_info__->stz_list_cutoff = INITIAL_STZ_CUTOFF ; 
+	__stz_info__->stz_list_cutoff = INITIAL_STZ_CUTOFF ;
 	state = __stand_param__->start_state ;
 
 #ifdef OCCUPANCY_DEBUG
@@ -547,9 +547,9 @@
 #endif
 	__stz_info__->stz_list_size = FIRST_STZ ;
 	__stz_info__->last_stz_output = FAIL ;
-   
+
 	/*-- <revision date='2009-08-09'> Special evaluation for landmarks </revision> --*/
-	if (state > EXTRA_STATE) 
+	if (state > EXTRA_STATE)
 	{
 		return (evaluate_micro_l(__stand_param__)) ;
 	}
@@ -557,16 +557,16 @@
 	{
 		first_composition(__stand_param__) ; /* 2007-08-09 */
 		/* -- cycle through all the possible compositions -- */
-		do 
+		do
 		{
 			int target_len ;
 			if ((target_len = prepare_target_pattern(__stand_param__)) == TARG_START)
 			{
 				continue ;
 			}
-			/* -------------------------------------------------------------- 
+			/* --------------------------------------------------------------
             We don't need to build a clause tree for each composition for
-            MICRO_B and MACRO start states since we only want one 
+            MICRO_B and MACRO start states since we only want one
             segment.
 			----------------------------------------------------------------*/
 			switch (state)
@@ -584,7 +584,7 @@
 			default :
 				scan_clause_tree(__stand_param__, state, target_len) ;
 			}
-			/* ---------------------------------------------------------------- 
+			/* ----------------------------------------------------------------
             If we don't check the list size, we may be checking the score
             of some previous result in the case where no standardization is
             found
@@ -611,7 +611,7 @@
 			break ;
 		}
 #endif
-		if (state != MICRO_M) 
+		if (state != MICRO_M)
 		{
 			break ;
 		}
@@ -629,8 +629,8 @@
 <summary>
 <function name='analyze.c (first_composition)'/>
 <called-by> <functionref='analyze.c (evaluator)'/>
-<remarks> Called by Evaluator to intialize __best_output__ and __sym_sel__ - 
-	also sets up lex_sym, save_defs and __num_defs__ from the 
+<remarks> Called by Evaluator to intialize __best_output__ and __sym_sel__ -
+	also sets up lex_sym, save_defs and __num_defs__ from the
     definitions in the LexVector  </remarks>
 </summary>
 =======================================================================*/
@@ -656,7 +656,7 @@
 			__stand_param__->def_array[i][j] = __def__ ;
 		}
 		__num_defs__[i] = j ;
-	}     
+	}
 }
 
 /* ============================================================
@@ -683,7 +683,7 @@
 		------------------------------------------------------------- */
 		if ( !need_compression( __stand_param__ , in_symb , lex_pos , target_pos ))
 		{
-			/* --------------------------------------------------------- 
+			/* ---------------------------------------------------------
             If no compression, associate this lex_pos with the
             target_pos, put the symbol into the target and increment
             the target_pos. Otherwise, keep the same target_pos and
@@ -709,7 +709,7 @@
 called by analyze.c (do_left_combine)
 -- moved from tokenize.c to analyze.c
 ==============================================================*/
-static int no_break( STAND_PARAM *__stand_param__ , int n ) 
+static int no_break( STAND_PARAM *__stand_param__ , int n )
 {
 	int k = __stand_param__->lex_vector[n].EndMorph ;
 	/* 0 is no break
@@ -727,7 +727,7 @@
 {
 	/*-- A LEFT_COMPRESS left compresses only if a LEFT_COMPRESS there to
 		combine with --*/
-	if (( target_pos == TARG_START ) || ( __stand_param__->target[target_pos - 1] != LEFT_COMPRESS )) 
+	if (( target_pos == TARG_START ) || ( __stand_param__->target[target_pos - 1] != LEFT_COMPRESS ))
 	{
 		/*-- A RIGHT_COMPRESS also returns FALSE if it is at the start or
 			if the previous token isn't a LEFT_COMPRESS. need_compression will
@@ -753,18 +753,18 @@
 called by analyze.c (prepare_target_pattern)
 calls analyze.c (do_left_combine)
 ==============================================================*/
-static int need_compression( STAND_PARAM *__stand_param__ , SYMB a , int lex_pos , int target_pos ) 
+static int need_compression( STAND_PARAM *__stand_param__ , SYMB a , int lex_pos , int target_pos )
 {
 	/*-- No stopwords are accepted, no matter what --*/
-	if ( a == RIGHT_COMPRESS ) 
+	if ( a == RIGHT_COMPRESS )
 	{
 		/*-- Does it combine with the last target symbol or the next? --*/
 		if ( !do_left_combine( __stand_param__ , lex_pos , target_pos ))
 		{
-			/* --------------------------------------------------------------- 
-            do a right combine by giving it the next position. Note that 
-            this allows the possibility of a STOPWORD with combining with 
-            TYPE or DIR tokens, but this is what we want in cases like EL 
+			/* ---------------------------------------------------------------
+            do a right combine by giving it the next position. Note that
+            this allows the possibility of a STOPWORD with combining with
+            TYPE or DIR tokens, but this is what we want in cases like EL
             CAMINO RD -- a RIGHT_COMPRESS may stray into the wrong field --
             deal with this when decompressing
 			---------------------------------------------------------------- */
@@ -804,7 +804,7 @@
 	int pos = start_pos ; /* -- one beyond the last symbol -- */
 	int state = start_state ; /* --for the __tran_table__ -- */
 	int depth = START_DEPTH ; /* --how deep in the clause tree -- */
-	int cl = 0 ; 
+	int cl = 0 ;
 	KW *__keyw__ = NULL ;
 
 	while (TRUE)
@@ -869,7 +869,7 @@
 				}
 				/* -- keep the same cl,  state , depth and pos -- */
 				sum -= __inner_seg__->Value ; /* -- restore the previous sum -- */
-				__keyw__ = __keyw__->OutputNext ; /* -- and get the next rule on the 
+				__keyw__ = __keyw__->OutputNext ; /* -- and get the next rule on the
                                               linked list -- */
 				continue ;
 			}
@@ -887,8 +887,8 @@
 		{
 			sum -= __outer_seg__->Value ;
 			pos = __outer_seg__->End + 1 ;
-		} 
-		else 
+		}
+		else
 		{
 			sum = 0.00 ;
 			pos = start_pos ;
@@ -922,7 +922,7 @@
 	{
 		/*-- once we get a short keyword, depart --*/
 		if (__kw__->Length < pos) return ;
-		/*-- fill in the rest of this definition for output if it forms part 
+		/*-- fill in the rest of this definition for output if it forms part
          of a completed stz --*/
 		__seg__->Output = __kw__->Output ;
 		if (__rules__->collect_statistics)
@@ -950,7 +950,7 @@
 			printf ("\nrank %d ( %f)\n",__kw__->Weight,__load_value__[__kw__->Weight]) ;
 		}
 #endif
-		/* -- don't skew weights with these start states - so the cutoff is 
+		/* -- don't skew weights with these start states - so the cutoff is
          easier -- */
 		deposit_stz(__stand_param__,__load_value__[__kw__->Weight],START_DEPTH) ;
 	}
@@ -1043,9 +1043,9 @@
 =======================================================================*/
 static STZ * copy_stz(STAND_PARAM *__stand_param__ ,double current_score)
 {
-	/* -- sort it into the list and knock the last one off the list 
+	/* -- sort it into the list and knock the last one off the list
       if it is MAX_STZ -- */
-	/* -- Take the Score of the last remaining item as the new cutoff, 
+	/* -- Take the Score of the last remaining item as the new cutoff,
       if it is greater than the current cutoff -- */
 	int i ;
     int last_on_list ;
@@ -1053,7 +1053,7 @@
 
 
 	STZ_PARAM *__stz_info__ = __stand_param__->stz_info ;
-	STZ **__stz_list__ = __stz_info__->stz_array ; 
+	STZ **__stz_list__ = __stz_info__->stz_array ;
 
 	/* -- Increase the list size only if it isn't full. If it is full, take
 		the score of the last on the list (which we're going to knock off the
@@ -1064,8 +1064,8 @@
 		__stz_info__->stz_list_size++ ;
 	}
 	
-	/* -- Get the pointer of the last on the list if the list is full (to be 
-      knocked off, or one beyond the previous last item (with undefined 
+	/* -- Get the pointer of the last on the list if the list is full (to be
+      knocked off, or one beyond the previous last item (with undefined
       content) if the list isn't full. -- */
 	last_on_list = __stz_info__->stz_list_size - 1 ;
 	__cur_stz__ = __stz_list__[last_on_list] ; /* -- implicitly discard contents -- */
@@ -1078,14 +1078,14 @@
 		__cur_stz__->output[i] = FAIL ;
 	}
 	/* -- boundary condition : last-1   last
-                               [ ]     [ ] 
+                               [ ]     [ ]
       suppose the last - 1 has a score less than the current score - then
         it isn't copied into last, so __cur_stz__ goes back into the slot
         from which it was just removed - nothing moves  -- */
 	for (i = last_on_list;i > FIRST_STZ;i --)
 	{
-		/* -- Get the next pointer on the list and move it back if it has a 
-         lesser score. Otherwise we put the pointer to the new stz in the 
+		/* -- Get the next pointer on the list and move it back if it has a
+         lesser score. Otherwise we put the pointer to the new stz in the
          present position -- */
 		STZ *__next_stz__ = __stz_list__[i-1] ;
 		if (current_score > __next_stz__->raw_score)
@@ -1114,12 +1114,12 @@
 analyze.c (save_current_composition)
 called by analyze.c (deposit_stz)
 calls analyze.c (copy_best)
-<remarks>called by deposit_stz to align the current standardization output 
-      symbols to the LEXEME input symbols - it depends on the correct 
-      LEXEMES being present and the __sym_sel__ reflecting the last composition. 
+<remarks>called by deposit_stz to align the current standardization output
+      symbols to the LEXEME input symbols - it depends on the correct
+      LEXEMES being present and the __sym_sel__ reflecting the last composition.
       Consequently it must be done at the time of deposit </remarks>
 =======================================================================*/
-static void save_current_composition(STAND_PARAM *__stand_param__,SEG *__segments__, int depth, SYMB *__best_output__ , DEF **__best_defs__) 
+static void save_current_composition(STAND_PARAM *__stand_param__,SEG *__segments__, int depth, SYMB *__best_output__ , DEF **__best_defs__)
 {
 	
 	int lex_pos ;
@@ -1132,7 +1132,7 @@
 		as W if a SINGLE or WEST if a DIRECT </remarks> --*/
 	
 	/* -- use the whole target -- */
-	for ( lex_pos = FIRST_LEX_POS ; lex_pos < __stand_param__->LexNum ; lex_pos++ ) 
+	for ( lex_pos = FIRST_LEX_POS ; lex_pos < __stand_param__->LexNum ; lex_pos++ )
 	{
 		__best_defs__[lex_pos] = __stand_param__->def_array[lex_pos][__sym_sel__[lex_pos]] ;
 	}
@@ -1164,11 +1164,11 @@
 =======================================================================*/
 static int copy_best( STAND_PARAM *__stand_param__ , int *__sym_sel__ , SYMB output_symb , int beg , SYMB *__best_output__ )
 {
-	int lex_pos ; 
+	int lex_pos ;
 	int *__orig_pos__ = __stand_param__->orig_str_pos ;
 	
-	/*-- <remarks> <code>orig_pos</code> has the (multiple) LEXEME positions to which the 
-      (single) output symbol corresponds - so we add that symbol to each of 
+	/*-- <remarks> <code>orig_pos</code> has the (multiple) LEXEME positions to which the
+      (single) output symbol corresponds - so we add that symbol to each of
       the positions </remarks> --*/
 	
 	int next_target_pos = __orig_pos__[beg] + 1 ;
@@ -1182,8 +1182,8 @@
 		if (( lex_pos > FIRST_LEX_POS ) && ( output_symb != STREET ) && ( __stand_param__->comp_lex_sym[lex_pos][__sym_sel__[lex_pos]] == RIGHT_COMPRESS ) && ( __best_output__[lex_pos - 1] == STREET ))
 		{
 			__best_output__[lex_pos] = STREET ;
-		} 
-		else 
+		}
+		else
 		{
 			__best_output__[lex_pos] = output_symb ;
 		}
@@ -1231,7 +1231,7 @@
 <summary>
 	<function name='analyze.c (default_seg_val)'/>
 	<calls> <functionref='analyze.c (make_singleton)'/> </calls>
-	<called-by> <functionref='analyze.c (force_arc_clause, 
+	<called-by> <functionref='analyze.c (force_arc_clause,
 		_force_macro_clause_)'/> </called-by>
 	<revision date='2009-08-09'> Fourth arg now used to determine if
 		the __sym_sel__ should be initialized to the first definition :
@@ -1273,7 +1273,7 @@
 		__stand_param__->cur_sym_sel[pos] = sel ;
 		return TRUE ;
 	}
-	return FALSE ;   
+	return FALSE ;
 }
 
 /* ====================================================================
@@ -1291,14 +1291,14 @@
 		return (_modify_position_(__stand_param__,__segments__, depth , lex_pos , in_sym , out_sym)) ;
 	}
 	return FALSE ;
-}   
+}
 
 
 
 /* ====================================================================
 analyze.c (force_arc_clause)
 called by analyze.c (evaluator)
-calls analyze.c (default_seg_val, schema_modify_position and _force_deposit_) 
+calls analyze.c (default_seg_val, schema_modify_position and _force_deposit_)
 <remarks>We're going to force standardization on an Arc clause without
       much computation. first_composition has already done its work,
       so we go through the lex_sym looking for likely constructions , using
@@ -1315,7 +1315,7 @@
 	/*-- look for a SUFDIR in the last position --*/
 	if (lex_start < lex_end -1)
 	{
-		if (schema_modify_position( __stand_param__ , __stz_info__->segs , depth , lex_end , DIRECT , SUFDIR )) 
+		if (schema_modify_position( __stand_param__ , __stz_info__->segs , depth , lex_end , DIRECT , SUFDIR ))
 		{
 			lex_end-- ;
 			depth ++ ;
@@ -1391,7 +1391,7 @@
 	<calls> <function ref='analyze.c (deposit_stz)'/> </calls>
 </summary>
 =======================================================================*/
-static void _force_deposit_( STAND_PARAM *__stand_param__ , int depth ) 
+static void _force_deposit_( STAND_PARAM *__stand_param__ , int depth )
 {
 	/*-- <remarks> Worst case scenario: we have a string of unknowns. It'll score
 		really low, but not zero. </remarks> --*/
@@ -1410,7 +1410,7 @@
 called by analyze.c (evaluator)
 calls analyze.c (lex_has_def)
 =======================================================================*/
-static int non_geocode_address( STAND_PARAM *__stand_param__ ) 
+static int non_geocode_address( STAND_PARAM *__stand_param__ )
 {
 	/* -- scan through each position looking for an RR or BOXH token. -- */
 	int lex_sym_pos ;
@@ -1418,7 +1418,7 @@
 	for ( lex_sym_pos = FIRST_LEX_POS ; lex_sym_pos < n ; lex_sym_pos ++ )
 	{
 		int result = lex_has_def( __stand_param__ , lex_sym_pos , RR ) ;
-		if ( result != FAIL ) 
+		if ( result != FAIL )
 		{
 			return TRUE ;
 		}
@@ -1442,53 +1442,53 @@
     STZ **__stz_list__;
 
 	STZ_PARAM *__stz_info__ = __stand_param__->stz_info ;
-	if (__err_param__ == NULL) 
+	if (__err_param__ == NULL)
 	{
 		printf("Input tokenization candidates:\n") ;
-	} 
-	else 
+	}
+	else
 	{
 		LOG_MESS("Input tokenization candidates:",__err_param__) ;
 	}
-	for (lex_pos = FIRST_LEX_POS;lex_pos < __stand_param__->LexNum;lex_pos ++) 
+	for (lex_pos = FIRST_LEX_POS;lex_pos < __stand_param__->LexNum;lex_pos ++)
 	{
 		for ( __def__ = __stand_param__->lex_vector[lex_pos].DefList; __def__ != NULL; __def__ = __def__->Next)
 		{
-			if (__err_param__ == NULL) 
+			if (__err_param__ == NULL)
 			{
 				printf("\t(%d) std: %s, tok: %d (%s)\n",lex_pos,((__def__->Protect )? __stand_param__->lex_vector[lex_pos].Text : __def__->Standard),__def__->Type,in_symb_name(__def__->Type));
-			} 
-			else 
+			}
+			else
 			{
 				sprintf( __err_param__->error_buf , "\t(%d) std: %s, tok: %d (%s)\n" , lex_pos , (( __def__->Protect )? __stand_param__->lex_vector[lex_pos].Text : __def__->Standard) , __def__->Type , in_symb_name( __def__->Type ));
 				register_error( __err_param__ ) ;
 			}
 		}
 	}
-	n = __stz_info__->stz_list_size ; 
+	n = __stz_info__->stz_list_size ;
 	__stz_list__ = __stz_info__->stz_array ;
 	for ( stz_no = FIRST_STZ ; stz_no < n ; stz_no ++ )
 	{
 		STZ *__cur_stz__ = __stz_list__[stz_no] ;
-		if ( __err_param__ == NULL ) 
+		if ( __err_param__ == NULL )
 		{
 			printf( "Raw standardization %d with score %f:\n" , ( stz_no  ) , __cur_stz__->score ) ;
-		} 
-		else 
+		}
+		else
 		{
 			LOG_MESS2( "Raw standardization %d with score %f:\n" , ( stz_no  ) , __cur_stz__->score , __err_param__ ) ;
 		}
-		for ( lex_pos = FIRST_LEX_POS ; lex_pos < __stand_param__->LexNum ; lex_pos ++ ) 
+		for ( lex_pos = FIRST_LEX_POS ; lex_pos < __stand_param__->LexNum ; lex_pos ++ )
 		{
             SYMB k;
 			__def__ = __cur_stz__->definitions[lex_pos] ;
 			/*-- 2010-11-18 : handle end STOPWORD --*/
 			k = __cur_stz__->output[lex_pos] ;
-			if ( __err_param__ == NULL ) 
+			if ( __err_param__ == NULL )
 			{
 				printf( "\t(%d) Input %d (%s) text %s mapped to output %d (%s)\n" , lex_pos , __def__->Type , in_symb_name( __def__->Type ) , (( __def__->Protect )? __stand_param__->lex_vector[lex_pos].Text : __def__->Standard ) , k , (( k == FAIL )? "NONE" : out_symb_name( k ))) ;
-			} 
-			else 
+			}
+			else
 			{
 				sprintf( __err_param__->error_buf , "\t(%d) Input %d (%s) text %s mapped to output %d (%s)\n" , lex_pos , __def__->Type , in_symb_name( __def__->Type ) , (( __def__->Protect )? __stand_param__->lex_vector[lex_pos].Text : __def__->Standard ) , k , (( k == FAIL )? "NONE" : out_symb_name( k ))) ;
 				register_error( __err_param__ ) ;

Modified: trunk/extensions/address_standardizer/err_param.c
===================================================================
--- trunk/extensions/address_standardizer/err_param.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extensions/address_standardizer/err_param.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,4 +1,4 @@
-/* -- err_param.c 
+/* -- err_param.c
 
 This file handles the buffering and output of errors
 
@@ -39,7 +39,7 @@
    err_mem = err_p -> err_array  ; \
    err_p -> error_buf = err_mem -> content_buf ; \
    err_mem -> is_fatal = TRUE ; \
-   BLANK_STRING( err_mem -> content_buf ) 
+   BLANK_STRING( err_mem -> content_buf )
 
 
 
@@ -79,10 +79,10 @@
                        log_name ) ;
 #endif
          return NULL ;
-      }                  
+      }
    }
    return err_p ;
-}   
+}
 
 
 /* ------------------------------------------------------------
@@ -115,7 +115,7 @@
 #endif
       }
       BLANK_STRING( err_out_buf ) ;
-   }    
+   }
    FREE_AND_NULL( err_p ) ;
 }
 
@@ -127,8 +127,8 @@
 static int turn_off_error_log( ERR_PARAM *err_p ) {
    ERR_REC *err_mem ;
 
-   if ( ( err_p == NULL ) || 
-        ( err_p -> stream == NULL ) ) { 
+   if ( ( err_p == NULL ) ||
+        ( err_p -> stream == NULL ) ) {
       return FALSE ;
    }
    fclose( err_p -> stream ) ;
@@ -140,7 +140,7 @@
 /* ----------------------------------------------------------
 err_param.c (empty_errors)
 calls : err_param.c (turn_off_error_log)
-returns FALSE when all errors have been reported. 
+returns FALSE when all errors have been reported.
 TRUE otherwise
 ------------------------------------------------------------*/
 int empty_errors( ERR_PARAM *err_p ,
@@ -168,7 +168,7 @@
    err_mem = err_p -> err_array + err_p -> first_err ;
    append_string_to_max( err_dest ,
                          err_mem -> content_buf ,
-                         MAXSTRLEN ) ;   
+                         MAXSTRLEN ) ;
    *is_fatal = err_mem -> is_fatal ;
 
    /* -- update the low mark -- */
@@ -219,7 +219,7 @@
    if ( strlen( err_p -> error_buf ) > MAXSTRLEN ) {
 #ifndef NO_STDERR_OUTPUT
       PRINT_ERROR( "Error message %s is too long" ,
-                    err_p -> error_buf ) ; 
+                    err_p -> error_buf ) ;
 #endif
       return ;
    }
@@ -253,16 +253,16 @@
       }
    } else {
       /* -- last_err points to the next one to fill -- */
-      err_p -> last_err ++ ; 
+      err_p -> last_err ++ ;
       err_mem = err_p -> err_array + err_p -> last_err  ;
    }
 
    /* -- reset error_buf to the new content_buf -- */
-   err_p -> error_buf = err_mem -> content_buf ; 
+   err_p -> error_buf = err_mem -> content_buf ;
    BLANK_STRING( err_mem -> content_buf ) ;
    err_p -> next_fatal = TRUE ;
    return ;
-} 
+}
 
 
 /*==========================================

Modified: trunk/extensions/address_standardizer/export.c
===================================================================
--- trunk/extensions/address_standardizer/export.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extensions/address_standardizer/export.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,4 +1,4 @@
-/* -- export.c 
+/* -- export.c
 
 This file contains the routines for extracting the sequence of
 postal attributes and definitions produced by the standardizer
@@ -28,11 +28,11 @@
 #define ORDER_DISPLACEMENT 2
 
 /* -- local prototypes -- */
-static void _copy_standard_( STAND_PARAM * , SYMB , int , int  ) ; 
-static void _scan_target_( STAND_PARAM * , SYMB , int  ) ; 
+static void _copy_standard_( STAND_PARAM * , SYMB , int , int  ) ;
+static void _scan_target_( STAND_PARAM * , SYMB , int  ) ;
 static char *_get_standard_( STAND_PARAM * , int , int ) ;
 static char *_get_definition_text_( STAND_PARAM * , int ) ;
- 
+
 //#ifndef BUILD_API
 
 /* -- local storage -- */
@@ -116,8 +116,8 @@
 		{
 			__standard_fields__[i][0] = SENTINEL ;
 		}
-	} 
-	else 
+	}
+	else
 	{
 		/*-- Clean only one set --*/
 		if ( which_fields == RIGHT )
@@ -127,8 +127,8 @@
 			{
 				__standard_fields__[i][0] = SENTINEL ;
 			}
-		} 
-		else 
+		}
+		else
 		{
 			/*-- Erase the micro fields only --*/
 			for ( i = BLDNG ; i < CITY ; i++ )
@@ -174,12 +174,12 @@
 export.c (stuff_fields)
 --calls export.c (_scan_target_)
 -------------------------------------------*/
-void stuff_fields( STAND_PARAM *__stand_param__ ) 
+void stuff_fields( STAND_PARAM *__stand_param__ )
 {
 	int fld ;
 	/*-- Translate the symbols and definitions of the standardization into
 		the __standard_fields__ for output --*/
-	for (fld = 0 ;fld < NEEDHEAD ;fld++) 
+	for (fld = 0 ;fld < NEEDHEAD ;fld++)
 	{
 		/*-- Fields that correspond one to one with the symbols --*/
 		_scan_target_(__stand_param__ ,fld,fld) ;
@@ -207,8 +207,8 @@
 		if (__dest_file__ != NULL)
 		{
 			fprintf(__dest_file__,"%s\n",(is_landmark? __landmark_record_start_tag__[opt] : __record_start_tag__[opt])) ;
-		} 
-		else 
+		}
+		else
 		{
 			printf("%s\n",(is_landmark? __landmark_record_start_tag__[opt] : __record_start_tag__[opt])) ;
 		}
@@ -241,8 +241,8 @@
 					default :
 						__source_start_tag__ = ( char * ) __field_start_tag__[loc][opt] ;
 					}
-				} 
-				else 
+				}
+				else
 				{
 					__source_start_tag__ = (char *) __field_start_tag__[loc][opt] ;
 				}
@@ -269,7 +269,7 @@
 						__source_end_tag__ = ( char * ) __field_tag_end__[ loc ][ opt ] ;
 					}
 				}
-				else 
+				else
 				{
 					__source_end_tag__ = ( char * ) __field_tag_end__[ loc ][ opt ] ;
 				}
@@ -278,20 +278,20 @@
 			if ( __dest_file__ != NULL )
 			{
 				fprintf( __dest_file__ , "%s" , __line_buf__ ) ;
-			} 
-			else 
+			}
+			else
 			{
 				printf( "%s" , __line_buf__ ) ;
 			}
 		}
 	}
-	if ( opt < NO_FORMAT ) 
+	if ( opt < NO_FORMAT )
 	{
-		if ( __dest_file__ != NULL ) 
+		if ( __dest_file__ != NULL )
 		{
 			fprintf( __dest_file__ , "%s\n", ( is_landmark? __landmark_record_end_tag__[ opt ] : __record_end_tag__[ opt ]));
-		} 
-		else 
+		}
+		else
 		{
 			printf( "%s\n" , ( is_landmark? __landmark_record_end_tag__[ opt ] :  __record_end_tag__[ opt ] ) );
 		}
@@ -299,8 +299,8 @@
 	if ( __dest_file__ != NULL )
 	{
 		fflush( __dest_file__ ) ;
-	} 
-	else 
+	}
+	else
 	{
 		fflush( stdout ) ;
 	}
@@ -331,7 +331,7 @@
 		{
 			if (__scan_DEF__->Type == ORD)
 			{
-				if ((__selected_standardization__ = __scan_DEF__->Standard) != NULL) 
+				if ((__selected_standardization__ = __scan_DEF__->Standard) != NULL)
 				{
 					return (__selected_standardization__) ;
 				}
@@ -353,10 +353,10 @@
 		char *__zero_pointer__ ;
 		char *__buffer_pointer__ = __zero_pointer__ = __selected_standardization__ ;
 		while ( *__zero_pointer__ == '0' ) __zero_pointer__++ ; /*-- Move to first nonzero character --*/
-		while ( *__zero_pointer__ != SENTINEL ) *__buffer_pointer__++ = *__zero_pointer__++ ; /*-- Move down in buffer --*/ 
+		while ( *__zero_pointer__ != SENTINEL ) *__buffer_pointer__++ = *__zero_pointer__++ ; /*-- Move down in buffer --*/
 		/*-- Trim down all-zeroes to a single zero: if deleting all
 			the zeros leaves an empty buffer, put a zero back --*/
-		if ( __buffer_pointer__ == __selected_standardization__ ) *__buffer_pointer__++ = '0' ; 
+		if ( __buffer_pointer__ == __selected_standardization__ ) *__buffer_pointer__++ = '0' ;
 		BLANK_STRING( __buffer_pointer__ ) ;
 	}
 	return ( __selected_standardization__ ) ;
@@ -364,7 +364,7 @@
 
 /*-----------------------------------------
 export.c (_scan_target_ )
--- calls export.c (_copy_standard_) 
+-- calls export.c (_copy_standard_)
 -- called by export.c (stuff_fields)
 -------------------------------------------*/
 static void _scan_target_(STAND_PARAM *__stand_param__,SYMB sym , int dest)
@@ -387,11 +387,11 @@
 }
 
 /*-----------------------------------------
-export.c (_copy_standard_) 
--- called by export.c (_scan_target_) -- 
---calls export.c (_get_standard_, 
-strlen, strcpy 
-uses macro SPACE_APPEND_WITH_LEN 
+export.c (_copy_standard_)
+-- called by export.c (_scan_target_) --
+--calls export.c (_get_standard_,
+strlen, strcpy
+uses macro SPACE_APPEND_WITH_LEN
 -------------------------------------------*/
 static void _copy_standard_( STAND_PARAM *__stand_param__ , SYMB output_sym , int fld , int lex_pos )
 {
@@ -407,7 +407,7 @@
 	if ( *__dest_buf__ != SENTINEL )
 	{
 		SPACE_APPEND_WITH_LEN( __dest_buf__ , __stan_str__ , MAXFLDLEN ) ;
-	} 
+	}
 	else if ( output_sym == UNITT )
 	{
 		/*-- If the unit id type is missing, one needs to be provided.
@@ -418,13 +418,13 @@
 
 		strcpy( __dest_buf__ , "# " ) ; /* -- reconsider this -- */
 		append_string_to_max( __dest_buf__ , __stan_str__ , MAXFLDLEN ) ;
-	} 
+	}
 	else if ( output_sym == BOXT )
 	{
 		strcpy( __dest_buf__, "BOX " ) ;
 		append_string_to_max( __dest_buf__ , __stan_str__ ,MAXFLDLEN ) ;
-	} 
-	else 
+	}
+	else
 	{
 		strcpy( __dest_buf__ , __stan_str__ ) ;
 	}

Modified: trunk/extensions/address_standardizer/gamma.c
===================================================================
--- trunk/extensions/address_standardizer/gamma.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extensions/address_standardizer/gamma.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,4 +1,4 @@
-/* -- gamma.c 
+/* -- gamma.c
 
 This file reads the rules file into memory and sets up the rule
 lookup structures. These are based on the optimized Aho-Corasick
@@ -31,24 +31,24 @@
 #endif
 
 /* -- local prototypes -- */
-static int initialize_link( ERR_PARAM *, KW *** , NODE ) ; 
-static void classify_link( RULE_PARAM * , KW ***, KW *, NODE , SYMB , SYMB  ) ; 
-static void add_failure_linkage( KW ***, NODE , NODE  ) ; 
-static NODE **precompute_gamma_function( ERR_PARAM *, NODE ** , KW ***, NODE  ) ; 
+static int initialize_link( ERR_PARAM *, KW *** , NODE ) ;
+static void classify_link( RULE_PARAM * , KW ***, KW *, NODE , SYMB , SYMB  ) ;
+static void add_failure_linkage( KW ***, NODE , NODE  ) ;
+static NODE **precompute_gamma_function( ERR_PARAM *, NODE ** , KW ***, NODE  ) ;
 
 static double load_value[ NUMBER_OF_WEIGHTS ] = {
-   0.00, 0.325, 0.35 , 0.375 , 0.4 , 
-   0.475 , 0.55, 0.6 , 0.65 , 0.675 , 
-   0.7 , 0.75 , 0.8 , 0.825 , 0.85 , 
+   0.00, 0.325, 0.35 , 0.375 , 0.4 ,
+   0.475 , 0.55, 0.6 , 0.65 , 0.675 ,
+   0.7 , 0.75 , 0.8 , 0.825 , 0.85 ,
    0.9 , 0.95 , 1.00 } ;
 
-/*--------------------------------------------------------------------------- 
+/*---------------------------------------------------------------------------
 gamma.c (refresh_transducer)
-called by analyze.c (prepare_target_pattern) 
-The registry of matching keywords is regenerated with the use of the 
+called by analyze.c (prepare_target_pattern)
+The registry of matching keywords is regenerated with the use of the
 precomputed Gamma function, Output Links and the current target.
 ----------------------------------------------------------------------------*/
-void refresh_transducer( NODE *r , 
+void refresh_transducer( NODE *r ,
                          SYMB *S ,
                          NODE **gamma_function ) {
    NODE q ;
@@ -57,30 +57,30 @@
    i = 0 ;
    q = r[ i ] = EPSILON ;
    while ( S[ i ] != FAIL ) {
-      q = gamma_function[ q ][ S[ i ] ] ; 
+      q = gamma_function[ q ][ S[ i ] ] ;
       i++ ;
       r[ i ] = q ;
    }
 }
 
-/*--------------------------------------------------------------------------- 
+/*---------------------------------------------------------------------------
 gamma.c (is_input_symbol)
 called by gamma.c (create_rules)
 ----------------------------------------------------------------------------*/
 int is_input_symbol( SYMB sym ) {
 
-   if ( sym > MAXINSYM || 
+   if ( sym > MAXINSYM ||
         sym < 0 )
       return FALSE ;
    return TRUE ;
 }
 
-/*--------------------------------------------------------------------------- 
+/*---------------------------------------------------------------------------
 gamma.c (is_output_symbol)
 called by gamma.c (create_rules)
 ----------------------------------------------------------------------------*/
 int is_output_symbol( SYMB sym ) {
-   if ( sym > MAXOUTSYM || 
+   if ( sym > MAXOUTSYM ||
         sym < 0 )
       return FALSE ;
    return TRUE ;
@@ -191,7 +191,7 @@
     /* get local copies of stuff saved in RULES */
     o_l = rules -> r_p -> output_link ;
     k_s = rules -> r_p -> key_space ;
-    
+
     Trie = rules -> Trie ;
     r = rules -> r ;
 
@@ -286,7 +286,7 @@
     i++ ;
     t = rule[i] ;
     i++ ;
-    w = rule[i] ; 
+    w = rule[i] ;
 
     classify_link( rules -> r_p ,
                    o_l ,
@@ -364,20 +364,20 @@
 
 #else
 
-/*--------------------------------------------------------------------------- 
+/*---------------------------------------------------------------------------
 gamma.c (create_rules)
 called by standard.l (init_stand_process)
 calls util.c (open_aux_file)
 calls gamma.c (initialize_link, is_input_symbol, is_output_symbol,
-classify_link,precompute_gamma_function) 
+classify_link,precompute_gamma_function)
 ----------------------------------------------------------------------------*/
 RULE_PARAM *create_rules( const char *rule_name ,
                           PAGC_GLOBAL *glo_p ) {
    /* -- returns size of Gamma Function Matrix -- */
-   SYMB a , 
+   SYMB a ,
         t ;
    NODE u ;
-   int i , 
+   int i ,
        w ;
    int is_eof = FALSE ;
    int rule_number = 0 ;
@@ -387,15 +387,15 @@
         *rule_end ,
         *r ;
    KW *keyw , *k_s ;
-   KW ***o_l ; 
-   NODE **Trie ; 
+   KW ***o_l ;
+   NODE **Trie ;
    SYMB *r_s ;
-   RULE_PARAM *r_p ; 
+   RULE_PARAM *r_p ;
    ERR_PARAM *err_p ;
 
    err_p = glo_p -> process_errors ;
 
-   PAGC_ALLOC_STRUC(r_p,RULE_PARAM,err_p,NULL) ; 
+   PAGC_ALLOC_STRUC(r_p,RULE_PARAM,err_p,NULL) ;
 
    /* -- initialize the statistics record -- */
    r_p -> collect_statistics = FALSE ;
@@ -412,40 +412,40 @@
 
 
    /* -- storage for input and output records -- */
-   PAGC_CALLOC_STRUC(r_s,SYMB,RULESPACESIZE,err_p,NULL); 
+   PAGC_CALLOC_STRUC(r_s,SYMB,RULESPACESIZE,err_p,NULL);
 
    /* -- storage for temporary trie for rules -- */
-   PAGC_CALLOC_STRUC(Trie,NODE *,MAXNODES,err_p,NULL); 
+   PAGC_CALLOC_STRUC(Trie,NODE *,MAXNODES,err_p,NULL);
 
    /* -- initialize the first( EPSILON ) node of the trie -- */
-   PAGC_CALLOC_STRUC(Trie[EPSILON],NODE,MAXINSYM,err_p,NULL); 
+   PAGC_CALLOC_STRUC(Trie[EPSILON],NODE,MAXINSYM,err_p,NULL);
 
-   for ( a = 0 ; 
-         a < MAXINSYM ; 
+   for ( a = 0 ;
+         a < MAXINSYM ;
          a++ ) {
       Trie[ EPSILON ][ a ] = FAIL ;
    }
 
    /* -- storage for global output_link -- */
-   PAGC_CALLOC_STRUC(o_l,KW **,MAXNODES,err_p,NULL); 
-   PAGC_CALLOC_STRUC(k_s,KW,MAXRULES,err_p,NULL); 
+   PAGC_CALLOC_STRUC(o_l,KW **,MAXNODES,err_p,NULL);
+   PAGC_CALLOC_STRUC(k_s,KW,MAXRULES,err_p,NULL);
 
-   rule_end = r_s + RULESPACESIZE ; 
+   rule_end = r_s + RULESPACESIZE ;
    if ( !initialize_link( err_p ,
-                          o_l , 
+                          o_l ,
                           EPSILON ) ) {
       return NULL ;
    }
-   for ( r = r_s ; 
-         !feof( rule_file ) ; 
+   for ( r = r_s ;
+         !feof( rule_file ) ;
          r++, rule_number++ ) {
       if ( rule_number >= MAXRULES ) {
          CLIENT_ERR( err_p ) ;
          RET_ERR( "create_rules: Too many rules in file",
                   err_p,
-                  NULL) ; 
+                  NULL) ;
       }
-      keyw = k_s + rule_number ; 
+      keyw = k_s + rule_number ;
       MEM_ERR(keyw,err_p,NULL);
       /* -- get input record -- */
 
@@ -454,15 +454,15 @@
       if ( rule_start > rule_end ) {
          RET_ERR( "create_rules: Too many rules for allocated memory",
                   err_p,
-                  NULL ) ; 
+                  NULL ) ;
       }
-      for ( i = 0 ; 
-            ; 
+      for ( i = 0 ;
+            ;
             i++, r++  ) {
 
          /* -- read the first integer -- */
-         fscanf( rule_file, 
-                 "%d", 
+         fscanf( rule_file,
+                 "%d",
                  r ) ;
          /* -- a fail at the beginning of a field indicates end of record
             unless it's at the beginning of the record, in which case
@@ -476,29 +476,29 @@
          /* -- check the input -- */
          if ( !is_input_symbol( *r ) ) {
             CLIENT_ERR( err_p ) ;
-            RET_ERR2( "create_rules: Rule file: Bad Input Token %d at rule %d", 
-                      *r, 
-                      rule_number , 
-                      err_p, 
+            RET_ERR2( "create_rules: Rule file: Bad Input Token %d at rule %d",
+                      *r,
+                      rule_number ,
+                      err_p,
                       NULL ) ;
          }
 
          /* -- build the trie structure -- */
          if ( Trie[ u ][ *r ] == FAIL ) {
-            if ( ++last_node >= MAXNODES ) { 
+            if ( ++last_node >= MAXNODES ) {
                RET_ERR( "create_rules: Too many nodes in gamma function",
                         err_p,
-                        NULL ) ; 
+                        NULL ) ;
             }
             Trie[ u ][ *r ] = last_node ;
             PAGC_CALLOC_STRUC(Trie[last_node],NODE,MAXINSYM,err_p,NULL) ;
-            for ( a = 0 ; 
-                  a < MAXINSYM ; 
+            for ( a = 0 ;
+                  a < MAXINSYM ;
                   a++ ) {
                Trie[ last_node ][ a ] = FAIL ;
-            }        
+            }
             if ( !initialize_link( err_p ,
-                                   o_l , 
+                                   o_l ,
                                    last_node ) ) {
                return NULL ;
             }
@@ -520,14 +520,14 @@
       r++ ; /* -- move to beginning of the output tokens -- */
       rule_start = r ; /* -- remember the beginning -- */
       while ( TRUE ) {
-         fscanf( rule_file, 
-                 "%d", 
+         fscanf( rule_file,
+                 "%d",
                  r ) ;
          if ( *r == FAIL )
             break ;
          if ( !is_output_symbol( *r ) ) {
-            RET_ERR2( "create_rules: Rule File: Non-Token %d in Rule #%d\n", 
-                      *r , 
+            RET_ERR2( "create_rules: Rule File: Non-Token %d in Rule #%d\n",
+                      *r ,
                       rule_number,
                       err_p,
                       NULL ) ;
@@ -537,18 +537,18 @@
       keyw -> Output = rule_start ;
 
       /* -- classify the output -- */
-      fscanf( rule_file , 
-              "%d" , 
+      fscanf( rule_file ,
+              "%d" ,
               &t ) ;
-      fscanf( rule_file , 
-              "%d" , 
+      fscanf( rule_file ,
+              "%d" ,
               &w ) ;
 
       classify_link( r_p ,
-                     o_l , 
-                     keyw , 
-                     u , 
-                     w , 
+                     o_l ,
+                     keyw ,
+                     u ,
+                     w ,
                      t ) ;
    } /* -- end of file read -- */
 
@@ -561,14 +561,14 @@
    fclose( rule_file ) ;
 
 
-   if ( ++last_node >= MAXNODES ) { 
+   if ( ++last_node >= MAXNODES ) {
       RET_ERR( "create_rules: Too many nodes in gamma function" ,
                err_p,
-               NULL) ; 
+               NULL) ;
    }
    /* -- change the EPSILON node transitions in preparation for Gamma -- */
-   for ( a = 0 ; 
-         a < MAXINSYM ; 
+   for ( a = 0 ;
+         a < MAXINSYM ;
          a++ ) {
       if ( Trie[ EPSILON ][ a ] == FAIL ) {
          Trie[ EPSILON ][ a ] = EPSILON ;
@@ -576,18 +576,18 @@
    }
 
    /* -- create the global Gamma function matrix -- */
-   if ( ( r_p -> gamma_matrix = precompute_gamma_function( err_p, 
-                                                           Trie , 
-                                                           o_l , 
+   if ( ( r_p -> gamma_matrix = precompute_gamma_function( err_p,
+                                                           Trie ,
+                                                           o_l ,
                                                            last_node ) ) == NULL ) {
       return NULL ;
    }
 
    /* -- no longer need the Trie -- */
-   PAGC_DESTROY_2D_ARRAY(Trie,NODE,last_node) ; 
+   PAGC_DESTROY_2D_ARRAY(Trie,NODE,last_node) ;
 
 
-   r_p -> num_nodes = last_node ; 
+   r_p -> num_nodes = last_node ;
 
    if ( glo_p -> log_init ) {
       CLIENT_ERR( err_p ) ;
@@ -597,15 +597,15 @@
                  err_p ) ;
    }
 
-   return r_p ; 
+   return r_p ;
 }
 
 #endif
 
-/*--------------------------------------------------------------------------- 
+/*---------------------------------------------------------------------------
 gamma.c (destroy_rules)
 ----------------------------------------------------------------------------*/
-void destroy_rules( RULE_PARAM * r_p ) { 
+void destroy_rules( RULE_PARAM * r_p ) {
    if ( r_p != NULL ) {
       DBG("destroy_rules 1");
       FREE_AND_NULL( r_p -> rule_space ) ;
@@ -622,28 +622,28 @@
 
 /* ========================= Output Links ========================= */
 
-/*--------------------------------------------------------------------------- 
+/*---------------------------------------------------------------------------
 gamma.c (initalize_link)
 called by gamma.c (create_rules)
 ----------------------------------------------------------------------------*/
 static int initialize_link( ERR_PARAM *err_p ,
-                            KW ***o_l , 
+                            KW ***o_l ,
                             NODE u ) {
    int cl ;
 
    /* -- classification by clause type -- */
 
-   PAGC_CALLOC_STRUC(o_l[u],KW *,MAX_CL,err_p,FALSE); 
-   for ( cl = 0 ; 
-         cl < MAX_CL ; 
+   PAGC_CALLOC_STRUC(o_l[u],KW *,MAX_CL,err_p,FALSE);
+   for ( cl = 0 ;
+         cl < MAX_CL ;
          cl++ ) {
 
-      o_l[ u ][ cl ] = NULL ; 
+      o_l[ u ][ cl ] = NULL ;
    }
    return TRUE ;
 }
 
-/*--------------------------------------------------------------------------- 
+/*---------------------------------------------------------------------------
 gamma.c (classify_link)
 called by gamma.c (create_rules)
 ----------------------------------------------------------------------------*/
@@ -655,7 +655,7 @@
                            SYMB c ) {
 
    /* -- classification by clause type -- */
-   KW * last_key , 
+   KW * last_key ,
       * penult ;
 
    k -> hits = 0 ;
@@ -677,7 +677,7 @@
 
 }
 
-/*--------------------------------------------------------------------------- 
+/*---------------------------------------------------------------------------
 gamma.c (add_failure_linkage)
 called by gamma.c (precompute_gamma_function)
 ----------------------------------------------------------------------------*/
@@ -691,15 +691,15 @@
       *fk ;
    int cl ;
 
-   for ( cl = 0 ; 
-         cl < MAX_CL ; 
+   for ( cl = 0 ;
+         cl < MAX_CL ;
          cl++ ) {
       /* -- append the failure keys for each class to the end of the
-         appropriate chain -- */ 
-      fk = o_l[ x ][ cl ] ; 
-      k = o_l[ u ][ cl ] ; 
+         appropriate chain -- */
+      fk = o_l[ x ][ cl ] ;
+      k = o_l[ u ][ cl ] ;
       if ( k == NULL ) {
-         o_l[ u ][ cl ] = fk ; 
+         o_l[ u ][ cl ] = fk ;
       } else {
          /* -- since the chain will be already null-terminated, we only find
             the end of the chain if fk is non-null -- */
@@ -715,20 +715,20 @@
    }
 }
 
-/*--------------------------------------------------------------------------- 
+/*---------------------------------------------------------------------------
 gamma.c (precompute_gamma_function)
 called by gamma.c (create_rules)
 calls gamma.c (add_failure_linkage)
 ----------------------------------------------------------------------------*/
 static NODE **precompute_gamma_function( ERR_PARAM *err_p ,
-                                         NODE **Trie , 
-                                         KW ***o_l , 
+                                         NODE **Trie ,
+                                         KW ***o_l ,
                                          NODE n ) {
-   NODE u , 
-        ua , 
+   NODE u ,
+        ua ,
         x ;
    SYMB a ;
-   int i , 
+   int i ,
        j ;
    NODE **Gamma ;
    NODE *Failure ,
@@ -739,12 +739,12 @@
    /* -- Storage for Breadth First Search Queue -- */
    PAGC_CALLOC_STRUC(Queue,NODE,n,err_p,NULL) ;
 
-   PAGC_CALLOC_2D_ARRAY(Gamma,NODE,n,MAXINSYM,err_p,NULL) ; 
+   PAGC_CALLOC_2D_ARRAY(Gamma,NODE,n,MAXINSYM,err_p,NULL) ;
 
    u = EPSILON ;
    i = 0 ;
    for ( a = 0 ;
-         a < MAXINSYM ; 
+         a < MAXINSYM ;
          a++ ) {
       x = Trie[ EPSILON ][ a ] ;
       Gamma[ EPSILON ][ a ] = x ;
@@ -756,12 +756,12 @@
    }
    Queue[ i ] = FAIL ; /* -- terminate the list of nodes to process -- */
 
-   for ( j = 0 ; 
-         Queue[ j ] != FAIL ; 
+   for ( j = 0 ;
+         Queue[ j ] != FAIL ;
          j++ ) {
       u = Queue[ j ] ;
       /* -- get non-Fail transitions from Trie onto queue -- */
-      for ( a = 0 ; 
+      for ( a = 0 ;
             a < MAXINSYM ;
             a++ ) {
          if ( ( x = Trie[ u ][ a ] ) != FAIL ) {
@@ -770,11 +770,11 @@
       }
       Queue[ i ] = FAIL ; /* -- mark end of list -- */
       x = Failure[ u ] ;
-      add_failure_linkage( o_l , 
-                           x , 
+      add_failure_linkage( o_l ,
+                           x ,
                            u ) ;
-      for ( a = 0 ; 
-            a < MAXINSYM ; 
+      for ( a = 0 ;
+            a < MAXINSYM ;
             a ++ ) {
          ua = Trie[ u ][ a ] ;
          if ( ua != FAIL ) {
@@ -787,7 +787,7 @@
    }
    FREE_AND_NULL( Failure ) ;
    FREE_AND_NULL( Queue ) ;
-   return Gamma ; 
+   return Gamma ;
 }
 
 
@@ -804,7 +804,7 @@
 #ifdef BUILD_API
 int output_rule_statistics( RULE_PARAM *r_p, ERR_PARAM *err_p ) {
 #else
-int output_rule_statistics( RULE_PARAM *r_p , 
+int output_rule_statistics( RULE_PARAM *r_p ,
                             ERR_PARAM *err_p ,
                             char *name ,
                             DS_Handle _file_sys_p ) {
@@ -815,43 +815,43 @@
    SYMB *OL ;
    char *sts_name = NULL ;
    FILE *sts_file = NULL ;
-   KW * k ; 
-   KW * k_s ; 
+   KW * k ;
+   KW * k_s ;
    double hit_frequency ,
           best_frequency ;
 
    if ( !r_p -> collect_statistics ) {
       printf( "Statistics were not collected\n" ) ;
       return FALSE ;
-   }      
+   }
 
 #ifndef BUILD_API
    if ( name != NULL && name[ 0 ] != SENTINEL ) {
       OPEN_ALLOCATED_NAME(sts_name,"sts",sts_file,name,"wb+",_file_sys_p,err_p,FALSE) ;
-   } 
+   }
 #endif
 
    /* -- cycle through the keys -- */
-   n = r_p -> rules_read ; 
-   k_s = r_p -> key_space ; 
+   n = r_p -> rules_read ;
+   k_s = r_p -> key_space ;
    for ( i = 0 , found_count = 0 ;
          i < n ;
          i++ ) {
-      k = k_s + i ; 
+      k = k_s + i ;
       if ( k -> hits == 0 ) {
          continue ;
       }
- 
+
       found_count++ ;
       if ( sts_file == NULL ) {
-         printf( "\nRule %d is of type %d (%s)\n: " ,  
+         printf( "\nRule %d is of type %d (%s)\n: " ,
                  i ,
                  k -> Type ,
                  rule_type_names[ k -> Type ] ) ;
          printf( "Input : " ) ;
       } else {
          fprintf( sts_file ,
-                  "\nRule %d is of type %d (%s)\n: " ,  
+                  "\nRule %d is of type %d (%s)\n: " ,
                   i ,
                   k -> Type ,
                   rule_type_names[ k -> Type ]  ) ;
@@ -898,7 +898,7 @@
          printf ( "\nrank %d ( %f): hits %d out of %d\n" ,
                   k -> Weight ,
                   load_value[ k -> Weight ] ,
-                  k->hits, 
+                  k->hits,
                   r_p -> total_key_hits ) ;
       } else {
          hit_frequency = ( ( double ) k -> hits ) / ( ( double ) r_p -> total_key_hits ) ;
@@ -920,16 +920,16 @@
       printf( "Found %d rules hit\n" , found_count ) ;
    } else {
       fprintf( sts_file ,
-               "Found %d rules hit\n" , 
+               "Found %d rules hit\n" ,
                found_count ) ;
-   }          
+   }
    /* -- start over -- */
    r_p -> total_key_hits = 0 ;
    r_p -> total_best_keys = 0 ;
    if ( sts_file != NULL ) {
       fflush( sts_file ) ;
       fclose( sts_file ) ;
-      FREE_AND_NULL( sts_name ) ; 
+      FREE_AND_NULL( sts_name ) ;
    } else {
       fflush( stdout ) ;
    }

Modified: trunk/extensions/address_standardizer/lexicon.c
===================================================================
--- trunk/extensions/address_standardizer/lexicon.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extensions/address_standardizer/lexicon.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,4 +1,4 @@
-/* -- lexicon.c 
+/* -- lexicon.c
 
 This file reads the lexicon definitions into a chained
 hash table and handles the lookups of words in the hash table,
@@ -40,7 +40,7 @@
 
 /* -- local prototypes -- */
 static unsigned calc_hash( char * ) ;
-static ENTRY **create_hash_table( ERR_PARAM * ) ; 
+static ENTRY **create_hash_table( ERR_PARAM * ) ;
 static int add_dict_entry( ERR_PARAM *, ENTRY ** , char * , int , SYMB , char * ) ;
 
 #ifndef BUILD_API
@@ -49,7 +49,7 @@
 #endif
 
 LEXICON *lex_init( ERR_PARAM *err_p ) ;
-static int append_new_def( ERR_PARAM *, ENTRY * , SYMB , char * , int ) ; 
+static int append_new_def( ERR_PARAM *, ENTRY * , SYMB , char * , int ) ;
 static unsigned elf_hash( char * ) ;
 void print_lexicon( ENTRY ** hash_table ) ;
 
@@ -111,9 +111,9 @@
                         const char *gaz_name ) {
    /* -- called by init_stand_process to read in the Lexicon and set up the
       definitions in memory for hash table access -- */
-   FILE *gaz_file , 
+   FILE *gaz_file ,
         *dict_file ;
-   ENTRY **hash_table ; 
+   ENTRY **hash_table ;
 
    if ( (hash_table = create_hash_table( glo_p -> process_errors ) ) == NULL ) {
        return NULL ;
@@ -122,9 +122,9 @@
    if ( gaz_name != NULL ) {
       if ( ( gaz_file = open_aux_file( glo_p ,
                                        gaz_name ) ) == NULL )
-         return NULL ; 
+         return NULL ;
       if ( !read_lexicon( glo_p -> process_errors ,
-                          hash_table , 
+                          hash_table ,
                           gaz_file ) ) {
           fclose( gaz_file ) ;
           return NULL ;
@@ -136,7 +136,7 @@
                                      lex_name ) ) == NULL )
       return NULL  ;
    if ( !read_lexicon( glo_p -> process_errors ,
-                       hash_table , 
+                       hash_table ,
                        dict_file ) ) {
        fclose( dict_file ) ;
        return NULL ;
@@ -148,13 +148,13 @@
 /* ----------------------------------------------------
 lexicon.c (read_lexicon) -
 called by lexicon.c (create_lexicon) for each file
-calls convert_field, add_dict_entry  
+calls convert_field, add_dict_entry
 returns FALSE if error encountered
 stdio.h (fgets,feof,sscanf)
 uses macro BLANK_STRING
 -------------------------------------------------------*/
 static int read_lexicon( ERR_PARAM *err_p ,
-                         ENTRY **hash_table , 
+                         ENTRY **hash_table ,
                          FILE *CFile ) {
    char record_buffer[ MAXSTRLEN ] ;
    char lookup_str[ MAXTEXT ] ;
@@ -167,8 +167,8 @@
    while ( !feof( CFile ) ) {
       /* -- read in each line of the csv file and add to hash table -- */
       BLANK_STRING(record_buffer) ;
-      fgets( record_buffer , 
-             MAXSTRLEN , 
+      fgets( record_buffer ,
+             MAXSTRLEN ,
              CFile ) ;
 
 #ifdef SEW_NOT_SURE_IF_WE_NEED_THIS
@@ -197,7 +197,7 @@
       next_str = convert_field( standard_str ,
                                 next_str ) ;
       if ( add_dict_entry( err_p ,
-                           hash_table , 
+                           hash_table ,
                            lookup_str ,
                            ( num_def - 1 ) ,
                            cur_token ,
@@ -226,7 +226,7 @@
       return NULL ;
    while ( ( c = *s++ ) != SENTINEL ) {
       if ( c == '\"' ||
-           c == '\r' ) 
+           c == '\r' )
          continue ; /* -- ignore quotes and carriage returns -- */
       /* -- zero terminate field and record delimiters -- */
       if ( c == '\n' ||
@@ -256,7 +256,7 @@
 	{
 		return ;
 	}
-	for (__i__ = 0 ;__i__ < LEXICON_HTABSIZE ;__i__++ ) 
+	for (__i__ = 0 ;__i__ < LEXICON_HTABSIZE ;__i__++ )
 	{
 		for (__E__ = hash_table[__i__] ;__E__ != NULL ;__E__ = __F__)
 		{
@@ -302,7 +302,7 @@
 calls lexicon.c (calc_hash)
 string.h (strcmp)
 -------------------------------------------------------*/
-ENTRY *find_entry(ENTRY **hash_table,char *lookup_str) 
+ENTRY *find_entry(ENTRY **hash_table,char *lookup_str)
 {
 	/* -- called to create a lexeme -- */
 	ENTRY *__E__ ;
@@ -325,8 +325,8 @@
 called by lexicon.c (calc_hash)
 -------------------------------------------------------*/
 static unsigned elf_hash( char *key_str ) {
-  unsigned h , 
-           g , 
+  unsigned h ,
+           g ,
            c ;
 
   h = 0 ;
@@ -366,7 +366,7 @@
 	unsigned __i__ ;
 	ENTRY **__hash_table__ ;
 	PAGC_CALLOC_STRUC(__hash_table__,ENTRY *,LEXICON_HTABSIZE,err_p,NULL) ;
-	for (__i__ = 0 ;__i__ < LEXICON_HTABSIZE ;__i__++ ) 
+	for (__i__ = 0 ;__i__ < LEXICON_HTABSIZE ;__i__++ )
 	{
 		__hash_table__[__i__] = NULL ;
 	}
@@ -381,7 +381,7 @@
 return ERR_FAIL if error
 -------------------------------------------------------*/
 static int add_dict_entry( ERR_PARAM *err_p ,
-                           ENTRY **hash_table , 
+                           ENTRY **hash_table ,
                            char *lookup_str ,
                            int def_num ,
                            SYMB t ,
@@ -391,13 +391,13 @@
    E = find_entry( hash_table ,
                    lookup_str ) ;
    if ( E == NULL ) {
-      unsigned hash_index ; 
+      unsigned hash_index ;
 
       PAGC_ALLOC_STRUC(E,ENTRY,err_p,ERR_FAIL);
       /* -- add the Lookup string to the record -- */
       PAGC_STORE_STR(E->Lookup,lookup_str,err_p,ERR_FAIL) ;
       /* -- add new entry to beginning of table -- */
-      hash_index = calc_hash( lookup_str ) ; 
+      hash_index = calc_hash( lookup_str ) ;
 
       E -> Next = hash_table[ hash_index ] ; /* -- collision chain -- */
       hash_table[ hash_index ] = E ;
@@ -407,7 +407,7 @@
                                         FALSE ,
                                         err_p ) ) == NULL ) {
           return ERR_FAIL ;
-      }  
+      }
   } else {
       int err_stat ;
       if ( E -> DefList == NULL ) {
@@ -437,10 +437,10 @@
                            ENTRY *E ,
                            SYMB t ,
                            char *text ,
-                           int def_num ) { 
+                           int def_num ) {
 
-   DEF *D, 
-       *pd, 
+   DEF *D,
+       *pd,
        *cd ;
    for ( cd = E -> DefList , pd = NULL ;
          cd != NULL ;
@@ -468,10 +468,10 @@
 }
 
 /*--------------------------------------------------------------------
-lexicon.c (create_def) 
+lexicon.c (create_def)
 called by lexicon.c (append_new_def) tokenize.c (setup_default_defs)
 allocate memory for lexicon entry.
-Pflag is TRUE for default entries 
+Pflag is TRUE for default entries
 returns NULL for allocation error
 uses macro PAGC_ALLOC_STRUC, PAGC_STORE_STR
 -------------------------------------------------------------------- */

Modified: trunk/extensions/address_standardizer/pagc_api.h
===================================================================
--- trunk/extensions/address_standardizer/pagc_api.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extensions/address_standardizer/pagc_api.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,4 +1,4 @@
-/* -- pagc_api.h 
+/* -- pagc_api.h
 
 This file is the common header file for PAGC internal routines
 
@@ -75,9 +75,9 @@
 
 //#define WITH_ALT_LEFT_RIGHT
 
-/* 2009-07-21 : keep track of version 
+/* 2009-07-21 : keep track of version
    2010-02-01 : increase to 0.3.0
-   2010-08-20 : increase to 0.4.0 
+   2010-08-20 : increase to 0.4.0
    2011-08-14 : increase to 0.4.1 */
 
 #ifdef WITH_ALT_LEFT_RIGHT
@@ -236,13 +236,13 @@
 #endif
 /* -- error records -- */
 
-typedef struct err_rec 
+typedef struct err_rec
 {
 	int is_fatal ; /* -- is this a fatal error ? -- */
 	char content_buf[MAXSTRLEN] ; /* -- storage for message -- */
 } ERR_REC ;
 
-typedef struct err_param 
+typedef struct err_param
 {
 	int last_err ;
 	int first_err ;
@@ -302,7 +302,7 @@
 #define PREFIX  3
 #define EXIT  4
 
-/* -- tokens -- 
+/* -- tokens --
    used in tokenize.c -- */
 #define DFRACT 0
 #define DSINGLE 1
@@ -322,17 +322,17 @@
 /* ================= standardization records ===================*/
 
 /* -- This structure stores a definition for a lexical entry -- */
-typedef struct def  
+typedef struct def
 {
 	int Order ; /* -- the order in the list -- */
 	SYMB Type ; /* -- the Input symbol -- */
-	int Protect ; 
+	int Protect ;
 	char *Standard ; /* -- The standardization -- */
 	struct def *Next ;
 } DEF ;
 
 /* -- This stores the data for a lexical entry -- */
-typedef struct entry 
+typedef struct entry
 {
 	char *Lookup ; /* -- To match against the input word -- */
 	DEF *DefList ; /* -- list of definitions and outputs for this word -- */
@@ -341,7 +341,7 @@
 
 
 /* -- storage for standardization rules -- */
-typedef struct keyword 
+typedef struct keyword
 {
 	SYMB *Input ; /* -- List of input symbols -- */
 	SYMB *Output ; /* -- List of output symbols, 1-1 with input -- */
@@ -354,7 +354,7 @@
 } KW ;
 
 
-typedef struct lexeme 
+typedef struct lexeme
 {
 	int StartMorph ;
 	int EndMorph ;
@@ -363,7 +363,7 @@
 } LEXEME ;
 
 /* 2006-11-02 */
-typedef struct rule_param 
+typedef struct rule_param
 {
 	int num_nodes ;
 	int rules_read ;
@@ -377,7 +377,7 @@
 } RULE_PARAM ;
 
 /* -- structure used to assemble composite output -- */
-typedef struct seg 
+typedef struct seg
 {
 	SYMB sub_sym ; /* -- Used in forced standardization -- */
 	int Start ; /* -- the start target position -- */
@@ -389,17 +389,17 @@
 } SEG ;
 
 /* -- storage structure for standardization candidates -- */
-typedef struct stz 
+typedef struct stz
 {
     DS_Score_t score ; /* -- standardization score -- */
     DS_Score_t raw_score ;
     KW *build_key ; /* -- use to collect statistics -- */
-    DEF *definitions[MAXLEX] ; /* -- lexical or input definitions -- */ 
+    DEF *definitions[MAXLEX] ; /* -- lexical or input definitions -- */
     SYMB output[MAXLEX] ; /* -- output tokens -- */
 } STZ ;
 
 /* 2006-11-02 */
-typedef struct stz_param 
+typedef struct stz_param
 {
 	int stz_list_size ;
 	int last_stz_output ;
@@ -409,7 +409,7 @@
 } STZ_PARAM ;
 
 /* 2006-11-14 */
-struct morph 
+struct morph
 {
 	int Term ;
 	int TextLen ;
@@ -417,7 +417,7 @@
 	DEFDEF Sym ;
 } ;
 
-typedef struct stand_param 
+typedef struct stand_param
 {
 	int cur_morph ;
 	int base_morph ;
@@ -432,7 +432,7 @@
 	/*-- <revision date='2012-06-01'> Add gaz_lexicon to be triggered on __start_state__ = MACRO </revision> --*/
 	ENTRY **gaz_lexicon ;
 	/*-- <revision date='2012-07-22'> Keep track of start_state </revision> --*/
-	int start_state ; 
+	int start_state ;
 	ERR_PARAM *errors ;
 	STZ_PARAM *stz_info ; /* structure created by analyze.c (create_segments) */
 	DEF **default_def ;
@@ -441,14 +441,14 @@
 	SYMB best_output[MAXLEX] ;
 	SYMB target[MAXLEX] ; /* -- target for Aho-Corasick -- */
 	LEXEME lex_vector[MAXLEX] ;
-	int cur_sym_sel[MAXLEX] ; /* -- currently selected symbol 
+	int cur_sym_sel[MAXLEX] ; /* -- currently selected symbol
                                   for each lexeme -- */
 	int orig_str_pos[MAXLEX] ; /* -- compression buffer -- */
 	int def_cnt[MAXLEX] ; /* -- number of symbols for each lexeme -- */
-	NODE registry[MAXLEX + 1] ; /* -- Aho-Corasick : offsets to output 
+	NODE registry[MAXLEX + 1] ; /* -- Aho-Corasick : offsets to output
                                          links -- */
 	DEF *best_defs[MAXLEX] ;
-	DEF *def_array[MAXLEX][MAXDEF] ; /* -- the definitions for each 
+	DEF *def_array[MAXLEX][MAXDEF] ; /* -- the definitions for each
                                                lexeme -- */
 	SYMB comp_lex_sym[MAXLEX][MAXDEF] ; /* -- symbols for each lexeme -- */
 } STAND_PARAM ;
@@ -461,9 +461,9 @@
 /* -- The attribute structure is used to coordinate the schema in the
    reference data with the postal attributes identified by the standardizer
    and which may be used in the user's addresses. -- */
-typedef struct attribute 
+typedef struct attribute
 {
-	SYMB symbol ; 
+	SYMB symbol ;
 	int comp_type ; /* -- The comparision type used in matching -- */
 	int check_dir ; /* -- TRUE if a non-blank reference field is read -- */
 	int num_redirects ;
@@ -479,11 +479,11 @@
                                         attribute should be redirected -- */
 } ATTRIBUTE ;
 
-/* -------------------------------------------------------------- 
+/* --------------------------------------------------------------
 This structure is used to store the information on each reference
-record with which we attempt to match the user record 
+record with which we attempt to match the user record
 ---------------------------------------------------------------- */
-typedef struct candidate 
+typedef struct candidate
 {
 	int score_card ; /*2008-12-15*/
 	DS_Entity_t record ; /* -- reference database record number -- */
@@ -496,7 +496,7 @@
                    betaref.c (ReadScoreStandardized) -- */
 } CANDIDATE ; /* -- structure initialized in Index/CreateCandidate --*/
 
-typedef struct int_candidate 
+typedef struct int_candidate
 {
 	DS_Entity_t record_A ;
 	DS_Entity_t record_B ;
@@ -513,7 +513,7 @@
 
 /* ================== global record =================== */
 
-typedef struct pagc_global 
+typedef struct pagc_global
 {
 	int log_init ;
 	RULE_PARAM *rules ;
@@ -522,7 +522,7 @@
 	ENTRY **addr_lexicon ; /*-- 2006-11-20 --*/
 	ENTRY **poi_lexicon ;
 	/*-- <revision date='2012-07-16'> gaz_lexicon </revision> --*/
-	ENTRY **gaz_lexicon ; 
+	ENTRY **gaz_lexicon ;
 	DS_Handle _file_sys ;
 	ERR_PARAM *process_errors ;
 } PAGC_GLOBAL ;
@@ -533,7 +533,7 @@
 
 /* ============================ main schema record ========================== */
 
-typedef struct schema 
+typedef struct schema
 {
 	DS_Score_t match_weight[MAXOUTSYM] ; /* match weight for each token employed in the schema */
 	DS_Score_t unmatch_weight[MAXOUTSYM] ; /* the non-match weight for each */
@@ -564,7 +564,7 @@
 	DS_Coord_t MBR_min_X ; /* Minimum point X */
 	DS_Coord_t MBR_min_Y ; /* Minimum point Y */
 	int pagc_ver ; /*-- <revision date='2009-07-21'> Tracking version. </revision> --*/
-	DS_Dim_t shp_typ ; /* Shape type in shapefile - point, arc */ 
+	DS_Dim_t shp_typ ; /* Shape type in shapefile - point, arc */
 	int both_sides ; /* do arcs have both sides, ie both left and right? -- used for SITE_INTERPOLATE */
 	DS_Field_t from_cross_col ; /* the from cross street in the reference shapeset (for intersections) */
 	DS_Field_t to_cross_col ; /* the to cross street for intersections */
@@ -580,7 +580,7 @@
 	DS_Field_t subdistrict_beta ;
 	DS_Field_t occ_field1 ; /* -- if HAVE_OCCUPANCY -- */
 	DS_Field_t occ_field2 ; /* -- if HAVE_OCCUPANCY -- */
-	/*-- <revision date='2010-09-27'> Eliminate X_field and Y_field for HAVE_DBF_POSITION 
+	/*-- <revision date='2010-09-27'> Eliminate X_field and Y_field for HAVE_DBF_POSITION
 		and use following: </revision> --*/
 	DS_Geo_t typ_geo_cols ;
 	DS_Field_t num_geo_cols ;
@@ -627,7 +627,7 @@
 
 /* ===================== build database control record ============= */
 
-typedef struct bdb_build_param 
+typedef struct bdb_build_param
 {
 	ERR_PARAM *errors ;
 	SCHEMA *schema ;
@@ -637,9 +637,9 @@
 } BDB_BUILD_PARAM ;
 
 
-/* ============ structures for intersection search =========== */ 
+/* ============ structures for intersection search =========== */
 
-typedef struct x_cand 
+typedef struct x_cand
 {
 	DS_Entity_t beta_rec ;
 	int reversed ;
@@ -651,14 +651,14 @@
 	struct x_cand *cluster ;
 } X_CAND ;
 
-typedef struct pair_read 
+typedef struct pair_read
 {
 	DS_Entity_t record_1 ;
 	DS_Entity_t record_2 ;
 	struct pair_read *next ;
 } PAIR_READ ;
 
-typedef struct box_cell 
+typedef struct box_cell
 {
 	X_CAND *splitter ;
 	PAIR_READ *pair_list ;
@@ -668,7 +668,7 @@
 
 /* ============== structure for recording beta records read ======== */
 
-typedef struct record_read 
+typedef struct record_read
 {
 	DS_Entity_t row_no ;
 	int stz ;
@@ -676,16 +676,16 @@
 	struct record_read * right ;
 } RECORD_READ ;
 
-typedef struct r_r_mgr 
+typedef struct r_r_mgr
 {
 	int current_offset ;
 	void *base ; /* 2010-06-24 : change to void * for flexibility */
 	struct r_r_mgr *prev_block ;
 	struct r_r_mgr *next_block ;
-} R_R_MGR ; 
+} R_R_MGR ;
 
 /* 2011-01-24 : keep schema linkages on hand until closure */
-typedef struct schema_db_linkage 
+typedef struct schema_db_linkage
 {
 	SCHEMA * linked_schema ;
 	DS_Handle _linked_beta ;
@@ -694,7 +694,7 @@
 
 /* ============ main matching context record ========== */
 
-typedef struct pagc_context 
+typedef struct pagc_context
 {
 	SCHEMA *schema ;
 	ERR_PARAM *errors ;
@@ -726,12 +726,12 @@
 	R_R_MGR *pair_r_r ; /* 2010-06-26 new structure */
 	R_R_MGR *box_r_r ; /* 2010-06-26 new structure */
 	R_R_MGR *x_cand_r_r ; /* 2010-06-26 new structure */
-	RECORD_READ **rec_hash_tab ; /* -- allocated memory -- */ 
+	RECORD_READ **rec_hash_tab ; /* -- allocated memory -- */
 	DS_Byte_t *shape_buf ;
 	char transfer_buf[MAX_TRANSFER_BUF_SIZE] ;
 /*   PAIR_READ *pair_buf ;  2010-06-26, no longer needed */
 	BOX_CELL **overlap_buf ; /* -- allocated memory -- */
-	BOX_CELL *box_root ; 
+	BOX_CELL *box_root ;
 /*   BOX_CELL *box_cell_array ;   2010-06-26, no longer needed */
 /*   int num_box_cells ;  2010-06-26, no longer needed */
 } PAGC_CONTEXT ;
@@ -739,7 +739,7 @@
 
 /* =============== client interface record (not exposed) =========== */
 
-typedef struct client_handle 
+typedef struct client_handle
 {
 	int handle_check ;
 	int num_contexts ;
@@ -752,7 +752,7 @@
 } CLIENT_HANDLE ;
 
 /* 2009-07-27 : structure for landmark scoring */
-typedef struct cand_score_params 
+typedef struct cand_score_params
 {
 	int target_word_cnt ;
 	int postal_idx ; /* which requester field has the postal */
@@ -827,7 +827,7 @@
 /* -- analyze.c -- */
 int install_def_block_table(ENTRY **, ERR_PARAM *) ;
 STZ_PARAM *create_segments(ERR_PARAM *) ;
-void destroy_segments(STZ_PARAM *) ; 
+void destroy_segments(STZ_PARAM *) ;
 int get_next_stz(STAND_PARAM *, int) ;
 double get_stz_downgrade(STAND_PARAM *, int) ;
 /*-- <revision date='2012-07-22'> Keep track of start_state </revision> --*/
@@ -869,7 +869,7 @@
 /* -- candform.c -- */
 int sads_format_standard_fields(STAND_PARAM *, int, char *) ;
 void fetch_standard_headers(char *) ;
-/* 2008-07-21 sads_format_candidate : add is_parity_mismatch argument, 
+/* 2008-07-21 sads_format_candidate : add is_parity_mismatch argument,
    add source_identifier argument */
 #ifdef THREE_SOURCE_IDS
 int sads_format_candidate(PAGC_CONTEXT *, DS_Entity_t, int, char *, int, int, int, int *, char *, char *, char *) ;
@@ -914,8 +914,8 @@
 int collect_incident_arcs(PAGC_CONTEXT *, int, int, int) ;
 
 /* -- score.c -- */
-int read_score_stand(PAGC_CONTEXT *, DS_Score_t *, char **, DS_Entity_t, int, int *) ; 
-int read_score_stand_land( PAGC_CONTEXT *, DS_Score_t *, char **, DS_Entity_t, int *, CAND_SCORE_PARAMS *) ; 
+int read_score_stand(PAGC_CONTEXT *, DS_Score_t *, char **, DS_Entity_t, int, int *) ;
+int read_score_stand_land( PAGC_CONTEXT *, DS_Score_t *, char **, DS_Entity_t, int *, CAND_SCORE_PARAMS *) ;
 int resolve_range_direction(int *, int *, int, int, int, int) ;
 DS_Score_t interpolate_weight(DS_Score_t, DS_Score_t, DS_Score_t) ;
 int match_number_interval_left_right(int, int, int, int, int, int) ;
@@ -967,19 +967,19 @@
 int print_beta_text(PAGC_CONTEXT *) ;
 int print_index_text(PAGC_CONTEXT *, DS_Index_Link) ;
 int print_shape_index(PAGC_CONTEXT *, DS_Index_Link) ;
-int calc_landmark_word_weights(PAGC_CONTEXT *, int, int *, DS_Score_t *) ; 
+int calc_landmark_word_weights(PAGC_CONTEXT *, int, int *, DS_Score_t *) ;
 
 /* -- alpharef.c -- */
 int read_alpha_house(DS_Handle, DS_Entity_t, DS_Field_t, int) ;
 int extract_house(const char *, int) ;
-/* 2008-07-30 : add unstandard_mac_alternate arg and flag for alternate city names 
+/* 2008-07-30 : add unstandard_mac_alternate arg and flag for alternate city names
    2009-11-23 : add arrays for official name fields */
 /*-- <revision date='2012-08-30'> Use check_macro </revision> --*/
 int read_unstandardized(SCHEMA *, DS_Handle, DS_Entity_t, int *, int *, int *, char *, CHECK_MACRO* , char *, char **, DS_Field_t *, int *, ERR_PARAM *) ;
 
 /* -- makebeta.c -- */	
 int init_standardized_table(SCHEMA *, ERR_PARAM *) ;
-int soundex_street_words(char *, char **) ; 
+int soundex_street_words(char *, char **) ;
 /* 2008-08-01 : add stand_alt_macro flag for alternate city names */
 /*-- <revision date='2012-08-30'> Use check_macro </revision> --*/
 int write_standardized(SCHEMA *, BDB_BUILD_PARAM *, char **, char **, CHECK_MACRO *, int, int *, char *, char *, char *, DS_Entity_t, int) ;
@@ -1019,20 +1019,20 @@
 #define LOG_MESS(STR,WHERE) \
    sprintf( WHERE -> error_buf , \
             STR ) ; \
-   register_error( WHERE ) 
+   register_error( WHERE )
 
 #define LOG_MESS1( TEMP,INSERT,WHERE) \
    sprintf( WHERE -> error_buf , \
             TEMP, \
             INSERT ) ; \
-   register_error( WHERE ) 
+   register_error( WHERE )
 
 #define LOG_MESS2( TEMP,INSERT1,INSERT2,WHERE ) \
    sprintf( WHERE -> error_buf , \
             TEMP, \
             INSERT1, \
             INSERT2 ) ; \
-   register_error( WHERE ) 
+   register_error( WHERE )
 
 #define LOG_MESS3( TEMP,INSERT1,INSERT2,INSERT3,WHERE ) \
    sprintf( WHERE -> error_buf , \
@@ -1040,9 +1040,9 @@
             INSERT1, \
             INSERT2 , \
             INSERT3 ) ; \
-   register_error( WHERE  ) 
+   register_error( WHERE  )
 
-   
+
 #define RET_ERR(STR,WHERE,RET) \
    LOG_MESS(STR,WHERE) ; \
    return RET
@@ -1078,7 +1078,7 @@
    DEST = (char * ) malloc( sizeof( char ) * ( strlen( SRC ) + 1 ) ) ; \
    MEM_ERR(DEST,WHERE,RET_VAL) ; \
    BLANK_STRING(DEST) ; \
-   strcpy(DEST,SRC) 
+   strcpy(DEST,SRC)
 
 
 #define PAGC_ALLOC_STRUC(LOC,TYP,WHERE,EXIT_TYPE) \
@@ -1157,7 +1157,7 @@
 #define MAKE_CONCAT_KEY(TARGET,SOURCE_A,SOURCE_B) \
    BLANK_STRING(TARGET) ; \
    strcpy( TARGET , SOURCE_A ) ; \
-   COMMA_APPEND_WITH_LEN( TARGET , SOURCE_B , MAXSTRLEN ) 
+   COMMA_APPEND_WITH_LEN( TARGET , SOURCE_B , MAXSTRLEN )
 
 #define MAKE_CONCAT_SOUNDEX_KEY(SOURCE_A,SOURCE_B,DEST,HOLD,CNT,SW) \
    soundex_street_words( SOURCE_A, SW) ; \
@@ -1181,7 +1181,7 @@
    if ( CLIENT_PTR == NULL ) return FALSE ; \
    NATIVE_PTR = ( CLIENT_HANDLE * ) CLIENT_PTR ; \
    if ( NATIVE_PTR -> handle_check != HANDLE_CHECK ) return 0
-   
+
 #define CHECK_BOUNDS( ARRAY_SIZE , ARRAY_IDX ) \
    if ( ( ARRAY_IDX > ARRAY_SIZE ) || (ARRAY_IDX < 1 ) ) { \
       CLIENT_ERR( pagc_p -> global_record -> process_errors ) ; \

Modified: trunk/extensions/address_standardizer/pagc_common.h
===================================================================
--- trunk/extensions/address_standardizer/pagc_common.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extensions/address_standardizer/pagc_common.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,4 +1,4 @@
-/*-- pagc_common.h -- 
+/*-- pagc_common.h --
 
 Certain common definitions used both by the pagc library and its clients
 
@@ -18,8 +18,8 @@
 */
 
 /* For pagc-0.4.0 : last revised 2010-11-08 */
- 
 
+
 #ifndef PAGC_COM_H
 #define PAGC_COM_H
 
@@ -57,10 +57,10 @@
 #define SITE_INTERPOLATE 1
 #define INTERSECTION 2
 #define ADDRESS_RANGE_2 3
-#define ADDRESS_RANGE_4 4 
+#define ADDRESS_RANGE_4 4
 #define REVERSE_SITE 5
-#define REVERSE_INTERSECTION 6 
-#define INTERSECTION_B 7 
+#define REVERSE_INTERSECTION 6
+#define INTERSECTION_B 7
 #define CONCAT 8
 #define LANDMARK_NAME 9
 

Modified: trunk/extensions/address_standardizer/pagc_tools.c
===================================================================
--- trunk/extensions/address_standardizer/pagc_tools.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extensions/address_standardizer/pagc_tools.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,4 +1,4 @@
-/* -- pagc_tools.c 
+/* -- pagc_tools.c
 
 Various and miscellaneous functions.
 
@@ -90,27 +90,27 @@
    "QUAD",
 } ;
 
-/* ------------------------------------------------------------ 
+/* ------------------------------------------------------------
    ISO 8859 character set may pop up in some files. After 1998
-   TigerLine will use them. 
+   TigerLine will use them.
 ------------------------------------------------------------- */
 void convert_latin_one ( char *inp ) {
    unsigned char *str ;
 
-   for ( str = ( unsigned char * ) inp ; 
-         *str != SENTINEL ; 
+   for ( str = ( unsigned char * ) inp ;
+         *str != SENTINEL ;
          str++ ) {
       unsigned char ch ;
       ch = *str ;
-      /* ------------------------------------------- 
+      /* -------------------------------------------
          if bit 7 is set, reset bit 5 so both upper
-         and lower case can be done together 
+         and lower case can be done together
       --------------------------------------------- */
       if ( ch & 0x80 ) {
          ch &= 0xDF ;
-         /* ----------------------------------------- 
+         /* -----------------------------------------
             reduce letters with diacritical marks to
-            their unmarked base letters 
+            their unmarked base letters
          ------------------------------------------ */
          if ( ch >= 0xC0 &&
               ch <= 0xC6 )
@@ -132,19 +132,19 @@
          else if ( ch >= 0xdd && ch < 0xdf )
             ch = 'Y' ;
          else
-            /* ------------------------------- 
+            /* -------------------------------
                just clear the top bit so it
                won't gum up the edit distance
-               machinery 
+               machinery
             -------------------------------- */
             ch &= 0x7f ;
       }
       *str = ch ;
    }
 
-   /* ---------------------------------------------- 
+   /* ----------------------------------------------
    while we're at it, add a newline to the end
-      because the lexical scanner likes it like that 
+      because the lexical scanner likes it like that
    ----------------------------------------------- */
    *str++ = '\n' ;
    *str = SENTINEL ;
@@ -158,7 +158,7 @@
       return ;
    /* -- skip the delimitor if dest is empty -- */
    if ( *dest == SENTINEL ) {
-      append_string_to_max( dest , 
+      append_string_to_max( dest ,
                             ( char * ) src ,
                             max_wid ) ;
       return ;
@@ -182,7 +182,7 @@
    for ( i = 0 ;
          i < MAXOUTSYM ;
          i++ ) {
-      if ( strcmp( src , 
+      if ( strcmp( src ,
                    OutSymbNames[ i ] ) == 0 )
          return i ;
    }
@@ -234,10 +234,10 @@
 	while ( ( end_ptr > input_path_name ) && NOT_PATH_DELIMITOR(*end_ptr) ) {
 		end_ptr -- ;
 	}
-	/* --------------------------------------------------------------- 
+	/* ---------------------------------------------------------------
 	either end_ptr has the last delimitor or it is at string start.
 		If the first case, we need to increment to get the filename and
-		need to copy everything up to and including for the path. 
+		need to copy everything up to and including for the path.
 	-----------------------------------------------------------------*/
 	/* -- copy from beg to endptr to output path -- */
 	dest = output_head ;
@@ -283,7 +283,7 @@
    combine_buf[ 0 ] = global_path_separator ;
    combine_buf[ 1 ] = SENTINEL ;
 
-   if ( ( input_head != NULL ) && 
+   if ( ( input_head != NULL ) &&
         ( input_head[ 0 ] != SENTINEL ) ) {
       append_string_to_max( output_path_name ,
                             input_head ,
@@ -304,7 +304,7 @@
 void upper_case( char *d ,
                  const char *s ) {
    /* -- make an uppercase copy in d of string in s -- */
-   for ( ; 
+   for ( ;
          *s != SENTINEL ;
          s++ ) {
       *d++ = ( islower( *s )? toupper( *s ) : *s ) ;
@@ -329,7 +329,7 @@
 		char a  = *start_byte_ptr ;
 		*start_byte_ptr = *end_byte_ptr ;
 		*end_byte_ptr = a ;
-	}                     
+	}
 }
 
 /*=================================================================
@@ -343,7 +343,7 @@
    char *d_ptr , *s_ptr , *buf_end ;
 
    /* -- move to end of current contents of buffer -- */
-   d_ptr = dest_buf_start ; 
+   d_ptr = dest_buf_start ;
    while ( ( a = *d_ptr ) != SENTINEL ) {
       d_ptr ++ ;
    }
@@ -357,14 +357,14 @@
 #endif
       exit( 1 ) ;
 #else
-      /* TODO if postgresql we can throw and error or notice 
+      /* TODO if postgresql we can throw and error or notice
          but for now we will just truncate the string */
       *d_ptr = SENTINEL ;
       return;
 #endif
    }
    s_ptr = src_str_start ;
-   while ( ( ( a = *s_ptr++ ) != SENTINEL ) && 
+   while ( ( ( a = *s_ptr++ ) != SENTINEL ) &&
            ( d_ptr != buf_end ) ) {
       *d_ptr++ = a ;
    }
@@ -381,7 +381,7 @@
                          char * p_s ) {
    char *c_w_d_ptr ;
 
-   c_w_d_ptr = getcwd( c_w_d , 
+   c_w_d_ptr = getcwd( c_w_d ,
                        ( PATHNAME_LEN - 1 ) ) ;
    if ( c_w_d_ptr  == NULL ) {
       return FALSE ;
@@ -417,18 +417,18 @@
 #ifdef MSYS_POSIX
 /*------------------------------------------------------------------
 pagc_tools.c (conform_directory_separator)
--- called only if compiled with MSYS_POSIX defined ..... 
+-- called only if compiled with MSYS_POSIX defined .....
 -- transform non-POSIX directory separators to conform with POSIX --
 called by init_global
 string.h (strlen)
 -------------------------------------------------------------------*/
 static void conform_directory_separator( char * path_name ) {
-   int i , 
-       pn_len ;   
+   int i ,
+       pn_len ;
 
    pn_len = strlen( path_name ) ;
-   for ( i = 0 ; 
-         i < pn_len ; 
+   for ( i = 0 ;
+         i < pn_len ;
          i++ ) {
       if ( path_name[ i ] == BACK_SLASH ) {
          path_name[ i ] = FORE_SLASH ;

Modified: trunk/extensions/address_standardizer/pagc_tools.h
===================================================================
--- trunk/extensions/address_standardizer/pagc_tools.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extensions/address_standardizer/pagc_tools.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,5 +1,5 @@
 /*=================================================================
-  -- pagc_tools.h -- 
+  -- pagc_tools.h --
 
 Certain common tools used both by the pagc library and its clients
 

Modified: trunk/extensions/address_standardizer/parseaddress-api.c
===================================================================
--- trunk/extensions/address_standardizer/parseaddress-api.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extensions/address_standardizer/parseaddress-api.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -93,13 +93,13 @@
     int erroffset;
     pcre *re;
     int rc;
-    
+
     re = pcre_compile(pattern, options, &error, &erroffset, NULL);
     if (!re) return -99;
-    
+
     rc = pcre_exec(re, NULL, s, strlen(s), 0, 0, ovect, OVECCOUNT);
     free(re);
-    
+
     if (rc < 0) return rc;
     else if (rc == 0) rc = OVECCOUNT/3;
 
@@ -144,7 +144,7 @@
     }
 
     /* clean the string of multiple white spaces and . */
-    
+
     for (i=0, j=0; i<strlen(s); i++) {
         c = s[i];
         if (c == '.') c = s[i] = ' ';
@@ -198,7 +198,7 @@
 
     caregx = "^(?-xism:(?i:(?=[abmnopqsy])(?:n[ltsu]|[am]b|[bq]c|on|pe|sk|yt)))$";
     stregx = "\\b(?-xism:(?i:(?=[abcdfghiklmnopqrstuvwy])(?:a(?:l(?:a(?:bam|sk)a|berta)?|mer(?:ican)?\\ samoa|r(?:k(?:ansas)?|izona)?|[kszb])|s(?:a(?:moa|skatchewan)|outh\\ (?:carolin|dakot)a|\\ (?:carolin|dakot)a|[cdk])|c(?:a(?:lif(?:ornia)?)?|o(?:nn(?:ecticut)?|lorado)?|t)|d(?:e(?:la(?:ware)?)?|istrict\\ of\\ columbia|c)|f(?:l(?:(?:orid)?a)?|ederal\\ states\\ of\\ micronesia|m)|m(?:i(?:c(?:h(?:igan)?|ronesia)|nn(?:esota)?|ss(?:(?:issipp|our)i)?)?|a(?:r(?:shall(?:\\ is(?:l(?:and)?)?)?|yland)|ss(?:achusetts)?|ine|nitoba)?|o(?:nt(?:ana)?)?|[ehdnstpb])|g(?:u(?:am)?|(?:eorgi)?a)|h(?:awai)?i|i(?:d(?:aho)?|l(?:l(?:inois)?)?|n(?:d(?:iana)?)?|(?:ow)?a)|k(?:(?:ansa)?s|(?:entuck)?y)|l(?:a(?:bordor)?|ouisiana)|n(?:e(?:w(?:\\ (?:foundland(?:\\ and\\ labordor)?|hampshire|jersey|mexico|(?:yor|brunswic)k)|foundland)|(?:brask|vad)a)?|o(?:rth(?:\\ (?:mariana(?:\\ is(?:l(?:and)?)?)?|(?:carolin|dakot)a)|west\\ territor(?:ies|y))|va\\ scotia)|\\ (?:carolin|dakot)a|u(?:navut)?|[vhjmycdblsf]|w?t)|o(?:h(
 ?:io)?|k(?:lahoma)?|r(?:egon)?|n(?:t(?:ario)?)?)|p(?:a(?:lau)?|e(?:nn(?:sylvania)?|i)?|r(?:ince\\ edward\\ island)?|w|uerto\\ rico)|r(?:hode\\ island|i)|t(?:e(?:nn(?:essee)?|xas)|[nx])|ut(?:ah)?|v(?:i(?:rgin(?:\\ islands|ia))?|(?:ermon)?t|a)|w(?:a(?:sh(?:ington)?)?|i(?:sc(?:onsin)?)?|y(?:oming)?|(?:est)?\\ virginia|v)|b(?:ritish\\ columbia|c)|q(?:uebe)?c|y(?:ukon|t))))$";
-    
+
     rc = match(stregx, s, ovect, PCRE_CASELESS);
     if (rc > 0) {
         state = (char *) palloc0((ovect[1]-ovect[0]+1) * sizeof(char));
@@ -206,7 +206,7 @@
 
         /* truncate the state/province off the string */
         *(s+ovect[0]) = '\0';
-        
+
         /* lookup state in hash and get abbreviation */
         strtoupper(state);
 #ifdef USE_HSEARCH
@@ -316,7 +316,7 @@
         /* truncate the state/province off the string */
         *(s+ovect[2]) = '\0';
     }
-        
+
     /* clean trailing punctuation */
     clean_trailing_punct(s);
 

Modified: trunk/extensions/address_standardizer/parseaddress-stcities.h
===================================================================
--- trunk/extensions/address_standardizer/parseaddress-stcities.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extensions/address_standardizer/parseaddress-stcities.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,6 +1,6 @@
 #define NUM_STATES 59
 
-    static const char *states[NUM_STATES] = 
+    static const char *states[NUM_STATES] =
         {"AK","AL","AR","AS","AZ","CA","CO","CT","DC","DE","FL","FM","GA","GU","HI","IA","ID","IL","IN","KS","KY","LA","MA","MD","ME","MH","MI","MN","MO","MP","MS","MT","NC","ND","NE","NH","NJ","NM","NV","NY","OH","OK","OR","PA","PR","PW","RI","SC","SD","TN","TX","UT","VA","VI","VT","WA","WI","WV","WY"};
 
     static const char *stcities[NUM_STATES] = {

Modified: trunk/extensions/address_standardizer/standard.c
===================================================================
--- trunk/extensions/address_standardizer/standard.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extensions/address_standardizer/standard.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,4 +1,4 @@
-/* -- standard.c 
+/* -- standard.c
 
 interface for the standardizer
 
@@ -43,7 +43,7 @@
 
 #define TERM_AND_LENGTH \
 	*__dest__ = SENTINEL ; \
-	n = strlen(__scan_buf__) 
+	n = strlen(__scan_buf__)
 
 #define RETURN_NEW_MORPH(TOKEN_ARG) \
 	if (!new_morph(__stand_param__,TOKEN_ARG,__scan_buf__,n))\
@@ -53,7 +53,7 @@
 	return __src__
 
 #define COLLECT_LOOKAHEAD \
-	*__dest__++ = a ; __src__++ ; *__dest__++ = b ; __src__++ 
+	*__dest__++ = a ; __src__++ ; *__dest__++ = b ; __src__++
 
 #define COLLECT_WHILE(COND) \
 	do { *__dest__++ = a ; __src__++ ; a = *__src__ ; } while (COND)
@@ -138,9 +138,9 @@
 		}
 	}
 	return FALSE ;
-}  
+}
 
-static char * _Scan_Next_( STAND_PARAM *__stand_param__,char * __in_ptr__) 
+static char * _Scan_Next_( STAND_PARAM *__stand_param__,char * __in_ptr__)
 {
 	int n ;
 	char __scan_buf__[MAXSTRLEN] ;
@@ -366,7 +366,7 @@
 
 int std_ready_standardizer(STANDARDIZER *std)
 {
-    std -> misc_stand = 
+    std -> misc_stand =
         init_stand_context(std -> pagc_p, std -> err_p, 1);
 
     if (std -> misc_stand == NULL)
@@ -542,7 +542,7 @@
 	<remarks>set up process level, opens the lexicons and rules
 		and default definitions for the tokenizer</remarks>
 	<calls><functionref='(gamma.c) create_rules'/>, <functionref='(lexicon.c) create_lexicon'/>,
-		<functionref='(tokenize.c) setup_default_defs'/> and 
+		<functionref='(tokenize.c) setup_default_defs'/> and
 		<functionref='(analyze.c) install_def_block_table'/></calls>
 </summary>
 =========================================================================*/
@@ -557,13 +557,13 @@
 	{
 		return FALSE ;
 	}
-	if ((__pagc_global__->poi_lexicon = create_lexicon(__pagc_global__ ,__featword_name__ ,NULL)) == NULL) 
+	if ((__pagc_global__->poi_lexicon = create_lexicon(__pagc_global__ ,__featword_name__ ,NULL)) == NULL)
 	{
 		return FALSE ;
 	}
 #ifdef GAZ_LEXICON
 	/*-- <revision date='2012-06-01'> Add gaz_lexicon to be triggered on _start_state_ = MACRO </revision> --*/
-	if ((__pagc_global__->gaz_lexicon = create_lexicon(__pagc_global__,__gazetteer_name__,NULL)) == NULL) 
+	if ((__pagc_global__->gaz_lexicon = create_lexicon(__pagc_global__,__gazetteer_name__,NULL)) == NULL)
 	{
 		return FALSE ;
 	}
@@ -582,7 +582,7 @@
 	<function name='standard.c (close_stand_process)'/>
 	<remarks> Called on exit to close down standardizer </remarks>
 	<calls> <functionref='(tokenize.c) remove_default_defs'/>,
-		<functionref='(gamma.c) destroy_rules'/> and 
+		<functionref='(gamma.c) destroy_rules'/> and
 		<functionref='lexicon.c (destroy_lexicon)'/></calls>
 </summary>
 =========================================================================*/
@@ -604,7 +604,7 @@
 	/*-- <revision date='2012-06-01'> Add gaz_lexicon to be triggered on _start_state_ = MACRO </revision> --*/
 #ifdef GAZ_LEXICON
     DBG("destroy_lexicon(__pagc_global__->gaz_lexicon)");
-	destroy_lexicon(__pagc_global__->gaz_lexicon) ; 
+	destroy_lexicon(__pagc_global__->gaz_lexicon) ;
 #endif
 }
 
@@ -653,9 +653,9 @@
 		<macroref='FREE_AND_NULL'/></calls>
 <summary>
 =========================================================================*/
-void close_stand_context( STAND_PARAM *__stand_param__ ) 
+void close_stand_context( STAND_PARAM *__stand_param__ )
 {
-	if (__stand_param__ == NULL) 
+	if (__stand_param__ == NULL)
 	{
 		return ;
 	}

Modified: trunk/extensions/address_standardizer/std_pg_hash.c
===================================================================
--- trunk/extensions/address_standardizer/std_pg_hash.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extensions/address_standardizer/std_pg_hash.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -210,7 +210,7 @@
 CreateStdHash(void)
 {
     HASHCTL ctl;
-    
+
     ctl.keysize = sizeof(MemoryContext);
     ctl.entrysize = sizeof(StdHashEntry);
     ctl.hash = mcxt_ptr_hash_std;

Modified: trunk/extensions/address_standardizer/test_main.c
===================================================================
--- trunk/extensions/address_standardizer/test_main.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extensions/address_standardizer/test_main.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -147,7 +147,7 @@
         argc -= 2;
         argv += 2;
     }
-    else if (argc != 1) 
+    else if (argc != 1)
         Usage();
 
     std = std_init();
@@ -291,7 +291,7 @@
               MAXSTRLEN ) ;
       input_str[ 0 ] = SENTINEL ;
       /* -- get user's input -- */
-      if ( ( !get_input_line( input_str , stdin ) ) || 
+      if ( ( !get_input_line( input_str , stdin ) ) ||
            ( strncmp( input_str , "exit" , 4 ) == 0 ) ||
            ( strncmp( input_str , "quit" , 4 ) == 0 ) ||
            ( strncmp( input_str , "done" , 4 ) == 0 )

Modified: trunk/extensions/address_standardizer/tokenize.c
===================================================================
--- trunk/extensions/address_standardizer/tokenize.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extensions/address_standardizer/tokenize.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,4 +1,4 @@
-/* -- tokenize.c 
+/* -- tokenize.c
 
 This module takes the lexical scanner's output, possibly recombining
 it, looking it up in the lexicon for possible definitions, preparing
@@ -46,20 +46,20 @@
 static int no_space( LEXEME * , struct morph * ) ;
 static int process_lexeme( STAND_PARAM * , int , int ) ;
 static int is_route( ENTRY * ) ;
-static int is_direction_letter( LEXEME * , LEXEME *, struct morph * ,DEF **, char * ) ; 
+static int is_direction_letter( LEXEME * , LEXEME *, struct morph * ,DEF **, char * ) ;
 #ifdef EXPRESS_ORDINALS
 static int is_ordinal_suffix( LEXEME * , LEXEME *, struct morph * ,DEF **, char * ) ;
 #endif
-static int is_zip( STAND_PARAM * , DEF ** , struct morph * ) ; 
-static void fix_mixed( STAND_PARAM * , DEF **, struct morph * ) ; 
-static void reunite_mixed( STAND_PARAM * , DEF ** , struct morph * , char * ) ; 
-static void mark_hyphen_unit( int , LEXEME * , struct morph * , DEF ** ) ; 
-static void numeric_tail( STAND_PARAM * , DEF ** , struct morph *, char * ) ; 
-static DEF *new_defs( struct morph * , DEF ** , ENTRY * , int , char * ) ; 
-static int set_lexeme( STAND_PARAM *, int , int , DEF *, char * ) ; 
-static void reset_lexeme( LEXEME * ) ; 
+static int is_zip( STAND_PARAM * , DEF ** , struct morph * ) ;
+static void fix_mixed( STAND_PARAM * , DEF **, struct morph * ) ;
+static void reunite_mixed( STAND_PARAM * , DEF ** , struct morph * , char * ) ;
+static void mark_hyphen_unit( int , LEXEME * , struct morph * , DEF ** ) ;
+static void numeric_tail( STAND_PARAM * , DEF ** , struct morph *, char * ) ;
+static DEF *new_defs( struct morph * , DEF ** , ENTRY * , int , char * ) ;
+static int set_lexeme( STAND_PARAM *, int , int , DEF *, char * ) ;
+static void reset_lexeme( LEXEME * ) ;
 static void combine_lexemes( STAND_PARAM * , struct morph * , DEF * ) ;
-static int phrase_from_morphs( struct morph * , char * , int  , int ) ; 
+static int phrase_from_morphs( struct morph * , char * , int  , int ) ;
 
 #define MAKE_DEFAULT_DEF_FIRST(DTOKEN,TOKEN) \
    if ( ( glo_p -> default_def[DTOKEN] = create_def(TOKEN,NULL,0,TRUE,glo_p->process_errors) ) == NULL) \
@@ -133,8 +133,8 @@
 return FALSE on error (too many lexemes)
 calls tokenize.c (process_lexeme)
 --------------------------------------------------------- */
-int process_input( STAND_PARAM *s_p ) { 
-  /* -- process all the morphs not yet made into lexemes 
+int process_input( STAND_PARAM *s_p ) {
+  /* -- process all the morphs not yet made into lexemes
      -- called by scanner -- */
 
 
@@ -147,7 +147,7 @@
      if ( s_p -> base_morph == ERR_FAIL ) {
         return FALSE ;
      }
-     s_p -> LexNum++ ; 
+     s_p -> LexNum++ ;
   }
   return TRUE ;
 }
@@ -161,16 +161,16 @@
 calls tokenize.c (next_morph)
 uses macros CLIENT_ERR, RET_ERR1
 --------------------------------------------------------- */
-int new_morph( STAND_PARAM *s_p , 
+int new_morph( STAND_PARAM *s_p ,
                DEFDEF t ,
                const char *s ,
                int length ) {
-   struct morph *morph_vector; 
-   int i , j ; 
+   struct morph *morph_vector;
+   int i , j ;
 
-   morph_vector = s_p -> morph_array ; 
+   morph_vector = s_p -> morph_array ;
    /* -- called by scanner to do one morpheme -- */
-   i = s_p -> cur_morph ; 
+   i = s_p -> cur_morph ;
    j = s_p -> base_morph ;
 
    if ( length >= MAXTEXT ) {
@@ -181,15 +181,15 @@
                 FALSE) ;
    }
 
-   morph_vector[ i ]. Term = 0 ; 
-   morph_vector[ i ] . Sym = t ; 
+   morph_vector[ i ]. Term = 0 ;
+   morph_vector[ i ] . Sym = t ;
    /* -- Lexicon is in upper case - we need to match. -- */
-   upper_case( morph_vector[ i ] . Text , 
+   upper_case( morph_vector[ i ] . Text ,
                s ) ;
-   morph_vector[ i ] . TextLen = length ; 
+   morph_vector[ i ] . TextLen = length ;
 
    /* -- Is it time to look for a phrase? -- */
-   
+
    if ( i == ( j + MAXPHRASE - 1 ) ) {
       if ( ( s_p -> base_morph = process_lexeme( s_p ,
                                                  i ,
@@ -199,7 +199,7 @@
       }
       s_p -> LexNum++ ;
    }
-   return ( next_morph( s_p ) ) ; 
+   return ( next_morph( s_p ) ) ;
 }
 
 /*-----------------------------------------------------
@@ -209,7 +209,7 @@
 return FALSE if too many
 uses macros CLIENT_ERR, RET_ERR
 ------------------------------------------------------*/
-static int next_morph( STAND_PARAM *s_p ) { 
+static int next_morph( STAND_PARAM *s_p ) {
    if ( s_p -> cur_morph++ > MAXMORPHS ) {
       CLIENT_ERR( s_p -> errors ) ;
       RET_ERR( "next_morph: Too many morphemes in input",
@@ -224,7 +224,7 @@
 called by standard.l (yylex)
 adds a terminator to a morph
 ------------------------------------------------------*/
-void set_term( STAND_PARAM *s_p , 
+void set_term( STAND_PARAM *s_p ,
                int c ,
                const char *s ) {
 
@@ -250,13 +250,13 @@
 tokenize.c (no_space)
 called by tokenize.c (reunite_mixed, is_direction_letter)
 --------------------------------------------------------*/
-static int no_space( LEXEME *lex_p , 
+static int no_space( LEXEME *lex_p ,
                      struct morph *morph_p  ) {
    int k ;
 
-   k = lex_p -> EndMorph ; 
-   return ( ( ( morph_p + k ) -> Term == 0 )? 
-              TRUE : 
+   k = lex_p -> EndMorph ;
+   return ( ( ( morph_p + k ) -> Term == 0 )?
+              TRUE :
               FALSE ) ;
 }
 
@@ -271,7 +271,7 @@
    s_p -> cur_morph = 0 ;
    s_p -> base_morph = 0 ;
    s_p -> LexNum = 0 ;
-   for ( i = FIRST_LEX_POS ; 
+   for ( i = FIRST_LEX_POS ;
          i < MAXLEX ;
          i++ ) {
       reset_lexeme( s_p -> lex_vector + i ) ;
@@ -288,27 +288,27 @@
 MACROS: BLANK_STRING
 string.h (strncmp)
 -----------------------------------------------------------*/
-static int process_lexeme( STAND_PARAM *s_p , 
-                           int cur_m, 
+static int process_lexeme( STAND_PARAM *s_p ,
+                           int cur_m,
                            int base_m ) {
    int Ceiling ;
    ENTRY *cur_entry ;
    char LTarget[ MAXSTRLEN ] ;
-   struct morph *morph_ptr ; 
-   DEF **d_p ; 
+   struct morph *morph_ptr ;
+   DEF **d_p ;
    LEXEME *lex_p ;
 
-   d_p = s_p -> default_def ; 
-   morph_ptr = s_p -> morph_array ; 
+   d_p = s_p -> default_def ;
+   morph_ptr = s_p -> morph_array ;
    BLANK_STRING(LTarget) ;
    cur_entry = NULL ;
-   for ( Ceiling = cur_m ; 
-         Ceiling >= base_m ; 
+   for ( Ceiling = cur_m ;
+         Ceiling >= base_m ;
          Ceiling-- ) {
       /* -- Combine the morphs into a phrase from cur_morph to Ceiling -- */
-      Ceiling = phrase_from_morphs( morph_ptr , 
-                                    LTarget, 
-                                    base_m, 
+      Ceiling = phrase_from_morphs( morph_ptr ,
+                                    LTarget,
+                                    base_m,
                                     Ceiling ) ;
 
       if ( ( cur_entry = find_entry( s_p -> lexicon , /* 2007-11-20 hash table */
@@ -317,23 +317,23 @@
             necessary to establish that the entry does not subsume a
             more appropriate entry. -- */
 
-         lex_p = s_p -> lex_vector + s_p -> LexNum - 1 ; 
+         lex_p = s_p -> lex_vector + s_p -> LexNum - 1 ;
          if ( ( Ceiling > base_m ) &&
               ( base_m > 0 ) &&
-              ( !strncmp( LTarget, 
-                          "ST ", 
+              ( !strncmp( LTarget,
+                          "ST ",
                           3 ) ) ) {
             /* -- have we preempted street or saint by state? -- */
             /* -- and what about at the end of the address? -- */
             if ( is_route( cur_entry ) ) {
-               if ( find_def_type( lex_p -> DefList, 
+               if ( find_def_type( lex_p -> DefList,
                                    precedes_route_list ) ) {
                  /* -- if the previous lexeme is any of the categories
                     on precedes_route_list, we're okay -- */
                   break ;
                }
                /* -- reject if preceded by a number -- */
-               if ( find_def_type( lex_p -> DefList , 
+               if ( find_def_type( lex_p -> DefList ,
                                    NumberL ) )
 
                   continue ;
@@ -351,11 +351,11 @@
       add the new lexeme to the list -- */
 
    /* -- pass LTarget to new_defs -- */
-   if ( !set_lexeme( s_p , 
+   if ( !set_lexeme( s_p ,
                      base_m,
                      Ceiling,
-                     new_defs( morph_ptr , 
-                               d_p , 
+                     new_defs( morph_ptr ,
+                               d_p ,
                                cur_entry,
                                base_m ,
                                LTarget ),
@@ -363,18 +363,18 @@
        return ERR_FAIL ;
    }
    /* -- Handle reactants and reunite broken alphanumeric strings -- */
-   reunite_mixed( s_p , 
-                  d_p , 
-                  morph_ptr , 
+   reunite_mixed( s_p ,
+                  d_p ,
+                  morph_ptr ,
                   LTarget ) ;
 
-   mark_hyphen_unit( s_p -> LexNum , 
-                     s_p -> lex_vector , 
-                     morph_ptr , 
+   mark_hyphen_unit( s_p -> LexNum ,
+                     s_p -> lex_vector ,
+                     morph_ptr ,
                      d_p  ) ;
    /* -- return position of next unprocessed morpheme -- */
    return ( Ceiling + 1 ) ;
-}  
+}
 
 /*-----------------------------------------------------
 tokenize.c (is_route)
@@ -401,15 +401,15 @@
 call tokenize.c (no_space)
 string.h (strlen)
 ------------------------------------------------------*/
-static int is_direction_letter( LEXEME *cur_lex_p , 
-                                LEXEME *prev_lex_p , 
+static int is_direction_letter( LEXEME *cur_lex_p ,
+                                LEXEME *prev_lex_p ,
                                 struct morph *morph_p ,
-                                DEF **d_p , 
+                                DEF **d_p ,
                                 char *LT ) {
    char c ;
 
    if ( ( strlen( LT ) == 1 ) &&
-        ( no_space( prev_lex_p, 
+        ( no_space( prev_lex_p,
                     morph_p   ) ) ) {
        c = *LT ;
        switch ( c ) {
@@ -427,17 +427,17 @@
 }
 
 #ifdef EXPRESS_ORDINALS
-static int is_ordinal_suffix( LEXEME *cur_lex_p , 
+static int is_ordinal_suffix( LEXEME *cur_lex_p ,
                               LEXEME *prev_lex_p ,
                               struct morph *morph_p ,
                               DEF **d_p ,
                               char *LT ) {
    int prev_len ;
-   char Ult, 
+   char Ult,
         Penult ;
 
    if ( ( strlen( LT ) != 2 ) ||
-        ( no_space( prev_lex_p, 
+        ( no_space( prev_lex_p,
                     morph_p   ) ) ) {
       return FALSE ;
    }
@@ -487,8 +487,8 @@
 calls tokenize.c (combine_lexemes, no_space, find_def_type)
 string.h (strlen) ctype.h (isalpha,isdigit)
 -----------------------------------------------------------*/
-static int is_zip( STAND_PARAM *s_p , 
-                   DEF **d_p , 
+static int is_zip( STAND_PARAM *s_p ,
+                   DEF **d_p ,
                    struct morph *morph_p  ) {
    /* -- Canadian Postal Code and US zip code -
       called by reunite_mixed -- */
@@ -496,12 +496,12 @@
    char *cur_txt ;
    int alt_state ;
    int tl ;
-   LEXEME *cur_lex_p ; 
+   LEXEME *cur_lex_p ;
 
-   cur_lex_p = s_p -> lex_vector + s_p -> LexNum ; 
-   cur_txt = cur_lex_p -> Text ; 
+   cur_lex_p = s_p -> lex_vector + s_p -> LexNum ;
+   cur_txt = cur_lex_p -> Text ;
    tl = strlen( cur_txt ) ;
-   if ( ( find_def_type( cur_lex_p -> DefList, 
+   if ( ( find_def_type( cur_lex_p -> DefList,
                          NumberL ) ) &&
         ( tl > 3 ) ) {
       /* -- US Zip code -- */
@@ -509,17 +509,17 @@
          return FALSE ;
       }
       if ( isalpha( *cur_txt ) ) {
- 
+
          return FALSE ;
       }
-      d = ( ( tl == 4 )? DZIPT : 
+      d = ( ( tl == 4 )? DZIPT :
                          DZIPH ) ;
-      cur_lex_p -> DefList = d_p[ d ] ; 
+      cur_lex_p -> DefList = d_p[ d ] ;
       return TRUE ;
    }
 
    /* -- Canadian postal codes -- */
-   if ( s_p -> LexNum < 2 ) { 
+   if ( s_p -> LexNum < 2 ) {
       return FALSE ;
    }
    if ( tl != 1 ) {
@@ -535,14 +535,14 @@
       }
    }
    cur_lex_p-- ;
-   cur_txt = cur_lex_p -> Text ; 
-   if ( !no_space( cur_lex_p , 
+   cur_txt = cur_lex_p -> Text ;
+   if ( !no_space( cur_lex_p ,
                    morph_p  ) ) {
       return FALSE ;
    }
    /* -- First check if lexeme created for Mixed, with a
       length of 2 on the last pass -- */
-   if ( find_def_type( cur_lex_p -> DefList , 
+   if ( find_def_type( cur_lex_p -> DefList ,
                        MixedL ) ) {
 
       if ( strlen( cur_txt ) != 2 ) {
@@ -569,9 +569,9 @@
          }
       }
       /* -- if it ends with a digit, it's the tail -- */
-      d = ( ( alt_state ) ? DPOSTT : 
+      d = ( ( alt_state ) ? DPOSTT :
                             DPOSTH ) ;
-      combine_lexemes( s_p , 
+      combine_lexemes( s_p ,
                        morph_p ,
                        d_p[ d ]  ) ;
       return TRUE;
@@ -593,8 +593,8 @@
       }
    }
 
-   cur_lex_p -- ; 
-   cur_txt = cur_lex_p -> Text ; 
+   cur_lex_p -- ;
+   cur_txt = cur_lex_p -> Text ;
 
    /* -- Now look for a character, not followed by a space, which must be
       a number if the current character is a number, and a letter if the
@@ -602,7 +602,7 @@
    if ( strlen( cur_txt ) != 1 ) {
       return FALSE;
    }
-   if ( !no_space( cur_lex_p , 
+   if ( !no_space( cur_lex_p ,
                    morph_p  ) ) {
       return FALSE;
    }
@@ -616,12 +616,12 @@
 
    /* -- if it ends with a digit, it's the tail -- */
 
-   d = ( ( alt_state ) ? DPOSTT : 
+   d = ( ( alt_state ) ? DPOSTT :
                          DPOSTH ) ;
-   combine_lexemes( s_p , 
-                    morph_p , 
+   combine_lexemes( s_p ,
+                    morph_p ,
                     d_p[ d ]  ) ;
-   combine_lexemes( s_p , 
+   combine_lexemes( s_p ,
                     morph_p  ,
                     d_p[ d ]  ) ;
    return TRUE ;
@@ -632,24 +632,24 @@
 called by tokenize.c (reunite_mixed)
 calls tokenize.c (combine_lexemes, no_space, find_def_type)
 ----------------------------------------------------------*/
-static void fix_mixed( STAND_PARAM *s_p , 
-                       DEF **d_p , 
+static void fix_mixed( STAND_PARAM *s_p ,
+                       DEF **d_p ,
                        struct morph *morph_p  ) {
    /* -- recombine alphabet sequences and numeric sequences split apart by
       the lexical scanner - but only if they form an identifier. -- */
-   LEXEME *cur_lex_p, *prev_lex_p ; 
+   LEXEME *cur_lex_p, *prev_lex_p ;
 
 
-   cur_lex_p = s_p -> lex_vector + s_p -> LexNum ; 
-   prev_lex_p = cur_lex_p - 1 ; 
+   cur_lex_p = s_p -> lex_vector + s_p -> LexNum ;
+   prev_lex_p = cur_lex_p - 1 ;
 
-   if ( s_p -> LexNum < 2 ) 
+   if ( s_p -> LexNum < 2 )
       return ;
-   if ( !no_space( prev_lex_p , 
+   if ( !no_space( prev_lex_p ,
                    morph_p  ) ) {
       return ;
    }
-   if ( !find_def_type( cur_lex_p -> DefList ,  
+   if ( !find_def_type( cur_lex_p -> DefList ,
                         mixed_components ) ) {
       return ;
    }
@@ -658,41 +658,41 @@
       preceding it. If the previous item was mixed and not a postal code,
       then we'll just merge this one in right away. -- */
 
-   if ( find_def_type( prev_lex_p -> DefList , 
+   if ( find_def_type( prev_lex_p -> DefList ,
                        MixedL ) &&
-        !find_def_type( prev_lex_p -> DefList , 
+        !find_def_type( prev_lex_p -> DefList ,
                         PostalL ) ) {
       /* -- if the previous item is mixed and not a postal code -- */
 
-      combine_lexemes( s_p , 
-                       morph_p , 
+      combine_lexemes( s_p ,
+                       morph_p ,
                        d_p[ DMIXED ]  ) ;
       return ;
    }
 
    /* -- The previous lexeme must be of the right kind to do a mix -- */
-   if ( !find_def_type( prev_lex_p -> DefList , 
+   if ( !find_def_type( prev_lex_p -> DefList ,
                       mixed_components ) ) {
       return ;
    }
    /* -- If a road comes before a mixed, it might also be a PROV -- */
-   if ( find_def_type( prev_lex_p -> DefList ,  
+   if ( find_def_type( prev_lex_p -> DefList ,
                      RoadL ) &&
-        !find_def_type( prev_lex_p -> DefList , 
+        !find_def_type( prev_lex_p -> DefList ,
                       ProvL ) ) {
       return ;
    }
 
    /* -- a mixed identifier only follows certain types -- */
 
-   prev_lex_p -- ; 
-   if ( !find_def_type( prev_lex_p -> DefList , 
+   prev_lex_p -- ;
+   if ( !find_def_type( prev_lex_p -> DefList ,
                         precedes_identifier_list ) ) {
       return ;
    }
 
-   combine_lexemes( s_p , 
-                    morph_p , 
+   combine_lexemes( s_p ,
+                    morph_p ,
                     d_p[ DMIXED ]  ) ;
    return ;
 }
@@ -702,26 +702,26 @@
 called by tokenize.c (process_lexeme)
 calls tokenize.c (is_zip, numeric_tail, fix_mixed)
 ------------------------------------------------------*/
-static void reunite_mixed( STAND_PARAM *s_p , 
-                           DEF **d_p , 
-                           struct morph *morph_p , 
+static void reunite_mixed( STAND_PARAM *s_p ,
+                           DEF **d_p ,
+                           struct morph *morph_p ,
                            char *LT ) {
    /* -- called by process_lexeme -- */
 
-   if ( is_zip( s_p , 
+   if ( is_zip( s_p ,
                 d_p ,
                 morph_p  ) ) {
       return ; /* -- handle postal and zip codes -- */
    }
-   
-   numeric_tail( s_p , 
-                 d_p , 
-                 morph_p , 
+
+   numeric_tail( s_p ,
+                 d_p ,
+                 morph_p ,
                  LT ) ;
 
 
-   fix_mixed( s_p , 
-              d_p , 
+   fix_mixed( s_p ,
+              d_p ,
               morph_p ) ; /* -- handle mixed identifiers -- */
 }
 
@@ -730,30 +730,30 @@
 called by tokenize.c (process_lexeme)
 calls tokenize.c (find_def_type)
 ------------------------------------------------------*/
-static void mark_hyphen_unit( int n , 
-                              LEXEME *lex_p , 
-                              struct morph *morph_p , 
+static void mark_hyphen_unit( int n ,
+                              LEXEME *lex_p ,
+                              struct morph *morph_p ,
                               DEF **def_ptr  ) {
 
    /* -- if the current lexeme is the second and the previous is terminated
       by a hyphen and both are numbers, redefine the previous lexeme to
       be a unittail. -- */
 
-   LEXEME *cur_lex_p ; 
+   LEXEME *cur_lex_p ;
 
-   cur_lex_p = lex_p + n ; 
-   if ( ( n != 1 ) || 
-        ( !find_def_type( ( cur_lex_p ) -> DefList , 
+   cur_lex_p = lex_p + n ;
+   if ( ( n != 1 ) ||
+        ( !find_def_type( ( cur_lex_p ) -> DefList ,
                           NumberL ) ) ||
-        ( !find_def_type( ( cur_lex_p - 1 ) -> DefList, 
+        ( !find_def_type( ( cur_lex_p - 1 ) -> DefList,
                           NumberL ) ) ) {
       return ;
    }
-   
-   cur_lex_p -- ; 
+
+   cur_lex_p -- ;
    if ( ( morph_p + ( cur_lex_p  -> EndMorph  ) ) -> Term == 3  ) {
       /* -- overwrite the old deflist -- */
-      cur_lex_p -> DefList = def_ptr[DUNIT] ;  
+      cur_lex_p -> DefList = def_ptr[DUNIT] ;
    }
 }
 
@@ -763,52 +763,52 @@
 called by tokenize.c (reunite_mixed )
 calls tokenize.c (combine_lexemes, find_def_type, is_direction_letter)
 ----------------------------------------------------------------------*/
-static void numeric_tail( STAND_PARAM *s_p , 
-                          DEF **d_p , 
-                          struct morph *morph_p , 
+static void numeric_tail( STAND_PARAM *s_p ,
+                          DEF **d_p ,
+                          struct morph *morph_p ,
                           char *LT ) {
 
    /* -- all subsequent items follow a number -- */
    int n ;
-   LEXEME *prev_lex_p , *cur_lex_p ; 
+   LEXEME *prev_lex_p , *cur_lex_p ;
 
 
-   n = s_p -> LexNum ; 
+   n = s_p -> LexNum ;
    if ( n < 1 )
       return  ;
-   cur_lex_p = s_p -> lex_vector + n ; 
-   prev_lex_p = cur_lex_p - 1 ; 
-   if ( !find_def_type( prev_lex_p -> DefList , 
+   cur_lex_p = s_p -> lex_vector + n ;
+   prev_lex_p = cur_lex_p - 1 ;
+   if ( !find_def_type( prev_lex_p -> DefList ,
                         NumberL ) ) {
       return ;
    }
-   if ( is_direction_letter( cur_lex_p , 
-                             prev_lex_p , 
-                             morph_p , 
-                             d_p , 
+   if ( is_direction_letter( cur_lex_p ,
+                             prev_lex_p ,
+                             morph_p ,
+                             d_p ,
                              LT ) ) {
       return ;
    }
 
 #ifdef COMBINE_FRACTS_WITH_NUMBS
-   if ( find_def_type( cur_lex_p -> DefList , 
+   if ( find_def_type( cur_lex_p -> DefList ,
                        FractL ) ) {
 
-      combine_lexemes( s_p , 
-                       morph_p , 
+      combine_lexemes( s_p ,
+                       morph_p ,
                        d_p[ DNUMBER ] )  ;
       return ;
    }
 #endif
 
 #ifdef EXPRESS_ORDINALS
-   if ( is_ordinal_suffix( cur_lex_p , 
+   if ( is_ordinal_suffix( cur_lex_p ,
                            prev_lex_p ,
                            morph_p ,
                            d_p ,
                            LT ) ) {
-      combine_lexemes( s_p , 
-                       morph_p , 
+      combine_lexemes( s_p ,
+                       morph_p ,
                        d_p[ DORD ] ) ;
       return ;
    }
@@ -821,8 +821,8 @@
 called by tokenize.c (process_lexemes)
 MACROS: BLANK_STRING
 ------------------------------------------------------*/
-static DEF *new_defs( struct morph *morph_p , 
-                      DEF **d_p , 
+static DEF *new_defs( struct morph *morph_p ,
+                      DEF **d_p ,
                       ENTRY *Cur ,
                       int pos ,
                       char *LTarget ) {
@@ -834,7 +834,7 @@
       check context - but implementation has all sorts of pitfalls - maybe
       later -- */
 
-   s = ( morph_p + pos ) -> Sym ; 
+   s = ( morph_p + pos ) -> Sym ;
 
    if ( Cur != NULL ) {
       return( Cur -> DefList );
@@ -843,25 +843,25 @@
       the Target is copied into the lexeme -- */
 
 #ifndef EXPRESS_ORDINALS
-   if ( s == DORD ) { 
+   if ( s == DORD ) {
       /* -- remove the suffix -- */
       BLANK_STRING((LTarget + strlen(LTarget) - 2)) ;
    }
 #endif
 
    /* -- if no entry was found, just use the default list -- */
-   return ( d_p[ s ]  ) ; 
+   return ( d_p[ s ]  ) ;
 }
 
 /*-----------------------------------------------------
 tokenize.c (is_symb_on_list)
 called by tokenize.c (find_def_type, is_route)
 ------------------------------------------------------*/
-int is_symb_on_list( SYMB a , 
+int is_symb_on_list( SYMB a ,
                      SYMB *List ) {
    SYMB *s ;
-   for ( s = List ; 
-         *s != FAIL ; 
+   for ( s = List ;
+         *s != FAIL ;
          s++ )
       if ( *s == a )
          return TRUE ;
@@ -876,11 +876,11 @@
 called by tokenize.c (process_lexeme etc)
 return TRUE if found
 ------------------------------------------------------*/
-int find_def_type( DEF *df , 
+int find_def_type( DEF *df ,
                    SYMB *slist ) {
    DEF *d ;
 
-   for ( d = df ; 
+   for ( d = df ;
          d != NULL ;
          d = d -> Next )
      if ( is_symb_on_list( d -> Type ,
@@ -892,27 +892,27 @@
 /*-----------------------------------------------------
 tokenize.c (set_lexeme)
 called by tokenize.c (process_lexeme)
-MACROS: CLIENT_ERR, RET_ERR1 
+MACROS: CLIENT_ERR, RET_ERR1
 string.h (strcpy)
 ------------------------------------------------------*/
-static int set_lexeme( STAND_PARAM *s_p , 
+static int set_lexeme( STAND_PARAM *s_p ,
                        int Start ,
-                       int End , 
+                       int End ,
                        DEF *start_def ,
                        char *text ) {
    LEXEME *L ;
-   int n ; 
+   int n ;
 
    /* -- we need a limit -- */
-   if ( ( n = s_p -> LexNum ) >= MAXLEX ) { 
+   if ( ( n = s_p -> LexNum ) >= MAXLEX ) {
       CLIENT_ERR( s_p -> errors ) ;
       RET_ERR1( "set_lexeme: %s is one too many lexemes" ,
                 text ,
                 s_p -> errors ,
                 FALSE ) ;
    }
-   L = s_p -> lex_vector + n ; 
-   strcpy( L -> Text , 
+   L = s_p -> lex_vector + n ;
+   strcpy( L -> Text ,
            text ) ;
    L -> DefList = start_def ;
    L -> StartMorph = Start ;
@@ -925,14 +925,14 @@
 called by tokenize.c (combine_lexemes, initialize_morphs)
 NULL out the lexeme's text buffer
 --------------------------------------------------------*/
-static void reset_lexeme( LEXEME *lex_p ) { 
+static void reset_lexeme( LEXEME *lex_p ) {
    int i ;
    char *s ;
 
-   lex_p -> DefList = NULL ; 
-   s = lex_p -> Text ; 
-   for ( i = 0 ; 
-         i < MAXTEXT ; 
+   lex_p -> DefList = NULL ;
+   s = lex_p -> Text ;
+   for ( i = 0 ;
+         i < MAXTEXT ;
          i++ ) {
       *( s + i ) = SENTINEL ;
    }
@@ -943,26 +943,26 @@
 called by tokenize.c (is_zip, fix_mixed , numeric tail)
 calls tokenize.c (phrase_from_morphs, reset_lexeme)
 ------------------------------------------------------*/
-static void combine_lexemes( STAND_PARAM *s_p , 
-                             struct morph * morph_p , 
+static void combine_lexemes( STAND_PARAM *s_p ,
+                             struct morph * morph_p ,
                              DEF *d ) {
    /* -- combine the current Lexeme with the previous one -- */
-    LEXEME *CurLexVector, *PrevLexVector ; 
+    LEXEME *CurLexVector, *PrevLexVector ;
 
     /* -- find the two lexemes to combine -- */
-    CurLexVector = s_p -> lex_vector + s_p -> LexNum ; 
-    PrevLexVector = CurLexVector - 1 ; 
-    PrevLexVector -> EndMorph = CurLexVector -> EndMorph ; /* the new end */ 
-    PrevLexVector -> Text[ 0 ] = SENTINEL ; 
+    CurLexVector = s_p -> lex_vector + s_p -> LexNum ;
+    PrevLexVector = CurLexVector - 1 ;
+    PrevLexVector -> EndMorph = CurLexVector -> EndMorph ; /* the new end */
+    PrevLexVector -> Text[ 0 ] = SENTINEL ;
 
-    phrase_from_morphs( morph_p , 
-                            PrevLexVector -> Text , 
-                            PrevLexVector -> StartMorph , 
-                            PrevLexVector -> EndMorph ) ; 
-    
+    phrase_from_morphs( morph_p ,
+                            PrevLexVector -> Text ,
+                            PrevLexVector -> StartMorph ,
+                            PrevLexVector -> EndMorph ) ;
+
     PrevLexVector -> DefList = d ; /* - overwrite old deflist -- */
-    reset_lexeme( CurLexVector ) ; 
-    s_p -> LexNum-- ; 
+    reset_lexeme( CurLexVector ) ;
+    s_p -> LexNum-- ;
 }
 
 /*--------------------------------------------------------
@@ -971,28 +971,28 @@
 concatenate the morph strings into a single string
 uses macro BLANK_STRING
 ---------------------------------------------------------*/
-static int phrase_from_morphs( struct morph *morph_vector , 
-                               char *Dest , 
-                               int beg , 
+static int phrase_from_morphs( struct morph *morph_vector ,
+                               char *Dest ,
+                               int beg ,
                                int end ) {
-   int i , 
+   int i ,
        a ;
 
-   BLANK_STRING(Dest) ; 
+   BLANK_STRING(Dest) ;
    strcpy( Dest ,
            morph_vector[ beg ] . Text ) ;
-   for ( i = beg + 1 ; 
-         i <= end ; 
+   for ( i = beg + 1 ;
+         i <= end ;
          i++ ) {
       /* -- No breaks in the middle of a phrase -- */
-      
+
       a = morph_vector[ i - 1 ] . Term ;
       if ( a == 1 )
          return ( i - 1 ) ; /* -- indicate last morph used -- */
       if ( a > 1 ) {
          append_string_to_max( Dest ,
                                " " ,
-                               MAXSTRLEN ) ; 
+                               MAXSTRLEN ) ;
       }
       append_string_to_max( Dest,
                             morph_vector[ i ] . Text ,

Modified: trunk/extensions/address_standardizer/us_gaz.sql
===================================================================
--- trunk/extensions/address_standardizer/us_gaz.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extensions/address_standardizer/us_gaz.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -3,7 +3,7 @@
     seq integer,
     word text,
     stdword text,
-    token integer, is_custom boolean NOT NULL DEFAULT true, CONSTRAINT pk_us_gaz PRIMARY KEY(id) 
+    token integer, is_custom boolean NOT NULL DEFAULT true, CONSTRAINT pk_us_gaz PRIMARY KEY(id)
 );
 
 -- this will be needed for upgrading to prevent purging of custom entries

Modified: trunk/extensions/address_standardizer/us_lex.sql
===================================================================
--- trunk/extensions/address_standardizer/us_lex.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extensions/address_standardizer/us_lex.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -3,7 +3,7 @@
     seq integer,
     word text,
     stdword text,
-    token integer, is_custom boolean NOT NULL DEFAULT true, CONSTRAINT pk_us_lex PRIMARY KEY(id) 
+    token integer, is_custom boolean NOT NULL DEFAULT true, CONSTRAINT pk_us_lex PRIMARY KEY(id)
 );
 
 -- this will be needed for upgrading to prevent purging of custom entries

Modified: trunk/extensions/address_standardizer/us_rules.sql
===================================================================
--- trunk/extensions/address_standardizer/us_rules.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extensions/address_standardizer/us_rules.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,5 +1,5 @@
 CREATE TABLE IF NOT EXISTS us_rules (
-    id serial, rule text, is_custom boolean NOT NULL DEFAULT true, CONSTRAINT pk_us_rules PRIMARY KEY(id) 
+    id serial, rule text, is_custom boolean NOT NULL DEFAULT true, CONSTRAINT pk_us_rules PRIMARY KEY(id)
 );
 
 -- this will be needed for upgrading to prevent purging of custom entries

Modified: trunk/extensions/postgis_extension_helper.sql
===================================================================
--- trunk/extensions/postgis_extension_helper.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extensions/postgis_extension_helper.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,5 +1,5 @@
 -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
--- 
+--
 ----
 -- PostGIS - Spatial Types for PostgreSQL
 -- http://postgis.net
@@ -10,7 +10,7 @@
 -- the terms of the GNU General Public Licence. See the COPYING file.
 --
 -- Author: Regina Obe <lr at pcorp.us>
---  
+--
 -- This is a suite of SQL helper functions for use during a PostGIS extension install/upgrade
 -- The functions get uninstalled after the extention install/upgrade process
 ---------------------------
@@ -21,7 +21,7 @@
 CREATE OR REPLACE FUNCTION postgis_extension_remove_objects(param_extension text, param_type text)
   RETURNS boolean AS
 $$
-DECLARE 
+DECLARE
 	var_sql text := '';
 	var_r record;
 	var_result boolean := false;
@@ -29,9 +29,9 @@
 	var_is_aggregate boolean := false;
 	var_sql_list text := '';
 BEGIN
-		var_class := CASE WHEN lower(param_type) = 'function' OR lower(param_type) = 'aggregate' THEN 'pg_proc' ELSE '' END; 
+		var_class := CASE WHEN lower(param_type) = 'function' OR lower(param_type) = 'aggregate' THEN 'pg_proc' ELSE '' END;
 		var_is_aggregate := CASE WHEN lower(param_type) = 'aggregate' THEN true ELSE false END;
-		var_sql_list := 'SELECT ''ALTER EXTENSION '' || e.extname || '' DROP '' || $3 || '' '' || COALESCE(proc.proname || ''('' || oidvectortypes(proc.proargtypes) || '')'',typ.typname, cd.relname, op.oprname, 
+		var_sql_list := 'SELECT ''ALTER EXTENSION '' || e.extname || '' DROP '' || $3 || '' '' || COALESCE(proc.proname || ''('' || oidvectortypes(proc.proargtypes) || '')'',typ.typname, cd.relname, op.oprname,
 				cs.typname || '' AS '' || ct.typname || '') '', opcname, opfname) || '';'' AS remove_command
 		FROM pg_depend As d INNER JOIN pg_extension As e
 			ON d.refobjid = e.oid INNER JOIN pg_class As c ON
@@ -62,7 +62,7 @@
 CREATE OR REPLACE FUNCTION postgis_extension_drop_if_exists(param_extension text, param_statement text)
   RETURNS boolean AS
 $$
-DECLARE 
+DECLARE
 	var_sql_ext text := 'ALTER EXTENSION ' || quote_ident(param_extension) || ' ' || replace(param_statement, 'IF EXISTS', '');
 	var_result boolean := false;
 BEGIN
@@ -92,14 +92,14 @@
 		var_result := a_schema_name || ' already in database search_path';
 	ELSE
 		var_cur_search_path := var_cur_search_path || ', '
-                        || quote_ident(a_schema_name); 
+                        || quote_ident(a_schema_name);
 		EXECUTE 'ALTER DATABASE ' || quote_ident(current_database())
                               || ' SET search_path = ' || var_cur_search_path;
 		var_result := a_schema_name || ' has been added to end of database search_path ';
 	END IF;
 
 	EXECUTE 'SET search_path = ' || var_cur_search_path;
-  
+
   RETURN var_result;
 END
 $$

Modified: trunk/extensions/postgis_extension_helper_uninstall.sql
===================================================================
--- trunk/extensions/postgis_extension_helper_uninstall.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extensions/postgis_extension_helper_uninstall.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,5 +1,5 @@
 -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
--- 
+--
 ----
 -- PostGIS - Spatial Types for PostgreSQL
 -- http://postgis.net
@@ -10,7 +10,7 @@
 -- the terms of the GNU General Public Licence. See the COPYING file.
 --
 -- Author: Regina Obe <lr at pcorp.us>
---  
+--
 -- This drops extension helper functions
 -- and should be called at the end of the extension upgrade file
 DROP FUNCTION postgis_extension_remove_objects(text, text);

Modified: trunk/extras/history_table/history_table.sql
===================================================================
--- trunk/extras/history_table/history_table.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/history_table/history_table.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -37,7 +37,7 @@
 v_table_sql text;
 
 --SQL statement that will perform an update on geometry_columns
-v_update_geometry_sql text; 
+v_update_geometry_sql text;
 
 --SQL statement that will perform an update on historic_tables
 v_update_history_sql text;
@@ -57,7 +57,7 @@
 	--end sql
 	
 	--generate sql for creating the historic table
-	v_table_sql:= 'CREATE TABLE ' || v_history_table || 
+	v_table_sql:= 'CREATE TABLE ' || v_history_table ||
 	'(' ||
 	'history_id serial not null,' ||
 	'date_added timestamp not null default now(),' ||
@@ -83,7 +83,7 @@
 	--insert into historic_tables
 	v_update_history_sql:='INSERT INTO public.historic_information(table_id,table_name,primary_field,geometry_field) VALUES (' ||
 	'DEFAULT,' ||
-	quote_literal(v_history_table) || ',' || 
+	quote_literal(v_history_table) || ',' ||
 	quote_literal(v_gid) || ',' ||
 	quote_literal(p_geometry_field) || ');';
 	--end update historic tables
@@ -121,7 +121,7 @@
 	'INSERT INTO ' || p_schema || '.' || p_table || '_history VALUES(' ||
 	'DEFAULT,' || --history_id nextval()
 	'DEFAULT,' || --date_added now()
-	'NULL,' || --date_deleted 
+	'NULL,' || --date_deleted
 	quote_literal('INSERT') || ',' || --operation
 	'DEFAULT,' ||
 	'NEW.' || p_gid_field || ',' ||
@@ -154,7 +154,7 @@
 	'INSERT INTO ' || p_schema || '.' || p_table || '_history VALUES (' ||
 	'DEFAULT,' || --history_id nextval()
 	'DEFAULT,' || --date_added now()
-	'NULL,' || --date_deleted 
+	'NULL,' || --date_deleted
 	quote_literal('INSERT') || ',' || --operation
 	'DEFAULT,' ||
 	'NEW.' || p_gid_field || ',' ||

Modified: trunk/extras/ogc_test_suite/1_schema.sql
===================================================================
--- trunk/extras/ogc_test_suite/1_schema.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/ogc_test_suite/1_schema.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -9,17 +9,17 @@
 -- The material in this document details an Open GIS Consortium Test Suite in
 -- accordance with a license that your organization has signed. Please refer
 -- to http://www.opengis.org/testing/ to obtain a copy of the general license
--- (it is part of the Conformance Testing Agreement). 
+-- (it is part of the Conformance Testing Agreement).
 --
 --//////////////////////////////////////////////////////////////////////////////
 --
 -- OpenGIS Simple Features for SQL (Types and Functions) Test Suite Software
--- 
+--
 -- This file "sqltsch.sql" is part 1 of a two part standardized test
 -- suite in SQL script form. The other file that is required for this test
 -- suite, "sqltque.sql", one additional script is provided ("sqltcle.sql") that
--- performs cleanup operations between test runs, and other documents that 
--- describe the OGC Conformance Test Program are available via the WWW at 
+-- performs cleanup operations between test runs, and other documents that
+-- describe the OGC Conformance Test Program are available via the WWW at
 -- http://www.opengis.org/testing/index.htm
 --
 -- NOTE CONCERNING INFORMATION ON CONFORMANCE TESTING AND THIS TEST SUITE
@@ -38,11 +38,11 @@
 -- make it work properly. OGC has documented the allowable adaptations within
 -- this test suite where possible. Other information about adaptations may be
 -- discovered in the Test Suite Guidelines document for this test suite.
--- 
+--
 -- PLEASE NOTE THE OGC REQUIRES THAT ADAPTATIONS ARE FULLY DOCUMENTED USING
 -- LIBERAL COMMENT BLOCKS CONFORMING TO THE FOLLOWING FORMAT:
 --
--- -- !#@ ADAPTATION BEGIN 
+-- -- !#@ ADAPTATION BEGIN
 -- explanatory text goes here
 -- ---------------------
 -- -- BEGIN ORIGINAL SQL
@@ -57,7 +57,7 @@
 -- ---------------------
 -- -- END   ADAPTED  SQL
 -- ---------------------
--- -- !#@ ADAPTATION END 
+-- -- !#@ ADAPTATION END
 --
 --//////////////////////////////////////////////////////////////////////////////
 --
@@ -66,18 +66,18 @@
 --//////////////////////////////////////////////////////////////////////////////
 --
 -- Create the neccessary feature and geometry tables(views) and metadata tables
--- (views) to load and query the "Blue Lake" test data for OpenGIS Simple 
+-- (views) to load and query the "Blue Lake" test data for OpenGIS Simple
 -- Features for SQL (Types and Functions) test.
--- 
+--
 -- Required feature tables (views) are:
---                        Lakes 
+--                        Lakes
 --                        Road Segments
 --                        Divided Routes
 --                        Buildings
 --                        Forests
 --                        Bridges
---                        Named Places 
---                        Streams 
+--                        Named Places
+--                        Streams
 --                        Ponds
 --                        Map Neatlines
 --
@@ -118,8 +118,8 @@
 -- ---------------------
 -- -- !#@ ADAPTATION END
 --
-INSERT INTO spatial_ref_sys (SRID,AUTH_NAME,AUTH_SRID,SRTEXT) 
-VALUES (101, 'POSC', 32214, 
+INSERT INTO spatial_ref_sys (SRID,AUTH_NAME,AUTH_SRID,SRTEXT)
+VALUES (101, 'POSC', 32214,
 'PROJCS["UTM_ZONE_14N", GEOGCS["World Geodetic System 72",
 DATUM["WGS_72",  SPHEROID["NWL_10D", 6378135, 298.26]],
 PRIMEM["Greenwich", 0], UNIT["Meter", 1.0]],
@@ -142,7 +142,7 @@
 -- The following schema is created using CREATE TABLE statements.
 -- Furthermore, it DOES NOT create the GEOMETRY_COLUMNS metadata table.
 -- Implementer's should replace the CREATE TABLES below with the mechanism
--- that it uses to create feature tables and the GEOMETRY_COLUMNS table/view 
+-- that it uses to create feature tables and the GEOMETRY_COLUMNS table/view
 --
 --//////////////////////////////////////////////////////////////////////////////
 --
@@ -157,8 +157,8 @@
 --
 --
 -- !#@ ADAPTATION BEGIN
--- We break the schema creation into two steps, first create the 
--- attribute table, second use the AddGeometryColumn() function 
+-- We break the schema creation into two steps, first create the
+-- attribute table, second use the AddGeometryColumn() function
 -- to create and register the geometry column.
 -- ---------------------
 -- -- BEGIN ORIGINAL SQL
@@ -362,7 +362,7 @@
 -- Buildings
 --
 --*** ADAPTATION ALERT ***
--- A view could be used to provide the below semantics without multiple geometry 
+-- A view could be used to provide the below semantics without multiple geometry
 -- columns in a table. In other words, create two tables. One table would
 -- contain the POINT position and the other would create the POLYGON footprint.
 -- Then create a view with the semantics of the buildings table below.
@@ -522,12 +522,12 @@
 --
 -- We have one lake, Blue Lake. It is a polygon with a hole. Its geometry is
 -- described in WKT format as:
---   'POLYGON( (52 18, 66 23, 73  9, 48  6, 52 18), 
+--   'POLYGON( (52 18, 66 23, 73  9, 48  6, 52 18),
 --             (59 18, 67 18, 67 13, 59 13, 59 18) )'
 --==============================================================================
 --
 --
-INSERT INTO lakes VALUES (101, 'Blue Lake', 
+INSERT INTO lakes VALUES (101, 'Blue Lake',
     PolygonFromText('POLYGON((52 18,66 23,73 9,48 6,52 18),(59 18,67 18,67 13,59 13,59 18))', 101)
 );
 --
@@ -539,32 +539,32 @@
 --  name 'Route 5', fid 102
 --   'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )'
 --  name 'Route 5', fid 103
---   'LINESTRING( 44 31, 56 34, 70 38 )' 
+--   'LINESTRING( 44 31, 56 34, 70 38 )'
 --  name 'Route 5', fid 104
---   'LINESTRING( 70 38, 72 48 )' 
+--   'LINESTRING( 70 38, 72 48 )'
 --  name 'Main Street', fid 105
---   'LINESTRING( 70 38, 84 42 )' 
+--   'LINESTRING( 70 38, 84 42 )'
 --  name 'Dirt Road by Green Forest', fid 106
 --   'LINESTRING( 28 26, 28 0 )'
 --
 --==================
 --
 --
-INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2, 
+INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
     LineStringFromText('LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101)
 );
-INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4, 
+INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
     LineStringFromText('LINESTRING( 44 31, 56 34, 70 38 )' ,101)
 );
-INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2, 
+INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
     LineStringFromText('LINESTRING( 70 38, 72 48 )' ,101)
 );
-INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4, 
+INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
     LineStringFromText('LINESTRING( 70 38, 84 42 )' ,101)
 );
-INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL, 1, 
+INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL, 1,
     LineStringFromText('LINESTRING( 28 26, 28 0 )',101)
-);                                    
+);
 --
 --==================
 -- DividedRoutes
@@ -575,7 +575,7 @@
 --
 --==================
 --
-INSERT INTO divided_routes VALUES(119, 'Route 75', 4, 
+INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
     MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))', 101)
 );
 --
@@ -584,13 +584,13 @@
 --
 -- We have one forest. Its geometry is a multipolygon.
 -- The geometry is described in WKT format as:
---   'MULTIPOLYGON( ( (28 26, 28 0, 84 0, 84 42, 28 26), 
---                    (52 18, 66 23, 73 9, 48 6, 52 18) ), 
+--   'MULTIPOLYGON( ( (28 26, 28 0, 84 0, 84 42, 28 26),
+--                    (52 18, 66 23, 73 9, 48 6, 52 18) ),
 --                  ( (59 18, 67 18, 67 13, 59 13, 59 18) ) )'
 --
 --==================
 --
-INSERT INTO forests VALUES(109, 'Green Forest', 
+INSERT INTO forests VALUES(109, 'Green Forest',
     MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))', 101)
 );
 --
@@ -603,7 +603,7 @@
 --
 --==================
 --
-INSERT INTO bridges VALUES(110, 'Cam Bridge', 
+INSERT INTO bridges VALUES(110, 'Cam Bridge',
     PointFromText('POINT( 44 31 )', 101)
 );
 --
@@ -617,10 +617,10 @@
 --
 --==================
 --
-INSERT INTO streams VALUES(111, 'Cam Stream', 
+INSERT INTO streams VALUES(111, 'Cam Stream',
     LineStringFromText('LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101)
 );
-INSERT INTO streams VALUES(112, NULL, 
+INSERT INTO streams VALUES(112, NULL,
     LineStringFromText('LINESTRING( 76 0, 78 4, 73 9 )', 101)
 );
 --
@@ -638,12 +638,12 @@
 --
 --==================
 --
-INSERT INTO buildings VALUES(113, '123 Main Street', 
-    PointFromText('POINT( 52 30 )', 101), 
+INSERT INTO buildings VALUES(113, '123 Main Street',
+    PointFromText('POINT( 52 30 )', 101),
     PolygonFromText('POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101)
 );
-INSERT INTO buildings VALUES(114, '215 Main Street', 
-    PointFromText('POINT( 64 33 )', 101), 
+INSERT INTO buildings VALUES(114, '215 Main Street',
+    PointFromText('POINT( 64 33 )', 101),
     PolygonFromText('POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101)
 );
 --
@@ -656,7 +656,7 @@
 --
 --==================
 --
-INSERT INTO ponds VALUES(120, NULL, 'Stock Pond', 
+INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
     MultiPolygonFromText('MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ), ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101)
 );
 --
@@ -672,10 +672,10 @@
 --
 --==================
 --
-INSERT INTO named_places VALUES(117, 'Ashton', 
+INSERT INTO named_places VALUES(117, 'Ashton',
     PolygonFromText('POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101)
 );
-INSERT INTO named_places VALUES(118, 'Goose Island', 
+INSERT INTO named_places VALUES(118, 'Goose Island',
     PolygonFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101)
 );
 --
@@ -688,7 +688,7 @@
 --
 --==================
 --
-INSERT INTO map_neatlines VALUES(115, 
+INSERT INTO map_neatlines VALUES(115,
     PolygonFromText('POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101)
 );
 --

Modified: trunk/extras/ogc_test_suite/2_queries.sql
===================================================================
--- trunk/extras/ogc_test_suite/2_queries.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/ogc_test_suite/2_queries.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -9,17 +9,17 @@
 -- The material in this document details an Open GIS Consortium Test Suite in
 -- accordance with a license that your organization has signed. Please refer
 -- to http://www.opengis.org/testing/ to obtain a copy of the general license
--- (it is part of the Conformance Testing Agreement). 
+-- (it is part of the Conformance Testing Agreement).
 --
 --//////////////////////////////////////////////////////////////////////////////
 --
 -- OpenGIS Simple Features for SQL (Types and Functions) Test Suite Software
--- 
+--
 -- This file "sqltque.sql" is part 2 of a two part standardized test
 -- suite in SQL script form. The other file that is required for this test
 -- suite, "sqltsch.sql", one additional script is provided ("sqltcle.sql") that
--- performs cleanup operations between test runs, and other documents that 
--- describe the OGC Conformance Test Program are available via the WWW at 
+-- performs cleanup operations between test runs, and other documents that
+-- describe the OGC Conformance Test Program are available via the WWW at
 -- http://www.opengis.org/testing/index.htm
 --
 -- NOTE CONCERNING INFORMATION ON CONFORMANCE TESTING AND THIS TEST SUITE
@@ -38,11 +38,11 @@
 -- make it work properly. OGC has documented the allowable adaptations within
 -- this test suite where possible. Other information about adaptations may be
 -- discovered in the Test Suite Guidelines document for this test suite.
--- 
+--
 -- PLEASE NOTE THE OGC REQUIRES THAT ADAPTATIONS ARE FULLY DOCUMENTED USING
 -- LIBERAL COMMENT BLOCKS CONFORMING TO THE FOLLOWING FORMAT:
 --
--- -- !#@ ADAPTATION BEGIN 
+-- -- !#@ ADAPTATION BEGIN
 -- explanatory text goes here
 -- ---------------------
 -- -- BEGIN ORIGINAL SQL
@@ -57,7 +57,7 @@
 -- ---------------------
 -- -- END   ADAPTED  SQL
 -- ---------------------
--- -- !#@ ADAPTATION END 
+-- -- !#@ ADAPTATION END
 --
 --//////////////////////////////////////////////////////////////////////////////
 --
@@ -66,7 +66,7 @@
 --//////////////////////////////////////////////////////////////////////////////
 --
 -- Please refer to the Test Suite Guidelines for this test suite for further
--- information concerning the test data. The actual data is created by 
+-- information concerning the test data. The actual data is created by
 -- executing "sqltsch.sql"
 --
 --//////////////////////////////////////////////////////////////////////////////
@@ -80,16 +80,16 @@
 --================================
 -- Conformance Item T1	
 -- GEOMETRY_COLUMNS table/view is created/updated properly	
--- For this test we will check to see that all of the feature tables are 
+-- For this test we will check to see that all of the feature tables are
 -- represented by entries in the GEOMETRY_COLUMNS table/view
 --
--- ANSWER: lakes, road_segments, divided_routes, buildings, forests, bridges, 
+-- ANSWER: lakes, road_segments, divided_routes, buildings, forests, bridges,
 --         named_places, streams, ponds, map_neatlines
 -- *** ADAPTATION ALERT ***	
 -- Since there are no quotes around the table names in the CREATE TABLEs,
--- they will be converted to upper case in many DBMSs, and therefore, the 
+-- they will be converted to upper case in many DBMSs, and therefore, the
 -- answer to this query may be:
--- ANSWER: LAKES, ROAD_SEGMENTS, DIVIDED_ROUTES, BUILDINGS, FORESTS, BRIDGES, 
+-- ANSWER: LAKES, ROAD_SEGMENTS, DIVIDED_ROUTES, BUILDINGS, FORESTS, BRIDGES,
 --         NAMED_PLACES, STREAMS, PONDS, MAP_NEATLINES
 -- *** ADAPTATION ALERT ***	
 -- If the implementer made the adaptation concerning the buildings table
@@ -105,13 +105,13 @@
 --================================
 -- Conformance Item T2	
 -- GEOMETRY_COLUMNS table/view is created/updated properly	
--- For this test we will check to see that the correct geometry columns for the 
+-- For this test we will check to see that the correct geometry columns for the
 -- streams table is represented in the GEOMETRY_COLUMNS table/view
 --
 -- ANSWER: centerline
 -- *** ADAPTATION ALERT ***	
 -- Since there are no quotes around the table name, streams, in it's CREATE TABLE,
--- it will be converted to upper case in many DBMSs, and therefore, the WHERE 
+-- it will be converted to upper case in many DBMSs, and therefore, the WHERE
 -- clause may have to be f_table_name = 'STREAMS'.
 --
 --================================
@@ -124,13 +124,13 @@
 --================================
 -- Conformance Item T3	
 -- GEOMETRY_COLUMNS table/view is created/updated properly	
--- For this test we will check to see that the correct coordinate dimension 
+-- For this test we will check to see that the correct coordinate dimension
 -- for the streams table is represented in the GEOMETRY_COLUMNS table/view
 --
 -- ANSWER: 2	
 -- *** ADAPTATION ALERT ***	
 -- Since there are no quotes around the table name, streams, in it's CREATE TABLE,
--- it will be converted to upper case in many DBMSs, and therefore, the WHERE 
+-- it will be converted to upper case in many DBMSs, and therefore, the WHERE
 -- clause may have to be f_table_name = 'STREAMS'.
 --
 --================================
@@ -143,13 +143,13 @@
 --================================
 -- Conformance Item T4	
 -- GEOMETRY_COLUMNS table/view is created/updated properly	
--- For this test we will check to see that the correct value of srid for 
+-- For this test we will check to see that the correct value of srid for
 -- the streams table is represented in the GEOMETRY_COLUMNS table/view
 --
 -- ANSWER: 101	
 -- *** ADAPTATION ALERT ***	
 -- Since there are no quotes around the table name, streams, in it's CREATE TABLE,
--- it will be converted to upper case in many DBMSs, and therefore, the WHERE 
+-- it will be converted to upper case in many DBMSs, and therefore, the WHERE
 -- clause may have to be f_table_name = 'STREAMS'.
 --
 --================================
@@ -162,15 +162,15 @@
 --================================
 -- Conformance Item T5
 -- SPATIAL_REF_SYS table/view is created/updated properly
--- For this test we will check to see that the correct value of srtext is 
+-- For this test we will check to see that the correct value of srtext is
 -- represented in the SPATIAL_REF_SYS table/view
 --
--- ANSWER: 'PROJCS["UTM_ZONE_14N", GEOGCS["World Geodetic System 72", 
---           DATUM["WGS_72",  SPHEROID["NWL_10D", 6378135, 298.26]], 
---           PRIMEM["Greenwich", 0], UNIT["Meter", 1.0]], 
---           PROJECTION["Traverse_Mercator"], PARAMETER["False_Easting", 500000.0], 
---           PARAMETER["False_Northing", 0.0], PARAMETER["Central_Meridian", -99.0], 
---           PARAMETER["Scale_Factor", 0.9996], PARAMETER["Latitude_of_origin", 0.0], 
+-- ANSWER: 'PROJCS["UTM_ZONE_14N", GEOGCS["World Geodetic System 72",
+--           DATUM["WGS_72",  SPHEROID["NWL_10D", 6378135, 298.26]],
+--           PRIMEM["Greenwich", 0], UNIT["Meter", 1.0]],
+--           PROJECTION["Traverse_Mercator"], PARAMETER["False_Easting", 500000.0],
+--           PARAMETER["False_Northing", 0.0], PARAMETER["Central_Meridian", -99.0],
+--           PARAMETER["Scale_Factor", 0.9996], PARAMETER["Latitude_of_origin", 0.0],
 --           UNIT["Meter", 1.0]]'	
 --
 --================================
@@ -196,8 +196,8 @@
 --
 --================================
 --
-SELECT Dimension(shore) 
-FROM lakes 
+SELECT Dimension(shore)
+FROM lakes
 WHERE name = 'Blue Lake';
 --
 --
@@ -212,21 +212,21 @@
 --
 -- !#@ ADAPTATION BEGIN
 -- Test script incorrectly references the 'lakes' table
--- instead of the 'divided_routes' table where 'Route 75' 
+-- instead of the 'divided_routes' table where 'Route 75'
 -- appears.
 -- ---------------------
 -- -- BEGIN ORIGINAL SQL
 -- ---------------------
--- SELECT GeometryType(centerlines) 
--- FROM lakes 
+-- SELECT GeometryType(centerlines)
+-- FROM lakes
 -- WHERE name = 'Route 75';
 -- ---------------------
 -- -- END   ORIGINAL SQL
 -- ---------------------
 -- -- BEGIN ADAPTED  SQL
 -- ---------------------
-SELECT GeometryType(centerlines) 
-FROM divided_routes 
+SELECT GeometryType(centerlines)
+FROM divided_routes
 WHERE name = 'Route 75';
 -- ---------------------
 -- -- END   ADAPTED  SQL
@@ -242,23 +242,23 @@
 --
 --================================
 --
-SELECT AsText(boundary) 
-FROM named_places 
+SELECT AsText(boundary)
+FROM named_places
 WHERE name = 'Goose Island';
 --
 --================================
 -- Conformance Item T9	
 -- AsBinary(g Geometry) : Blob
 -- For this test we will determine the WKB representation of Goose Island.
--- We will test by applying AsText to the result of PolygonFromText to the 
+-- We will test by applying AsText to the result of PolygonFromText to the
 -- result of AsBinary.
 --
 -- ANSWER: 'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )'
 --
 --================================
 --
-SELECT AsText(PolygonFromWKB(AsBinary(boundary))) 
-FROM named_places 
+SELECT AsText(PolygonFromWKB(AsBinary(boundary)))
+FROM named_places
 WHERE name = 'Goose Island';
 --
 --================================
@@ -270,14 +270,14 @@
 --
 --================================
 --
-SELECT SRID(boundary) 
-FROM named_places 
+SELECT SRID(boundary)
+FROM named_places
 WHERE name = 'Goose Island';
 --
 --================================
 -- Conformance Item T11	
 -- IsEmpty(g Geometry) : Integer
--- For this test we will determine whether the geometry of a 
+-- For this test we will determine whether the geometry of a
 -- segment of Route 5 is empty.
 --
 -- ANSWER: 0
@@ -288,14 +288,14 @@
 --
 --================================
 --
-SELECT IsEmpty(centerline) 
-FROM road_segments 
+SELECT IsEmpty(centerline)
+FROM road_segments
 WHERE name = 'Route 5' AND aliases = 'Main Street';
 --
 --================================
 -- Conformance Item T12	
 -- IsSimple(g Geometry) : Integer
--- For this test we will determine whether the geometry of a 
+-- For this test we will determine whether the geometry of a
 -- segment of Blue Lake is simple.
 --
 -- ANSWER: 1
@@ -306,8 +306,8 @@
 --
 --================================
 --
-SELECT IsSimple(shore) 
-FROM lakes 
+SELECT IsSimple(shore)
+FROM lakes
 WHERE name = 'Blue Lake';
 --
 --================================
@@ -315,27 +315,27 @@
 -- Boundary(g Geometry) : Geometry
 -- For this test we will determine the boundary of Goose Island.
 -- NOTE: The boundary result is as defined in 3.12.3.2 of 96-015R1.
--- 
+--
 -- ANSWER: 'LINESTRING( 67 13, 67 18, 59 18, 59 13, 67 13 )'
 --
 --================================
 --
 -- !#@ ADAPTATION BEGIN
--- Test script includes extraneous parenthesis around the 
+-- Test script includes extraneous parenthesis around the
 -- 'boundary' column.
 -- ---------------------
 -- -- BEGIN ORIGINAL SQL
 -- ---------------------
--- SELECT AsText(Boundary((boundary)) 
--- FROM named_places 
+-- SELECT AsText(Boundary((boundary))
+-- FROM named_places
 -- WHERE name = 'Goose Island';
 -- ---------------------
 -- -- END   ORIGINAL SQL
 -- ---------------------
 -- -- BEGIN ADAPTED  SQL
 -- ---------------------
-SELECT AsText(Boundary(boundary)) 
-FROM named_places 
+SELECT AsText(Boundary(boundary))
+FROM named_places
 WHERE name = 'Goose Island';
 -- ---------------------
 -- -- END   ADAPTED  SQL
@@ -346,7 +346,7 @@
 -- Conformance Item T14	
 -- Envelope(g Geometry) : Geometry
 -- For this test we will determine the envelope of Goose Island.
--- 
+--
 -- ANSWER: 'POLYGON( ( 59 13, 59 18, 67 18, 67 13, 59 13) )'
 --
 --================================
@@ -357,16 +357,16 @@
 -- ---------------------
 -- -- BEGIN ORIGINAL SQL
 -- ---------------------
--- SELECT AsText(Envelope((boundary)) 
--- FROM named_places 
+-- SELECT AsText(Envelope((boundary))
+-- FROM named_places
 -- WHERE name = 'Goose Island';
 -- ---------------------
 -- -- END   ORIGINAL SQL
 -- ---------------------
 -- -- BEGIN ADAPTED  SQL
 -- ---------------------
-SELECT AsText(Envelope(boundary)) 
-FROM named_places 
+SELECT AsText(Envelope(boundary))
+FROM named_places
 WHERE name = 'Goose Island';
 -- ---------------------
 -- -- END   ADAPTED  SQL
@@ -385,27 +385,27 @@
 -- Conformance Item T15	
 -- X(p Point) : Double Precision
 -- For this test we will determine the X coordinate of Cam Bridge.
--- 
+--
 -- ANSWER: 44.00
 --
 --================================
 --
 -- !#@ ADAPTATION BEGIN
--- Test script reference to 'Bridges' is not correct, the 
+-- Test script reference to 'Bridges' is not correct, the
 -- attribute value is 'Cam Bridge'.
 -- ---------------------
 -- -- BEGIN ORIGINAL SQL
 -- ---------------------
--- SELECT X(position) 
--- FROM bridges 
+-- SELECT X(position)
+-- FROM bridges
 -- WHERE name = 'Bridges';
 -- ---------------------
 -- -- END   ORIGINAL SQL
 -- ---------------------
 -- -- BEGIN ADAPTED  SQL
 -- ---------------------
-SELECT X(position) 
-FROM bridges 
+SELECT X(position)
+FROM bridges
 WHERE name = 'Cam Bridge';
 -- ---------------------
 -- -- END   ADAPTED  SQL
@@ -416,13 +416,13 @@
 -- Conformance Item T16	
 -- Y(p Point) : Double Precision
 -- For this test we will determine the Y coordinate of Cam Bridge.
--- 
+--
 -- ANSWER: 31.00
 --
 --================================
 --
-SELECT Y(position) 
-FROM bridges 
+SELECT Y(position)
+FROM bridges
 WHERE name = 'Cam Bridge';
 --
 --
@@ -443,7 +443,7 @@
 --================================
 --
 SELECT AsText(StartPoint(centerline))
-FROM road_segments 
+FROM road_segments
 WHERE fid = 102;
 --
 --================================
@@ -456,14 +456,14 @@
 --================================
 --
 SELECT AsText(EndPoint(centerline))
-FROM road_segments 
+FROM road_segments
 WHERE fid = 102;
 --
 --================================
 -- Conformance Item T19	
 -- IsClosed(c Curve) : Integer
 -- For this test we will determine the boundary of Goose Island.
--- 
+--
 -- ANSWER: 1
 -- *** Adaptation Alert ***
 -- If the implementer provides IsClosed as a boolean function, instead of as
@@ -472,15 +472,15 @@
 --
 --================================
 --
-SELECT IsClosed(Boundary(boundary)) 
-FROM named_places 
+SELECT IsClosed(Boundary(boundary))
+FROM named_places
 WHERE name = 'Goose Island';
 --
 --================================
 -- Conformance Item T20	
 -- IsRing(c Curve) : Integer
 -- For this test we will determine the boundary of Goose Island.
--- 
+--
 -- ANSWER: 1
 -- *** Adaptation Alert ***
 -- If the implementer provides IsRing as a boolean function, instead of as
@@ -489,8 +489,8 @@
 --
 --================================
 --
-SELECT IsRing(Boundary(boundary)) 
-FROM named_places 
+SELECT IsRing(Boundary(boundary))
+FROM named_places
 WHERE name = 'Goose Island';
 --
 --================================
@@ -503,7 +503,7 @@
 --================================
 --
 SELECT Length(centerline)
-FROM road_segments 
+FROM road_segments
 WHERE fid = 106;
 --
 --
@@ -524,7 +524,7 @@
 --================================
 --
 SELECT NumPoints(centerline)
-FROM road_segments 
+FROM road_segments
 WHERE fid = 102;
 --
 --================================
@@ -537,7 +537,7 @@
 --================================
 --
 SELECT AsText(PointN(centerline, 1))
-FROM road_segments 
+FROM road_segments
 WHERE fid = 102;
 --
 --
@@ -558,7 +558,7 @@
 --================================
 --
 SELECT AsText(Centroid(boundary))
-FROM named_places 
+FROM named_places
 WHERE name = 'Goose Island';
 --
 --================================
@@ -577,7 +577,7 @@
 --================================
 --
 SELECT Contains(boundary, PointOnSurface(boundary))
-FROM named_places 
+FROM named_places
 WHERE name = 'Goose Island';
 --
 --================================
@@ -590,7 +590,7 @@
 --================================
 --
 SELECT Area(boundary)
-FROM named_places 
+FROM named_places
 WHERE name = 'Goose Island';
 --
 --
@@ -611,7 +611,7 @@
 --================================
 --
 SELECT AsText(ExteriorRing(shore))
-FROM lakes 
+FROM lakes
 WHERE name = 'Blue Lake';
 --
 --================================
@@ -624,7 +624,7 @@
 --================================
 --
 SELECT NumInteriorRings(shore)
-FROM lakes 
+FROM lakes
 WHERE name = 'Blue Lake';
 --
 --================================
@@ -637,7 +637,7 @@
 --================================
 --
 SELECT AsText(InteriorRingN(shore, 1))
-FROM lakes 
+FROM lakes
 WHERE name = 'Blue Lake';
 --
 --
@@ -658,7 +658,7 @@
 --================================
 --
 SELECT NumGeometries(centerlines)
-FROM divided_routes 
+FROM divided_routes
 WHERE name = 'Route 75';
 --
 --================================
@@ -678,7 +678,7 @@
 -- -- BEGIN ORIGINAL SQL
 -- ---------------------
 -- SELECT GeometryN(centerlines, 2)
--- FROM divided_routes 
+-- FROM divided_routes
 -- WHERE name = 'Route 75';
 -- ---------------------
 -- -- END   ORIGINAL SQL
@@ -686,7 +686,7 @@
 -- -- BEGIN ADAPTED  SQL
 -- ---------------------
 SELECT AsText(GeometryN(centerlines, 2))
-FROM divided_routes 
+FROM divided_routes
 WHERE name = 'Route 75';
 -- ---------------------
 -- -- END   ADAPTED  SQL
@@ -715,7 +715,7 @@
 --================================
 --
 SELECT IsClosed(centerlines)
-FROM divided_routes 
+FROM divided_routes
 WHERE name = 'Route 75';
 --
 --================================
@@ -729,7 +729,7 @@
 --================================
 --
 SELECT Length(centerlines)
-FROM divided_routes 
+FROM divided_routes
 WHERE name = 'Route 75';
 --
 --
@@ -750,7 +750,7 @@
 --================================
 --
 SELECT AsText(Centroid(shores))
-FROM ponds 
+FROM ponds
 WHERE fid = 120;
 --
 --================================
@@ -769,7 +769,7 @@
 --================================
 --
 SELECT Contains(shores, PointOnSurface(shores))
-FROM ponds 
+FROM ponds
 WHERE fid = 120;
 --
 --================================
@@ -782,7 +782,7 @@
 --================================
 --
 SELECT Area(shores)
-FROM ponds 
+FROM ponds
 WHERE fid = 120;
 --
 --
@@ -808,7 +808,7 @@
 --================================
 --
 SELECT Equals(boundary, PolygonFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
-FROM named_places 
+FROM named_places
 WHERE name = 'Goose Island';
 --
 --================================
@@ -826,7 +826,7 @@
 --================================
 --
 SELECT Disjoint(centerlines, boundary)
-FROM divided_routes, named_places 
+FROM divided_routes, named_places
 WHERE divided_routes.name = 'Route 75' AND named_places.name = 'Ashton';
 --
 --================================
@@ -844,13 +844,13 @@
 --================================
 --
 -- !#@ ADAPTATION BEGIN
--- The test script attempts to test the 'Touch' function, but the 
+-- The test script attempts to test the 'Touch' function, but the
 -- specification document uses 'Touches' as the function name.
 -- ---------------------
 -- -- BEGIN ORIGINAL SQL
 -- ---------------------
 -- SELECT Touch(centerline, shore)
--- FROM streams, lakes 
+-- FROM streams, lakes
 -- WHERE streams.name = 'Cam Stream' AND lakes.name = 'Blue Lake';
 -- ---------------------
 -- -- END   ORIGINAL SQL
@@ -858,7 +858,7 @@
 -- -- BEGIN ADAPTED  SQL
 -- ---------------------
 SELECT Touches(centerline, shore)
-FROM streams, lakes 
+FROM streams, lakes
 WHERE streams.name = 'Cam Stream' AND lakes.name = 'Blue Lake';
 -- ---------------------
 -- -- END   ADAPTED  SQL
@@ -880,15 +880,15 @@
 --================================
 --
 -- !#@ ADAPTATION BEGIN
--- Test script reverses the correct order of arguments to 'Within()'. 
--- Specification says 'Within(g1,g2) is 'TRUE if g1 is completely 
--- contained in g2' and test explanation says we are checking if 
+-- Test script reverses the correct order of arguments to 'Within()'.
+-- Specification says 'Within(g1,g2) is 'TRUE if g1 is completely
+-- contained in g2' and test explanation says we are checking if
 -- the house (g1, footprint) is within Ashton (g2, boundary).
 -- ---------------------
 -- -- BEGIN ORIGINAL SQL
 -- ---------------------
 -- SELECT Within(boundary, footprint)
--- FROM named_places, buildings 
+-- FROM named_places, buildings
 -- WHERE named_places.name = 'Ashton' AND buildings.address = '215 Main Street';
 -- ---------------------
 -- -- END   ORIGINAL SQL
@@ -896,7 +896,7 @@
 -- -- BEGIN ADAPTED  SQL
 -- ---------------------
 SELECT Within(footprint, boundary)
-FROM named_places, buildings 
+FROM named_places, buildings
 WHERE named_places.name = 'Ashton' AND buildings.address = '215 Main Street';
 -- ---------------------
 -- -- END   ADAPTED  SQL
@@ -906,7 +906,7 @@
 --================================
 -- Conformance Item T41	
 -- Overlap(g1 Geometry, g2 Geometry) : Integer
--- For this test we will determine if the geometry of Green Forest overlaps 
+-- For this test we will determine if the geometry of Green Forest overlaps
 -- the geometry of Ashton.
 --
 -- ANSWER: 1
@@ -924,7 +924,7 @@
 -- -- BEGIN ORIGINAL SQL
 -- ---------------------
 -- SELECT Overlap(forest.boundary, named_places.boundary)
--- FROM forests, named_places 
+-- FROM forests, named_places
 -- WHERE forests.name = 'Green Forest' AND named_places.name = 'Ashton';
 -- ---------------------
 -- -- END   ORIGINAL SQL
@@ -932,7 +932,7 @@
 -- -- BEGIN ADAPTED  SQL
 -- ---------------------
 SELECT Overlaps(forests.boundary, named_places.boundary)
-FROM forests, named_places 
+FROM forests, named_places
 WHERE forests.name = 'Green Forest' AND named_places.name = 'Ashton';
 -- ---------------------
 -- -- END   ADAPTED  SQL
@@ -942,7 +942,7 @@
 --================================
 -- Conformance Item T42	
 -- Cross(g1 Geometry, g2 Geometry) : Integer
--- For this test we will determine if the geometry of road segment 102 crosses 
+-- For this test we will determine if the geometry of road segment 102 crosses
 -- the geometry of Route 75.
 --
 -- ANSWER: 1
@@ -962,7 +962,7 @@
 -- -- BEGIN ORIGINAL SQL
 -- ---------------------
 -- SELECT Cross(road_segment.centerline, divided_routes.centerlines)
--- FROM road_segment, divided_routes 
+-- FROM road_segment, divided_routes
 -- WHERE road_segment.fid = 102 AND divided_routes.name = 'Route 75';
 -- ---------------------
 -- -- END   ORIGINAL SQL
@@ -970,7 +970,7 @@
 -- -- BEGIN ADAPTED  SQL
 -- ---------------------
 SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
-FROM road_segments, divided_routes 
+FROM road_segments, divided_routes
 WHERE road_segments.fid = 102 AND divided_routes.name = 'Route 75';
 -- ---------------------
 -- -- END   ADAPTED  SQL
@@ -980,7 +980,7 @@
 --================================
 -- Conformance Item T43	
 -- Intersects(g1 Geometry, g2 Geometry) : Integer
--- For this test we will determine if the geometry of road segment 102 intersects 
+-- For this test we will determine if the geometry of road segment 102 intersects
 -- the geometry of Route 75.
 --
 -- ANSWER: 1
@@ -998,7 +998,7 @@
 -- -- BEGIN ORIGINAL SQL
 -- ---------------------
 -- SELECT Intersects(road_segment.centerline, divided_routes.centerlines)
--- FROM road_segment, divided_routes 
+-- FROM road_segment, divided_routes
 -- WHERE road_segment.fid = 102 AND divided_routes.name = 'Route 75';
 -- ---------------------
 -- -- END   ORIGINAL SQL
@@ -1006,7 +1006,7 @@
 -- -- BEGIN ADAPTED  SQL
 -- ---------------------
 SELECT Intersects(road_segments.centerline, divided_routes.centerlines)
-FROM road_segments, divided_routes 
+FROM road_segments, divided_routes
 WHERE road_segments.fid = 102 AND divided_routes.name = 'Route 75';
 -- ---------------------
 -- -- END   ADAPTED  SQL
@@ -1016,7 +1016,7 @@
 --================================
 -- Conformance Item T44	
 -- Contains(g1 Geometry, g2 Geometry) : Integer
--- For this test we will determine if the geometry of Green Forest contains 
+-- For this test we will determine if the geometry of Green Forest contains
 -- the geometry of Ashton.
 --
 -- ANSWER: 0
@@ -1034,7 +1034,7 @@
 -- -- BEGIN ORIGINAL SQL
 -- ---------------------
 -- SELECT Contains(forest.boundary, named_places.boundary)
--- FROM forests, named_places 
+-- FROM forests, named_places
 -- WHERE forests.name = 'Green Forest' AND named_places.name = 'Ashton';
 -- ---------------------
 -- -- END   ORIGINAL SQL
@@ -1042,7 +1042,7 @@
 -- -- BEGIN ADAPTED  SQL
 -- ---------------------
 SELECT Contains(forests.boundary, named_places.boundary)
-FROM forests, named_places 
+FROM forests, named_places
 WHERE forests.name = 'Green Forest' AND named_places.name = 'Ashton';
 -- ---------------------
 -- -- END   ADAPTED  SQL
@@ -1052,7 +1052,7 @@
 --================================
 -- Conformance Item T45	
 -- Relate(g1 Geometry, g2 Geometry, PatternMatrix String) : Integer
--- For this test we will determine if the geometry of Green Forest relates to 
+-- For this test we will determine if the geometry of Green Forest relates to
 -- the geometry of Ashton using the pattern "TTTTTTTTT".
 --
 -- ANSWER: 1
@@ -1070,7 +1070,7 @@
 -- -- BEGIN ORIGINAL SQL
 -- ---------------------
 -- SELECT Relate(forest.boundary, named_places.boundary, 'TTTTTTTTT')
--- FROM forests, named_places 
+-- FROM forests, named_places
 -- WHERE forests.name = 'Green Forest' AND named_places.name = 'Ashton';
 -- ---------------------
 -- -- END   ORIGINAL SQL
@@ -1078,7 +1078,7 @@
 -- -- BEGIN ADAPTED  SQL
 -- ---------------------
 SELECT Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT')
-FROM forests, named_places 
+FROM forests, named_places
 WHERE forests.name = 'Green Forest' AND named_places.name = 'Ashton';
 -- ---------------------
 -- -- END   ADAPTED  SQL
@@ -1103,7 +1103,7 @@
 --================================
 --
 SELECT Distance(position, boundary)
-FROM bridges, named_places 
+FROM bridges, named_places
 WHERE bridges.name = 'Cam Bridge' AND named_places.name = 'Ashton';
 --
 --
@@ -1117,7 +1117,7 @@
 --================================
 -- Conformance Item T47	
 -- Intersection(g1 Geometry, g2 Geometry) : Geometry
--- For this test we will determine the intersection between Cam Stream and 
+-- For this test we will determine the intersection between Cam Stream and
 -- Blue Lake.
 --
 -- ANSWER: 'POINT( 52 18 )'
@@ -1132,7 +1132,7 @@
 -- -- BEGIN ORIGINAL SQL
 -- ---------------------
 -- SELECT Intersection(centerline, shore)
--- FROM streams, lakes 
+-- FROM streams, lakes
 -- WHERE streams.name = 'Cam Stream' AND lakes.name = 'Blue Lake';
 -- ---------------------
 -- -- END   ORIGINAL SQL
@@ -1140,7 +1140,7 @@
 -- -- BEGIN ADAPTED  SQL
 -- ---------------------
 SELECT AsText(Intersection(centerline, shore))
-FROM streams, lakes 
+FROM streams, lakes
 WHERE streams.name = 'Cam Stream' AND lakes.name = 'Blue Lake';
 -- ---------------------
 -- -- END   ADAPTED  SQL
@@ -1150,7 +1150,7 @@
 --================================
 -- Conformance Item T48	
 -- Difference(g1 Geometry, g2 Geometry) : Geometry
--- For this test we will determine the difference between Ashton and 
+-- For this test we will determine the difference between Ashton and
 -- Green Forest.
 --
 -- ANSWER: 'POLYGON( ( 56 34, 62 48, 84 48, 84 42, 56 34) )'
@@ -1168,7 +1168,7 @@
 -- -- BEGIN ORIGINAL SQL
 -- ---------------------
 -- SELECT Difference(named_places.boundary, forests.boundary)
--- FROM named_places, forests 
+-- FROM named_places, forests
 -- WHERE named_places.name = 'Ashton' AND forests.name = 'Green Forest';
 -- ---------------------
 -- -- END   ORIGINAL SQL
@@ -1176,7 +1176,7 @@
 -- -- BEGIN ADAPTED  SQL
 -- ---------------------
 SELECT AsText(Difference(named_places.boundary, forests.boundary))
-FROM named_places, forests 
+FROM named_places, forests
 WHERE named_places.name = 'Ashton' AND forests.name = 'Green Forest';
 -- ---------------------
 -- -- END   ADAPTED  SQL
@@ -1186,7 +1186,7 @@
 --================================
 -- Conformance Item T49	
 -- Union(g1 Geometry, g2 Geometry) : Integer
--- For this test we will determine the union of Blue Lake and Goose Island 
+-- For this test we will determine the union of Blue Lake and Goose Island
 --
 -- ANSWER: 'POLYGON((52 18,66 23,73 9,48 6,52 18))'
 -- NOTE: The outer ring of Blue Lake is the answer.
@@ -1206,7 +1206,7 @@
 -- -- BEGIN ORIGINAL SQL
 -- ---------------------
 -- SELECT Union(shore, boundary)
--- FROM lakes, named_places 
+-- FROM lakes, named_places
 -- WHERE lakes.name = 'Blue Lake' AND named_places.name = Ashton';
 -- ---------------------
 -- -- END   ORIGINAL SQL
@@ -1214,7 +1214,7 @@
 -- -- BEGIN ADAPTED  SQL
 -- ---------------------
 SELECT AsText(GeomUnion(shore, boundary))
-FROM lakes, named_places 
+FROM lakes, named_places
 WHERE lakes.name = 'Blue Lake' AND named_places.name = 'Goose Island';
 -- ---------------------
 -- -- END   ADAPTED  SQL
@@ -1224,8 +1224,8 @@
 --================================
 -- Conformance Item T50	
 -- SymmetricDifference(g1 Geometry, g2 Geometry) : Integer
--- For this test we will determine the symmetric difference of Blue Lake 
--- and Goose Island 
+-- For this test we will determine the symmetric difference of Blue Lake
+-- and Goose Island
 --
 -- ANSWER: 'POLYGON((52 18,66 23,73 9,48 6,52 18))'
 -- NOTE: The outer ring of Blue Lake is the answer.
@@ -1242,7 +1242,7 @@
 -- -- BEGIN ORIGINAL SQL
 -- ---------------------
 -- SELECT SymmetricDifference(shore, boundary)
--- FROM lakes, named_places 
+-- FROM lakes, named_places
 -- WHERE lakes.name = 'Blue Lake' OR named_places.name = 'Ashton';
 -- ---------------------
 -- -- END   ORIGINAL SQL
@@ -1250,7 +1250,7 @@
 -- -- BEGIN ADAPTED  SQL
 -- ---------------------
 SELECT AsText(SymmetricDifference(shore, boundary))
-FROM lakes, named_places 
+FROM lakes, named_places
 WHERE lakes.name = 'Blue Lake' AND named_places.name = 'Goose Island';
 -- ---------------------
 -- -- END   ADAPTED  SQL
@@ -1302,7 +1302,7 @@
 --================================
 -- Conformance Item T52	
 -- ConvexHull(g Geometry) : Geometry
--- For this test we will determine the convex hull of Blue Lake 
+-- For this test we will determine the convex hull of Blue Lake
 --
 -- ANSWER: 'POLYGON((52 18,66 23,73 9,48 6,52 18))'
 -- NOTE: The outer ring of Blue Lake is the answer.

Modified: trunk/extras/ogc_test_suite/3_cleanup.sql
===================================================================
--- trunk/extras/ogc_test_suite/3_cleanup.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/ogc_test_suite/3_cleanup.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -3,7 +3,7 @@
 -- *** ADAPTATION ALERT ***
 -- OGC will not examine this script for adaptations.
 -- Please add any other cleanup to this script.
--- 
+--
 DELETE FROM spatial_ref_sys;
 DELETE FROM geometry_columns;
 DROP TABLE lakes;

Modified: trunk/extras/tiger_geocoder/census_loader.sql
===================================================================
--- trunk/extras/tiger_geocoder/census_loader.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/census_loader.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -2,21 +2,21 @@
 -- PostGIS - Spatial Types for PostgreSQL
 -- http://postgis.net
 --
--- Copyright (C) 2010, 2011 Regina Obe and Leo Hsu 
+-- Copyright (C) 2010, 2011 Regina Obe and Leo Hsu
 -- Paragon Corporation
 --
 -- This is free software; you can redistribute and/or modify it under
 -- the terms of the GNU General Public Licence. See the COPYING file.
 --
 -- Author: Regina Obe and Leo Hsu <lr at pcorp.us>
---  
+--
 -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 --SET search_path TO tiger,public;
 SELECT tiger.SetSearchPathForInstall('tiger');
-CREATE OR REPLACE FUNCTION create_census_base_tables() 
+CREATE OR REPLACE FUNCTION create_census_base_tables()
 	RETURNS text AS
 $$
-DECLARE var_temp text; 
+DECLARE var_temp text;
 BEGIN
 var_temp := tiger.SetSearchPathForInstall('tiger');
 IF NOT EXISTS(SELECT table_name FROM information_schema.columns WHERE table_schema = 'tiger' AND column_name = 'tract_id' AND table_name = 'tract')  THEN
@@ -106,46 +106,46 @@
   RETURNS SETOF text AS
 $$
 SELECT create_census_base_tables();
-SELECT 
+SELECT
 	loader_macro_replace(
 		replace(
 			loader_macro_replace(declare_sect
-				, ARRAY['staging_fold', 'state_fold','website_root', 'psql', 'state_abbrev', 'data_schema', 'staging_schema', 'state_fips'], 
+				, ARRAY['staging_fold', 'state_fold','website_root', 'psql', 'state_abbrev', 'data_schema', 'staging_schema', 'state_fips'],
 				ARRAY[variables.staging_fold, s.state_fold, variables.website_root, platform.psql, s.state_abbrev, variables.data_schema, variables.staging_schema, s.state_fips::text]
 			), '/', platform.path_sep) || '
 ' ||
 	-- State level files - if an override website is specified we use that instead of variable one
 	array_to_string( ARRAY(SELECT 'cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name) ), 'http://', ''),'ftp://','')    || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*_' || s.state_fips || '*_' || table_name || '.zip ') || '
-' ||loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -' ||  lu.insert_mode || ' -s 4269 -g the_geom ' 
-		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year || '_' || s.state_fips 
-	|| '_' || lu.table_name || '.dbf tiger_staging.' || lower(s.state_abbrev) || '_' || lu.table_name || ' | '::text || platform.psql 
-		|| COALESCE(E'\n' || 
+' ||loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -' ||  lu.insert_mode || ' -s 4269 -g the_geom '
+		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year || '_' || s.state_fips
+	|| '_' || lu.table_name || '.dbf tiger_staging.' || lower(s.state_abbrev) || '_' || lu.table_name || ' | '::text || platform.psql
+		|| COALESCE(E'\n' ||
 			lu.post_load_process , '') , ARRAY['loader','table_name', 'lookup_name'], ARRAY[platform.loader, lu.table_name, lu.lookup_name ])
 				FROM loader_lookuptables AS lu
 				WHERE level_state = true AND load = true AND lookup_name IN('tract','bg','tabblock')
-				ORDER BY process_order, lookup_name), E'\n') ::text 
+				ORDER BY process_order, lookup_name), E'\n') ::text
 	-- County Level files
 	|| E'\n' ||
 		array_to_string( ARRAY(SELECT 'cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  || '/'), 'http://', ''),'ftp://','')  || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*_' || s.state_fips || '*_' || table_name || '.zip ') || '
 ' || loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || COALESCE(county_process_command || E'\n','')
-				|| COALESCE(E'\n' ||lu.post_load_process , '') , ARRAY['loader','table_name','lookup_name'], ARRAY[platform.loader  || CASE WHEN lu.single_geom_mode THEN ' -S' ELSE ' ' END::text, lu.table_name, lu.lookup_name ]) 
+				|| COALESCE(E'\n' ||lu.post_load_process , '') , ARRAY['loader','table_name','lookup_name'], ARRAY[platform.loader  || CASE WHEN lu.single_geom_mode THEN ' -S' ELSE ' ' END::text, lu.table_name, lu.lookup_name ])
 				FROM loader_lookuptables AS lu
 				WHERE level_county = true AND load = true AND lookup_name IN('tract','bg','tabblock')
-				ORDER BY process_order, lookup_name), E'\n') ::text 
-	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'state_fold', 'website_root', 'state_abbrev','state_fips'], 
+				ORDER BY process_order, lookup_name), E'\n') ::text
+	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'state_fold', 'website_root', 'state_abbrev','state_fips'],
 	ARRAY[platform.psql,  variables.data_schema, variables.staging_schema, variables.staging_fold, s.state_fold,variables.website_root, s.state_abbrev, s.state_fips::text])
 			AS shell_code
 FROM loader_variables As variables
-		CROSS JOIN (SELECT name As state, abbrev As state_abbrev, lpad(st_code::text,2,'0') As state_fips, 
-			 lpad(st_code::text,2,'0') || '_' 
+		CROSS JOIN (SELECT name As state, abbrev As state_abbrev, lpad(st_code::text,2,'0') As state_fips,
+			 lpad(st_code::text,2,'0') || '_'
 	|| replace(name, ' ', '_') As state_fold
 FROM state_lookup) As s CROSS JOIN loader_platform As platform
 WHERE $1 @> ARRAY[state_abbrev::text]      -- If state is contained in list of states input generate script for it
@@ -153,11 +153,11 @@
 ;
 $$
   LANGUAGE sql VOLATILE;
-  
+
 --update with census tract loading logic
-DELETE FROM loader_lookuptables WHERE lookup_name IN('tract','tabblock','bg');           
+DELETE FROM loader_lookuptables WHERE lookup_name IN('tract','tabblock','bg');
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude )
-VALUES(10, 'tract', 'tract', true, false, true,false, 'c', 
+VALUES(10, 'tract', 'tract', true, false, true,false, 'c',
 '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (tract_id) ) INHERITS(tiger.${lookup_name}); " ',
 	'${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${table_name} RENAME geoid TO tract_id;  SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}'')); "
 	${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"
@@ -165,7 +165,7 @@
 	${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"', ARRAY['gid']);
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude )
-VALUES(11, 'tabblock', 'tabblock', true, false, true,false, 'c', 
+VALUES(11, 'tabblock', 'tabblock', true, false, true,false, 'c',
 '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (tabblock_id)) INHERITS(tiger.${lookup_name});" ',
 '${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${table_name} RENAME geoid TO tabblock_id;  SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}''), ''{gid, statefp10, countyfp10, tractce10, blockce10,suffix1ce,blockce,tractce}''::text[]); "
 ${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
@@ -173,7 +173,7 @@
 ${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"', ARRAY['gid']);
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude )
-VALUES(12, 'bg', 'bg', true,false, true,false, 'c', 
+VALUES(12, 'bg', 'bg', true,false, true,false, 'c',
 '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (bg_id)) INHERITS(tiger.${lookup_name});" ',
 '${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${table_name} RENAME geoid TO bg_id;  SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}'')); "
 ${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"

Modified: trunk/extras/tiger_geocoder/create_geocode.sql
===================================================================
--- trunk/extras/tiger_geocoder/create_geocode.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/create_geocode.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -3,14 +3,14 @@
 -- http://postgis.net
 --
 -- Copyright (C) 2010, 2011 Regina Obe and Leo Hsu
--- Copyright (C) 2008 Stephen Frost (et al) 
+-- Copyright (C) 2008 Stephen Frost (et al)
 -- reintegrated back into PostGIS code base from Steven's git (http://www.snowman.net/git/tiger_geocoder/)
 -- Copyright Refractions Research
 --
 -- This is free software; you can redistribute and/or modify it under
 -- the terms of the GNU General Public Licence. See the COPYING file.
 --
---  
+--
 -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 -- Tiger is where we're going to create the functions, but we need
 -- the PostGIS functions/types which are in public.

Modified: trunk/extras/tiger_geocoder/geocode/census_tracts_functions.sql
===================================================================
--- trunk/extras/tiger_geocoder/geocode/census_tracts_functions.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/geocode/census_tracts_functions.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,5 +1,5 @@
- /*** 
- * 
+ /***
+ *
  * Copyright (C) 2012 Regina Obe and Leo Hsu (Paragon Corporation)
  **/
 -- This function given a geometry try will try to determine the tract.
@@ -23,7 +23,7 @@
 		IF ST_SRID(loc_geom) = 4269 THEN
 			var_loc_geom := loc_geom;
 		ELSIF ST_SRID(loc_geom) > 0 THEN
-			var_loc_geom := ST_Transform(loc_geom, 4269); 
+			var_loc_geom := ST_Transform(loc_geom, 4269);
 		ELSE --If srid is unknown, assume its 4269
 			var_loc_geom := ST_SetSRID(loc_geom, 4269);
 		END IF;
@@ -31,7 +31,7 @@
 			var_loc_geom := ST_Centroid(var_loc_geom);
 		END IF;
 	END IF;
-	-- Determine state tables to check 
+	-- Determine state tables to check
 	-- this is needed to take advantage of constraint exclusion
 	IF var_debug THEN
 		RAISE NOTICE 'Get matching states start: %', clock_timestamp();

Modified: trunk/extras/tiger_geocoder/geocode/geocode.sql
===================================================================
--- trunk/extras/tiger_geocoder/geocode/geocode.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/geocode/geocode.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -29,7 +29,7 @@
 
     RETURN NEXT;
   END LOOP;*/
- 
+
   RETURN QUERY SELECT g.addy, g.geomout, g.rating FROM geocode(ADDY, max_results, restrict_geom) As g ORDER BY g.rating;
 
 END;
@@ -37,7 +37,7 @@
 
 
 CREATE OR REPLACE FUNCTION geocode(
-    IN_ADDY NORM_ADDY, 
+    IN_ADDY NORM_ADDY,
     max_results integer DEFAULT 10,
     restrict_geom geometry DEFAULT null,
     OUT ADDY NORM_ADDY,

Modified: trunk/extras/tiger_geocoder/geocode/geocode_address.sql
===================================================================
--- trunk/extras/tiger_geocoder/geocode/geocode_address.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/geocode/geocode_address.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -25,14 +25,14 @@
   IF parsed.stateAbbrev IS NOT NULL THEN
     in_statefp := statefp FROM state_lookup As s WHERE s.abbrev = parsed.stateAbbrev;
   END IF;
-  
-  IF in_statefp IS NULL THEN 
+
+  IF in_statefp IS NULL THEN
   --if state is not provided or was bogus, just pick the first where the zip is present
     in_statefp := statefp FROM zip_lookup_base WHERE zip = substring(parsed.zip,1,5) LIMIT 1;
   END IF;
-  
+
   IF restrict_geom IS NOT NULL THEN
-  		IF ST_SRID(restrict_geom) < 1 OR ST_SRID(restrict_geom) = 4236 THEN 
+  		IF ST_SRID(restrict_geom) < 1 OR ST_SRID(restrict_geom) = 4236 THEN
   		-- basically has no srid or if wgs84 close enough to NAD 83 -- assume same as data
   			var_restrict_geom = ST_SetSRID(restrict_geom,4269);
   		ELSE
@@ -40,12 +40,12 @@
   			var_restrict_geom = ST_SnapToGrid(ST_Transform(restrict_geom, 4269), 0.000001);
   		END IF;
   END IF;
-  var_bfilter := ' SELECT zcta5ce FROM tiger.zcta5 AS zc  
-                    WHERE zc.statefp = ' || quote_nullable(in_statefp) || ' 
+  var_bfilter := ' SELECT zcta5ce FROM tiger.zcta5 AS zc
+                    WHERE zc.statefp = ' || quote_nullable(in_statefp) || '
                         AND ST_Intersects(zc.the_geom, ' || quote_literal(var_restrict_geom::text) || '::geometry)  ' ;
 
   SELECT NULL::varchar[] As zip INTO zip_info;
- 
+
   IF parsed.zip IS NOT NULL  THEN
   -- Create an array of 5 zips containing 2 before and 2 after our target if our streetName is longer
     IF length(parsed.streetName) > 7 THEN
@@ -55,7 +55,7 @@
         SELECT zip_range(parsed.zip, -1, 1) As zip INTO zip_info;
     END IF;
     --This signals bad zip input, only use the range if it falls in the place zip range
-    IF length(parsed.zip) != 5 AND parsed.location IS NOT NULL THEN 
+    IF length(parsed.zip) != 5 AND parsed.location IS NOT NULL THEN
          stmt := 'SELECT ARRAY(SELECT DISTINCT zip
           FROM tiger.zip_lookup_base AS z
          WHERE z.statefp = $1
@@ -88,28 +88,28 @@
    -- Brute force -- try to find perfect matches and exit if we have one
    -- we first pull all the names in zip and rank by if zip matches input zip and streetname matches street
   stmt := 'WITH a AS
-  	( SELECT * 
+  	( SELECT *
   		FROM (SELECT f.*, ad.side, ad.zip, ad.fromhn, ad.tohn,
   					RANK() OVER(ORDER BY ' || CASE WHEN parsed.zip > '' THEN ' diff_zip(ad.zip,$7) + ' ELSE '' END
-						||' CASE WHEN lower(f.name) = lower($2) THEN 0 ELSE levenshtein_ignore_case(f.name, lower($2) )  END + 
-						levenshtein_ignore_case(f.fullname, lower($2 || '' '' || COALESCE($4,'''')) ) 
+						||' CASE WHEN lower(f.name) = lower($2) THEN 0 ELSE levenshtein_ignore_case(f.name, lower($2) )  END +
+						levenshtein_ignore_case(f.fullname, lower($2 || '' '' || COALESCE($4,'''')) )
 						+ CASE WHEN (greatest_hn(ad.fromhn,ad.tohn) % 2)::integer = ($1 % 2)::integer THEN 0 ELSE 1 END
-						+ CASE WHEN $1::integer BETWEEN least_hn(ad.fromhn,ad.tohn) AND greatest_hn(ad.fromhn, ad.tohn) 
-							THEN 0 ELSE 4 END 
+						+ CASE WHEN $1::integer BETWEEN least_hn(ad.fromhn,ad.tohn) AND greatest_hn(ad.fromhn, ad.tohn)
+							THEN 0 ELSE 4 END
 							+ CASE WHEN lower($4) = lower(f.suftypabrv) OR lower($4) = lower(f.pretypabrv) THEN 0 ELSE 1 END
 							+ rate_attributes($5, f.predirabrv,'
          || '    $2,  f.name , $4,'
          || '    suftypabrv , $6,'
-         || '    sufdirabrv, prequalabr)  
+         || '    sufdirabrv, prequalabr)
 							)
 						As rank
-                		FROM tiger.featnames As f INNER JOIN tiger.addr As ad ON (f.tlid = ad.tlid) 
-                    WHERE $10 = f.statefp AND $10 = ad.statefp 
+                		FROM tiger.featnames As f INNER JOIN tiger.addr As ad ON (f.tlid = ad.tlid)
+                    WHERE $10 = f.statefp AND $10 = ad.statefp
                     	'
-                    || CASE WHEN length(parsed.streetName) > 5  THEN ' AND (lower(f.fullname) LIKE (COALESCE($5 || '' '','''') || lower($2) || ''%'')::text OR lower(f.name) = lower($2) OR soundex(f.name) = soundex($2) ) ' ELSE  ' AND lower(f.name) = lower($2) ' END 
-                    || CASE WHEN zip_info.zip IS NOT NULL THEN '    AND ( ad.zip = ANY($9::varchar[]) )  ' ELSE '' END 
-            || ' ) AS foo ORDER BY rank LIMIT ' || max_results*3 || ' ) 
-  	SELECT * FROM ( 
+                    || CASE WHEN length(parsed.streetName) > 5  THEN ' AND (lower(f.fullname) LIKE (COALESCE($5 || '' '','''') || lower($2) || ''%'')::text OR lower(f.name) = lower($2) OR soundex(f.name) = soundex($2) ) ' ELSE  ' AND lower(f.name) = lower($2) ' END
+                    || CASE WHEN zip_info.zip IS NOT NULL THEN '    AND ( ad.zip = ANY($9::varchar[]) )  ' ELSE '' END
+            || ' ) AS foo ORDER BY rank LIMIT ' || max_results*3 || ' )
+  	SELECT * FROM (
     SELECT DISTINCT ON (sub.predirabrv,sub.fename,COALESCE(sub.suftypabrv, sub.pretypabrv) ,sub.sufdirabrv,sub.place,s.stusps,sub.zip)'
          || '    sub.predirabrv   as fedirp,'
          || '    sub.fename,'
@@ -122,12 +122,12 @@
          || '        sub.tohn, sub.the_geom, sub.side) as address_geom,'
          || '       sub.sub_rating + '
          || CASE WHEN parsed.zip > '' THEN '  least(coalesce(diff_zip($7 , sub.zip),0), 10)::integer  '
-            ELSE '1' END::text 
+            ELSE '1' END::text
          || ' + coalesce(levenshtein_ignore_case($3, sub.place),5)'
          || '    as sub_rating,'
          || '    sub.exact_address as exact_address, sub.tohn, sub.fromhn '
          || ' FROM ('
-         || '  SELECT tlid, predirabrv, COALESCE(b.prequalabr || '' '','''' ) || b.name As fename, suftypabrv, sufdirabrv, fromhn, tohn, 
+         || '  SELECT tlid, predirabrv, COALESCE(b.prequalabr || '' '','''' ) || b.name As fename, suftypabrv, sufdirabrv, fromhn, tohn,
                     side,  zip, rate_attributes($5, predirabrv,'
          || '    $2,  b.name , $4,'
          || '    suftypabrv , $6,'
@@ -151,8 +151,8 @@
          || '            AND $1::integer <= greatest_hn(b.fromhn,b.tohn) '
          || '            AND ($1 % 2)::numeric::integer = (to_number(b.fromhn,''99999999'') % 2)'
          || '    as exact_address, b.name, b.prequalabr, b.pretypabrv, b.tfidr, b.tfidl, b.the_geom, b.place '
-         || '  FROM 
-             (SELECT   a.tlid, a.fullname, a.name, a.predirabrv, a.suftypabrv, a.sufdirabrv, a.prequalabr, a.pretypabrv, 
+         || '  FROM
+             (SELECT   a.tlid, a.fullname, a.name, a.predirabrv, a.suftypabrv, a.sufdirabrv, a.prequalabr, a.pretypabrv,
                 b.the_geom, tfidr, tfidl,
                 a.side ,
                 a.fromhn,
@@ -162,28 +162,28 @@
 
                 FROM  a INNER JOIN tiger.edges As b ON (a.statefp = b.statefp AND a.tlid = b.tlid  '
                || ')
-                    INNER JOIN tiger.faces AS f ON ($10 = f.statefp AND ( (b.tfidl = f.tfid AND a.side = ''L'') OR (b.tfidr = f.tfid AND a.side = ''R'' ) )) 
-                    INNER JOIN tiger.place p ON ($10 = p.statefp AND f.placefp = p.placefp ' 
-          || CASE WHEN parsed.location > '' AND zip_info.zip IS NULL THEN ' AND ( lower(p.name) LIKE (lower($3::text) || ''%'')  ) ' ELSE '' END          
+                    INNER JOIN tiger.faces AS f ON ($10 = f.statefp AND ( (b.tfidl = f.tfid AND a.side = ''L'') OR (b.tfidr = f.tfid AND a.side = ''R'' ) ))
+                    INNER JOIN tiger.place p ON ($10 = p.statefp AND f.placefp = p.placefp '
+          || CASE WHEN parsed.location > '' AND zip_info.zip IS NULL THEN ' AND ( lower(p.name) LIKE (lower($3::text) || ''%'')  ) ' ELSE '' END
           || ')
                 WHERE a.statefp = $10  AND  b.statefp = $10   '
-             ||   CASE WHEN var_restrict_geom IS NOT NULL THEN ' AND ST_Intersects(b.the_geom, $8::geometry) '  ELSE '' END 
+             ||   CASE WHEN var_restrict_geom IS NOT NULL THEN ' AND ST_Intersects(b.the_geom, $8::geometry) '  ELSE '' END
              || '
 
-          )   As b  
-           ORDER BY 10 ,  11 DESC 
-           LIMIT 20 
-            ) AS sub 
-          JOIN tiger.state s ON ($10 = s.statefp) 
-            ORDER BY 1,2,3,4,5,6,7,9 
+          )   As b
+           ORDER BY 10 ,  11 DESC
+           LIMIT 20
+            ) AS sub
+          JOIN tiger.state s ON ($10 = s.statefp)
+            ORDER BY 1,2,3,4,5,6,7,9
           LIMIT 20) As foo ORDER BY sub_rating, exact_address DESC LIMIT  ' || max_results*10 ;
-         
+
   IF var_debug THEN
-         RAISE NOTICE 'stmt: %', 
+         RAISE NOTICE 'stmt: %',
             replace(replace( replace(
                 replace(
-                replace(replace( replace(replace(replace(replace(stmt, '$10', quote_nullable(in_statefp) ), '$2',quote_nullable(parsed.streetName)),'$3', 
-                quote_nullable(parsed.location)), '$4', quote_nullable(parsed.streetTypeAbbrev) ), 
+                replace(replace( replace(replace(replace(replace(stmt, '$10', quote_nullable(in_statefp) ), '$2',quote_nullable(parsed.streetName)),'$3',
+                quote_nullable(parsed.location)), '$4', quote_nullable(parsed.streetTypeAbbrev) ),
                 '$5', quote_nullable(parsed.preDirAbbrev) ),
                    '$6', quote_nullable(parsed.postDirAbbrev) ),
                    '$7', quote_nullable(parsed.zip) ),
@@ -194,19 +194,19 @@
         --RAISE NOTICE 'DEALLOCATE query_base_geo;';
     END IF;
     FOR results IN EXECUTE stmt USING parsed.address,parsed.streetName, parsed.location, parsed.streetTypeAbbrev, parsed.preDirAbbrev, parsed.postDirAbbrev, parsed.zip, var_restrict_geom, zip_info.zip, in_statefp LOOP
-      
+
         -- If we found a match with an exact street, then don't bother
         -- trying to do non-exact matches
-    
-        exact_street := true;    
-        
+
+        exact_street := true;
+
         IF results.exact_address THEN
             ADDY.address := parsed.address;
         ELSE
             ADDY.address := CASE WHEN parsed.address > to_number(results.tohn,'99999999') AND parsed.address > to_number(results.fromhn, '99999999') THEN greatest_hn(results.fromhn, results.tohn)::integer
                 ELSE least_hn(results.fromhn, results.tohn)::integer END ;
         END IF;
-        
+
         ADDY.preDirAbbrev     := results.fedirp;
         ADDY.streetName       := results.fename;
         ADDY.streetTypeAbbrev := results.fetype;
@@ -215,36 +215,36 @@
         ADDY.stateAbbrev      := results.state;
         ADDY.zip              := results.zip;
         ADDY.parsed := TRUE;
-        
+
         GEOMOUT := results.address_geom;
         RATING := results.sub_rating;
         var_n := var_n + 1;
-        
+
         IF var_bestrating IS NULL THEN
             var_bestrating := RATING; /** the first record to come is our best rating we will ever get **/
         END IF;
-        
+
         -- Only consider matches with decent ratings
         IF RATING < 90 THEN
             RETURN NEXT;
         END IF;
-        
+
         -- If we get an exact match, then just return that
         IF RATING = 0 THEN
             RETURN;
         END IF;
-    
+
         IF var_n >= max_results AND RATING < 10  THEN --we have exceeded our desired limit and rating is not horrible
             RETURN;
         END IF;
-    
+
     END LOOP;
-    
+
     IF var_bestrating < 30 THEN --if we already have a match with a rating of 30 or less, its unlikely we can do any better
         RETURN;
     END IF;
-    
 
+
 -- There are a couple of different things to try, from the highest preference and falling back
   -- to lower-preference options.
   -- We start out with zip-code matching, where the zip code could possibly be in more than one
@@ -254,15 +254,15 @@
   -- Finally, if we didn't get a zip code or a city match, we fall back to just a location/street
   -- lookup to try and find *something* useful.
   -- In the end, we *have* to find a statefp, one way or another.
-  var_sql := 
+  var_sql :=
   ' SELECT statefp,location,a.zip,exact,min(pref) FROM
     (SELECT zip_state.statefp as statefp,$1 as location, true As exact, ARRAY[zip_state.zip] as zip,1 as pref
-        FROM zip_state WHERE zip_state.zip = $2 
+        FROM zip_state WHERE zip_state.zip = $2
             AND (' || quote_nullable(in_statefp) || ' IS NULL OR zip_state.statefp = ' || quote_nullable(in_statefp) || ')
           ' || COALESCE(' AND zip_state.zip IN(' || var_bfilter || ')', '') ||
         ' UNION SELECT zip_state_loc.statefp,zip_state_loc.place As location,false As exact, array_agg(zip_state_loc.zip) AS zip,1 + abs(COALESCE(diff_zip(max(zip), $2),0) - COALESCE(diff_zip(min(zip), $2),0)) As pref
               FROM zip_state_loc
-             WHERE zip_state_loc.statefp = ' || quote_nullable(in_statefp) || ' 
+             WHERE zip_state_loc.statefp = ' || quote_nullable(in_statefp) || '
                    AND lower($1) = lower(zip_state_loc.place) '  || COALESCE(' AND zip_state_loc.zip IN(' || var_bfilter || ')', '') ||
         '     GROUP BY zip_state_loc.statefp,zip_state_loc.place
       UNION SELECT zip_state_loc.statefp,zip_state_loc.place As location,false As exact, array_agg(zip_state_loc.zip),3
@@ -275,12 +275,12 @@
              WHERE zip_lookup_base.statefp = ' || quote_nullable(in_statefp) || '
                          AND (soundex($1) = soundex(zip_lookup_base.city) OR soundex($1) = soundex(zip_lookup_base.county))
              GROUP BY zip_lookup_base.statefp,zip_lookup_base.city
-      UNION SELECT ' || quote_nullable(in_statefp) || ' As statefp,$1 As location,false As exact,NULL, 5) as a ' 
-      ' WHERE a.statefp IS NOT NULL 
+      UNION SELECT ' || quote_nullable(in_statefp) || ' As statefp,$1 As location,false As exact,NULL, 5) as a '
+      ' WHERE a.statefp IS NOT NULL
       GROUP BY statefp,location,a.zip,exact, pref ORDER BY exact desc, pref, zip';
   /** FOR zip_info IN     SELECT statefp,location,zip,exact,min(pref) FROM
     (SELECT zip_state.statefp as statefp,parsed.location as location, true As exact, ARRAY[zip_state.zip] as zip,1 as pref
-        FROM zip_state WHERE zip_state.zip = parsed.zip 
+        FROM zip_state WHERE zip_state.zip = parsed.zip
             AND (in_statefp IS NULL OR zip_state.statefp = in_statefp)
         UNION SELECT zip_state_loc.statefp,parsed.location,false As exact, array_agg(zip_state_loc.zip),2 + diff_zip(zip[1], parsed.zip)
               FROM zip_state_loc
@@ -318,12 +318,12 @@
          || '        sub.tohn, e.the_geom, sub.side) as address_geom,'
          || '       sub.sub_rating + '
          || CASE WHEN parsed.zip > '' THEN '  least((coalesce(diff_zip($7 , sub.zip),0) *1.00/2)::integer, coalesce(levenshtein_ignore_case($7, sub.zip),0) ) '
-            ELSE '3' END::text 
+            ELSE '3' END::text
          || ' + coalesce(least(levenshtein_ignore_case($3, coalesce(p.name,zip.city,cs.name,co.name)), levenshtein_ignore_case($3, coalesce(cs.name,co.name))),5)'
          || '    as sub_rating,'
          || '    sub.exact_address as exact_address '
          || ' FROM ('
-         || '  SELECT a.tlid, predirabrv, COALESCE(a.prequalabr || '' '','''' ) || a.name As fename, suftypabrv, sufdirabrv, fromhn, tohn, 
+         || '  SELECT a.tlid, predirabrv, COALESCE(a.prequalabr || '' '','''' ) || a.name As fename, suftypabrv, sufdirabrv, fromhn, tohn,
                     side, a.statefp, zip, rate_attributes($5, a.predirabrv,'
          || '    $2,  a.name , $4,'
          || '    a.suftypabrv , $6,'
@@ -358,7 +358,7 @@
          || '  ORDER BY 11'
          || '  LIMIT 20'
          || '    ) AS sub'
-         || '  JOIN tiger.edges e ON (' || quote_literal(zip_info.statefp) || ' = e.statefp AND sub.tlid = e.tlid AND e.mtfcc LIKE ''S%'' ' 
+         || '  JOIN tiger.edges e ON (' || quote_literal(zip_info.statefp) || ' = e.statefp AND sub.tlid = e.tlid AND e.mtfcc LIKE ''S%'' '
          ||   CASE WHEN var_restrict_geom IS NOT NULL THEN ' AND ST_Intersects(e.the_geom, $8) '  ELSE '' END || ') '
          || '  JOIN tiger.state s ON (' || quote_literal(zip_info.statefp) || ' = s.statefp)'
          || '  JOIN tiger.faces f ON (' || quote_literal(zip_info.statefp) || ' = f.statefp AND (e.tfidl = f.tfid OR e.tfidr = f.tfid))'
@@ -409,7 +409,7 @@
       GEOMOUT := results.address_geom;
       RATING := results.sub_rating;
       var_n := var_n + 1;
-      
+
       -- If our ratings go above 99 exit because its a really bad match
       IF RATING > 99 THEN
         RETURN;

Modified: trunk/extras/tiger_geocoder/geocode/geocode_intersection.sql
===================================================================
--- trunk/extras/tiger_geocoder/geocode/geocode_intersection.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/geocode/geocode_intersection.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,11 +1,11 @@
- /*** 
- * 
+ /***
+ *
  * Copyright (C) 2011-2016 Regina Obe and Leo Hsu (Paragon Corporation)
  **/
 -- This function given two roadways, state and optional city, zip
 -- Will return addresses that are at the intersecton of those roadways
 -- The address returned will be the address on the first road way
--- Use case example an address at the intersection of 2 streets: 
+-- Use case example an address at the intersection of 2 streets:
 -- SELECT pprint_addy(addy), st_astext(geomout),rating FROM geocode_intersection('School St', 'Washington St', 'MA', 'Boston','02117');
 --DROP FUNCTION tiger.geocode_intersection(text,text,text,text,text,integer);
 CREATE OR REPLACE FUNCTION geocode_intersection(
@@ -25,7 +25,7 @@
     var_na_inter1 norm_addy;
     var_sql text := '';
     var_zip varchar(5)[];
-    in_statefp varchar(2) ; 
+    in_statefp varchar(2) ;
     var_debug boolean := get_geocode_setting('debug_geocode_intersection')::boolean;
     results record;
 BEGIN
@@ -44,31 +44,31 @@
     IF var_zip IS NULL AND in_city > '' THEN
         var_zip := array_agg(zip) FROM zip_lookup_base WHERE statefp = in_statefp AND lower(city) = lower(in_city);
     END IF;
-    
+
     -- if we don't have a city or zip, don't bother doing the zip check, just keep as null
     IF var_zip IS NULL AND in_city > '' THEN
         var_zip := array_agg(zip) FROM zip_lookup_base WHERE statefp = in_statefp AND lower(city) LIKE lower(in_city) || '%'  ;
-    END IF; 
+    END IF;
     IF var_debug THEN
 		RAISE NOTICE 'var_zip: %, city: %', quote_nullable(var_zip), quote_nullable(in_city);	
     END IF;
     var_sql := '
-    WITH 
+    WITH
     	a1 AS (SELECT f.*, addr.fromhn, addr.tohn, addr.side , addr.zip
-    				FROM (SELECT * FROM tiger.featnames 
+    				FROM (SELECT * FROM tiger.featnames
     							WHERE statefp = $1 AND ( lower(name) = $2  ' ||
-    							CASE WHEN length(var_na_road.streetName) > 5 THEN ' or  lower(fullname) LIKE $6 || ''%'' ' ELSE '' END || ')' 
+    							CASE WHEN length(var_na_road.streetName) > 5 THEN ' or  lower(fullname) LIKE $6 || ''%'' ' ELSE '' END || ')'
     							|| ')  AS f LEFT JOIN (SELECT * FROM tiger.addr As addr WHERE addr.statefp = $1) As addr ON (addr.tlid = f.tlid AND addr.statefp = f.statefp)
-    					WHERE $5::text[] IS NULL OR addr.zip = ANY($5::text[]) OR addr.zip IS NULL 
+    					WHERE $5::text[] IS NULL OR addr.zip = ANY($5::text[]) OR addr.zip IS NULL
     				ORDER BY CASE WHEN lower(f.fullname) = $6 THEN 0 ELSE 1 END
     				LIMIT 50000
     			  ),
         a2 AS (SELECT f.*, addr.fromhn, addr.tohn, addr.side , addr.zip
-    				FROM (SELECT * FROM tiger.featnames 
-    							WHERE statefp = $1 AND ( lower(name) = $4 ' || 
-    							CASE WHEN length(var_na_inter1.streetName) > 5 THEN ' or lower(fullname) LIKE $7 || ''%'' ' ELSE '' END || ')' 
+    				FROM (SELECT * FROM tiger.featnames
+    							WHERE statefp = $1 AND ( lower(name) = $4 ' ||
+    							CASE WHEN length(var_na_inter1.streetName) > 5 THEN ' or lower(fullname) LIKE $7 || ''%'' ' ELSE '' END || ')'
     							|| ' )  AS f LEFT JOIN (SELECT * FROM tiger.addr As addr WHERE addr.statefp = $1) AS addr ON (addr.tlid = f.tlid AND addr.statefp = f.statefp)
-    					WHERE $5::text[] IS NULL OR addr.zip = ANY($5::text[])  or addr.zip IS NULL 
+    					WHERE $5::text[] IS NULL OR addr.zip = ANY($5::text[])  or addr.zip IS NULL
     			ORDER BY CASE WHEN lower(f.fullname) = $7 THEN 0 ELSE 1 END
     				LIMIT 50000
     			  ),
@@ -76,42 +76,42 @@
     	 			CASE WHEN a.side = ''L'' THEN e.tfidl ELSE e.tfidr END AS tfid
     	 			FROM a1 As a
     					INNER JOIN  tiger.edges AS e ON (e.statefp = a.statefp AND a.tlid = e.tlid)
-    				WHERE e.statefp = $1 
+    				WHERE e.statefp = $1
     				ORDER BY CASE WHEN lower(a.name) = $4 THEN 0 ELSE 1 END + CASE WHEN lower(e.fullname) = $7 THEN 0 ELSE 1 END
     				LIMIT 5000) ,
     	e2 AS (SELECT e.the_geom, e.tnidf, e.tnidt, a.*,
     	 			CASE WHEN a.side = ''L'' THEN e.tfidl ELSE e.tfidr END AS tfid
     				FROM (SELECT * FROM tiger.edges WHERE statefp = $1) AS e INNER JOIN a2 AS a ON (e.statefp = a.statefp AND a.tlid = e.tlid)
-    					INNER JOIN e1 ON (e.statefp = e1.statefp  
+    					INNER JOIN e1 ON (e.statefp = e1.statefp
     					AND ARRAY[e.tnidf, e.tnidt] && ARRAY[e1.tnidf, e1.tnidt] )
     					
     				WHERE (lower(e.fullname) = $7 or lower(a.name) LIKE $4 || ''%'')
     				ORDER BY CASE WHEN lower(a.name) = $4 THEN 0 ELSE 1 END + CASE WHEN lower(e.fullname) = $7 THEN 0 ELSE 1 END
     				LIMIT 5000
-    				), 
+    				),
     	segs AS (SELECT DISTINCT ON(e1.tlid, e1.side)
                    CASE WHEN e1.tnidf = e2.tnidf OR e1.tnidf = e2.tnidt THEN
                                 e1.fromhn
                             ELSE
-                                e1.tohn END As address, e1.predirabrv As fedirp, COALESCE(e1.prequalabr || '' '','''' ) || e1.name As fename, 
-                             COALESCE(e1.suftypabrv,e1.pretypabrv)  As fetype, e1.sufdirabrv AS fedirs, 
+                                e1.tohn END As address, e1.predirabrv As fedirp, COALESCE(e1.prequalabr || '' '','''' ) || e1.name As fename,
+                             COALESCE(e1.suftypabrv,e1.pretypabrv)  As fetype, e1.sufdirabrv AS fedirs,
                                p.name As place, e1.zip,
                              CASE WHEN e1.tnidf = e2.tnidf OR e1.tnidf = e2.tnidt THEN
                                 ST_StartPoint(ST_GeometryN(ST_Multi(e1.the_geom),1))
-                             ELSE ST_EndPoint(ST_GeometryN(ST_Multi(e1.the_geom),1)) END AS geom ,   
-                                CASE WHEN lower(p.name) = $3 THEN 0 ELSE 1 END  
-                                + levenshtein_ignore_case(p.name, $3) 
+                             ELSE ST_EndPoint(ST_GeometryN(ST_Multi(e1.the_geom),1)) END AS geom ,
+                                CASE WHEN lower(p.name) = $3 THEN 0 ELSE 1 END
+                                + levenshtein_ignore_case(p.name, $3)
                                 + levenshtein_ignore_case(e1.name || COALESCE('' '' || e1.sufqualabr, ''''),$2) +
                                 CASE WHEN e1.fullname = $6 THEN 0 ELSE levenshtein_ignore_case(e1.fullname, $6) END +
                                 + levenshtein_ignore_case(e2.name || COALESCE('' '' || e2.sufqualabr, ''''),$4)
-                                AS a_rating  
-                    FROM e1 
+                                AS a_rating
+                    FROM e1
                             INNER JOIN e2 ON (
-                                  ARRAY[e2.tnidf, e2.tnidt] && ARRAY[e1.tnidf, e1.tnidt]  ) 
+                                  ARRAY[e2.tnidf, e2.tnidt] && ARRAY[e1.tnidf, e1.tnidt]  )
                              INNER JOIN (SELECT * FROM tiger.faces WHERE statefp = $1) As fa1 ON (e1.tfid = fa1.tfid  )
                           LEFT JOIN tiger.place AS p ON (fa1.placefp = p.placefp AND p.statefp = $1 )
                        ORDER BY e1.tlid, e1.side, a_rating LIMIT $9*4 )
-    SELECT address, fedirp , fename, fetype,fedirs,place, zip , geom, a_rating 
+    SELECT address, fedirp , fename, fetype,fedirs,place, zip , geom, a_rating
         FROM segs ORDER BY a_rating LIMIT  $9';
 
     IF var_debug THEN
@@ -119,7 +119,7 @@
         	replace(replace(replace(
                 replace(
                     replace(
-                        replace(var_sql, '$1', quote_nullable(in_statefp)), 
+                        replace(var_sql, '$1', quote_nullable(in_statefp)),
                               '$2', quote_nullable(lower(var_na_road.streetName) ) ),
                       '$3', quote_nullable(lower(in_city)) ),
                       '$4', quote_nullable(lower(var_na_inter1.streetName) ) ),
@@ -141,10 +141,10 @@
         ADDY.zip              := results.zip;
         ADDY.parsed := TRUE;
         ADDY.address := substring(results.address FROM '[0-9]+')::integer;
-        
+
         GEOMOUT := results.geom;
         RATING := results.a_rating;
-		RETURN NEXT; 
+		RETURN NEXT;
 	END LOOP;
 	RETURN;
 END;

Modified: trunk/extras/tiger_geocoder/geocode/geocode_location.sql
===================================================================
--- trunk/extras/tiger_geocoder/geocode/geocode_location.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/geocode/geocode_location.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -67,7 +67,7 @@
 
   IF var_debug THEN
     RAISE NOTICE 'geocode_location stmt: %', stmt;
-  END IF;     
+  END IF;
   FOR result IN EXECUTE stmt
   LOOP
 
@@ -87,7 +87,7 @@
       END IF;
     END IF;
   END LOOP;
-  
+
   IF var_debug THEN
     RAISE NOTICE 'geocode_location ending: %', clock_timestamp();
   END IF;

Modified: trunk/extras/tiger_geocoder/geocode/interpolate_from_address.sql
===================================================================
--- trunk/extras/tiger_geocoder/geocode/interpolate_from_address.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/geocode/interpolate_from_address.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -7,7 +7,7 @@
 -- fifth are from the other.
 -- in_side Side of street -- either 'L', 'R' or if blank ignores side of road
 -- in_offset_m -- number of meters offset to the side
-CREATE OR REPLACE FUNCTION interpolate_from_address(given_address INTEGER, in_addr1 VARCHAR, in_addr2 VARCHAR, in_road GEOMETRY, 
+CREATE OR REPLACE FUNCTION interpolate_from_address(given_address INTEGER, in_addr1 VARCHAR, in_addr2 VARCHAR, in_road GEOMETRY,
 	in_side VARCHAR DEFAULT '',in_offset_m float DEFAULT 10) RETURNS GEOMETRY
 AS $_$
 DECLARE
@@ -24,7 +24,7 @@
     IF in_road IS NULL THEN
         RETURN NULL;
     END IF;
-    
+
 	var_addr1 := to_number(in_addr1, '999999');
 	var_addr2 := to_number(in_addr2, '999999');
 
@@ -54,18 +54,18 @@
     center_pt = ST_LineInterpolatePoint(road, part);
     IF in_side > '' AND in_offset_m > 0 THEN
     /** Compute point the point to the in_side of the geometry **/
-    /**Take into consideration non-straight so we consider azimuth 
-    	of the 2 points that straddle the center location**/ 
+    /**Take into consideration non-straight so we consider azimuth
+    	of the 2 points that straddle the center location**/
     	IF part = 0 THEN
     		az := ST_Azimuth (ST_StartPoint(road), ST_PointN(road,2));
     	ELSIF part = 1 THEN
     		az := ST_Azimuth (ST_PointN(road,ST_NPoints(road) - 1), ST_EndPoint(road));
-    	ELSE 
+    	ELSE
     		/** Find the largest nth point position that is before the center point
     			This will be the start of our azimuth calc **/
     		SELECT i INTO npos
-    			FROM generate_series(1,ST_NPoints(road)) As i 
-    					WHERE part > ST_LineLocatePoint(road,ST_PointN(road,i)) 
+    			FROM generate_series(1,ST_NPoints(road)) As i
+    					WHERE part > ST_LineLocatePoint(road,ST_PointN(road,i))
     					ORDER BY i DESC;
     		IF npos < ST_NPoints(road) THEN				
     			az := ST_Azimuth (ST_PointN(road,npos), ST_PointN(road, npos + 1));
@@ -92,7 +92,7 @@
     RETURN result;
 END;
 $_$ LANGUAGE plpgsql IMMUTABLE COST 10;
--- needed to ban stupid warning about how we are using deprecated functions 
+-- needed to ban stupid warning about how we are using deprecated functions
 -- yada yada yada need this to work in 2.0 too bah
 ALTER FUNCTION interpolate_from_address(integer, character varying, character varying, geometry, character varying, double precision)
   SET client_min_messages='ERROR';

Modified: trunk/extras/tiger_geocoder/geocode/other_helper_functions.sql
===================================================================
--- trunk/extras/tiger_geocoder/geocode/other_helper_functions.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/geocode/other_helper_functions.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,17 +1,17 @@
- /*** 
- * 
+ /***
+ *
  * Copyright (C) 2011 Regina Obe and Leo Hsu (Paragon Corporation)
  **/
 -- Note we are wrapping this in a function so we can make it immutable and thus useable in an index
--- It also allows us to shorten and possibly better cache the repetitive pattern in the code 
--- greatest(to_number(b.fromhn,''99999999''),to_number(b.tohn,''99999999'')) 
+-- It also allows us to shorten and possibly better cache the repetitive pattern in the code
+-- greatest(to_number(b.fromhn,''99999999''),to_number(b.tohn,''99999999''))
 -- and least(to_number(b.fromhn,''99999999''),to_number(b.tohn,''99999999''))
 CREATE OR REPLACE FUNCTION least_hn(fromhn varchar, tohn varchar)
   RETURNS integer AS
 $$ SELECT least(to_number( CASE WHEN trim($1) ~ '^[0-9]+$' THEN $1 ELSE '0' END,'9999999'),to_number(CASE WHEN trim($2) ~ '^[0-9]+$' THEN $2 ELSE '0' END,'9999999') )::integer;  $$
   LANGUAGE sql IMMUTABLE
   COST 200;
-  
+
 -- Note we are wrapping this in a function so we can make it immutable (for some reason least and greatest aren't considered immutable)
 -- and thu useable in an index or cacheable for multiple calls
 CREATE OR REPLACE FUNCTION greatest_hn(fromhn varchar, tohn varchar)
@@ -19,7 +19,7 @@
 $$ SELECT greatest(to_number( CASE WHEN trim($1) ~ '^[0-9]+$' THEN $1 ELSE '0' END,'99999999'),to_number(CASE WHEN trim($2) ~ '^[0-9]+$' THEN $2 ELSE '0' END,'99999999') )::integer;  $$
   LANGUAGE sql IMMUTABLE
   COST 200;
-  
+
 -- Returns an absolute difference between two zips
 -- This is generally more efficient than doing levenshtein
 -- Since when people get the wrong zip, its usually off by one or 2 numeric distance
@@ -29,7 +29,7 @@
 $$ SELECT abs(to_number( CASE WHEN trim(substring($1,1,5)) ~ '^[0-9]+$' THEN $1 ELSE '0' END,'99999')::integer - to_number( CASE WHEN trim(substring($2,1,5)) ~ '^[0-9]+$' THEN $2 ELSE '0' END,'99999')::integer )::integer;  $$
   LANGUAGE sql IMMUTABLE STRICT
   COST 200;
-  
+
 -- function return  true or false if 2 numeric streets are equal such as 15th St, 23rd st
 -- it compares just the numeric part of the street for equality
 -- PURPOSE: handle bad formats such as 23th St so 23th St = 23rd St
@@ -39,9 +39,9 @@
 CREATE OR REPLACE FUNCTION numeric_streets_equal(input_street varchar, output_street varchar)
     RETURNS boolean AS
 $$
-    SELECT COALESCE(length($1) < 10 AND length($2) < 10 
-            AND $1 ~ E'^[0-9\/\s]+' AND $2 ~ E'^[0-9\/\s]+' 
-            AND  trim(substring($1, E'^[0-9\/\s]+')) = trim(substring($2, E'^[0-9\/\s]+')), false); 
+    SELECT COALESCE(length($1) < 10 AND length($2) < 10
+            AND $1 ~ E'^[0-9\/\s]+' AND $2 ~ E'^[0-9\/\s]+'
+            AND  trim(substring($1, E'^[0-9\/\s]+')) = trim(substring($2, E'^[0-9\/\s]+')), false);
 $$
 LANGUAGE sql IMMUTABLE
 COST 5;
@@ -51,11 +51,11 @@
 CREATE OR REPLACE FUNCTION drop_indexes_generate_script(tiger_data_schema text DEFAULT 'tiger_data')
 RETURNS text AS
 $$
-SELECT array_to_string(ARRAY(SELECT 'DROP INDEX ' || schemaname || '.' || indexname || ';' 
+SELECT array_to_string(ARRAY(SELECT 'DROP INDEX ' || schemaname || '.' || indexname || ';'
 FROM pg_catalog.pg_indexes  where schemaname IN('tiger',$1)  AND indexname NOT LIKE 'uidx%' AND indexname NOT LIKE 'pk_%' AND indexname NOT LIKE '%key'), E'\n');
 $$
 LANGUAGE sql STABLE;
--- Generate script to create missing indexes in tiger tables. 
+-- Generate script to create missing indexes in tiger tables.
 -- This will generate sql you can run to index commonly used join columns in geocoder for tiger and tiger_data schemas --
 CREATE OR REPLACE FUNCTION missing_indexes_generate_script()
 RETURNS text AS
@@ -63,138 +63,138 @@
 SELECT array_to_string(ARRAY(
 -- create unique index on faces for tfid seems to perform better --
 SELECT 'CREATE UNIQUE INDEX uidx_' || c.table_schema || '_' || c.table_name || '_' || c.column_name || ' ON ' || c.table_schema || '.' || c.table_name || ' USING btree(' || c.column_name || ');' As index
-FROM (SELECT table_name, table_schema  FROM 
+FROM (SELECT table_name, table_schema  FROM
 	information_schema.tables WHERE table_type = 'BASE TABLE') As t  INNER JOIN
-	(SELECT * FROM information_schema.columns WHERE column_name IN('tfid') ) AS c  
+	(SELECT * FROM information_schema.columns WHERE column_name IN('tfid') ) AS c
 		ON (t.table_name = c.table_name AND t.table_schema = c.table_schema)
-		LEFT JOIN pg_catalog.pg_indexes i ON 
-			(i.tablename = c.table_name AND i.schemaname = c.table_schema 
-				AND  indexname LIKE 'uidx%' || c.column_name || '%' ) 
+		LEFT JOIN pg_catalog.pg_indexes i ON
+			(i.tablename = c.table_name AND i.schemaname = c.table_schema
+				AND  indexname LIKE 'uidx%' || c.column_name || '%' )
 WHERE i.tablename IS NULL AND c.table_schema IN('tiger','tiger_data') AND c.table_name LIKE '%faces'
 UNION ALL
 -- basic btree regular indexes
 SELECT 'CREATE INDEX idx_' || c.table_schema || '_' || c.table_name || '_' || c.column_name || ' ON ' || c.table_schema || '.' || c.table_name || ' USING btree(' || c.column_name || ');' As index
-FROM (SELECT table_name, table_schema  FROM 
+FROM (SELECT table_name, table_schema  FROM
 	information_schema.tables WHERE table_type = 'BASE TABLE') As t  INNER JOIN
-	(SELECT * FROM information_schema.columns WHERE column_name IN('countyfp', 'tlid', 'tfidl', 'tfidr', 'tfid', 'zip', 'placefp', 'cousubfp') ) AS c  
+	(SELECT * FROM information_schema.columns WHERE column_name IN('countyfp', 'tlid', 'tfidl', 'tfidr', 'tfid', 'zip', 'placefp', 'cousubfp') ) AS c
 		ON (t.table_name = c.table_name AND t.table_schema = c.table_schema)
-		LEFT JOIN pg_catalog.pg_indexes i ON 
-			(i.tablename = c.table_name AND i.schemaname = c.table_schema 
-				AND  indexdef LIKE '%' || c.column_name || '%' ) 
+		LEFT JOIN pg_catalog.pg_indexes i ON
+			(i.tablename = c.table_name AND i.schemaname = c.table_schema
+				AND  indexdef LIKE '%' || c.column_name || '%' )
 WHERE i.tablename IS NULL AND c.table_schema IN('tiger','tiger_data')  AND (NOT c.table_name LIKE '%faces')
 -- Gist spatial indexes --
 UNION ALL
 SELECT 'CREATE INDEX idx_' || c.table_schema || '_' || c.table_name || '_' || c.column_name || '_gist ON ' || c.table_schema || '.' || c.table_name || ' USING gist(' || c.column_name || ');' As index
-FROM (SELECT table_name, table_schema FROM 
+FROM (SELECT table_name, table_schema FROM
 	information_schema.tables WHERE table_type = 'BASE TABLE') As t  INNER JOIN
-	(SELECT * FROM information_schema.columns WHERE column_name IN('the_geom', 'geom') ) AS c  
+	(SELECT * FROM information_schema.columns WHERE column_name IN('the_geom', 'geom') ) AS c
 		ON (t.table_name = c.table_name AND t.table_schema = c.table_schema)
-		LEFT JOIN pg_catalog.pg_indexes i ON 
-			(i.tablename = c.table_name AND i.schemaname = c.table_schema 
-				AND  indexdef LIKE '%' || c.column_name || '%') 
+		LEFT JOIN pg_catalog.pg_indexes i ON
+			(i.tablename = c.table_name AND i.schemaname = c.table_schema
+				AND  indexdef LIKE '%' || c.column_name || '%')
 WHERE i.tablename IS NULL AND c.table_schema IN('tiger','tiger_data')
 -- Soundex indexes --
 UNION ALL
 SELECT 'CREATE INDEX idx_' || c.table_schema || '_' || c.table_name || '_snd_' || c.column_name || ' ON ' || c.table_schema || '.' || c.table_name || ' USING btree(soundex(' || c.column_name || '));' As index
-FROM (SELECT table_name, table_schema FROM 
+FROM (SELECT table_name, table_schema FROM
 	information_schema.tables WHERE table_type = 'BASE TABLE') As t  INNER JOIN
-	(SELECT * FROM information_schema.columns WHERE column_name IN('name', 'place', 'city') ) AS c  
+	(SELECT * FROM information_schema.columns WHERE column_name IN('name', 'place', 'city') ) AS c
 		ON (t.table_name = c.table_name AND t.table_schema = c.table_schema)
-		LEFT JOIN pg_catalog.pg_indexes i ON 
-			(i.tablename = c.table_name AND i.schemaname = c.table_schema 
-				AND  indexdef LIKE '%soundex(%' || c.column_name || '%' AND indexdef LIKE '%_snd_' || c.column_name || '%' ) 
-WHERE i.tablename IS NULL AND c.table_schema IN('tiger','tiger_data') 
+		LEFT JOIN pg_catalog.pg_indexes i ON
+			(i.tablename = c.table_name AND i.schemaname = c.table_schema
+				AND  indexdef LIKE '%soundex(%' || c.column_name || '%' AND indexdef LIKE '%_snd_' || c.column_name || '%' )
+WHERE i.tablename IS NULL AND c.table_schema IN('tiger','tiger_data')
     AND (c.table_name LIKE '%county%' OR c.table_name LIKE '%featnames'
-    OR c.table_name  LIKE '%place' or c.table_name LIKE '%zip%'  or c.table_name LIKE '%cousub') 
+    OR c.table_name  LIKE '%place' or c.table_name LIKE '%zip%'  or c.table_name LIKE '%cousub')
 -- Lower indexes --
 UNION ALL
 SELECT 'CREATE INDEX idx_' || c.table_schema || '_' || c.table_name || '_lower_' || c.column_name || ' ON ' || c.table_schema || '.' || c.table_name || ' USING btree(lower(' || c.column_name || '));' As index
-FROM (SELECT table_name, table_schema FROM 
+FROM (SELECT table_name, table_schema FROM
 	information_schema.tables WHERE table_type = 'BASE TABLE') As t  INNER JOIN
-	(SELECT * FROM information_schema.columns WHERE column_name IN('name', 'place', 'city') ) AS c  
+	(SELECT * FROM information_schema.columns WHERE column_name IN('name', 'place', 'city') ) AS c
 		ON (t.table_name = c.table_name AND t.table_schema = c.table_schema)
-		LEFT JOIN pg_catalog.pg_indexes i ON 
-			(i.tablename = c.table_name AND i.schemaname = c.table_schema 
-				AND  indexdef LIKE '%btree%(%lower(%' || c.column_name || '%') 
-WHERE i.tablename IS NULL AND c.table_schema IN('tiger','tiger_data') 
-    AND (c.table_name LIKE '%county%' OR c.table_name LIKE '%featnames' OR c.table_name  LIKE '%place' or c.table_name LIKE '%zip%' or c.table_name LIKE '%cousub') 
+		LEFT JOIN pg_catalog.pg_indexes i ON
+			(i.tablename = c.table_name AND i.schemaname = c.table_schema
+				AND  indexdef LIKE '%btree%(%lower(%' || c.column_name || '%')
+WHERE i.tablename IS NULL AND c.table_schema IN('tiger','tiger_data')
+    AND (c.table_name LIKE '%county%' OR c.table_name LIKE '%featnames' OR c.table_name  LIKE '%place' or c.table_name LIKE '%zip%' or c.table_name LIKE '%cousub')
 -- Least address index btree least_hn(fromhn, tohn)
 UNION ALL
 SELECT 'CREATE INDEX idx_' || c.table_schema || '_' || c.table_name || '_least_address' || ' ON ' || c.table_schema || '.' || c.table_name || ' USING btree(least_hn(fromhn, tohn));' As index
-FROM (SELECT table_name, table_schema FROM 
+FROM (SELECT table_name, table_schema FROM
 	information_schema.tables WHERE table_type = 'BASE TABLE' AND table_name LIKE '%addr' AND table_schema IN('tiger','tiger_data')) As t  INNER JOIN
-	(SELECT * FROM information_schema.columns WHERE column_name IN('fromhn') ) AS c  
+	(SELECT * FROM information_schema.columns WHERE column_name IN('fromhn') ) AS c
 		ON (t.table_name = c.table_name AND t.table_schema = c.table_schema)
-		LEFT JOIN pg_catalog.pg_indexes i ON 
-			(i.tablename = c.table_name AND i.schemaname = c.table_schema 
-				AND  indexdef LIKE '%least_hn(%' || c.column_name || '%') 
+		LEFT JOIN pg_catalog.pg_indexes i ON
+			(i.tablename = c.table_name AND i.schemaname = c.table_schema
+				AND  indexdef LIKE '%least_hn(%' || c.column_name || '%')
 WHERE i.tablename IS NULL
 -- var_ops lower --
 UNION ALL
 SELECT 'CREATE INDEX idx_' || c.table_schema || '_' || c.table_name || '_l' || c.column_name || '_var_ops' || ' ON ' || c.table_schema || '.' || c.table_name || ' USING btree(lower(' || c.column_name || ') varchar_pattern_ops);' As index
-FROM (SELECT table_name, table_schema FROM 
+FROM (SELECT table_name, table_schema FROM
 	information_schema.tables WHERE table_type = 'BASE TABLE' AND (table_name LIKE '%featnames' or table_name LIKE '%place' or table_name LIKE '%zip_lookup_base' or table_name LIKE '%zip_state_loc') AND table_schema IN('tiger','tiger_data')) As t  INNER JOIN
-	(SELECT * FROM information_schema.columns WHERE column_name IN('name', 'city', 'place', 'fullname') ) AS c  
+	(SELECT * FROM information_schema.columns WHERE column_name IN('name', 'city', 'place', 'fullname') ) AS c
 		ON (t.table_name = c.table_name AND t.table_schema = c.table_schema)
-		LEFT JOIN pg_catalog.pg_indexes i ON 
-			(i.tablename = c.table_name AND i.schemaname = c.table_schema 
-				AND  indexdef LIKE '%btree%(%lower%' || c.column_name || ')%varchar_pattern_ops%') 
+		LEFT JOIN pg_catalog.pg_indexes i ON
+			(i.tablename = c.table_name AND i.schemaname = c.table_schema
+				AND  indexdef LIKE '%btree%(%lower%' || c.column_name || ')%varchar_pattern_ops%')
 WHERE i.tablename IS NULL
 -- var_ops mtfcc --
 /** UNION ALL
 SELECT 'CREATE INDEX idx_' || c.table_schema || '_' || c.table_name || '_' || c.column_name || '_var_ops' || ' ON ' || c.table_schema || '.' || c.table_name || ' USING btree(' || c.column_name || ' varchar_pattern_ops);' As index
-FROM (SELECT table_name, table_schema FROM 
+FROM (SELECT table_name, table_schema FROM
 	information_schema.tables WHERE table_type = 'BASE TABLE' AND (table_name LIKE '%featnames' or table_name LIKE '%edges') AND table_schema IN('tiger','tiger_data')) As t  INNER JOIN
-	(SELECT * FROM information_schema.columns WHERE column_name IN('mtfcc') ) AS c  
+	(SELECT * FROM information_schema.columns WHERE column_name IN('mtfcc') ) AS c
 		ON (t.table_name = c.table_name AND t.table_schema = c.table_schema)
-		LEFT JOIN pg_catalog.pg_indexes i ON 
-			(i.tablename = c.table_name AND i.schemaname = c.table_schema 
-				AND  indexdef LIKE '%btree%(' || c.column_name || '%varchar_pattern_ops%') 
+		LEFT JOIN pg_catalog.pg_indexes i ON
+			(i.tablename = c.table_name AND i.schemaname = c.table_schema
+				AND  indexdef LIKE '%btree%(' || c.column_name || '%varchar_pattern_ops%')
 WHERE i.tablename IS NULL **/
 -- zipl zipr on edges --
 UNION ALL
 SELECT 'CREATE INDEX idx_' || c.table_schema || '_' || c.table_name || '_' || c.column_name || ' ON ' || c.table_schema || '.' || c.table_name || ' USING btree(' || c.column_name || ' );' As index
-FROM (SELECT table_name, table_schema FROM 
+FROM (SELECT table_name, table_schema FROM
 	information_schema.tables WHERE table_type = 'BASE TABLE' AND table_name LIKE '%edges' AND table_schema IN('tiger','tiger_data')) As t  INNER JOIN
-	(SELECT * FROM information_schema.columns WHERE column_name IN('zipl', 'zipr') ) AS c  
+	(SELECT * FROM information_schema.columns WHERE column_name IN('zipl', 'zipr') ) AS c
 		ON (t.table_name = c.table_name AND t.table_schema = c.table_schema)
-		LEFT JOIN pg_catalog.pg_indexes i ON 
-			(i.tablename = c.table_name AND i.schemaname = c.table_schema 
-				AND  indexdef LIKE '%btree%(' || c.column_name || '%)%') 
+		LEFT JOIN pg_catalog.pg_indexes i ON
+			(i.tablename = c.table_name AND i.schemaname = c.table_schema
+				AND  indexdef LIKE '%btree%(' || c.column_name || '%)%')
 WHERE i.tablename IS NULL
 
 -- unique index on tlid state county --
 /*UNION ALL
 SELECT 'CREATE UNIQUE INDEX uidx_' || t.table_schema || '_' || t.table_name || '_tlid_statefp_countyfp ON ' || t.table_schema || '.' || t.table_name || ' USING btree(tlid,statefp,countyfp);' As index
-FROM (SELECT table_name, table_schema FROM 
-	information_schema.tables WHERE table_type = 'BASE TABLE' AND table_name LIKE '%edges' AND table_schema IN('tiger','tiger_data')) As t  
-		LEFT JOIN pg_catalog.pg_indexes i ON 
-			(i.tablename = t.table_name AND i.schemaname = t.table_schema 
-				AND  indexdef LIKE '%btree%(%tlid,%statefp%countyfp%)%') 
+FROM (SELECT table_name, table_schema FROM
+	information_schema.tables WHERE table_type = 'BASE TABLE' AND table_name LIKE '%edges' AND table_schema IN('tiger','tiger_data')) As t
+		LEFT JOIN pg_catalog.pg_indexes i ON
+			(i.tablename = t.table_name AND i.schemaname = t.table_schema
+				AND  indexdef LIKE '%btree%(%tlid,%statefp%countyfp%)%')
 WHERE i.tablename IS NULL*/
 --full text indexes on name field--
 /**UNION ALL
 SELECT 'CREATE INDEX idx_' || c.table_schema || '_' || c.table_name || '_fullname_ft_gist' || ' ON ' || c.table_schema || '.' || c.table_name || ' USING gist(to_tsvector(''english'',fullname))' As index
-FROM (SELECT table_name, table_schema FROM 
+FROM (SELECT table_name, table_schema FROM
 	information_schema.tables WHERE table_type = 'BASE TABLE' AND table_name LIKE '%featnames' AND table_schema IN('tiger','tiger_data')) As t  INNER JOIN
-	(SELECT * FROM information_schema.columns WHERE column_name IN('fullname') ) AS c  
+	(SELECT * FROM information_schema.columns WHERE column_name IN('fullname') ) AS c
 		ON (t.table_name = c.table_name AND t.table_schema = c.table_schema)
-		LEFT JOIN pg_catalog.pg_indexes i ON 
-			(i.tablename = c.table_name AND i.schemaname = c.table_schema 
-				AND  indexdef LIKE '%to_tsvector(%' || c.column_name || '%') 
+		LEFT JOIN pg_catalog.pg_indexes i ON
+			(i.tablename = c.table_name AND i.schemaname = c.table_schema
+				AND  indexdef LIKE '%to_tsvector(%' || c.column_name || '%')
 WHERE i.tablename IS NULL **/
 
 -- trigram index --
 /**UNION ALL
 SELECT 'CREATE INDEX idx_' || c.table_schema || '_' || c.table_name || '_' || c.column_name || '_trgm_gist' || ' ON ' || c.table_schema || '.' || c.table_name || ' USING gist(' || c.column_name || ' gist_trgm_ops);' As index
-FROM (SELECT table_name, table_schema FROM 
+FROM (SELECT table_name, table_schema FROM
 	information_schema.tables WHERE table_type = 'BASE TABLE' AND table_name LIKE '%featnames' AND table_schema IN('tiger','tiger_data')) As t  INNER JOIN
-	(SELECT * FROM information_schema.columns WHERE column_name IN('fullname', 'name') ) AS c  
+	(SELECT * FROM information_schema.columns WHERE column_name IN('fullname', 'name') ) AS c
 		ON (t.table_name = c.table_name AND t.table_schema = c.table_schema)
-		LEFT JOIN pg_catalog.pg_indexes i ON 
-			(i.tablename = c.table_name AND i.schemaname = c.table_schema 
-				AND  indexdef LIKE '%gist%(' || c.column_name || '%gist_trgm_ops%') 
-WHERE i.tablename IS NULL **/ 
+		LEFT JOIN pg_catalog.pg_indexes i ON
+			(i.tablename = c.table_name AND i.schemaname = c.table_schema
+				AND  indexdef LIKE '%gist%(' || c.column_name || '%gist_trgm_ops%')
+WHERE i.tablename IS NULL **/
 ORDER BY 1), E'\r');
 $$
 LANGUAGE sql VOLATILE;
@@ -212,27 +212,27 @@
 language plpgsql;
 
 
-CREATE OR REPLACE FUNCTION drop_dupe_featnames_generate_script() RETURNS text 
+CREATE OR REPLACE FUNCTION drop_dupe_featnames_generate_script() RETURNS text
 AS
 $$
 
 SELECT array_to_string(ARRAY(SELECT 'CREATE TEMPORARY TABLE dup AS
 SELECT min(f.gid) As min_gid, f.tlid, lower(f.fullname) As fname
 	FROM ONLY ' || t.table_schema || '.' || t.table_name || ' As f
-	GROUP BY f.tlid, lower(f.fullname) 
+	GROUP BY f.tlid, lower(f.fullname)
 	HAVING count(*) > 1;
 	
 DELETE FROM ' || t.table_schema || '.' || t.table_name || ' AS feat
 WHERE EXISTS (SELECT tlid FROM dup WHERE feat.tlid = dup.tlid AND lower(feat.fullname) = dup.fname
 		AND feat.gid > dup.min_gid);
 DROP TABLE dup;
-CREATE INDEX idx_' || t.table_schema || '_' || t.table_name || '_tlid ' || ' ON ' || t.table_schema || '.' || t.table_name || ' USING btree(tlid); 
+CREATE INDEX idx_' || t.table_schema || '_' || t.table_name || '_tlid ' || ' ON ' || t.table_schema || '.' || t.table_name || ' USING btree(tlid);
 ' As drop_sql_create_index
-FROM (SELECT table_name, table_schema FROM 
-	information_schema.tables WHERE table_type = 'BASE TABLE' AND (table_name LIKE '%featnames' ) AND table_schema IN('tiger','tiger_data')) As t 
-		LEFT JOIN pg_catalog.pg_indexes i ON 
-			(i.tablename = t.table_name AND i.schemaname = t.table_schema 
-				AND  indexdef LIKE '%btree%(%tlid%') 
+FROM (SELECT table_name, table_schema FROM
+	information_schema.tables WHERE table_type = 'BASE TABLE' AND (table_name LIKE '%featnames' ) AND table_schema IN('tiger','tiger_data')) As t
+		LEFT JOIN pg_catalog.pg_indexes i ON
+			(i.tablename = t.table_name AND i.schemaname = t.table_schema
+				AND  indexdef LIKE '%btree%(%tlid%')
 WHERE i.tablename IS NULL) ,E'\r');
 
 $$

Modified: trunk/extras/tiger_geocoder/geocode/rate_attributes.sql
===================================================================
--- trunk/extras/tiger_geocoder/geocode/rate_attributes.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/geocode/rate_attributes.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -46,7 +46,7 @@
     RAISE NOTICE 'streetNameA: %, streetNameB: %', streetNameA, streetNameB;
   END IF;
   IF streetNameA IS NOT NULL AND streetNameB IS NOT NULL THEN
-    -- We want to treat numeric streets that have numerics as equal 
+    -- We want to treat numeric streets that have numerics as equal
     -- and not penalize if they are spelled different e.g. have ND instead of TH
     IF NOT numeric_streets_equal(streetNameA, streetNameB) THEN
         IF prequalabr IS NOT NULL THEN
@@ -56,7 +56,7 @@
         ELSE
             result := result + levenshtein_ignore_case(streetNameA, streetNameB) * nameWeight;
         END IF;
-    ELSE 
+    ELSE
     -- Penalize for numeric streets if one is completely numeric and the other is not
     -- This is to minimize on highways like 3A being matched with numbered streets since streets are usually number followed by 2 characters e.g nth ave and highways are just number with optional letter for name
         IF  (streetNameB ~ E'[a-zA-Z]{2,10}' AND NOT (streetNameA ~ E'[a-zA-Z]{2,10}') ) OR (streetNameA ~ E'[a-zA-Z]{2,10}' AND NOT (streetNameB ~ E'[a-zA-Z]{2,10}') ) THEN

Modified: trunk/extras/tiger_geocoder/geocode/reverse_geocode.sql
===================================================================
--- trunk/extras/tiger_geocoder/geocode/reverse_geocode.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/geocode/reverse_geocode.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,5 +1,5 @@
- /*** 
- * 
+ /***
+ *
  * Copyright (C) 2011-2014 Regina Obe and Leo Hsu (Paragon Corporation)
  **/
 -- This function given a point try to determine the approximate street address (norm_addy form)
@@ -35,13 +35,13 @@
 		IF ST_SRID(pt) = 4269 THEN
 			var_pt := pt;
 		ELSIF ST_SRID(pt) > 0 THEN
-			var_pt := ST_Transform(pt, 4269); 
+			var_pt := ST_Transform(pt, 4269);
 		ELSE --If srid is unknown, assume its 4269
 			var_pt := ST_SetSRID(pt, 4269);
 		END IF;
 		var_pt := ST_SnapToGrid(var_pt, 0.00005); /** Get rid of floating point junk that would prevent intersections **/
 	END IF;
-	-- Determine state tables to check 
+	-- Determine state tables to check
 	-- this is needed to take advantage of constraint exclusion
 	IF var_debug THEN
 		RAISE NOTICE 'Get matching states start: %', clock_timestamp();
@@ -102,36 +102,36 @@
 
 	var_stmt := '
 	    WITH ref AS (
-	        SELECT ' || quote_literal(var_pt::text) || '::geometry As ref_geom ) , 
-			f AS 
+	        SELECT ' || quote_literal(var_pt::text) || '::geometry As ref_geom ) ,
+			f AS
 			( SELECT faces.* FROM faces  CROSS JOIN ref
-			WHERE faces.statefp = ' || quote_literal(var_state) || ' AND faces.countyfp = ' || quote_literal(var_countyfp) || ' 
+			WHERE faces.statefp = ' || quote_literal(var_state) || ' AND faces.countyfp = ' || quote_literal(var_countyfp) || '
 				AND ST_Intersects(faces.the_geom, ref_geom)
 				    ),
-			e AS 
+			e AS
 			( SELECT edges.tlid , edges.statefp, edges.the_geom, CASE WHEN edges.tfidr = f.tfid THEN ''R'' WHEN edges.tfidl = f.tfid THEN ''L'' ELSE NULL END::varchar As eside,
                     ST_ClosestPoint(edges.the_geom,ref_geom) As center_pt, ref_geom
-				FROM edges INNER JOIN f ON (f.statefp = edges.statefp AND (edges.tfidr = f.tfid OR edges.tfidl = f.tfid)) 
+				FROM edges INNER JOIN f ON (f.statefp = edges.statefp AND (edges.tfidr = f.tfid OR edges.tfidl = f.tfid))
 				    CROSS JOIN ref
-			WHERE edges.statefp = ' || quote_literal(var_state) || ' AND edges.countyfp = ' || quote_literal(var_countyfp) || ' 
+			WHERE edges.statefp = ' || quote_literal(var_state) || ' AND edges.countyfp = ' || quote_literal(var_countyfp) || '
 				AND ST_DWithin(edges.the_geom, ref.ref_geom, 0.01) AND (edges.mtfcc LIKE ''S%'') --only consider streets and roads
 				  )	,
-			ea AS 
+			ea AS
 			(SELECT e.statefp, e.tlid, a.fromhn, a.tohn, e.center_pt, ref_geom, a.zip, a.side, e.the_geom
-				FROM e LEFT JOIN addr As a ON (a.statefp = ' || quote_literal(var_state) || '  AND e.tlid = a.tlid and e.eside = a.side) 
+				FROM e LEFT JOIN addr As a ON (a.statefp = ' || quote_literal(var_state) || '  AND e.tlid = a.tlid and e.eside = a.side)
 				)
-		SELECT * 
+		SELECT *
 		FROM (SELECT DISTINCT ON(tlid,side)  foo.fullname, foo.predirabrv, foo.streetname, foo.streettypeabbrev, foo.zip,  foo.center_pt,
-			  side, to_number(CASE WHEN trim(fromhn) ~ ''^[0-9]+$'' THEN fromhn ELSE NULL END,''99999999'')  As fromhn, to_number(CASE WHEN trim(tohn) ~ ''^[0-9]+$'' THEN tohn ELSE NULL END,''99999999'') As tohn, 
+			  side, to_number(CASE WHEN trim(fromhn) ~ ''^[0-9]+$'' THEN fromhn ELSE NULL END,''99999999'')  As fromhn, to_number(CASE WHEN trim(tohn) ~ ''^[0-9]+$'' THEN tohn ELSE NULL END,''99999999'') As tohn,
 			  ST_GeometryN(ST_Multi(line),1) As line, dist
-		FROM 
+		FROM
 		  (SELECT e.tlid, e.the_geom As line, n.fullname, COALESCE(n.prequalabr || '' '','''')  || n.name AS streetname, n.predirabrv, COALESCE(suftypabrv, pretypabrv) As streettypeabbrev,
 		      n.sufdirabrv, e.zip, e.side, e.fromhn, e.tohn , e.center_pt,
 		          ST_Distance_Sphere(ST_SetSRID(e.center_pt,4326),ST_SetSRID(ref_geom,4326)) As dist
-				FROM ea AS e 
-					LEFT JOIN (SELECT featnames.* FROM featnames 
-			    WHERE featnames.statefp = ' || quote_literal(var_state) ||'   ) AS n ON (n.statefp =  e.statefp AND n.tlid = e.tlid) 
-				ORDER BY dist LIMIT 50 ) As foo 
+				FROM ea AS e
+					LEFT JOIN (SELECT featnames.* FROM featnames
+			    WHERE featnames.statefp = ' || quote_literal(var_state) ||'   ) AS n ON (n.statefp =  e.statefp AND n.tlid = e.tlid)
+				ORDER BY dist LIMIT 50 ) As foo
 				ORDER BY foo.tlid, foo.side, ';
 				
 	    -- for numbered street/road use var_rating_highway to determine whether to prefer numbered or not (0 no pref, 1 prefer numbered, 2 prefer named)
@@ -150,17 +150,17 @@
             var_primary_line := var_redge.line;
             var_primary_dist := var_redge.dist;
         END IF;
-  
+
         IF var_redge.fullname IS NOT NULL AND COALESCE(var_primary_fullname,'') = '' THEN -- this is the first non-blank name we are hitting grab info
             var_primary_fullname := var_redge.fullname;
             var_addy.streetname = var_redge.streetname;
             var_addy.streettypeabbrev := var_redge.streettypeabbrev;
             var_addy.predirabbrev := var_redge.predirabrv;
         END IF;
-       
+
         IF ST_Intersects(var_redge.line, var_primary_line) THEN
-            var_addy.streetname := var_redge.streetname; 
-            
+            var_addy.streetname := var_redge.streetname;
+
             var_addy.streettypeabbrev := var_redge.streettypeabbrev;
             var_addy.address := var_nstrnum;
             IF  var_redge.fromhn IS NOT NULL THEN
@@ -181,17 +181,17 @@
             --     var_addy.location := var_redge.location;
             -- ELSE
             --     var_addy.location := var_place;
-            -- END IF;  
-            
+            -- END IF;
+
             -- This is a cross streets - only add if not the primary adress street
             IF var_redge.fullname > '' AND var_redge.fullname <> var_primary_fullname THEN
                 street := array_append(street, (CASE WHEN include_strnum_range THEN COALESCE(var_redge.fromhn::varchar, '')::varchar || COALESCE(' - ' || var_redge.tohn::varchar,'')::varchar || ' '::varchar  ELSE '' END::varchar ||  COALESCE(var_redge.fullname::varchar,''))::varchar);
-            END IF;    
-            
+            END IF;
+
             -- consider this a potential address
             IF (var_redge.dist < var_primary_dist*1.1 OR var_redge.dist < 20)   THEN
                  -- We only consider this a possible address if it is really close to our point
-                 intpt := array_append(intpt,var_redge.center_pt); 
+                 intpt := array_append(intpt,var_redge.center_pt);
                 -- note that ramps don't have names or addresses but they connect at the edge of a range
                 -- so for ramps the address of connecting is still useful
                 IF var_debug THEN
@@ -210,7 +210,7 @@
 					var_addy_alt.streetname := var_addy.streetname;
 					var_addy_alt.streettypeabbrev := var_addy.streettypeabbrev;
                     var_addy_alt.predirabbrev := var_addy.predirabbrev;
-					addy[array_upper(addy,1) - 1 ] := var_addy_alt; 
+					addy[array_upper(addy,1) - 1 ] := var_addy_alt;
 					IF var_debug THEN
 						RAISE NOTICE 'Replaced with : %, %', var_addy_alt, clock_timestamp();
 					END IF;
@@ -223,9 +223,9 @@
 
             END IF;
         END IF;
-     
+
     END LOOP;
- 
+
     -- not matching roads or streets, just return basic info
     IF NOT FOUND THEN
         addy := array_append(addy,var_addy);
@@ -237,7 +237,7 @@
         RAISE NOTICE 'current array count : %, %', array_upper(addy,1), clock_timestamp();
     END IF;
 
-    RETURN;   
+    RETURN;
 END;
 $BODY$
   LANGUAGE plpgsql STABLE

Modified: trunk/extras/tiger_geocoder/geocode_settings.sql
===================================================================
--- trunk/extras/tiger_geocoder/geocode_settings.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/geocode_settings.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -8,12 +8,12 @@
 -- the terms of the GNU General Public Licence. See the COPYING file.
 --
 -- Author: Regina Obe and Leo Hsu <lr at pcorp.us>
---  
+--
 -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 --
 SELECT tiger.SetSearchPathForInstall('tiger');
 
-CREATE OR REPLACE FUNCTION install_geocode_settings() 
+CREATE OR REPLACE FUNCTION install_geocode_settings()
 	RETURNS void AS
 $$
 DECLARE var_temp text;
@@ -31,7 +31,7 @@
 	TRUNCATE TABLE geocode_settings_default;
 	INSERT INTO geocode_settings_default(name,setting,unit,category,short_desc)
 		SELECT f.*
-		FROM 
+		FROM
 		(VALUES ('debug_geocode_address', 'false', 'boolean','debug', 'outputs debug information in notice log such as queries when geocode_addresss is called if true')
 			, ('debug_geocode_intersection', 'false', 'boolean','debug', 'outputs debug information in notice log such as queries when geocode_intersection is called if true')
 			, ('debug_normalize_address', 'false', 'boolean','debug', 'outputs debug information in notice log such as queries and intermediate expressions when normalize_address is called if true')
@@ -59,7 +59,7 @@
 RETURNS text AS
 $$
 INSERT INTO geocode_settings(name, setting, unit, category, short_desc)
-SELECT name, setting, unit, category, short_desc 
+SELECT name, setting, unit, category, short_desc
     FROM geocode_settings_default
     WHERE name NOT IN(SELECT name FROM geocode_settings);
 

Modified: trunk/extras/tiger_geocoder/normalize/normalize_address.sql
===================================================================
--- trunk/extras/tiger_geocoder/normalize/normalize_address.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/normalize/normalize_address.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -71,9 +71,9 @@
   rec RECORD;
   ws VARCHAR;
   rawInput VARCHAR;
-  -- is this a highway 
+  -- is this a highway
   -- (we treat these differently since the road name often comes after the streetType)
-  isHighway boolean := false; 
+  isHighway boolean := false;
 BEGIN
   result.parsed := FALSE;
   IF use_pagc THEN
@@ -103,15 +103,15 @@
 
   -- There are two formats for zip code, the normal 5 digit , and
   -- the nine digit zip-4.  It may also not exist.
-  
+
   zipString := substring(rawInput from ws || E'([0-9]{5})$');
   IF zipString IS NULL THEN
     -- Check if the zip is just a partial or a one with -s
     -- or one that just has more than 5 digits
-    zipString := COALESCE(substring(rawInput from ws || '([0-9]{5})-[0-9]{0,4}$'), 
+    zipString := COALESCE(substring(rawInput from ws || '([0-9]{5})-[0-9]{0,4}$'),
                 substring(rawInput from ws || '([0-9]{2,5})$'),
                 substring(rawInput from ws || '([0-9]{6,14})$'));
-   
+
      -- Check if all we got was a zipcode, of either form
     IF zipString IS NULL THEN
       zipString := substring(rawInput from '^([0-9]{5})$');
@@ -136,7 +136,7 @@
         || ws || '+' || cull_null(zipString) || '[- ]?([0-9]{4})?$');
     /** strip off any trailing  spaces or ,**/
     fullStreet :=  btrim(fullStreet, ' ,');
-    
+
   ELSE
     fullStreet := rawInput;
   END IF;
@@ -293,14 +293,14 @@
   -- Reject all street types where the fullstreet name is equal to the name
   fullStreet := ' ' || trim(fullStreet);
   tempInt := count(*) FROM street_type_lookup
-      WHERE fullStreet ILIKE '%' || name || '%' AND 
+      WHERE fullStreet ILIKE '%' || name || '%' AND
         trim(upper(fullStreet)) != name AND
         texticregexeq(fullStreet, '(?i)' || ws || '(' || name
       || ')(?:' || ws || '|$)');
   IF tempInt = 1 THEN
     SELECT INTO rec abbrev, substring(fullStreet, '(?i)' || ws || '('
         || name || ')(?:' || ws || '|$)') AS given, is_hw FROM street_type_lookup
-        WHERE fullStreet ILIKE '%' || name || '%' AND 
+        WHERE fullStreet ILIKE '%' || name || '%' AND
              trim(upper(fullStreet)) != name AND
             texticregexeq(fullStreet, '(?i)' || ws || '(' || name
         || ')(?:' || ws || '|$)')  ;
@@ -313,22 +313,22 @@
   ELSIF tempInt > 1 THEN
     tempInt := 0;
     -- the last matching abbrev in the string is the most likely one
-    FOR rec IN SELECT * FROM 
+    FOR rec IN SELECT * FROM
     	(SELECT abbrev, name, substring(fullStreet, '(?i)' || ws || '?('
         || name || ')(?:' || ws || '|$)') AS given, is_hw ,
         		RANK() OVER( ORDER BY position(name IN upper(trim(fullStreet))) ) As n_start,
         		RANK() OVER( ORDER BY position(name IN upper(trim(fullStreet))) + length(name) ) As n_end,
         		COUNT(*) OVER() As nrecs, position(name IN upper(trim(fullStreet)))
         		FROM street_type_lookup
-        WHERE fullStreet ILIKE '%' || name || '%'  AND 
-            trim(upper(fullStreet)) != name AND 
-            (texticregexeq(fullStreet, '(?i)' || ws || '(' || name 
+        WHERE fullStreet ILIKE '%' || name || '%'  AND
+            trim(upper(fullStreet)) != name AND
+            (texticregexeq(fullStreet, '(?i)' || ws || '(' || name
             -- we only consider street types that are regular and not at beginning of name or are highways (since those can be at beg or end)
             -- we take the one that is the longest e.g Country Road would be more correct than Road
         || ')(?:' || ws || '|$)') OR (is_hw AND fullstreet ILIKE name || ' %') )
      AND ((NOT is_hw AND position(name IN upper(trim(fullStreet))) > 1 OR is_hw) )
         ) As foo
-        -- N_start - N_end - ensure we first get the one with the most overlapping sub types 
+        -- N_start - N_end - ensure we first get the one with the most overlapping sub types
         -- Then of those get the one that ends last and then starts first
         ORDER BY n_start - n_end, n_end DESC, n_start LIMIT 1  LOOP
       -- If we have found an internal address, make sure the type
@@ -369,11 +369,11 @@
     -- Check if the fullStreet contains the streetType and ends in just numbers
     -- If it does its a road number like a country road or state route or other highway
     -- Just set the number to be the name of street
-    
+
     tempString := NULL;
     IF isHighway THEN
         tempString :=  substring(fullStreet, streetType || ws || '+' || E'([0-9a-zA-Z]+)' || ws || '*');
-    END IF;    
+    END IF;
     IF tempString > '' AND result.location IS NOT NULL THEN
         reducedStreet := tempString;
         result.streetName := reducedStreet;
@@ -426,15 +426,15 @@
 		tempString := trim(regexp_replace(fullStreet,  reducedStreet ||  ws || '+' || streetType,''));
 		IF tempString > '' THEN
 		  tempString := abbrev FROM direction_lookup WHERE
-			 tempString ILIKE '%' || name || '%'  
+			 tempString ILIKE '%' || name || '%'
 			 AND texticregexeq(fullStreet || ' ', '(?i)' || reducedStreet || ws || '+' || streetType || ws || '+(' || name || ')' || ws || '+')
 			ORDER BY length(name) DESC LIMIT 1;
 		  IF tempString IS NOT NULL THEN
 			result.postDirAbbrev = trim(tempString);
 		  END IF;
 		END IF;
- 
 
+
 		IF debug_flag THEN
 			raise notice '% reduced street: %', clock_timestamp(), reducedStreet;
 		END IF;
@@ -465,7 +465,7 @@
       -- location was given.  We still need to look for post direction.
       SELECT INTO rec abbrev,
           substring(result.location, '(?i)^(' || name || ')' || ws) as value
-          FROM direction_lookup 
+          FROM direction_lookup
             WHERE result.location ILIKE '%' || name || '%' AND texticregexeq(result.location, '(?i)^'
           || name || ws) ORDER BY length(name) desc LIMIT 1;
       IF rec.value IS NOT NULL THEN
@@ -482,7 +482,7 @@
         SELECT INTO result.postDirAbbrev abbrev FROM direction_lookup WHERE
             upper(postDir) = upper(name);
         result.location := NULL;
-        
+
         IF debug_flag THEN
             RAISE NOTICE '% postDir exact match: %', clock_timestamp(), result.postDirAbbrev;
         END IF;
@@ -494,7 +494,7 @@
             result.location ILIKE '%' || name || '%' AND texticregexeq(result.location, '(?i)(^' || name || ')' || ws)
             	AND NOT  texticregexeq(rawInput, '(?i)(,' || ws || '+' || result.location || ')' || ws)
             ORDER BY length(name) desc LIMIT 1;
-            
+
         IF debug_flag THEN
             RAISE NOTICE '% location trying to extract postdir: %, tempstring: %, rawInput: %', clock_timestamp(), result.location, tempString, rawInput;
         END IF;
@@ -507,7 +507,7 @@
                   RAISE NOTICE '% postDir: %', clock_timestamp(), result.postDirAbbrev;
             END IF;
         END IF;
-        
+
       END IF;
     ELSE
       -- internal is not null, but is not at the end of the location string
@@ -517,7 +517,7 @@
         END IF;
         SELECT INTO tempString substring(fullStreet, '(?i)' || streetType
           || ws || '+(' || name || ')' || ws || '+' || result.internal)
-          FROM direction_lookup 
+          FROM direction_lookup
           WHERE fullStreet ILIKE '%' || name || '%' AND texticregexeq(fullStreet, '(?i)'
           || ws || name || ws || '+' || result.internal) ORDER BY length(name) desc LIMIT 1;
         IF tempString IS NOT NULL THEN
@@ -583,7 +583,7 @@
         reducedStreet := substring(fullStreet, '^(.*?)' || ws || '+'
                       || postDir);
         tempString := substring(reducedStreet, '(?i)(^' || name
-            || ')' || ws) FROM direction_lookup 
+            || ')' || ws) FROM direction_lookup
             WHERE
                 reducedStreet ILIKE '%' || name || '%' AND texticregexeq(reducedStreet, '(?i)(^' || name || ')' || ws)
             ORDER BY length(name) DESC;

Modified: trunk/extras/tiger_geocoder/normalize/pprint_addy.sql
===================================================================
--- trunk/extras/tiger_geocoder/normalize/pprint_addy.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/normalize/pprint_addy.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,4 +1,4 @@
--- helper function to determine if street type 
+-- helper function to determine if street type
 -- should be put before or after the street name
 -- note in streettype lookup this is misnamed as is_hw
 -- because I originally thought only highways had that behavior

Modified: trunk/extras/tiger_geocoder/normalize/state_extract.sql
===================================================================
--- trunk/extras/tiger_geocoder/normalize/state_extract.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/normalize/state_extract.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -25,7 +25,7 @@
   -- If there is a trailing space or , get rid of it
   -- this is to handle case where people use , instead of space to separate state and zip
   -- such as '2450 N COLORADO ST, PHILADELPHIA, PA, 19132' instead of '2450 N COLORADO ST, PHILADELPHIA, PA 19132'
-  
+
   --tempString := regexp_replace(rawInput, E'(.*)' || ws || '+', E'\\1');
   tempString := btrim(rawInput, ', ');
   -- Separate out the last word of the state, and use it to compare to

Modified: trunk/extras/tiger_geocoder/pagc_normalize/pagc_normalize_address.sql
===================================================================
--- trunk/extras/tiger_geocoder/pagc_normalize/pagc_normalize_address.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/pagc_normalize/pagc_normalize_address.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -27,9 +27,9 @@
  var_rec := standardize_address('pagc_lex'
        , 'pagc_gaz'
        , 'pagc_rules'
-, COALESCE(var_parse_rec.address1,''), 
+, COALESCE(var_parse_rec.address1,''),
    COALESCE(', ' || var_parse_rec.city,'') || COALESCE(', ' || var_parse_rec.state, '') || COALESCE(' ' || var_parse_rec.zip,'')  ) ;
- 
+
  -- For address number only put numbers and stop if reach a non-number e.g. 123-456 will return 123
   result.address := to_number(substring(var_rec.house_num, '[0-9]+'), '99999999999');
    --get rid of extraneous spaces before we return
@@ -38,7 +38,7 @@
   result.location := trim(var_rec.city);
   result.stateAbbrev := trim(var_rec.state);
   --this should be broken out separately like pagc, but normalizer doesn't have a slot for it
-  result.streettypeAbbrev := trim(COALESCE(var_rec.suftype, var_rec.pretype)); 
+  result.streettypeAbbrev := trim(COALESCE(var_rec.suftype, var_rec.pretype));
   result.preDirAbbrev := trim(var_rec.predir);
   result.postDirAbbrev := trim(var_rec.sufdir);
   result.internal := trim(var_rec.unit);

Modified: trunk/extras/tiger_geocoder/pagc_normalize/pagc_tables.sql
===================================================================
--- trunk/extras/tiger_geocoder/pagc_normalize/pagc_tables.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/pagc_normalize/pagc_tables.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,8 +1,8 @@
---  Lookup tables used by pagc to standardize in format expected by tiger geocoder 
+--  Lookup tables used by pagc to standardize in format expected by tiger geocoder
 SET client_encoding = 'UTF8';
 SET standard_conforming_strings = on;
 SELECT tiger.SetSearchPathForInstall('tiger');
-CREATE OR REPLACE FUNCTION install_pagc_tables() 
+CREATE OR REPLACE FUNCTION install_pagc_tables()
 	RETURNS void AS
 $$
 DECLARE var_temp text;
@@ -3822,7 +3822,7 @@
 SELECT pg_catalog.setval('pagc_lex_id_seq', (SELECT greatest((SELECT MAX(id) FROM pagc_lex),50000)), true);
 
 
--- set default to false so all we input will be treated as no custom -- 
+-- set default to false so all we input will be treated as no custom --
 ALTER TABLE tiger.pagc_rules ALTER COLUMN is_custom SET DEFAULT false;
 INSERT INTO pagc_rules (id, rule) VALUES (1, '1 -1 5 -1 2 7');
 INSERT INTO pagc_rules (id, rule) VALUES (2, '1 3 -1 5 3 -1 2 7');
@@ -8181,7 +8181,7 @@
 
 -- for some reason all rules are coming in as custom.  just force by id
 UPDATE tiger.pagc_rules SET is_custom = false where id < 10000;
--- after insert we need to set back to true so all 
--- user inputs are treated as custom 
+-- after insert we need to set back to true so all
+-- user inputs are treated as custom
 ALTER TABLE tiger.pagc_rules ALTER COLUMN is_custom SET DEFAULT true;
 SELECT pg_catalog.setval('pagc_rules_id_seq', 10000, true);
\ No newline at end of file

Modified: trunk/extras/tiger_geocoder/regress/geocode_regress.sql
===================================================================
--- trunk/extras/tiger_geocoder/regress/geocode_regress.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/regress/geocode_regress.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -29,7 +29,7 @@
 SELECT 'T15', pprint_addy(addy) As address, ST_AsText(ST_SnapToGrid(geomout,0.00001)) As pt, rating FROM geocode('101 Fedaral Street, Boston, MA',1);
 SELECT 'T16', pprint_addy(addy) As address, ST_AsText(ST_SnapToGrid(geomout,0.00001)) As pt, rating FROM geocode('101 Fedaral Street, Boston, MA',50);
 
--- needs addr these ones have more than 2 sides 
+-- needs addr these ones have more than 2 sides
 -- my alma mater doesn't geocode right without addr check  --
 SELECT 'T17', pprint_addy(addy) As address, ST_AsText(ST_SnapToGrid(geomout,0.00001)) As pt, rating FROM geocode('77 Massachusetts Avenue, Cambridge, MA 02139',1);
 
@@ -48,14 +48,14 @@
 SELECT '#1073b' As ticket, pprint_addy(addy) As address, ST_AsText(ST_SnapToGrid(geomout,0.00001)) As pt, rating FROM geocode('212 3rd Ave N, MINNEAPOLIS, MN 55401-',2);
 
 -- country roads and highways with spaces in street type
-SELECT '#1076a' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target) As g, target FROM (SELECT '16725 Co Rd 24, Plymouth, MN 55447'::text As target) As f) As foo;  
+SELECT '#1076a' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target) As g, target FROM (SELECT '16725 Co Rd 24, Plymouth, MN 55447'::text As target) As f) As foo;
 SELECT '#1076b' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,1) As g, target FROM (SELECT '16725 County Road 24, Plymouth, MN 55447'::text As target) As f) As foo;
-SELECT '#1076c' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,1) As g, target FROM (SELECT '13800 County Hwy 9, Andover, MN 55304'::text As target) AS f) As foo; 
-SELECT '#1076d' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,1) As g, target FROM (SELECT '13800 9, Andover, MN 55304'::text As target) AS f) As foo; 
-SELECT '#1076e' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,4) As g, target FROM (SELECT '3900 Route 6, Eastham, Massachusetts 02642'::text As target) AS f) As foo; 
+SELECT '#1076c' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,1) As g, target FROM (SELECT '13800 County Hwy 9, Andover, MN 55304'::text As target) AS f) As foo;
+SELECT '#1076d' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,1) As g, target FROM (SELECT '13800 9, Andover, MN 55304'::text As target) AS f) As foo;
+SELECT '#1076e' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,4) As g, target FROM (SELECT '3900 Route 6, Eastham, Massachusetts 02642'::text As target) AS f) As foo;
 
 -- country road that starts with a letter
-SELECT '#1076f' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,3) As g, target FROM (SELECT '1940 County Road C W, Roseville, MN 55113'::text As target) AS f) As foo; 
+SELECT '#1076f' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,3) As g, target FROM (SELECT '1940 County Road C W, Roseville, MN 55113'::text As target) AS f) As foo;
 
 -- ad road that in some sections no street range recorded --
 SELECT '#1076g' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target) As g, target FROM (SELECT '15709 Rockford Road, Plymouth, MN 55447'::text As target) As f) AS foo;
@@ -73,14 +73,14 @@
 
 
 -- service roads and interstates
-SELECT '#1112a' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,2) As g, target FROM (SELECT '8401 W 35W Service Dr NE, Blaine, MN 55449'::text As target) As f) As foo; 
-SELECT '#1112b' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,1) As g, target FROM (SELECT '8401 35W, Blaine, MN 55449'::text As target) As f) As foo; 
-SELECT '#1112c' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,1) As g, target FROM (SELECT '8401 35W West, Blaine, MN 55449'::text As target) As f) As foo; 
-SELECT '#1112d' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,1) As g, target FROM (SELECT '8401 West 35W, Blaine, MN 55449'::text As target) As f) As foo; 
-SELECT '#1112e' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,1) As g, target FROM (SELECT '8401 W 35W, Blaine, MN 55449'::text As target) As f) As foo; 
+SELECT '#1112a' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,2) As g, target FROM (SELECT '8401 W 35W Service Dr NE, Blaine, MN 55449'::text As target) As f) As foo;
+SELECT '#1112b' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,1) As g, target FROM (SELECT '8401 35W, Blaine, MN 55449'::text As target) As f) As foo;
+SELECT '#1112c' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,1) As g, target FROM (SELECT '8401 35W West, Blaine, MN 55449'::text As target) As f) As foo;
+SELECT '#1112d' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,1) As g, target FROM (SELECT '8401 West 35W, Blaine, MN 55449'::text As target) As f) As foo;
+SELECT '#1112e' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,1) As g, target FROM (SELECT '8401 W 35W, Blaine, MN 55449'::text As target) As f) As foo;
 
 -- working with prequalabrv such as Old .. something or other
-SELECT '#1113a' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,2) As g, target FROM (SELECT '8040 OLD CEDAR AVE S, BLOOMINGTON, MN 55425'::text As target) As f) As foo; 
+SELECT '#1113a' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,2) As g, target FROM (SELECT '8040 OLD CEDAR AVE S, BLOOMINGTON, MN 55425'::text As target) As f) As foo;
 SELECT '#1113b' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,2) As g, target FROM (SELECT '8040 CEDAR AVE S, BLOOMINGTON, MN 55425'::text As target) As f) As foo;
 SELECT '#1113c' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,2) As g, target FROM (SELECT '17405 Old Rockford Rd, Plymouth, MN 55446'::text As target) As f) As foo;
 SELECT '#1113d' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,2) As g, target FROM (SELECT '17405 Rockford Rd, Plymouth, MN 55446'::text As target) As f) As foo;
@@ -88,10 +88,10 @@
 SELECT '#1113f' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,2) As g, target FROM (SELECT '198 CONSTANCE BLVD, ANDOVER, MN 55304'::text As target) As f) As foo;
 
 -- #1145 addresses used to be slow to geocode took minutes
-SELECT '#1145a' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,2) As g, target FROM (SELECT '4051 27th Ave S Minneapolis MN 55405'::text As target) As f) As foo; 
-SELECT '#1145b' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,2) As g, target FROM (SELECT '3625 18th Ave S Minneapolis MN 55406'::text As target) As f) As foo; 
-SELECT '#1145c' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,2) As g, target FROM (SELECT '4057 10th Ave S Minneapolis MN 55406'::text As target) As f) As foo; 
-SELECT '#1145d' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,2) As g, target FROM (SELECT '8512 141 St Ct Apple Valley MN 55124'::text As target) As f) As foo; 
+SELECT '#1145a' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,2) As g, target FROM (SELECT '4051 27th Ave S Minneapolis MN 55405'::text As target) As f) As foo;
+SELECT '#1145b' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,2) As g, target FROM (SELECT '3625 18th Ave S Minneapolis MN 55406'::text As target) As f) As foo;
+SELECT '#1145c' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,2) As g, target FROM (SELECT '4057 10th Ave S Minneapolis MN 55406'::text As target) As f) As foo;
+SELECT '#1145d' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,2) As g, target FROM (SELECT '8512 141 St Ct Apple Valley MN 55124'::text As target) As f) As foo;
 SELECT '#1145e' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target) As g, target FROM (SELECT '103 36th St W Minneapolis MN 55409'::text As target) As f) As foo;
 
 -- cross street intersection

Modified: trunk/extras/tiger_geocoder/regress/normalize_address_regress.sql
===================================================================
--- trunk/extras/tiger_geocoder/regress/normalize_address_regress.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/regress/normalize_address_regress.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -4,7 +4,7 @@
 SELECT '#1051b' As ticket, * FROM normalize_address('3937 43RD AVE S, MINNEAPOLIS, MN 55406');
 SELECT '#1051c' As ticket, * FROM normalize_address('212 N 3rd Ave, Minneapolis, MN 55401');
 -- City missing ,  -- NOTE this one won't normalize right if you don't have MN data loaded
-SELECT '#1051d' As ticket, * FROM normalize_address('212 3rd Ave N Minneapolis, MN 55401'); 
+SELECT '#1051d' As ticket, * FROM normalize_address('212 3rd Ave N Minneapolis, MN 55401');
 -- comma in wrong spot
 SELECT * FROM normalize_address('529 Main Street, Boston MA, 02129');
 -- comma in right spot
@@ -33,16 +33,16 @@
 SELECT '#1086b' As ticket, * FROM normalize_address('949 N 3rd St, New Hyde Park, NY 11040');
 
 -- country roads and highways with spaces in street type
-SELECT '#1076a' As ticket, * FROM normalize_address('16725 Co Rd 24, Plymouth, MN 55447'); 
-SELECT '#1076b' As ticket, * FROM normalize_address('16725 County Road 24, Plymouth, MN 55447'); 
+SELECT '#1076a' As ticket, * FROM normalize_address('16725 Co Rd 24, Plymouth, MN 55447');
+SELECT '#1076b' As ticket, * FROM normalize_address('16725 County Road 24, Plymouth, MN 55447');
 SELECT '#1076c' As ticket, * FROM normalize_address('13800 County Hwy 9, Andover, MN 55304');
 SELECT '#1076d' As ticket, * FROM normalize_address('13800 9, Andover, MN 55304');
 -- this one is a regular street that happens to have a street type as the name
 SELECT '#1076e' As ticket, * FROM normalize_address('14 Forest Road, Acton, MA');
 
--- A country road with a letter name and direction 
+-- A country road with a letter name and direction
 -- NOTE this doesn't completely normalize right since the direction W is being cut off --
-SELECT '#1076f' As ticket, * FROM normalize_address('1940 County Road C W, Roseville, MN 55113'); 
+SELECT '#1076f' As ticket, * FROM normalize_address('1940 County Road C W, Roseville, MN 55113');
 
 -- Route with a name that sounds like a direction --
 SELECT '#1076g' As ticket, * FROM normalize_address('3900 Route 6, Eastham, Massachusetts 02642');
@@ -50,7 +50,7 @@
 -- Street that has same name as type  --
 SELECT '#1076h' As ticket, * FROM normalize_address('4533 PARK AVE S, MINNEAPOLIS, MN 55407');
 -- same street with alternate county name
-SELECT '#1076i' As ticket, * FROM normalize_address('4533 County Road 33, MINNEAPOLIS, MN 55407'); 
+SELECT '#1076i' As ticket, * FROM normalize_address('4533 County Road 33, MINNEAPOLIS, MN 55407');
 
 -- Same case of street type that has name as a type --
 -- this matches -
@@ -73,7 +73,7 @@
 SELECT '#1112e' As ticket, * FROM normalize_address('8401 W 35W, Blaine, MN 55449');
 
 -- Testing pretty print of highway addresses
--- These tests excerpted from Brian Hamlin's CASS failures 
+-- These tests excerpted from Brian Hamlin's CASS failures
 -- in #1077
 SELECT '#1125a' As ticket, pprint_addy(normalize_address('19596 COUNTY ROAD 480, COLCORD, OK 74338'));
 --(somehow broke #1125b

Modified: trunk/extras/tiger_geocoder/regress/pagc_normalize_address_regress.sql
===================================================================
--- trunk/extras/tiger_geocoder/regress/pagc_normalize_address_regress.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/regress/pagc_normalize_address_regress.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -8,7 +8,7 @@
 -- this currently turns 3rd to 3, we want to fix to keep 3rd as is
 SELECT '#1051c' As ticket, * FROM normalize_address('212 N 3rd Ave, Minneapolis, MN 55401');
 -- this currently turns 3rd to 3, we want to fix to keep 3rd as is
-SELECT '#1051d' As ticket, * FROM normalize_address('212 3rd Ave N Minneapolis, MN 55401'); 
+SELECT '#1051d' As ticket, * FROM normalize_address('212 3rd Ave N Minneapolis, MN 55401');
 -- comma in wrong spot
 SELECT * FROM normalize_address('529 Main Street, Boston MA, 02129');
 -- comma in right spot
@@ -38,16 +38,16 @@
 SELECT '#1086b' As ticket, * FROM normalize_address('949 N 3rd St, New Hyde Park, NY 11040');
 
 -- country roads and highways with spaces in street type
-SELECT '#1076a' As ticket, * FROM normalize_address('16725 Co Rd 24, Plymouth, MN 55447'); 
-SELECT '#1076b' As ticket, * FROM normalize_address('16725 County Road 24, Plymouth, MN 55447'); 
+SELECT '#1076a' As ticket, * FROM normalize_address('16725 Co Rd 24, Plymouth, MN 55447');
+SELECT '#1076b' As ticket, * FROM normalize_address('16725 County Road 24, Plymouth, MN 55447');
 SELECT '#1076c' As ticket, * FROM normalize_address('13800 County Hwy 9, Andover, MN 55304');
 SELECT '#1076d' As ticket, * FROM normalize_address('13800 9, Andover, MN 55304');
 -- this one is a regular street that happens to have a street type as the name
 SELECT '#1076e' As ticket, * FROM normalize_address('14 Forest Road, Acton, MA');
 
--- A country road with a letter name and direction 
+-- A country road with a letter name and direction
 -- NOTE this doesn't completely normalize right since the direction W is being cut off --
-SELECT '#1076f' As ticket, * FROM normalize_address('1940 County Road C W, Roseville, MN 55113'); 
+SELECT '#1076f' As ticket, * FROM normalize_address('1940 County Road C W, Roseville, MN 55113');
 
 -- Route with a name that sounds like a direction --
 SELECT '#1076g' As ticket, * FROM normalize_address('3900 Route 6, Eastham, Massachusetts 02642');
@@ -55,7 +55,7 @@
 -- Street that has same name as type  --
 SELECT '#1076h' As ticket, * FROM normalize_address('4533 PARK AVE S, MINNEAPOLIS, MN 55407');
 -- same street with alternate county name
-SELECT '#1076i' As ticket, * FROM normalize_address('4533 County Road 33, MINNEAPOLIS, MN 55407'); 
+SELECT '#1076i' As ticket, * FROM normalize_address('4533 County Road 33, MINNEAPOLIS, MN 55407');
 
 -- Same case of street type that has name as a type --
 -- this matches -

Modified: trunk/extras/tiger_geocoder/tables/lookup_tables_2011.sql
===================================================================
--- trunk/extras/tiger_geocoder/tables/lookup_tables_2011.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/tables/lookup_tables_2011.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -542,7 +542,7 @@
 INSERT INTO street_type_lookup (name, abbrev) VALUES ('RUN', 'Run');
 -- Start newly added 2011-7-12 --
 INSERT INTO street_type_lookup (name, abbrev)
- VALUES 
+ VALUES
  ('SERVICE DRIVE', 'Svc Dr'),
  ('SERVICE DR', 'Svc Dr'),
  ('SERVICE ROAD', 'Svc Rd'),
@@ -702,10 +702,10 @@
 INSERT INTO street_type_lookup (name, abbrev) VALUES ('UNS', 'Uns');
 INSERT INTO street_type_lookup (name, abbrev) VALUES ('WL', 'Wl');
 
--- prefix and suffix street names for highways and foreign named roads 
+-- prefix and suffix street names for highways and foreign named roads
 -- where street type is at front of streetname instead of after
 -- these usually have numbers for street names and often have spaces in type
-INSERT INTO street_type_lookup (name, abbrev, is_hw) 
+INSERT INTO street_type_lookup (name, abbrev, is_hw)
 SELECT name, abbrev, true
     FROM (VALUES
         ('CAM', 'Cam'),

Modified: trunk/extras/tiger_geocoder/tiger_loader_2011.sql
===================================================================
--- trunk/extras/tiger_geocoder/tiger_loader_2011.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/tiger_loader_2011.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -2,20 +2,20 @@
 -- PostGIS - Spatial Types for PostgreSQL
 -- http://postgis.net
 --
--- Copyright (C) 2010, 2011, 2012 Regina Obe and Leo Hsu 
+-- Copyright (C) 2010, 2011, 2012 Regina Obe and Leo Hsu
 -- Paragon Corporation
 --
 -- This is free software; you can redistribute and/or modify it under
 -- the terms of the GNU General Public Licence. See the COPYING file.
 --
 -- Author: Regina Obe and Leo Hsu <lr at pcorp.us>
---  
+--
 -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 --SET search_path TO tiger,public;
 --ALTER TABLE tiger.faces RENAME cd111fp  TO cdfp;
 SELECT tiger.SetSearchPathForInstall('tiger');
 BEGIN;
-CREATE OR REPLACE FUNCTION loader_macro_replace(param_input text, param_keys text[],param_values text[]) 
+CREATE OR REPLACE FUNCTION loader_macro_replace(param_input text, param_keys text[],param_values text[])
 RETURNS text AS
 $$
 	DECLARE var_result text = param_input;
@@ -37,12 +37,12 @@
 $$
 SELECT array_to_string(array_agg('DROP TABLE ' || quote_ident(table_schema) || '.' || quote_ident(table_name) || ';'),E'\n')
 	FROM (SELECT * FROM information_schema.tables
-	WHERE table_schema = $2 AND table_name like lower($1) || '_%' ORDER BY table_name) AS foo; 
+	WHERE table_schema = $2 AND table_name like lower($1) || '_%' ORDER BY table_name) AS foo;
 ;
 $$
   LANGUAGE sql VOLATILE;
-  
--- Helper function that generates script to drop all nation tables (county, state) in a particular schema 
+
+-- Helper function that generates script to drop all nation tables (county, state) in a particular schema
 -- This is useful for loading 2011 because state and county tables aren't broken out into separate state files
 DROP FUNCTION IF EXISTS drop_national_tables_generate_script(text);
 CREATE OR REPLACE FUNCTION drop_nation_tables_generate_script(param_schema text DEFAULT 'tiger_data')
@@ -50,18 +50,18 @@
 $$
 SELECT array_to_string(array_agg('DROP TABLE ' || quote_ident(table_schema) || '.' || quote_ident(table_name) || ';'),E'\n')
 	FROM (SELECT * FROM information_schema.tables
-	WHERE table_schema = $1 AND (table_name ~ E'^[a-z]{2}\_county' or table_name ~ E'^[a-z]{2}\_state' or table_name = 'state_all' or table_name LIKE 'county_all%') ORDER BY table_name) AS foo; 
+	WHERE table_schema = $1 AND (table_name ~ E'^[a-z]{2}\_county' or table_name ~ E'^[a-z]{2}\_state' or table_name = 'state_all' or table_name LIKE 'county_all%') ORDER BY table_name) AS foo;
 ;
 $$
   LANGUAGE sql VOLATILE;
-  
 
 
+
 DROP TABLE IF EXISTS loader_platform;
 CREATE TABLE loader_platform(os varchar(50) PRIMARY KEY, declare_sect text, pgbin text, wget text, unzip_command text, psql text, path_sep text, loader text, environ_set_command text, county_process_command text);
 GRANT SELECT ON TABLE loader_platform TO public;
 INSERT INTO loader_platform(os, wget, pgbin, declare_sect, unzip_command, psql,path_sep,loader, environ_set_command, county_process_command)
-VALUES('windows', '%WGETTOOL%', '%PGBIN%', 
+VALUES('windows', '%WGETTOOL%', '%PGBIN%',
 E'set TMPDIR=${staging_fold}\\temp\\
 set UNZIPTOOL="C:\\Program Files\\7-Zip\\7z.exe"
 set WGETTOOL="C:\\wget\\wget.exe"
@@ -77,14 +77,14 @@
 ', E'del %TMPDIR%\\*.* /Q
 %PSQL% -c "DROP SCHEMA ${staging_schema} CASCADE;"
 %PSQL% -c "CREATE SCHEMA ${staging_schema};"
-for /r %%z in (*.zip) do %UNZIPTOOL% e %%z  -o%TMPDIR% 
-cd %TMPDIR%', E'%PSQL%', E'\\', E'%SHP2PGSQL%', 'set ', 
+for /r %%z in (*.zip) do %UNZIPTOOL% e %%z  -o%TMPDIR%
+cd %TMPDIR%', E'%PSQL%', E'\\', E'%SHP2PGSQL%', 'set ',
 'for /r %%z in (*${table_name}.dbf) do (${loader} -D -s 4269 -g the_geom -W "latin1" %%z tiger_staging.${state_abbrev}_${table_name} | ${psql} & ${psql} -c "SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}''));")'
 );
 
 
 INSERT INTO loader_platform(os, wget, pgbin, declare_sect, unzip_command, psql, path_sep, loader, environ_set_command, county_process_command)
-VALUES('sh', 'wget', '', 
+VALUES('sh', 'wget', '',
 E'TMPDIR="${staging_fold}/temp/"
 UNZIPTOOL=unzip
 WGETTOOL="/usr/bin/wget"
@@ -104,8 +104,8 @@
 for z in *.zip; do $UNZIPTOOL -o -d $TMPDIR $z; done
 for z in */*.zip; do $UNZIPTOOL -o -d $TMPDIR $z; done
 cd $TMPDIR;\n', '${PSQL}', '/', '${SHP2PGSQL}', 'export ',
-'for z in *${table_name}.dbf; do 
-${loader} -D -s 4269 -g the_geom -W "latin1" $z ${staging_schema}.${state_abbrev}_${table_name} | ${psql} 
+'for z in *${table_name}.dbf; do
+${loader} -D -s 4269 -g the_geom -W "latin1" $z ${staging_schema}.${state_abbrev}_${table_name} | ${psql}
 ${PSQL} -c "SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}''));"
 done');
 
@@ -117,15 +117,15 @@
 GRANT SELECT ON TABLE loader_variables TO public;
 
 DROP TABLE IF EXISTS loader_lookuptables;
-CREATE TABLE loader_lookuptables(process_order integer NOT NULL DEFAULT 1000, 
-		lookup_name text primary key, 
-		table_name text, single_mode boolean NOT NULL DEFAULT true, 
-		load boolean NOT NULL DEFAULT true, 
-		level_county boolean NOT NULL DEFAULT false, 
+CREATE TABLE loader_lookuptables(process_order integer NOT NULL DEFAULT 1000,
+		lookup_name text primary key,
+		table_name text, single_mode boolean NOT NULL DEFAULT true,
+		load boolean NOT NULL DEFAULT true,
+		level_county boolean NOT NULL DEFAULT false,
 		level_state boolean NOT NULL DEFAULT false,
 		level_nation boolean NOT NULL DEFAULT false,
-		post_load_process text, single_geom_mode boolean DEFAULT false, 
-		insert_mode char(1) NOT NULL DEFAULT 'c', 
+		post_load_process text, single_geom_mode boolean DEFAULT false,
+		insert_mode char(1) NOT NULL DEFAULT 'c',
 		pre_load_process text,columns_exclude text[], website_root_override text);
 		
 GRANT SELECT ON TABLE loader_lookuptables TO public;
@@ -150,23 +150,23 @@
 	${psql} -c "VACUUM ANALYZE ${data_schema}.${lookup_name}_lookup;" ');
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, level_nation, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(1, 'state_all', 'state', true, false, false,true,false, 'c', 
+VALUES(1, 'state_all', 'state', true, false, false,true,false, 'c',
 	'${psql} -c "CREATE TABLE ${data_schema}.${lookup_name}(CONSTRAINT pk_${lookup_name} PRIMARY KEY (statefp),CONSTRAINT uidx_${lookup_name}_stusps  UNIQUE (stusps), CONSTRAINT uidx_${lookup_name}_gid UNIQUE (gid) ) INHERITS(state); "',
 	'${psql} -c "SELECT loader_load_staged_data(lower(''${table_name}''), lower(''${lookup_name}'')); "
 	${psql} -c "CREATE INDEX ${data_schema}_${lookup_name}_the_geom_gist ON ${data_schema}.${lookup_name} USING gist(the_geom);"
 	${psql} -c "VACUUM ANALYZE ${data_schema}.${lookup_name}"' );
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(3, 'place', 'place', true, false, true,false, 'c', 
+VALUES(3, 'place', 'place', true, false, true,false, 'c',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (plcidfp) ) INHERITS(place);" ',
 	'${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${table_name} RENAME geoid TO plcidfp;SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}'')); ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT uidx_${state_abbrev}_${lookup_name}_gid UNIQUE (gid);"
-${psql} -c "CREATE INDEX idx_${state_abbrev}_${lookup_name}_soundex_name ON ${data_schema}.${state_abbrev}_${lookup_name} USING btree (soundex(name));" 
+${psql} -c "CREATE INDEX idx_${state_abbrev}_${lookup_name}_soundex_name ON ${data_schema}.${state_abbrev}_${lookup_name} USING btree (soundex(name));"
 ${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"
-${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"'  
+${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"'
 	);
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(4, 'cousub', 'cousub', true, false, true,false, 'c', 
+VALUES(4, 'cousub', 'cousub', true, false, true,false, 'c',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (cosbidfp), CONSTRAINT uidx_${state_abbrev}_${lookup_name}_gid UNIQUE (gid)) INHERITS(${lookup_name});" ',
 	'${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${table_name} RENAME geoid TO cosbidfp;SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}'')); ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 ${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"
@@ -174,7 +174,7 @@
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, level_nation, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude, website_root_override  )
 -- this is a bit of a lie that its county.  It's really state but works better with column routine
-VALUES(4, 'zcta5', 'zcta510', true,true, false,false, false, 'a', 
+VALUES(4, 'zcta5', 'zcta510', true,true, false,false, false, 'a',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (zcta5ce,statefp), CONSTRAINT uidx_${state_abbrev}_${lookup_name}_gid UNIQUE (gid)) INHERITS(${lookup_name});" ',
 	'${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 ${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"'
@@ -182,7 +182,7 @@
 
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(6, 'faces', 'faces', true, true, false,false, 'c', 
+VALUES(6, 'faces', 'faces', true, true, false,false, 'c',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${table_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (gid)) INHERITS(${lookup_name});" ',
 	'${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${table_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"
 	${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_tfid ON ${data_schema}.${state_abbrev}_${lookup_name} USING btree (tfid);"
@@ -191,7 +191,7 @@
 	${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"');
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude )
-VALUES(7, 'featnames', 'featnames', true, true, false,false, 'a', 
+VALUES(7, 'featnames', 'featnames', true, true, false,false, 'a',
 '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${table_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (gid)) INHERITS(${table_name});ALTER TABLE ${data_schema}.${state_abbrev}_${table_name} ALTER COLUMN statefp SET DEFAULT ''${state_fips}'';" ',
 '${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_snd_name ON ${data_schema}.${state_abbrev}_${table_name} USING btree (soundex(name));"
 ${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_lname ON ${data_schema}.${state_abbrev}_${table_name} USING btree (lower(name));"
@@ -200,7 +200,7 @@
 ${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"', ARRAY['gid','statefp']);
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(8, 'edges', 'edges', true, true, false,false, 'a', 
+VALUES(8, 'edges', 'edges', true, true, false,false, 'a',
 '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${table_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (gid)) INHERITS(${table_name});" ',
 '${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${table_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 ${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_tlid ON ${data_schema}.${state_abbrev}_${table_name} USING btree (tlid);"
@@ -221,7 +221,7 @@
 ${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_zip_lookup_base_citysnd ON ${data_schema}.${state_abbrev}_zip_lookup_base USING btree(soundex(city));" ');
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process,columns_exclude )
-VALUES(9, 'addr', 'addr', true, true, false,false, 'a', 
+VALUES(9, 'addr', 'addr', true, true, false,false, 'a',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (gid)) INHERITS(${table_name});ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ALTER COLUMN statefp SET DEFAULT ''${state_fips}'';" ',
 	'${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 	${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_least_address ON tiger_data.${state_abbrev}_addr USING btree (least_hn(fromhn,tohn) );"
@@ -233,7 +233,7 @@
 	${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"',  ARRAY['gid','statefp','fromarmid', 'toarmid']);
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process,columns_exclude )
-VALUES(9, 'addrfeat', 'addrfeat', false, true, false,true, 'a', 
+VALUES(9, 'addrfeat', 'addrfeat', false, true, false,true, 'a',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (gid)) INHERITS(${table_name});ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ALTER COLUMN statefp SET DEFAULT ''${state_fips}'';" ',
 	'${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 	${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"',  ARRAY['gid','statefp','fromarmid', 'toarmid']);
@@ -242,31 +242,31 @@
   RETURNS SETOF text AS
 $BODY$
 WITH lu AS (SELECT lookup_name, table_name, pre_load_process,post_load_process, process_order, insert_mode, single_geom_mode, level_nation, level_county, level_state
-    FROM  loader_lookuptables 
+    FROM  loader_lookuptables
 				WHERE level_nation = true AND load = true)
-SELECT 
+SELECT
 	loader_macro_replace(
 		replace(
 			loader_macro_replace(declare_sect
-				, ARRAY['staging_fold', 'website_root', 'psql',  'data_schema', 'staging_schema'], 
+				, ARRAY['staging_fold', 'website_root', 'psql',  'data_schema', 'staging_schema'],
 				ARRAY[variables.staging_fold, variables.website_root, platform.psql, variables.data_schema, variables.staging_schema]
 			), '/', platform.path_sep) || '
 '  ||
 	-- Nation level files
 	array_to_string( ARRAY(SELECT loader_macro_replace('cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || variables.website_root  || '/' || upper(table_name)  || '/ --no-parent --relative --recursive --level=1 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || variables.website_root  || '/' || upper(table_name)  || '/ --no-parent --relative --recursive --level=1 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(variables.website_root, 'http://', ''),'ftp://','')  || '/' || upper(table_name)  || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*' || table_name || '.zip ') || '
-' || COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -' ||  lu.insert_mode || ' -s 4269 -g the_geom ' 
-		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year 
-	|| '_us_' || lu.table_name || '.dbf tiger_staging.' || lu.table_name || ' | '::text || platform.psql 
-		|| COALESCE(E'\n' || 
+' || COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -' ||  lu.insert_mode || ' -s 4269 -g the_geom '
+		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year
+	|| '_us_' || lu.table_name || '.dbf tiger_staging.' || lu.table_name || ' | '::text || platform.psql
+		|| COALESCE(E'\n' ||
 			lu.post_load_process , '') , ARRAY['loader','table_name', 'lookup_name'], ARRAY[platform.loader, lu.table_name, lu.lookup_name ]
 			)
 				FROM lu
-				ORDER BY process_order, lookup_name), E'\n') ::text 
-	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'website_root'], 
+				ORDER BY process_order, lookup_name), E'\n') ::text
+	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'website_root'],
 	ARRAY[platform.psql,  variables.data_schema, variables.staging_schema, variables.staging_fold, variables.website_root])
 			AS shell_code
 FROM loader_variables As variables
@@ -275,50 +275,50 @@
 ;
 $BODY$
   LANGUAGE sql VOLATILE;
-  
+
 CREATE OR REPLACE FUNCTION loader_generate_script(param_states text[], os text)
   RETURNS SETOF text AS
 $BODY$
-SELECT 
+SELECT
 	loader_macro_replace(
 		replace(
 			loader_macro_replace(declare_sect
-				, ARRAY['staging_fold', 'state_fold','website_root', 'psql', 'state_abbrev', 'data_schema', 'staging_schema', 'state_fips'], 
+				, ARRAY['staging_fold', 'state_fold','website_root', 'psql', 'state_abbrev', 'data_schema', 'staging_schema', 'state_fips'],
 				ARRAY[variables.staging_fold, s.state_fold, variables.website_root, platform.psql, s.state_abbrev, variables.data_schema, variables.staging_schema, s.state_fips::text]
 			), '/', platform.path_sep) || '
 ' ||
 	-- State level files - if an override website is specified we use that instead of variable one
 	array_to_string( ARRAY(SELECT 'cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name) ), 'http://', ''),'ftp://','')    || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*_' || s.state_fips || '*_' || table_name || '.zip ') || '
-' ||loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -' ||  lu.insert_mode || ' -s 4269 -g the_geom ' 
-		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year || '_' || s.state_fips 
-	|| '_' || lu.table_name || '.dbf tiger_staging.' || lower(s.state_abbrev) || '_' || lu.table_name || ' | '::text || platform.psql 
-		|| COALESCE(E'\n' || 
+' ||loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -' ||  lu.insert_mode || ' -s 4269 -g the_geom '
+		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year || '_' || s.state_fips
+	|| '_' || lu.table_name || '.dbf tiger_staging.' || lower(s.state_abbrev) || '_' || lu.table_name || ' | '::text || platform.psql
+		|| COALESCE(E'\n' ||
 			lu.post_load_process , '') , ARRAY['loader','table_name', 'lookup_name'], ARRAY[platform.loader, lu.table_name, lu.lookup_name ])
 				FROM loader_lookuptables AS lu
 				WHERE level_state = true AND load = true
-				ORDER BY process_order, lookup_name), E'\n') ::text 
+				ORDER BY process_order, lookup_name), E'\n') ::text
 	-- County Level files
 	|| E'\n' ||
 		array_to_string( ARRAY(SELECT 'cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  || '/'), 'http://', ''),'ftp://','')  || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*_' || s.state_fips || '*_' || table_name || '.zip ') || '
 ' || loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || COALESCE(county_process_command || E'\n','')
-				|| COALESCE(E'\n' ||lu.post_load_process , '') , ARRAY['loader','table_name','lookup_name'], ARRAY[platform.loader  || CASE WHEN lu.single_geom_mode THEN ' -S' ELSE ' ' END::text, lu.table_name, lu.lookup_name ]) 
+				|| COALESCE(E'\n' ||lu.post_load_process , '') , ARRAY['loader','table_name','lookup_name'], ARRAY[platform.loader  || CASE WHEN lu.single_geom_mode THEN ' -S' ELSE ' ' END::text, lu.table_name, lu.lookup_name ])
 				FROM loader_lookuptables AS lu
 				WHERE level_county = true AND load = true
-				ORDER BY process_order, lookup_name), E'\n') ::text 
-	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'state_fold', 'website_root', 'state_abbrev','state_fips'], 
+				ORDER BY process_order, lookup_name), E'\n') ::text
+	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'state_fold', 'website_root', 'state_abbrev','state_fips'],
 	ARRAY[platform.psql,  variables.data_schema, variables.staging_schema, variables.staging_fold, s.state_fold,variables.website_root, s.state_abbrev, s.state_fips::text])
 			AS shell_code
 FROM loader_variables As variables
-		CROSS JOIN (SELECT name As state, abbrev As state_abbrev, lpad(st_code::text,2,'0') As state_fips, 
-			 lpad(st_code::text,2,'0') || '_' 
+		CROSS JOIN (SELECT name As state, abbrev As state_abbrev, lpad(st_code::text,2,'0') As state_fips,
+			 lpad(st_code::text,2,'0') || '_'
 	|| replace(name, ' ', '_') As state_fold
 FROM state_lookup) As s CROSS JOIN loader_platform As platform
 WHERE $1 @> ARRAY[state_abbrev::text]      -- If state is contained in list of states input generate script for it
@@ -330,7 +330,7 @@
 CREATE OR REPLACE FUNCTION loader_load_staged_data(param_staging_table text, param_target_table text, param_columns_exclude text[]) RETURNS integer
 AS
 $$
-DECLARE 
+DECLARE
 	var_sql text;
 	var_staging_schema text; var_data_schema text;
 	var_temp text;
@@ -340,16 +340,16 @@
 -- Assume all the columns are in same order as target
 	SELECT staging_schema, data_schema INTO var_staging_schema, var_data_schema FROM loader_variables;
 	var_sql := 'INSERT INTO ' || var_data_schema || '.' || quote_ident(param_target_table) || '(' ||
-			array_to_string(ARRAY(SELECT quote_ident(column_name::text) 
-				FROM information_schema.columns 
+			array_to_string(ARRAY(SELECT quote_ident(column_name::text)
+				FROM information_schema.columns
 				 WHERE table_name = param_target_table
-					AND table_schema = var_data_schema 
-					AND column_name <> ALL(param_columns_exclude) ), ',') || ') SELECT ' 
-					|| array_to_string(ARRAY(SELECT quote_ident(column_name::text) 
-				FROM information_schema.columns 
+					AND table_schema = var_data_schema
+					AND column_name <> ALL(param_columns_exclude) ), ',') || ') SELECT '
+					|| array_to_string(ARRAY(SELECT quote_ident(column_name::text)
+				FROM information_schema.columns
 				 WHERE table_name = param_staging_table
-					AND table_schema = var_staging_schema 
-					AND column_name <> ALL( param_columns_exclude) ), ',') ||' FROM ' 
+					AND table_schema = var_staging_schema
+					AND column_name <> ALL( param_columns_exclude) ), ',') ||' FROM '
 					|| var_staging_schema || '.' || param_staging_table || ';';
 	RAISE NOTICE '%', var_sql;
 	EXECUTE (var_sql);
@@ -360,15 +360,15 @@
 $$
 LANGUAGE 'plpgsql' VOLATILE;
 
-CREATE OR REPLACE FUNCTION loader_load_staged_data(param_staging_table text, param_target_table text) 
+CREATE OR REPLACE FUNCTION loader_load_staged_data(param_staging_table text, param_target_table text)
 RETURNS integer AS
 $$
--- exclude this set list of columns if no exclusion list is specified 
+-- exclude this set list of columns if no exclusion list is specified
    SELECT  loader_load_staged_data($1, $2,(SELECT COALESCE(columns_exclude,ARRAY['gid', 'geoid','cpi','suffix1ce', 'statefp00', 'statefp10', 'countyfp00','countyfp10'
    ,'tractce00','tractce10', 'blkgrpce00', 'blkgrpce10', 'blockce00', 'blockce10'
-      , 'cousubfp00', 'submcdfp00', 'conctyfp00', 'placefp00', 'aiannhfp00', 'aiannhce00', 
-       'comptyp00', 'trsubfp00', 'trsubce00', 'anrcfp00', 'elsdlea00', 'scsdlea00', 
-       'unsdlea00', 'uace00', 'cd108fp', 'sldust00', 'sldlst00', 'vtdst00', 'zcta5ce00', 
+      , 'cousubfp00', 'submcdfp00', 'conctyfp00', 'placefp00', 'aiannhfp00', 'aiannhce00',
+       'comptyp00', 'trsubfp00', 'trsubce00', 'anrcfp00', 'elsdlea00', 'scsdlea00',
+       'unsdlea00', 'uace00', 'cd108fp', 'sldust00', 'sldlst00', 'vtdst00', 'zcta5ce00',
        'tazce00', 'ugace00', 'puma5ce00','vtdst10','tazce10','uace10','puma5ce10','tazce', 'uace', 'vtdst', 'zcta5ce', 'zcta5ce10', 'puma5ce']) FROM loader_lookuptables WHERE $2 LIKE '%' || lookup_name))
 $$
 language 'sql' VOLATILE;

Modified: trunk/extras/tiger_geocoder/tiger_loader_2012.sql
===================================================================
--- trunk/extras/tiger_geocoder/tiger_loader_2012.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/tiger_loader_2012.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -2,19 +2,19 @@
 -- PostGIS - Spatial Types for PostgreSQL
 -- http://postgis.net
 --
--- Copyright (C) 2010, 2011, 2012 Regina Obe and Leo Hsu 
+-- Copyright (C) 2010, 2011, 2012 Regina Obe and Leo Hsu
 -- Paragon Corporation
 --
 -- This is free software; you can redistribute and/or modify it under
 -- the terms of the GNU General Public Licence. See the COPYING file.
 --
 -- Author: Regina Obe and Leo Hsu <lr at pcorp.us>
---  
+--
 -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 SELECT tiger.SetSearchPathForInstall('tiger');
 BEGIN;
-CREATE OR REPLACE FUNCTION loader_macro_replace(param_input text, param_keys text[],param_values text[]) 
+CREATE OR REPLACE FUNCTION loader_macro_replace(param_input text, param_keys text[],param_values text[])
 RETURNS text AS
 $$
 	DECLARE var_result text = param_input;
@@ -36,12 +36,12 @@
 $$
 SELECT array_to_string(array_agg('DROP TABLE ' || quote_ident(table_schema) || '.' || quote_ident(table_name) || ';'),E'\n')
 	FROM (SELECT * FROM information_schema.tables
-	WHERE table_schema = $2 AND table_name like lower($1) || '_%' ORDER BY table_name) AS foo; 
+	WHERE table_schema = $2 AND table_name like lower($1) || '_%' ORDER BY table_name) AS foo;
 ;
 $$
   LANGUAGE sql VOLATILE;
-  
--- Helper function that generates script to drop all nation tables (county, state) in a particular schema 
+
+-- Helper function that generates script to drop all nation tables (county, state) in a particular schema
 -- This is useful for loading 2011 because state and county tables aren't broken out into separate state files
 DROP FUNCTION IF EXISTS drop_national_tables_generate_script(text);
 CREATE OR REPLACE FUNCTION drop_nation_tables_generate_script(param_schema text DEFAULT 'tiger_data')
@@ -49,34 +49,34 @@
 $$
 SELECT array_to_string(array_agg('DROP TABLE ' || quote_ident(table_schema) || '.' || quote_ident(table_name) || ';'),E'\n')
 	FROM (SELECT * FROM information_schema.tables
-	WHERE table_schema = $1 AND (table_name ~ E'^[a-z]{2}\_county' or table_name ~ E'^[a-z]{2}\_state' or table_name = 'state_all' or table_name LIKE 'county_all%') ORDER BY table_name) AS foo; 
+	WHERE table_schema = $1 AND (table_name ~ E'^[a-z]{2}\_county' or table_name ~ E'^[a-z]{2}\_state' or table_name = 'state_all' or table_name LIKE 'county_all%') ORDER BY table_name) AS foo;
 ;
 $$
   LANGUAGE sql VOLATILE;
-  
-DO 
+
+DO
 $$
 BEGIN
   IF NOT EXISTS (SELECT * FROM information_schema.tables WHERE table_name = 'loader_platform' AND table_schema = 'tiger') THEN
-      CREATE TABLE loader_platform(os varchar(50) PRIMARY KEY, declare_sect text, pgbin text, wget text, unzip_command text, psql text, path_sep text, loader text, environ_set_command text, county_process_command text);     
-  END IF;   
-END 
+      CREATE TABLE loader_platform(os varchar(50) PRIMARY KEY, declare_sect text, pgbin text, wget text, unzip_command text, psql text, path_sep text, loader text, environ_set_command text, county_process_command text);
+  END IF;
+END
 $$ LANGUAGE 'plpgsql';
 
-DO 
+DO
 $$
 BEGIN
   IF NOT EXISTS (SELECT * FROM information_schema.schemata WHERE schema_name = 'tiger_data') THEN
-       CREATE SCHEMA tiger_data;     
-  END IF;   
-END 
+       CREATE SCHEMA tiger_data;
+  END IF;
+END
 $$ LANGUAGE 'plpgsql';
 
 
 DELETE FROM loader_platform WHERE os IN ('sh', 'windows');
 GRANT SELECT ON TABLE loader_platform TO public;
 INSERT INTO loader_platform(os, wget, pgbin, declare_sect, unzip_command, psql,path_sep,loader, environ_set_command, county_process_command)
-VALUES('windows', '%WGETTOOL%', '%PGBIN%', 
+VALUES('windows', '%WGETTOOL%', '%PGBIN%',
 E'set TMPDIR=${staging_fold}\\temp\\
 set UNZIPTOOL="C:\\Program Files\\7-Zip\\7z.exe"
 set WGETTOOL="C:\\wget\\wget.exe"
@@ -93,14 +93,14 @@
 %PSQL% -c "DROP SCHEMA IF EXISTS ${staging_schema} CASCADE;"
 %PSQL% -c "CREATE SCHEMA ${staging_schema};"
 %PSQL% -c "DO language ''plpgsql'' $$ BEGIN IF NOT EXISTS (SELECT * FROM information_schema.schemata WHERE schema_name = ''${data_schema}'' ) THEN CREATE SCHEMA ${data_schema}; END IF;  END $$"
-for /r %%z in (*.zip) do %UNZIPTOOL% e %%z  -o%TMPDIR% 
-cd %TMPDIR%', E'%PSQL%', E'\\', E'%SHP2PGSQL%', 'set ', 
+for /r %%z in (*.zip) do %UNZIPTOOL% e %%z  -o%TMPDIR%
+cd %TMPDIR%', E'%PSQL%', E'\\', E'%SHP2PGSQL%', 'set ',
 'for /r %%z in (*${table_name}.dbf) do (${loader} -D -s 4269 -g the_geom -W "latin1" %%z tiger_staging.${state_abbrev}_${table_name} | ${psql} & ${psql} -c "SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}''));")'
 );
 
 
 INSERT INTO loader_platform(os, wget, pgbin, declare_sect, unzip_command, psql, path_sep, loader, environ_set_command, county_process_command)
-VALUES('sh', 'wget', '', 
+VALUES('sh', 'wget', '',
 E'TMPDIR="${staging_fold}/temp/"
 UNZIPTOOL=unzip
 WGETTOOL="/usr/bin/wget"
@@ -119,8 +119,8 @@
 for z in *.zip; do $UNZIPTOOL -o -d $TMPDIR $z; done
 for z in */*.zip; do $UNZIPTOOL -o -d $TMPDIR $z; done
 cd $TMPDIR;\n', '${PSQL}', '/', '${SHP2PGSQL}', 'export ',
-'for z in *${table_name}.dbf; do 
-${loader} -D -s 4269 -g the_geom -W "latin1" $z ${staging_schema}.${state_abbrev}_${table_name} | ${psql} 
+'for z in *${table_name}.dbf; do
+${loader} -D -s 4269 -g the_geom -W "latin1" $z ${staging_schema}.${state_abbrev}_${table_name} | ${psql}
 ${PSQL} -c "SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}''));"
 done');
 
@@ -128,9 +128,9 @@
 DO $$
 BEGIN
   IF NOT EXISTS (SELECT * FROM information_schema.tables WHERE table_name = 'loader_variables' AND table_schema = 'tiger') THEN
-      CREATE TABLE loader_variables(tiger_year varchar(4) PRIMARY KEY, website_root text, staging_fold text, data_schema text, staging_schema text);    
-  END IF;   
-END 
+      CREATE TABLE loader_variables(tiger_year varchar(4) PRIMARY KEY, website_root text, staging_fold text, data_schema text, staging_schema text);
+  END IF;
+END
 $$ LANGUAGE 'plpgsql';
 
 TRUNCATE TABLE loader_variables;
@@ -141,18 +141,18 @@
 DO $$
 BEGIN
   IF NOT EXISTS (SELECT * FROM information_schema.tables WHERE table_name = 'loader_lookuptables' AND table_schema = 'tiger') THEN
-   CREATE TABLE loader_lookuptables(process_order integer NOT NULL DEFAULT 1000, 
-		lookup_name text primary key, 
-		table_name text, single_mode boolean NOT NULL DEFAULT true, 
-		load boolean NOT NULL DEFAULT true, 
-		level_county boolean NOT NULL DEFAULT false, 
+   CREATE TABLE loader_lookuptables(process_order integer NOT NULL DEFAULT 1000,
+		lookup_name text primary key,
+		table_name text, single_mode boolean NOT NULL DEFAULT true,
+		load boolean NOT NULL DEFAULT true,
+		level_county boolean NOT NULL DEFAULT false,
 		level_state boolean NOT NULL DEFAULT false,
 		level_nation boolean NOT NULL DEFAULT false,
-		post_load_process text, single_geom_mode boolean DEFAULT false, 
-		insert_mode char(1) NOT NULL DEFAULT 'c', 
-		pre_load_process text,columns_exclude text[], website_root_override text);   
-  END IF;   
-END 
+		post_load_process text, single_geom_mode boolean DEFAULT false,
+		insert_mode char(1) NOT NULL DEFAULT 'c',
+		pre_load_process text,columns_exclude text[], website_root_override text);
+  END IF;
+END
 $$ LANGUAGE 'plpgsql';
 
 TRUNCATE TABLE loader_lookuptables;
@@ -180,23 +180,23 @@
 	${psql} -c "VACUUM ANALYZE ${data_schema}.${lookup_name}_lookup;" ');
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, level_nation, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(1, 'state_all', 'state', true, false, false,true,false, 'c', 
+VALUES(1, 'state_all', 'state', true, false, false,true,false, 'c',
 	'${psql} -c "CREATE TABLE ${data_schema}.${lookup_name}(CONSTRAINT pk_${lookup_name} PRIMARY KEY (statefp),CONSTRAINT uidx_${lookup_name}_stusps  UNIQUE (stusps), CONSTRAINT uidx_${lookup_name}_gid UNIQUE (gid) ) INHERITS(state); "',
 	'${psql} -c "SELECT loader_load_staged_data(lower(''${table_name}''), lower(''${lookup_name}'')); "
 	${psql} -c "CREATE INDEX ${data_schema}_${lookup_name}_the_geom_gist ON ${data_schema}.${lookup_name} USING gist(the_geom);"
 	${psql} -c "VACUUM ANALYZE ${data_schema}.${lookup_name}"' );
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(3, 'place', 'place', true, false, true,false, 'c', 
+VALUES(3, 'place', 'place', true, false, true,false, 'c',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (plcidfp) ) INHERITS(place);" ',
 	'${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${table_name} RENAME geoid TO plcidfp;SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}'')); ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT uidx_${state_abbrev}_${lookup_name}_gid UNIQUE (gid);"
-${psql} -c "CREATE INDEX idx_${state_abbrev}_${lookup_name}_soundex_name ON ${data_schema}.${state_abbrev}_${lookup_name} USING btree (soundex(name));" 
+${psql} -c "CREATE INDEX idx_${state_abbrev}_${lookup_name}_soundex_name ON ${data_schema}.${state_abbrev}_${lookup_name} USING btree (soundex(name));"
 ${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"
-${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"'  
+${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"'
 	);
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(4, 'cousub', 'cousub', true, false, true,false, 'c', 
+VALUES(4, 'cousub', 'cousub', true, false, true,false, 'c',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (cosbidfp), CONSTRAINT uidx_${state_abbrev}_${lookup_name}_gid UNIQUE (gid)) INHERITS(${lookup_name});" ',
 	'${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${table_name} RENAME geoid TO cosbidfp;SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}'')); ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 ${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"
@@ -204,7 +204,7 @@
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, level_nation, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude, website_root_override  )
 -- this is a bit of a lie that its county.  It's really state but works better with column routine
-VALUES(4, 'zcta5', 'zcta510', true,true, false,false, false, 'a', 
+VALUES(4, 'zcta5', 'zcta510', true,true, false,false, false, 'a',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (zcta5ce,statefp), CONSTRAINT uidx_${state_abbrev}_${lookup_name}_gid UNIQUE (gid)) INHERITS(${lookup_name});" ',
 	'${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 ${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"'
@@ -212,7 +212,7 @@
 
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(6, 'faces', 'faces', true, true, false,false, 'c', 
+VALUES(6, 'faces', 'faces', true, true, false,false, 'c',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${table_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (gid)) INHERITS(${lookup_name});" ',
 	'${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${table_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"
 	${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_tfid ON ${data_schema}.${state_abbrev}_${lookup_name} USING btree (tfid);"
@@ -221,7 +221,7 @@
 	${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"');
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude )
-VALUES(7, 'featnames', 'featnames', true, true, false,false, 'a', 
+VALUES(7, 'featnames', 'featnames', true, true, false,false, 'a',
 '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${table_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (gid)) INHERITS(${table_name});ALTER TABLE ${data_schema}.${state_abbrev}_${table_name} ALTER COLUMN statefp SET DEFAULT ''${state_fips}'';" ',
 '${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_snd_name ON ${data_schema}.${state_abbrev}_${table_name} USING btree (soundex(name));"
 ${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_lname ON ${data_schema}.${state_abbrev}_${table_name} USING btree (lower(name));"
@@ -230,7 +230,7 @@
 ${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"', ARRAY['gid','statefp']);
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(8, 'edges', 'edges', true, true, false,false, 'a', 
+VALUES(8, 'edges', 'edges', true, true, false,false, 'a',
 '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${table_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (gid)) INHERITS(${table_name});" ',
 '${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${table_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 ${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_tlid ON ${data_schema}.${state_abbrev}_${table_name} USING btree (tlid);"
@@ -251,7 +251,7 @@
 ${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_zip_lookup_base_citysnd ON ${data_schema}.${state_abbrev}_zip_lookup_base USING btree(soundex(city));" ');
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process,columns_exclude )
-VALUES(9, 'addr', 'addr', true, true, false,false, 'a', 
+VALUES(9, 'addr', 'addr', true, true, false,false, 'a',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (gid)) INHERITS(${table_name});ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ALTER COLUMN statefp SET DEFAULT ''${state_fips}'';" ',
 	'${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 	${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_least_address ON tiger_data.${state_abbrev}_addr USING btree (least_hn(fromhn,tohn) );"
@@ -263,7 +263,7 @@
 	${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"',  ARRAY['gid','statefp','fromarmid', 'toarmid']);
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process,columns_exclude )
-VALUES(9, 'addrfeat', 'addrfeat', false, true, false,true, 'a', 
+VALUES(9, 'addrfeat', 'addrfeat', false, true, false,true, 'a',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (gid)) INHERITS(${table_name});ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ALTER COLUMN statefp SET DEFAULT ''${state_fips}'';" ',
 	'${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 	${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"',  ARRAY['gid','statefp','fromarmid', 'toarmid']);
@@ -272,31 +272,31 @@
   RETURNS SETOF text AS
 $BODY$
 WITH lu AS (SELECT lookup_name, table_name, pre_load_process,post_load_process, process_order, insert_mode, single_geom_mode, level_nation, level_county, level_state
-    FROM  loader_lookuptables 
+    FROM  loader_lookuptables
 				WHERE level_nation = true AND load = true)
-SELECT 
+SELECT
 	loader_macro_replace(
 		replace(
 			loader_macro_replace(declare_sect
-				, ARRAY['staging_fold', 'website_root', 'psql',  'data_schema', 'staging_schema'], 
+				, ARRAY['staging_fold', 'website_root', 'psql',  'data_schema', 'staging_schema'],
 				ARRAY[variables.staging_fold, variables.website_root, platform.psql, variables.data_schema, variables.staging_schema]
 			), '/', platform.path_sep) || '
 '  ||
 	-- Nation level files
 	array_to_string( ARRAY(SELECT loader_macro_replace('cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || variables.website_root  || '/' || upper(table_name)  || '/ --no-parent --relative --recursive --level=1 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || variables.website_root  || '/' || upper(table_name)  || '/ --no-parent --relative --recursive --level=1 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(variables.website_root, 'http://', ''),'ftp://','')  || '/' || upper(table_name)  || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*' || table_name || '.zip ') || '
-' || COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -' ||  lu.insert_mode || ' -s 4269 -g the_geom ' 
-		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year 
-	|| '_us_' || lu.table_name || '.dbf tiger_staging.' || lu.table_name || ' | '::text || platform.psql 
-		|| COALESCE(E'\n' || 
+' || COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -' ||  lu.insert_mode || ' -s 4269 -g the_geom '
+		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year
+	|| '_us_' || lu.table_name || '.dbf tiger_staging.' || lu.table_name || ' | '::text || platform.psql
+		|| COALESCE(E'\n' ||
 			lu.post_load_process , '') , ARRAY['loader','table_name', 'lookup_name'], ARRAY[platform.loader, lu.table_name, lu.lookup_name ]
 			)
 				FROM lu
-				ORDER BY process_order, lookup_name), E'\n') ::text 
-	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'website_root'], 
+				ORDER BY process_order, lookup_name), E'\n') ::text
+	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'website_root'],
 	ARRAY[platform.psql,  variables.data_schema, variables.staging_schema, variables.staging_fold, variables.website_root])
 			AS shell_code
 FROM loader_variables As variables
@@ -305,50 +305,50 @@
 ;
 $BODY$
   LANGUAGE sql VOLATILE;
-  
+
 CREATE OR REPLACE FUNCTION loader_generate_script(param_states text[], os text)
   RETURNS SETOF text AS
 $BODY$
-SELECT 
+SELECT
 	loader_macro_replace(
 		replace(
 			loader_macro_replace(declare_sect
-				, ARRAY['staging_fold', 'state_fold','website_root', 'psql', 'state_abbrev', 'data_schema', 'staging_schema', 'state_fips'], 
+				, ARRAY['staging_fold', 'state_fold','website_root', 'psql', 'state_abbrev', 'data_schema', 'staging_schema', 'state_fips'],
 				ARRAY[variables.staging_fold, s.state_fold, variables.website_root, platform.psql, s.state_abbrev, variables.data_schema, variables.staging_schema, s.state_fips::text]
 			), '/', platform.path_sep) || '
 ' ||
 	-- State level files - if an override website is specified we use that instead of variable one
 	array_to_string( ARRAY(SELECT 'cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/tl_*_' || s.state_fips || '_* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/tl_*_' || s.state_fips || '_* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name) ), 'http://', ''),'ftp://','')    || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*_' || s.state_fips || '*_' || table_name || '.zip ') || '
-' ||loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -' ||  lu.insert_mode || ' -s 4269 -g the_geom ' 
-		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year || '_' || s.state_fips 
-	|| '_' || lu.table_name || '.dbf tiger_staging.' || lower(s.state_abbrev) || '_' || lu.table_name || ' | '::text || platform.psql 
-		|| COALESCE(E'\n' || 
+' ||loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -' ||  lu.insert_mode || ' -s 4269 -g the_geom '
+		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year || '_' || s.state_fips
+	|| '_' || lu.table_name || '.dbf tiger_staging.' || lower(s.state_abbrev) || '_' || lu.table_name || ' | '::text || platform.psql
+		|| COALESCE(E'\n' ||
 			lu.post_load_process , '') , ARRAY['loader','table_name', 'lookup_name'], ARRAY[platform.loader, lu.table_name, lu.lookup_name ])
 				FROM loader_lookuptables AS lu
 				WHERE level_state = true AND load = true
-				ORDER BY process_order, lookup_name), E'\n') ::text 
+				ORDER BY process_order, lookup_name), E'\n') ::text
 	-- County Level files
 	|| E'\n' ||
 		array_to_string( ARRAY(SELECT 'cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  || '/'), 'http://', ''),'ftp://','')  || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*_' || s.state_fips || '*_' || table_name || '.zip ') || '
 ' || loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || COALESCE(county_process_command || E'\n','')
-				|| COALESCE(E'\n' ||lu.post_load_process , '') , ARRAY['loader','table_name','lookup_name'], ARRAY[platform.loader  || CASE WHEN lu.single_geom_mode THEN ' -S' ELSE ' ' END::text, lu.table_name, lu.lookup_name ]) 
+				|| COALESCE(E'\n' ||lu.post_load_process , '') , ARRAY['loader','table_name','lookup_name'], ARRAY[platform.loader  || CASE WHEN lu.single_geom_mode THEN ' -S' ELSE ' ' END::text, lu.table_name, lu.lookup_name ])
 				FROM loader_lookuptables AS lu
 				WHERE level_county = true AND load = true
-				ORDER BY process_order, lookup_name), E'\n') ::text 
-	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'state_fold', 'website_root', 'state_abbrev','state_fips'], 
+				ORDER BY process_order, lookup_name), E'\n') ::text
+	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'state_fold', 'website_root', 'state_abbrev','state_fips'],
 	ARRAY[platform.psql,  variables.data_schema, variables.staging_schema, variables.staging_fold, s.state_fold,variables.website_root, s.state_abbrev, s.state_fips::text])
 			AS shell_code
 FROM loader_variables As variables
-		CROSS JOIN (SELECT name As state, abbrev As state_abbrev, lpad(st_code::text,2,'0') As state_fips, 
-			 lpad(st_code::text,2,'0') || '_' 
+		CROSS JOIN (SELECT name As state, abbrev As state_abbrev, lpad(st_code::text,2,'0') As state_fips,
+			 lpad(st_code::text,2,'0') || '_'
 	|| replace(name, ' ', '_') As state_fold
 FROM state_lookup) As s CROSS JOIN loader_platform As platform
 WHERE $1 @> ARRAY[state_abbrev::text]      -- If state is contained in list of states input generate script for it
@@ -360,7 +360,7 @@
 CREATE OR REPLACE FUNCTION loader_load_staged_data(param_staging_table text, param_target_table text, param_columns_exclude text[]) RETURNS integer
 AS
 $$
-DECLARE 
+DECLARE
 	var_sql text;
 	var_staging_schema text; var_data_schema text;
 	var_temp text;
@@ -370,16 +370,16 @@
 -- Assume all the columns are in same order as target
 	SELECT staging_schema, data_schema INTO var_staging_schema, var_data_schema FROM loader_variables;
 	var_sql := 'INSERT INTO ' || var_data_schema || '.' || quote_ident(param_target_table) || '(' ||
-			array_to_string(ARRAY(SELECT quote_ident(column_name::text) 
-				FROM information_schema.columns 
+			array_to_string(ARRAY(SELECT quote_ident(column_name::text)
+				FROM information_schema.columns
 				 WHERE table_name = param_target_table
-					AND table_schema = var_data_schema 
-					AND column_name <> ALL(param_columns_exclude) ), ',') || ') SELECT ' 
-					|| array_to_string(ARRAY(SELECT quote_ident(column_name::text) 
-				FROM information_schema.columns 
+					AND table_schema = var_data_schema
+					AND column_name <> ALL(param_columns_exclude) ), ',') || ') SELECT '
+					|| array_to_string(ARRAY(SELECT quote_ident(column_name::text)
+				FROM information_schema.columns
 				 WHERE table_name = param_staging_table
-					AND table_schema = var_staging_schema 
-					AND column_name <> ALL( param_columns_exclude) ), ',') ||' FROM ' 
+					AND table_schema = var_staging_schema
+					AND column_name <> ALL( param_columns_exclude) ), ',') ||' FROM '
 					|| var_staging_schema || '.' || param_staging_table || ';';
 	RAISE NOTICE '%', var_sql;
 	EXECUTE (var_sql);
@@ -390,16 +390,16 @@
 $$
 LANGUAGE 'plpgsql' VOLATILE;
 
-CREATE OR REPLACE FUNCTION loader_load_staged_data(param_staging_table text, param_target_table text) 
+CREATE OR REPLACE FUNCTION loader_load_staged_data(param_staging_table text, param_target_table text)
 RETURNS integer AS
 $$
--- exclude this set list of columns if no exclusion list is specified 
+-- exclude this set list of columns if no exclusion list is specified
 
    SELECT  loader_load_staged_data($1, $2,(SELECT COALESCE(columns_exclude,ARRAY['gid', 'geoid','cpi','suffix1ce', 'statefp00', 'statefp10', 'countyfp00','countyfp10'
    ,'tractce00','tractce10', 'blkgrpce00', 'blkgrpce10', 'blockce00', 'blockce10'
-      , 'cousubfp00', 'submcdfp00', 'conctyfp00', 'placefp00', 'aiannhfp00', 'aiannhce00', 
-       'comptyp00', 'trsubfp00', 'trsubce00', 'anrcfp00', 'elsdlea00', 'scsdlea00', 
-       'unsdlea00', 'uace00', 'cd108fp', 'sldust00', 'sldlst00', 'vtdst00', 'zcta5ce00', 
+      , 'cousubfp00', 'submcdfp00', 'conctyfp00', 'placefp00', 'aiannhfp00', 'aiannhce00',
+       'comptyp00', 'trsubfp00', 'trsubce00', 'anrcfp00', 'elsdlea00', 'scsdlea00',
+       'unsdlea00', 'uace00', 'cd108fp', 'sldust00', 'sldlst00', 'vtdst00', 'zcta5ce00',
        'tazce00', 'ugace00', 'puma5ce00','vtdst10','tazce10','uace10','puma5ce10','tazce', 'uace', 'vtdst', 'zcta5ce', 'zcta5ce10', 'puma5ce', 'ugace10','pumace10', 'estatefp', 'ugace']) FROM loader_lookuptables WHERE $2 LIKE '%' || lookup_name))
 $$
 language 'sql' VOLATILE;

Modified: trunk/extras/tiger_geocoder/tiger_loader_2013.sql
===================================================================
--- trunk/extras/tiger_geocoder/tiger_loader_2013.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/tiger_loader_2013.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -2,18 +2,18 @@
 -- PostGIS - Spatial Types for PostgreSQL
 -- http://postgis.net
 --
--- Copyright (C) 2010, 2011, 2012 Regina Obe and Leo Hsu 
+-- Copyright (C) 2010, 2011, 2012 Regina Obe and Leo Hsu
 -- Paragon Corporation
 --
 -- This is free software; you can redistribute and/or modify it under
 -- the terms of the GNU General Public Licence. See the COPYING file.
 --
 -- Author: Regina Obe and Leo Hsu <lr at pcorp.us>
---  
+--
 -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 SELECT tiger.SetSearchPathForInstall('tiger');
 BEGIN;
-CREATE OR REPLACE FUNCTION loader_macro_replace(param_input text, param_keys text[],param_values text[]) 
+CREATE OR REPLACE FUNCTION loader_macro_replace(param_input text, param_keys text[],param_values text[])
 RETURNS text AS
 $$
 	DECLARE var_result text = param_input;
@@ -35,12 +35,12 @@
 $$
 SELECT array_to_string(array_agg('DROP TABLE ' || quote_ident(table_schema) || '.' || quote_ident(table_name) || ';'),E'\n')
 	FROM (SELECT * FROM information_schema.tables
-	WHERE table_schema = $2 AND table_name like lower($1) || '_%' ORDER BY table_name) AS foo; 
+	WHERE table_schema = $2 AND table_name like lower($1) || '_%' ORDER BY table_name) AS foo;
 ;
 $$
   LANGUAGE sql VOLATILE;
-  
--- Helper function that generates script to drop all nation tables (county, state) in a particular schema 
+
+-- Helper function that generates script to drop all nation tables (county, state) in a particular schema
 -- This is useful for loading 2011 because state and county tables aren't broken out into separate state files
 DROP FUNCTION IF EXISTS drop_national_tables_generate_script(text);
 CREATE OR REPLACE FUNCTION drop_nation_tables_generate_script(param_schema text DEFAULT 'tiger_data')
@@ -48,34 +48,34 @@
 $$
 SELECT array_to_string(array_agg('DROP TABLE ' || quote_ident(table_schema) || '.' || quote_ident(table_name) || ';'),E'\n')
 	FROM (SELECT * FROM information_schema.tables
-	WHERE table_schema = $1 AND (table_name ~ E'^[a-z]{2}\_county' or table_name ~ E'^[a-z]{2}\_state' or table_name = 'state_all' or table_name LIKE 'county_all%') ORDER BY table_name) AS foo; 
+	WHERE table_schema = $1 AND (table_name ~ E'^[a-z]{2}\_county' or table_name ~ E'^[a-z]{2}\_state' or table_name = 'state_all' or table_name LIKE 'county_all%') ORDER BY table_name) AS foo;
 ;
 $$
   LANGUAGE sql VOLATILE;
-  
-DO 
+
+DO
 $$
 BEGIN
   IF NOT EXISTS (SELECT * FROM information_schema.tables WHERE table_name = 'loader_platform' AND table_schema = 'tiger') THEN
-      CREATE TABLE loader_platform(os varchar(50) PRIMARY KEY, declare_sect text, pgbin text, wget text, unzip_command text, psql text, path_sep text, loader text, environ_set_command text, county_process_command text);     
-  END IF;   
-END 
+      CREATE TABLE loader_platform(os varchar(50) PRIMARY KEY, declare_sect text, pgbin text, wget text, unzip_command text, psql text, path_sep text, loader text, environ_set_command text, county_process_command text);
+  END IF;
+END
 $$ LANGUAGE 'plpgsql';
 
-DO 
+DO
 $$
 BEGIN
   IF NOT EXISTS (SELECT * FROM information_schema.schemata WHERE schema_name = 'tiger_data') THEN
-       CREATE SCHEMA tiger_data;     
-  END IF;   
-END 
+       CREATE SCHEMA tiger_data;
+  END IF;
+END
 $$ LANGUAGE 'plpgsql';
 
 
 DELETE FROM loader_platform WHERE os IN ('sh', 'windows');
 GRANT SELECT ON TABLE loader_platform TO public;
 INSERT INTO loader_platform(os, wget, pgbin, declare_sect, unzip_command, psql,path_sep,loader, environ_set_command, county_process_command)
-VALUES('windows', '%WGETTOOL%', '%PGBIN%', 
+VALUES('windows', '%WGETTOOL%', '%PGBIN%',
 E'set TMPDIR=${staging_fold}\\temp\\
 set UNZIPTOOL="C:\\Program Files\\7-Zip\\7z.exe"
 set WGETTOOL="C:\\wget\\wget.exe"
@@ -92,14 +92,14 @@
 %PSQL% -c "DROP SCHEMA IF EXISTS ${staging_schema} CASCADE;"
 %PSQL% -c "CREATE SCHEMA ${staging_schema};"
 %PSQL% -c "DO language ''plpgsql'' $$ BEGIN IF NOT EXISTS (SELECT * FROM information_schema.schemata WHERE schema_name = ''${data_schema}'' ) THEN CREATE SCHEMA ${data_schema}; END IF;  END $$"
-for /r %%z in (*.zip) do %UNZIPTOOL% e %%z  -o%TMPDIR% 
-cd %TMPDIR%', E'%PSQL%', E'\\', E'%SHP2PGSQL%', 'set ', 
+for /r %%z in (*.zip) do %UNZIPTOOL% e %%z  -o%TMPDIR%
+cd %TMPDIR%', E'%PSQL%', E'\\', E'%SHP2PGSQL%', 'set ',
 'for /r %%z in (*${table_name}.dbf) do (${loader} -D -s 4269 -g the_geom -W "latin1" %%z tiger_staging.${state_abbrev}_${table_name} | ${psql} & ${psql} -c "SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}''));")'
 );
 
 
 INSERT INTO loader_platform(os, wget, pgbin, declare_sect, unzip_command, psql, path_sep, loader, environ_set_command, county_process_command)
-VALUES('sh', 'wget', '', 
+VALUES('sh', 'wget', '',
 E'TMPDIR="${staging_fold}/temp/"
 UNZIPTOOL=unzip
 WGETTOOL="/usr/bin/wget"
@@ -118,8 +118,8 @@
 for z in *.zip; do $UNZIPTOOL -o -d $TMPDIR $z; done
 for z in */*.zip; do $UNZIPTOOL -o -d $TMPDIR $z; done
 cd $TMPDIR;\n', '${PSQL}', '/', '${SHP2PGSQL}', 'export ',
-'for z in *${table_name}.dbf; do 
-${loader} -D -s 4269 -g the_geom -W "latin1" $z ${staging_schema}.${state_abbrev}_${table_name} | ${psql} 
+'for z in *${table_name}.dbf; do
+${loader} -D -s 4269 -g the_geom -W "latin1" $z ${staging_schema}.${state_abbrev}_${table_name} | ${psql}
 ${PSQL} -c "SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}''));"
 done');
 
@@ -127,9 +127,9 @@
 DO $$
 BEGIN
   IF NOT EXISTS (SELECT * FROM information_schema.tables WHERE table_name = 'loader_variables' AND table_schema = 'tiger') THEN
-      CREATE TABLE loader_variables(tiger_year varchar(4) PRIMARY KEY, website_root text, staging_fold text, data_schema text, staging_schema text);    
-  END IF;   
-END 
+      CREATE TABLE loader_variables(tiger_year varchar(4) PRIMARY KEY, website_root text, staging_fold text, data_schema text, staging_schema text);
+  END IF;
+END
 $$ LANGUAGE 'plpgsql';
 
 TRUNCATE TABLE loader_variables;
@@ -140,18 +140,18 @@
 DO $$
 BEGIN
   IF NOT EXISTS (SELECT * FROM information_schema.tables WHERE table_name = 'loader_lookuptables' AND table_schema = 'tiger') THEN
-   CREATE TABLE loader_lookuptables(process_order integer NOT NULL DEFAULT 1000, 
-		lookup_name text primary key, 
-		table_name text, single_mode boolean NOT NULL DEFAULT true, 
-		load boolean NOT NULL DEFAULT true, 
-		level_county boolean NOT NULL DEFAULT false, 
+   CREATE TABLE loader_lookuptables(process_order integer NOT NULL DEFAULT 1000,
+		lookup_name text primary key,
+		table_name text, single_mode boolean NOT NULL DEFAULT true,
+		load boolean NOT NULL DEFAULT true,
+		level_county boolean NOT NULL DEFAULT false,
 		level_state boolean NOT NULL DEFAULT false,
 		level_nation boolean NOT NULL DEFAULT false,
-		post_load_process text, single_geom_mode boolean DEFAULT false, 
-		insert_mode char(1) NOT NULL DEFAULT 'c', 
-		pre_load_process text,columns_exclude text[], website_root_override text);   
-  END IF;   
-END 
+		post_load_process text, single_geom_mode boolean DEFAULT false,
+		insert_mode char(1) NOT NULL DEFAULT 'c',
+		pre_load_process text,columns_exclude text[], website_root_override text);
+  END IF;
+END
 $$ LANGUAGE 'plpgsql';
 
 TRUNCATE TABLE loader_lookuptables;
@@ -179,23 +179,23 @@
 	${psql} -c "VACUUM ANALYZE ${data_schema}.${lookup_name}_lookup;" ');
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, level_nation, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(1, 'state_all', 'state', true, false, false,true,false, 'c', 
+VALUES(1, 'state_all', 'state', true, false, false,true,false, 'c',
 	'${psql} -c "CREATE TABLE ${data_schema}.${lookup_name}(CONSTRAINT pk_${lookup_name} PRIMARY KEY (statefp),CONSTRAINT uidx_${lookup_name}_stusps  UNIQUE (stusps), CONSTRAINT uidx_${lookup_name}_gid UNIQUE (gid) ) INHERITS(state); "',
 	'${psql} -c "SELECT loader_load_staged_data(lower(''${table_name}''), lower(''${lookup_name}'')); "
 	${psql} -c "CREATE INDEX ${data_schema}_${lookup_name}_the_geom_gist ON ${data_schema}.${lookup_name} USING gist(the_geom);"
 	${psql} -c "VACUUM ANALYZE ${data_schema}.${lookup_name}"' );
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(3, 'place', 'place', true, false, true,false, 'c', 
+VALUES(3, 'place', 'place', true, false, true,false, 'c',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (plcidfp) ) INHERITS(place);" ',
 	'${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${table_name} RENAME geoid TO plcidfp;SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}'')); ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT uidx_${state_abbrev}_${lookup_name}_gid UNIQUE (gid);"
-${psql} -c "CREATE INDEX idx_${state_abbrev}_${lookup_name}_soundex_name ON ${data_schema}.${state_abbrev}_${lookup_name} USING btree (soundex(name));" 
+${psql} -c "CREATE INDEX idx_${state_abbrev}_${lookup_name}_soundex_name ON ${data_schema}.${state_abbrev}_${lookup_name} USING btree (soundex(name));"
 ${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"
-${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"'  
+${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"'
 	);
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(4, 'cousub', 'cousub', true, false, true,false, 'c', 
+VALUES(4, 'cousub', 'cousub', true, false, true,false, 'c',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (cosbidfp), CONSTRAINT uidx_${state_abbrev}_${lookup_name}_gid UNIQUE (gid)) INHERITS(${lookup_name});" ',
 	'${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${table_name} RENAME geoid TO cosbidfp;SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}'')); ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 ${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"
@@ -203,7 +203,7 @@
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, level_nation, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude, website_root_override  )
 -- this is a bit of a lie that its county.  It's really state but works better with column routine
-VALUES(4, 'zcta5', 'zcta510', true,true, false,false, false, 'a', 
+VALUES(4, 'zcta5', 'zcta510', true,true, false,false, false, 'a',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (zcta5ce,statefp), CONSTRAINT uidx_${state_abbrev}_${lookup_name}_gid UNIQUE (gid)) INHERITS(${lookup_name});" ',
 	'${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 ${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"'
@@ -211,7 +211,7 @@
 
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(6, 'faces', 'faces', true, true, false,false, 'c', 
+VALUES(6, 'faces', 'faces', true, true, false,false, 'c',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${table_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (gid)) INHERITS(${lookup_name});" ',
 	'${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${table_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"
 	${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_tfid ON ${data_schema}.${state_abbrev}_${lookup_name} USING btree (tfid);"
@@ -220,7 +220,7 @@
 	${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"');
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude )
-VALUES(7, 'featnames', 'featnames', true, true, false,false, 'a', 
+VALUES(7, 'featnames', 'featnames', true, true, false,false, 'a',
 '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${table_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (gid)) INHERITS(${table_name});ALTER TABLE ${data_schema}.${state_abbrev}_${table_name} ALTER COLUMN statefp SET DEFAULT ''${state_fips}'';" ',
 '${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_snd_name ON ${data_schema}.${state_abbrev}_${table_name} USING btree (soundex(name));"
 ${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_lname ON ${data_schema}.${state_abbrev}_${table_name} USING btree (lower(name));"
@@ -229,7 +229,7 @@
 ${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"', ARRAY['gid','statefp']);
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(8, 'edges', 'edges', true, true, false,false, 'a', 
+VALUES(8, 'edges', 'edges', true, true, false,false, 'a',
 '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${table_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (gid)) INHERITS(${table_name});" ',
 '${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${table_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 ${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_tlid ON ${data_schema}.${state_abbrev}_${table_name} USING btree (tlid);"
@@ -250,7 +250,7 @@
 ${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_zip_lookup_base_citysnd ON ${data_schema}.${state_abbrev}_zip_lookup_base USING btree(soundex(city));" ');
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process,columns_exclude )
-VALUES(9, 'addr', 'addr', true, true, false,false, 'a', 
+VALUES(9, 'addr', 'addr', true, true, false,false, 'a',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (gid)) INHERITS(${table_name});ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ALTER COLUMN statefp SET DEFAULT ''${state_fips}'';" ',
 	'${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 	${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_least_address ON tiger_data.${state_abbrev}_addr USING btree (least_hn(fromhn,tohn) );"
@@ -262,7 +262,7 @@
 	${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"',  ARRAY['gid','statefp','fromarmid', 'toarmid']);
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process,columns_exclude )
-VALUES(9, 'addrfeat', 'addrfeat', false, true, false,true, 'a', 
+VALUES(9, 'addrfeat', 'addrfeat', false, true, false,true, 'a',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (gid)) INHERITS(${table_name});ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ALTER COLUMN statefp SET DEFAULT ''${state_fips}'';" ',
 	'${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 	${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"',  ARRAY['gid','statefp','fromarmid', 'toarmid']);
@@ -271,31 +271,31 @@
   RETURNS SETOF text AS
 $BODY$
 WITH lu AS (SELECT lookup_name, table_name, pre_load_process,post_load_process, process_order, insert_mode, single_geom_mode, level_nation, level_county, level_state
-    FROM  loader_lookuptables 
+    FROM  loader_lookuptables
 				WHERE level_nation = true AND load = true)
-SELECT 
+SELECT
 	loader_macro_replace(
 		replace(
 			loader_macro_replace(declare_sect
-				, ARRAY['staging_fold', 'website_root', 'psql',  'data_schema', 'staging_schema'], 
+				, ARRAY['staging_fold', 'website_root', 'psql',  'data_schema', 'staging_schema'],
 				ARRAY[variables.staging_fold, variables.website_root, platform.psql, variables.data_schema, variables.staging_schema]
 			), '/', platform.path_sep) || '
 '  ||
 	-- Nation level files
 	array_to_string( ARRAY(SELECT loader_macro_replace('cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || variables.website_root  || '/' || upper(table_name)  || '/ --no-parent --relative --recursive --level=1 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || variables.website_root  || '/' || upper(table_name)  || '/ --no-parent --relative --recursive --level=1 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(variables.website_root, 'http://', ''),'ftp://','')  || '/' || upper(table_name)  || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*' || table_name || '.zip ') || '
-' || COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -' ||  lu.insert_mode || ' -s 4269 -g the_geom ' 
-		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year 
-	|| '_us_' || lu.table_name || '.dbf tiger_staging.' || lu.table_name || ' | '::text || platform.psql 
-		|| COALESCE(E'\n' || 
+' || COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -' ||  lu.insert_mode || ' -s 4269 -g the_geom '
+		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year
+	|| '_us_' || lu.table_name || '.dbf tiger_staging.' || lu.table_name || ' | '::text || platform.psql
+		|| COALESCE(E'\n' ||
 			lu.post_load_process , '') , ARRAY['loader','table_name', 'lookup_name'], ARRAY[platform.loader, lu.table_name, lu.lookup_name ]
 			)
 				FROM lu
-				ORDER BY process_order, lookup_name), E'\n') ::text 
-	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'website_root'], 
+				ORDER BY process_order, lookup_name), E'\n') ::text
+	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'website_root'],
 	ARRAY[platform.psql,  variables.data_schema, variables.staging_schema, variables.staging_fold, variables.website_root])
 			AS shell_code
 FROM loader_variables As variables
@@ -304,50 +304,50 @@
 ;
 $BODY$
   LANGUAGE sql VOLATILE;
-  
+
 CREATE OR REPLACE FUNCTION loader_generate_script(param_states text[], os text)
   RETURNS SETOF text AS
 $BODY$
-SELECT 
+SELECT
 	loader_macro_replace(
 		replace(
 			loader_macro_replace(declare_sect
-				, ARRAY['staging_fold', 'state_fold','website_root', 'psql', 'state_abbrev', 'data_schema', 'staging_schema', 'state_fips'], 
+				, ARRAY['staging_fold', 'state_fold','website_root', 'psql', 'state_abbrev', 'data_schema', 'staging_schema', 'state_fips'],
 				ARRAY[variables.staging_fold, s.state_fold, variables.website_root, platform.psql, s.state_abbrev, variables.data_schema, variables.staging_schema, s.state_fips::text]
 			), '/', platform.path_sep) || '
 ' ||
 	-- State level files - if an override website is specified we use that instead of variable one
 	array_to_string( ARRAY(SELECT 'cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/tl_*_' || s.state_fips || '_* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/tl_*_' || s.state_fips || '_* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name) ), 'http://', ''),'ftp://','')    || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*_' || s.state_fips || '*_' || table_name || '.zip ') || '
-' ||loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -' ||  lu.insert_mode || ' -s 4269 -g the_geom ' 
-		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year || '_' || s.state_fips 
-	|| '_' || lu.table_name || '.dbf tiger_staging.' || lower(s.state_abbrev) || '_' || lu.table_name || ' | '::text || platform.psql 
-		|| COALESCE(E'\n' || 
+' ||loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -' ||  lu.insert_mode || ' -s 4269 -g the_geom '
+		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year || '_' || s.state_fips
+	|| '_' || lu.table_name || '.dbf tiger_staging.' || lower(s.state_abbrev) || '_' || lu.table_name || ' | '::text || platform.psql
+		|| COALESCE(E'\n' ||
 			lu.post_load_process , '') , ARRAY['loader','table_name', 'lookup_name'], ARRAY[platform.loader, lu.table_name, lu.lookup_name ])
 				FROM loader_lookuptables AS lu
 				WHERE level_state = true AND load = true
-				ORDER BY process_order, lookup_name), E'\n') ::text 
+				ORDER BY process_order, lookup_name), E'\n') ::text
 	-- County Level files
 	|| E'\n' ||
 		array_to_string( ARRAY(SELECT 'cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/tl_*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/tl_*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  || '/'), 'http://', ''),'ftp://','')  || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*_' || s.state_fips || '*_' || table_name || '.zip ') || '
 ' || loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || COALESCE(county_process_command || E'\n','')
-				|| COALESCE(E'\n' ||lu.post_load_process , '') , ARRAY['loader','table_name','lookup_name'], ARRAY[platform.loader  || CASE WHEN lu.single_geom_mode THEN ' -S' ELSE ' ' END::text, lu.table_name, lu.lookup_name ]) 
+				|| COALESCE(E'\n' ||lu.post_load_process , '') , ARRAY['loader','table_name','lookup_name'], ARRAY[platform.loader  || CASE WHEN lu.single_geom_mode THEN ' -S' ELSE ' ' END::text, lu.table_name, lu.lookup_name ])
 				FROM loader_lookuptables AS lu
 				WHERE level_county = true AND load = true
-				ORDER BY process_order, lookup_name), E'\n') ::text 
-	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'state_fold', 'website_root', 'state_abbrev','state_fips'], 
+				ORDER BY process_order, lookup_name), E'\n') ::text
+	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'state_fold', 'website_root', 'state_abbrev','state_fips'],
 	ARRAY[platform.psql,  variables.data_schema, variables.staging_schema, variables.staging_fold, s.state_fold,variables.website_root, s.state_abbrev, s.state_fips::text])
 			AS shell_code
 FROM loader_variables As variables
-		CROSS JOIN (SELECT name As state, abbrev As state_abbrev, lpad(st_code::text,2,'0') As state_fips, 
-			 lpad(st_code::text,2,'0') || '_' 
+		CROSS JOIN (SELECT name As state, abbrev As state_abbrev, lpad(st_code::text,2,'0') As state_fips,
+			 lpad(st_code::text,2,'0') || '_'
 	|| replace(name, ' ', '_') As state_fold
 FROM state_lookup) As s CROSS JOIN loader_platform As platform
 WHERE $1 @> ARRAY[state_abbrev::text]      -- If state is contained in list of states input generate script for it
@@ -359,7 +359,7 @@
 CREATE OR REPLACE FUNCTION loader_load_staged_data(param_staging_table text, param_target_table text, param_columns_exclude text[]) RETURNS integer
 AS
 $$
-DECLARE 
+DECLARE
 	var_sql text;
 	var_staging_schema text; var_data_schema text;
 	var_temp text;
@@ -369,18 +369,18 @@
 -- Assume all the columns are in same order as target
 	SELECT staging_schema, data_schema INTO var_staging_schema, var_data_schema FROM loader_variables;
 	var_sql := 'INSERT INTO ' || var_data_schema || '.' || quote_ident(param_target_table) || '(' ||
-			array_to_string(ARRAY(SELECT quote_ident(column_name::text) 
-				FROM information_schema.columns 
+			array_to_string(ARRAY(SELECT quote_ident(column_name::text)
+				FROM information_schema.columns
 				 WHERE table_name = param_target_table
-					AND table_schema = var_data_schema 
-					AND column_name <> ALL(param_columns_exclude) 
-                    ORDER BY ordinal_position ), ',') || ') SELECT ' 
-					|| array_to_string(ARRAY(SELECT quote_ident(column_name::text) 
-				FROM information_schema.columns 
+					AND table_schema = var_data_schema
+					AND column_name <> ALL(param_columns_exclude)
+                    ORDER BY ordinal_position ), ',') || ') SELECT '
+					|| array_to_string(ARRAY(SELECT quote_ident(column_name::text)
+				FROM information_schema.columns
 				 WHERE table_name = param_staging_table
-					AND table_schema = var_staging_schema 
-					AND column_name <> ALL( param_columns_exclude) 
-                    ORDER BY ordinal_position ), ',') ||' FROM ' 
+					AND table_schema = var_staging_schema
+					AND column_name <> ALL( param_columns_exclude)
+                    ORDER BY ordinal_position ), ',') ||' FROM '
 					|| var_staging_schema || '.' || param_staging_table || ';';
 	RAISE NOTICE '%', var_sql;
 	EXECUTE (var_sql);
@@ -391,16 +391,16 @@
 $$
 LANGUAGE 'plpgsql' VOLATILE;
 
-CREATE OR REPLACE FUNCTION loader_load_staged_data(param_staging_table text, param_target_table text) 
+CREATE OR REPLACE FUNCTION loader_load_staged_data(param_staging_table text, param_target_table text)
 RETURNS integer AS
 $$
--- exclude this set list of columns if no exclusion list is specified 
+-- exclude this set list of columns if no exclusion list is specified
 
    SELECT  loader_load_staged_data($1, $2,(SELECT COALESCE(columns_exclude,ARRAY['gid', 'geoid','cpi','suffix1ce', 'statefp00', 'statefp10', 'countyfp00','countyfp10'
    ,'tractce00','tractce10', 'blkgrpce00', 'blkgrpce10', 'blockce00', 'blockce10'
-      , 'cousubfp00', 'submcdfp00', 'conctyfp00', 'placefp00', 'aiannhfp00', 'aiannhce00', 
-       'comptyp00', 'trsubfp00', 'trsubce00', 'anrcfp00', 'elsdlea00', 'scsdlea00', 
-       'unsdlea00', 'uace00', 'cd108fp', 'sldust00', 'sldlst00', 'vtdst00', 'zcta5ce00', 
+      , 'cousubfp00', 'submcdfp00', 'conctyfp00', 'placefp00', 'aiannhfp00', 'aiannhce00',
+       'comptyp00', 'trsubfp00', 'trsubce00', 'anrcfp00', 'elsdlea00', 'scsdlea00',
+       'unsdlea00', 'uace00', 'cd108fp', 'sldust00', 'sldlst00', 'vtdst00', 'zcta5ce00',
        'tazce00', 'ugace00', 'puma5ce00','vtdst10','tazce10','uace10','puma5ce10','tazce', 'uace', 'vtdst', 'zcta5ce', 'zcta5ce10', 'puma5ce', 'ugace10','pumace10', 'estatefp', 'ugace']) FROM loader_lookuptables WHERE $2 LIKE '%' || lookup_name))
 $$
 language 'sql' VOLATILE;

Modified: trunk/extras/tiger_geocoder/tiger_loader_2014.sql
===================================================================
--- trunk/extras/tiger_geocoder/tiger_loader_2014.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/tiger_loader_2014.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -2,21 +2,21 @@
 -- PostGIS - Spatial Types for PostgreSQL
 -- http://postgis.net
 --
--- Copyright (C) 2010, 2011, 2012 Regina Obe and Leo Hsu 
+-- Copyright (C) 2010, 2011, 2012 Regina Obe and Leo Hsu
 -- Paragon Corporation
 --
 -- This is free software; you can redistribute and/or modify it under
 -- the terms of the GNU General Public Licence. See the COPYING file.
 --
 -- Author: Regina Obe and Leo Hsu <lr at pcorp.us>
---  
+--
 -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 SELECT tiger.SetSearchPathForInstall('tiger');
 BEGIN;
-CREATE OR REPLACE FUNCTION create_census_base_tables() 
+CREATE OR REPLACE FUNCTION create_census_base_tables()
 	RETURNS text AS
 $$
-DECLARE var_temp text; 
+DECLARE var_temp text;
 BEGIN
 var_temp := tiger.SetSearchPathForInstall('tiger');
 IF NOT EXISTS(SELECT table_name FROM information_schema.columns WHERE table_schema = 'tiger' AND column_name = 'tract_id' AND table_name = 'tract')  THEN
@@ -101,7 +101,7 @@
 $$
 language 'plpgsql';
 
-CREATE OR REPLACE FUNCTION loader_macro_replace(param_input text, param_keys text[],param_values text[]) 
+CREATE OR REPLACE FUNCTION loader_macro_replace(param_input text, param_keys text[],param_values text[])
 RETURNS text AS
 $$
 	DECLARE var_result text = param_input;
@@ -123,12 +123,12 @@
 $$
 SELECT array_to_string(array_agg('DROP TABLE ' || quote_ident(table_schema) || '.' || quote_ident(table_name) || ';'),E'\n')
 	FROM (SELECT * FROM information_schema.tables
-	WHERE table_schema = $2 AND table_name like lower($1) || '_%' ORDER BY table_name) AS foo; 
+	WHERE table_schema = $2 AND table_name like lower($1) || '_%' ORDER BY table_name) AS foo;
 ;
 $$
   LANGUAGE sql VOLATILE;
-  
--- Helper function that generates script to drop all nation tables (county, state) in a particular schema 
+
+-- Helper function that generates script to drop all nation tables (county, state) in a particular schema
 -- This is useful for loading 2011 because state and county tables aren't broken out into separate state files
 DROP FUNCTION IF EXISTS drop_national_tables_generate_script(text);
 CREATE OR REPLACE FUNCTION drop_nation_tables_generate_script(param_schema text DEFAULT 'tiger_data')
@@ -136,34 +136,34 @@
 $$
 SELECT array_to_string(array_agg('DROP TABLE ' || quote_ident(table_schema) || '.' || quote_ident(table_name) || ';'),E'\n')
 	FROM (SELECT * FROM information_schema.tables
-	WHERE table_schema = $1 AND (table_name ~ E'^[a-z]{2}\_county' or table_name ~ E'^[a-z]{2}\_state' or table_name = 'state_all' or table_name LIKE 'county_all%') ORDER BY table_name) AS foo; 
+	WHERE table_schema = $1 AND (table_name ~ E'^[a-z]{2}\_county' or table_name ~ E'^[a-z]{2}\_state' or table_name = 'state_all' or table_name LIKE 'county_all%') ORDER BY table_name) AS foo;
 ;
 $$
   LANGUAGE sql VOLATILE;
-  
-DO 
+
+DO
 $$
 BEGIN
   IF NOT EXISTS (SELECT * FROM information_schema.tables WHERE table_name = 'loader_platform' AND table_schema = 'tiger') THEN
-      CREATE TABLE loader_platform(os varchar(50) PRIMARY KEY, declare_sect text, pgbin text, wget text, unzip_command text, psql text, path_sep text, loader text, environ_set_command text, county_process_command text);     
-  END IF;   
-END 
+      CREATE TABLE loader_platform(os varchar(50) PRIMARY KEY, declare_sect text, pgbin text, wget text, unzip_command text, psql text, path_sep text, loader text, environ_set_command text, county_process_command text);
+  END IF;
+END
 $$ LANGUAGE 'plpgsql';
 
-DO 
+DO
 $$
 BEGIN
   IF NOT EXISTS (SELECT * FROM information_schema.schemata WHERE schema_name = 'tiger_data') THEN
-       CREATE SCHEMA tiger_data;     
-  END IF;   
-END 
+       CREATE SCHEMA tiger_data;
+  END IF;
+END
 $$ LANGUAGE 'plpgsql';
 
 
 DELETE FROM loader_platform WHERE os IN ('sh', 'windows');
 GRANT SELECT ON TABLE loader_platform TO public;
 INSERT INTO loader_platform(os, wget, pgbin, declare_sect, unzip_command, psql,path_sep,loader, environ_set_command, county_process_command)
-VALUES('windows', '%WGETTOOL%', '%PGBIN%', 
+VALUES('windows', '%WGETTOOL%', '%PGBIN%',
 E'set TMPDIR=${staging_fold}\\temp\\
 set UNZIPTOOL="C:\\Program Files\\7-Zip\\7z.exe"
 set WGETTOOL="C:\\wget\\wget.exe"
@@ -180,14 +180,14 @@
 %PSQL% -c "DROP SCHEMA IF EXISTS ${staging_schema} CASCADE;"
 %PSQL% -c "CREATE SCHEMA ${staging_schema};"
 %PSQL% -c "DO language ''plpgsql'' $$ BEGIN IF NOT EXISTS (SELECT * FROM information_schema.schemata WHERE schema_name = ''${data_schema}'' ) THEN CREATE SCHEMA ${data_schema}; END IF;  END $$"
-for /r %%z in (*.zip) do %UNZIPTOOL% e %%z  -o%TMPDIR% 
-cd %TMPDIR%', E'%PSQL%', E'\\', E'%SHP2PGSQL%', 'set ', 
+for /r %%z in (*.zip) do %UNZIPTOOL% e %%z  -o%TMPDIR%
+cd %TMPDIR%', E'%PSQL%', E'\\', E'%SHP2PGSQL%', 'set ',
 'for /r %%z in (*${table_name}*.dbf) do (${loader} -D -s 4269 -g the_geom -W "latin1" %%z tiger_staging.${state_abbrev}_${table_name} | ${psql} & ${psql} -c "SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}''));")'
 );
 
 
 INSERT INTO loader_platform(os, wget, pgbin, declare_sect, unzip_command, psql, path_sep, loader, environ_set_command, county_process_command)
-VALUES('sh', 'wget', '', 
+VALUES('sh', 'wget', '',
 E'TMPDIR="${staging_fold}/temp/"
 UNZIPTOOL=unzip
 WGETTOOL="/usr/bin/wget"
@@ -206,8 +206,8 @@
 for z in *.zip; do $UNZIPTOOL -o -d $TMPDIR $z; done
 for z in */*.zip; do $UNZIPTOOL -o -d $TMPDIR $z; done
 cd $TMPDIR;\n', '${PSQL}', '/', '${SHP2PGSQL}', 'export ',
-'for z in *${table_name}*.dbf; do 
-${loader} -D -s 4269 -g the_geom -W "latin1" $z ${staging_schema}.${state_abbrev}_${table_name} | ${psql} 
+'for z in *${table_name}*.dbf; do
+${loader} -D -s 4269 -g the_geom -W "latin1" $z ${staging_schema}.${state_abbrev}_${table_name} | ${psql}
 ${PSQL} -c "SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}''));"
 done');
 
@@ -215,9 +215,9 @@
 DO $$
 BEGIN
   IF NOT EXISTS (SELECT * FROM information_schema.tables WHERE table_name = 'loader_variables' AND table_schema = 'tiger') THEN
-      CREATE TABLE loader_variables(tiger_year varchar(4) PRIMARY KEY, website_root text, staging_fold text, data_schema text, staging_schema text);    
-  END IF;   
-END 
+      CREATE TABLE loader_variables(tiger_year varchar(4) PRIMARY KEY, website_root text, staging_fold text, data_schema text, staging_schema text);
+  END IF;
+END
 $$ LANGUAGE 'plpgsql';
 
 TRUNCATE TABLE loader_variables;
@@ -228,18 +228,18 @@
 DO $$
 BEGIN
   IF NOT EXISTS (SELECT * FROM information_schema.tables WHERE table_name = 'loader_lookuptables' AND table_schema = 'tiger') THEN
-   CREATE TABLE loader_lookuptables(process_order integer NOT NULL DEFAULT 1000, 
-		lookup_name text primary key, 
-		table_name text, single_mode boolean NOT NULL DEFAULT true, 
-		load boolean NOT NULL DEFAULT true, 
-		level_county boolean NOT NULL DEFAULT false, 
+   CREATE TABLE loader_lookuptables(process_order integer NOT NULL DEFAULT 1000,
+		lookup_name text primary key,
+		table_name text, single_mode boolean NOT NULL DEFAULT true,
+		load boolean NOT NULL DEFAULT true,
+		level_county boolean NOT NULL DEFAULT false,
 		level_state boolean NOT NULL DEFAULT false,
 		level_nation boolean NOT NULL DEFAULT false,
-		post_load_process text, single_geom_mode boolean DEFAULT false, 
-		insert_mode char(1) NOT NULL DEFAULT 'c', 
-		pre_load_process text,columns_exclude text[], website_root_override text);   
-  END IF;   
-END 
+		post_load_process text, single_geom_mode boolean DEFAULT false,
+		insert_mode char(1) NOT NULL DEFAULT 'c',
+		pre_load_process text,columns_exclude text[], website_root_override text);
+  END IF;
+END
 $$ LANGUAGE 'plpgsql';
 
 TRUNCATE TABLE loader_lookuptables;
@@ -256,7 +256,7 @@
 COMMENT ON COLUMN loader_lookuptables.website_root_override IS 'Path to use for wget instead of that specified in year table.  Needed currently for zcta where they release that only for 2000 and 2010';
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude )
-VALUES(10, 'tract', 'tract', true, false, true,false, 'c', 
+VALUES(10, 'tract', 'tract', true, false, true,false, 'c',
 '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (tract_id) ) INHERITS(tiger.${lookup_name}); " ',
 	'${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${table_name} RENAME geoid TO tract_id;  SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}'')); "
 	${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"
@@ -264,7 +264,7 @@
 	${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"', ARRAY['gid']);
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude )
-VALUES(11, 'tabblock', 'tabblock', true, true, false,false, 'c', 
+VALUES(11, 'tabblock', 'tabblock', true, true, false,false, 'c',
 '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (tabblock_id)) INHERITS(tiger.${lookup_name});" ',
 '${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${lookup_name} RENAME geoid10 TO tabblock_id;"
 ${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
@@ -273,7 +273,7 @@
 
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude )
-VALUES(12, 'bg', 'bg', true,false, true,false, 'c', 
+VALUES(12, 'bg', 'bg', true,false, true,false, 'c',
 '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (bg_id)) INHERITS(tiger.${lookup_name});" ',
 '${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${table_name} RENAME geoid TO bg_id;  SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}'')); "
 ${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
@@ -292,23 +292,23 @@
 	${psql} -c "VACUUM ANALYZE ${data_schema}.${lookup_name}_lookup;" ');
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, level_nation, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(1, 'state_all', 'state', true, false, false,true,false, 'c', 
+VALUES(1, 'state_all', 'state', true, false, false,true,false, 'c',
 	'${psql} -c "CREATE TABLE ${data_schema}.${lookup_name}(CONSTRAINT pk_${lookup_name} PRIMARY KEY (statefp),CONSTRAINT uidx_${lookup_name}_stusps  UNIQUE (stusps), CONSTRAINT uidx_${lookup_name}_gid UNIQUE (gid) ) INHERITS(state); "',
 	'${psql} -c "SELECT loader_load_staged_data(lower(''${table_name}''), lower(''${lookup_name}'')); "
 	${psql} -c "CREATE INDEX ${data_schema}_${lookup_name}_the_geom_gist ON ${data_schema}.${lookup_name} USING gist(the_geom);"
 	${psql} -c "VACUUM ANALYZE ${data_schema}.${lookup_name}"' );
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(3, 'place', 'place', true, false, true,false, 'c', 
+VALUES(3, 'place', 'place', true, false, true,false, 'c',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (plcidfp) ) INHERITS(place);" ',
 	'${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${table_name} RENAME geoid TO plcidfp;SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}'')); ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT uidx_${state_abbrev}_${lookup_name}_gid UNIQUE (gid);"
-${psql} -c "CREATE INDEX idx_${state_abbrev}_${lookup_name}_soundex_name ON ${data_schema}.${state_abbrev}_${lookup_name} USING btree (soundex(name));" 
+${psql} -c "CREATE INDEX idx_${state_abbrev}_${lookup_name}_soundex_name ON ${data_schema}.${state_abbrev}_${lookup_name} USING btree (soundex(name));"
 ${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"
-${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"'  
+${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"'
 	);
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(4, 'cousub', 'cousub', true, false, true,false, 'c', 
+VALUES(4, 'cousub', 'cousub', true, false, true,false, 'c',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (cosbidfp), CONSTRAINT uidx_${state_abbrev}_${lookup_name}_gid UNIQUE (gid)) INHERITS(${lookup_name});" ',
 	'${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${table_name} RENAME geoid TO cosbidfp;SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}'')); ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 ${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"
@@ -316,7 +316,7 @@
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, level_nation, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude, website_root_override  )
 -- this is a bit of a lie that its county.  It's really state but works better with column routine
-VALUES(4, 'zcta5', 'zcta510', true,true, false,false, false, 'a', 
+VALUES(4, 'zcta5', 'zcta510', true,true, false,false, false, 'a',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (zcta5ce,statefp), CONSTRAINT uidx_${state_abbrev}_${lookup_name}_gid UNIQUE (gid)) INHERITS(${lookup_name});" ',
 	'${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 ${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"'
@@ -324,7 +324,7 @@
 
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(6, 'faces', 'faces', true, true, false,false, 'c', 
+VALUES(6, 'faces', 'faces', true, true, false,false, 'c',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${table_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (gid)) INHERITS(${lookup_name});" ',
 	'${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${table_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"
 	${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_tfid ON ${data_schema}.${state_abbrev}_${lookup_name} USING btree (tfid);"
@@ -333,7 +333,7 @@
 	${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"');
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude )
-VALUES(7, 'featnames', 'featnames', true, true, false,false, 'a', 
+VALUES(7, 'featnames', 'featnames', true, true, false,false, 'a',
 '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${table_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (gid)) INHERITS(${table_name});ALTER TABLE ${data_schema}.${state_abbrev}_${table_name} ALTER COLUMN statefp SET DEFAULT ''${state_fips}'';" ',
 '${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_snd_name ON ${data_schema}.${state_abbrev}_${table_name} USING btree (soundex(name));"
 ${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_lname ON ${data_schema}.${state_abbrev}_${table_name} USING btree (lower(name));"
@@ -342,7 +342,7 @@
 ${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"', ARRAY['gid','statefp']);
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(8, 'edges', 'edges', true, true, false,false, 'a', 
+VALUES(8, 'edges', 'edges', true, true, false,false, 'a',
 '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${table_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (gid)) INHERITS(${table_name});" ',
 '${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${table_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 ${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_tlid ON ${data_schema}.${state_abbrev}_${table_name} USING btree (tlid);"
@@ -363,7 +363,7 @@
 ${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_zip_lookup_base_citysnd ON ${data_schema}.${state_abbrev}_zip_lookup_base USING btree(soundex(city));" ');
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process,columns_exclude )
-VALUES(9, 'addr', 'addr', true, true, false,false, 'a', 
+VALUES(9, 'addr', 'addr', true, true, false,false, 'a',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (gid)) INHERITS(${table_name});ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ALTER COLUMN statefp SET DEFAULT ''${state_fips}'';" ',
 	'${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 	${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_least_address ON tiger_data.${state_abbrev}_addr USING btree (least_hn(fromhn,tohn) );"
@@ -375,7 +375,7 @@
 	${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"',  ARRAY['gid','statefp','fromarmid', 'toarmid']);
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process,columns_exclude )
-VALUES(9, 'addrfeat', 'addrfeat', false, true, false,true, 'a', 
+VALUES(9, 'addrfeat', 'addrfeat', false, true, false,true, 'a',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (gid)) INHERITS(${table_name});ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ALTER COLUMN statefp SET DEFAULT ''${state_fips}'';" ',
 	'${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 	${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"',  ARRAY['gid','statefp','fromarmid', 'toarmid']);
@@ -384,31 +384,31 @@
   RETURNS SETOF text AS
 $BODY$
 WITH lu AS (SELECT lookup_name, table_name, pre_load_process,post_load_process, process_order, insert_mode, single_geom_mode, level_nation, level_county, level_state
-    FROM  loader_lookuptables 
+    FROM  loader_lookuptables
 				WHERE level_nation = true AND load = true)
-SELECT 
+SELECT
 	loader_macro_replace(
 		replace(
 			loader_macro_replace(declare_sect
-				, ARRAY['staging_fold', 'website_root', 'psql',  'data_schema', 'staging_schema'], 
+				, ARRAY['staging_fold', 'website_root', 'psql',  'data_schema', 'staging_schema'],
 				ARRAY[variables.staging_fold, variables.website_root, platform.psql, variables.data_schema, variables.staging_schema]
 			), '/', platform.path_sep) || '
 '  ||
 	-- Nation level files
 	array_to_string( ARRAY(SELECT loader_macro_replace('cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || variables.website_root  || '/' || upper(table_name)  || '/ --no-parent --relative --recursive --level=1 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || variables.website_root  || '/' || upper(table_name)  || '/ --no-parent --relative --recursive --level=1 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(variables.website_root, 'http://', ''),'ftp://','')  || '/' || upper(table_name)  || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*' || table_name || '.zip ') || '
-' || COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -D -' ||  lu.insert_mode || ' -s 4269 -g the_geom ' 
-		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year 
-	|| '_us_' || lu.table_name || '.dbf tiger_staging.' || lu.table_name || ' | '::text || platform.psql 
-		|| COALESCE(E'\n' || 
+' || COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -D -' ||  lu.insert_mode || ' -s 4269 -g the_geom '
+		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year
+	|| '_us_' || lu.table_name || '.dbf tiger_staging.' || lu.table_name || ' | '::text || platform.psql
+		|| COALESCE(E'\n' ||
 			lu.post_load_process , '') , ARRAY['loader','table_name', 'lookup_name'], ARRAY[platform.loader, lu.table_name, lu.lookup_name ]
 			)
 				FROM lu
-				ORDER BY process_order, lookup_name), E'\n') ::text 
-	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'website_root'], 
+				ORDER BY process_order, lookup_name), E'\n') ::text
+	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'website_root'],
 	ARRAY[platform.psql,  variables.data_schema, variables.staging_schema, variables.staging_fold, variables.website_root])
 			AS shell_code
 FROM loader_variables As variables
@@ -417,50 +417,50 @@
 ;
 $BODY$
   LANGUAGE sql VOLATILE;
-  
+
 CREATE OR REPLACE FUNCTION loader_generate_script(param_states text[], os text)
   RETURNS SETOF text AS
 $BODY$
-SELECT 
+SELECT
 	loader_macro_replace(
 		replace(
 			loader_macro_replace(declare_sect
-				, ARRAY['staging_fold', 'state_fold','website_root', 'psql', 'state_abbrev', 'data_schema', 'staging_schema', 'state_fips'], 
+				, ARRAY['staging_fold', 'state_fold','website_root', 'psql', 'state_abbrev', 'data_schema', 'staging_schema', 'state_fips'],
 				ARRAY[variables.staging_fold, s.state_fold, variables.website_root, platform.psql, s.state_abbrev, variables.data_schema, variables.staging_schema, s.state_fips::text]
 			), '/', platform.path_sep) || '
 ' ||
 	-- State level files - if an override website is specified we use that instead of variable one
 	array_to_string( ARRAY(SELECT 'cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/tl_*_' || s.state_fips || '_* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/tl_*_' || s.state_fips || '_* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name) ), 'http://', ''),'ftp://','')    || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*_' || s.state_fips || '*_' || table_name || '.zip ') || '
-' ||loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -D -' ||  lu.insert_mode || ' -s 4269 -g the_geom ' 
-		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year || '_' || s.state_fips 
-	|| '_' || lu.table_name || '.dbf tiger_staging.' || lower(s.state_abbrev) || '_' || lu.table_name || ' | '::text || platform.psql 
-		|| COALESCE(E'\n' || 
+' ||loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -D -' ||  lu.insert_mode || ' -s 4269 -g the_geom '
+		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year || '_' || s.state_fips
+	|| '_' || lu.table_name || '.dbf tiger_staging.' || lower(s.state_abbrev) || '_' || lu.table_name || ' | '::text || platform.psql
+		|| COALESCE(E'\n' ||
 			lu.post_load_process , '') , ARRAY['loader','table_name', 'lookup_name'], ARRAY[platform.loader, lu.table_name, lu.lookup_name ])
 				FROM loader_lookuptables AS lu
 				WHERE level_state = true AND load = true
-				ORDER BY process_order, lookup_name), E'\n') ::text 
+				ORDER BY process_order, lookup_name), E'\n') ::text
 	-- County Level files
 	|| E'\n' ||
 		array_to_string( ARRAY(SELECT 'cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/tl_*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/tl_*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  || '/'), 'http://', ''),'ftp://','')  || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*_' || s.state_fips || '*_' || table_name || '*.zip ') || '
 ' || loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || COALESCE(county_process_command || E'\n','')
-				|| COALESCE(E'\n' ||lu.post_load_process , '') , ARRAY['loader','table_name','lookup_name'], ARRAY[platform.loader  || ' -D ' || CASE WHEN lu.single_geom_mode THEN ' -S' ELSE ' ' END::text, lu.table_name, lu.lookup_name ]) 
+				|| COALESCE(E'\n' ||lu.post_load_process , '') , ARRAY['loader','table_name','lookup_name'], ARRAY[platform.loader  || ' -D ' || CASE WHEN lu.single_geom_mode THEN ' -S' ELSE ' ' END::text, lu.table_name, lu.lookup_name ])
 				FROM loader_lookuptables AS lu
 				WHERE level_county = true AND load = true
-				ORDER BY process_order, lookup_name), E'\n') ::text 
-	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'state_fold', 'website_root', 'state_abbrev','state_fips'], 
+				ORDER BY process_order, lookup_name), E'\n') ::text
+	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'state_fold', 'website_root', 'state_abbrev','state_fips'],
 	ARRAY[platform.psql,  variables.data_schema, variables.staging_schema, variables.staging_fold, s.state_fold,variables.website_root, s.state_abbrev, s.state_fips::text])
 			AS shell_code
 FROM loader_variables As variables
-		CROSS JOIN (SELECT name As state, abbrev As state_abbrev, lpad(st_code::text,2,'0') As state_fips, 
-			 lpad(st_code::text,2,'0') || '_' 
+		CROSS JOIN (SELECT name As state, abbrev As state_abbrev, lpad(st_code::text,2,'0') As state_fips,
+			 lpad(st_code::text,2,'0') || '_'
 	|| replace(name, ' ', '_') As state_fold
 FROM state_lookup) As s CROSS JOIN loader_platform As platform
 WHERE $1 @> ARRAY[state_abbrev::text]      -- If state is contained in list of states input generate script for it
@@ -472,7 +472,7 @@
 CREATE OR REPLACE FUNCTION loader_load_staged_data(param_staging_table text, param_target_table text, param_columns_exclude text[]) RETURNS integer
 AS
 $$
-DECLARE 
+DECLARE
 	var_sql text;
 	var_staging_schema text; var_data_schema text;
 	var_temp text;
@@ -482,18 +482,18 @@
 -- Assume all the columns are in same order as target
 	SELECT staging_schema, data_schema INTO var_staging_schema, var_data_schema FROM loader_variables;
 	var_sql := 'INSERT INTO ' || var_data_schema || '.' || quote_ident(param_target_table) || '(' ||
-			array_to_string(ARRAY(SELECT quote_ident(column_name::text) 
-				FROM information_schema.columns 
+			array_to_string(ARRAY(SELECT quote_ident(column_name::text)
+				FROM information_schema.columns
 				 WHERE table_name = param_target_table
-					AND table_schema = var_data_schema 
-					AND column_name <> ALL(param_columns_exclude) 
-                    ORDER BY ordinal_position ), ',') || ') SELECT ' 
-					|| array_to_string(ARRAY(SELECT quote_ident(column_name::text) 
-				FROM information_schema.columns 
+					AND table_schema = var_data_schema
+					AND column_name <> ALL(param_columns_exclude)
+                    ORDER BY ordinal_position ), ',') || ') SELECT '
+					|| array_to_string(ARRAY(SELECT quote_ident(column_name::text)
+				FROM information_schema.columns
 				 WHERE table_name = param_staging_table
-					AND table_schema = var_staging_schema 
-					AND column_name <> ALL( param_columns_exclude) 
-                    ORDER BY ordinal_position ), ',') ||' FROM ' 
+					AND table_schema = var_staging_schema
+					AND column_name <> ALL( param_columns_exclude)
+                    ORDER BY ordinal_position ), ',') ||' FROM '
 					|| var_staging_schema || '.' || param_staging_table || ';';
 	RAISE NOTICE '%', var_sql;
 	EXECUTE (var_sql);
@@ -504,16 +504,16 @@
 $$
 LANGUAGE 'plpgsql' VOLATILE;
 
-CREATE OR REPLACE FUNCTION loader_load_staged_data(param_staging_table text, param_target_table text) 
+CREATE OR REPLACE FUNCTION loader_load_staged_data(param_staging_table text, param_target_table text)
 RETURNS integer AS
 $$
--- exclude this set list of columns if no exclusion list is specified 
+-- exclude this set list of columns if no exclusion list is specified
 
    SELECT  loader_load_staged_data($1, $2,(SELECT COALESCE(columns_exclude,ARRAY['gid', 'geoid','cpi','suffix1ce', 'statefp00', 'statefp10', 'countyfp00','countyfp10'
    ,'tractce00','tractce10', 'blkgrpce00', 'blkgrpce10', 'blockce00', 'blockce10'
-      , 'cousubfp00', 'submcdfp00', 'conctyfp00', 'placefp00', 'aiannhfp00', 'aiannhce00', 
-       'comptyp00', 'trsubfp00', 'trsubce00', 'anrcfp00', 'elsdlea00', 'scsdlea00', 
-       'unsdlea00', 'uace00', 'cd108fp', 'sldust00', 'sldlst00', 'vtdst00', 'zcta5ce00', 
+      , 'cousubfp00', 'submcdfp00', 'conctyfp00', 'placefp00', 'aiannhfp00', 'aiannhce00',
+       'comptyp00', 'trsubfp00', 'trsubce00', 'anrcfp00', 'elsdlea00', 'scsdlea00',
+       'unsdlea00', 'uace00', 'cd108fp', 'sldust00', 'sldlst00', 'vtdst00', 'zcta5ce00',
        'tazce00', 'ugace00', 'puma5ce00','vtdst10','tazce10','uace10','puma5ce10','tazce', 'uace', 'vtdst', 'zcta5ce', 'zcta5ce10', 'puma5ce', 'ugace10','pumace10', 'estatefp', 'ugace', 'blockce']) FROM loader_lookuptables WHERE $2 LIKE '%' || lookup_name))
 $$
 language 'sql' VOLATILE;
@@ -522,46 +522,46 @@
   RETURNS SETOF text AS
 $$
 SELECT create_census_base_tables();
-SELECT 
+SELECT
 	loader_macro_replace(
 		replace(
 			loader_macro_replace(declare_sect
-				, ARRAY['staging_fold', 'state_fold','website_root', 'psql', 'state_abbrev', 'data_schema', 'staging_schema', 'state_fips'], 
+				, ARRAY['staging_fold', 'state_fold','website_root', 'psql', 'state_abbrev', 'data_schema', 'staging_schema', 'state_fips'],
 				ARRAY[variables.staging_fold, s.state_fold, variables.website_root, platform.psql, s.state_abbrev, variables.data_schema, variables.staging_schema, s.state_fips::text]
 			), '/', platform.path_sep) || '
 ' ||
 	-- State level files - if an override website is specified we use that instead of variable one
 	array_to_string( ARRAY(SELECT 'cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name) ), 'http://', ''),'ftp://','')    || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*_' || s.state_fips || '*_' || table_name || '.zip ') || '
-' ||loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -' ||  lu.insert_mode || ' -s 4269 -g the_geom ' 
-		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year || '_' || s.state_fips 
-	|| '_' || lu.table_name || '.dbf tiger_staging.' || lower(s.state_abbrev) || '_' || lu.table_name || ' | '::text || platform.psql 
-		|| COALESCE(E'\n' || 
+' ||loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -' ||  lu.insert_mode || ' -s 4269 -g the_geom '
+		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year || '_' || s.state_fips
+	|| '_' || lu.table_name || '.dbf tiger_staging.' || lower(s.state_abbrev) || '_' || lu.table_name || ' | '::text || platform.psql
+		|| COALESCE(E'\n' ||
 			lu.post_load_process , '') , ARRAY['loader','table_name', 'lookup_name'], ARRAY[platform.loader, lu.table_name, lu.lookup_name ])
 				FROM loader_lookuptables AS lu
 				WHERE level_state = true AND load = true AND lookup_name IN('tract','bg','tabblock')
-				ORDER BY process_order, lookup_name), E'\n') ::text 
+				ORDER BY process_order, lookup_name), E'\n') ::text
 	-- County Level files
 	|| E'\n' ||
 		array_to_string( ARRAY(SELECT 'cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  || '/'), 'http://', ''),'ftp://','')  || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*_' || s.state_fips || '*_' || table_name || '*.zip ') || '
 ' || loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || COALESCE(county_process_command || E'\n','')
-				|| COALESCE(E'\n' ||lu.post_load_process , '') , ARRAY['loader','table_name','lookup_name'], ARRAY[platform.loader  || CASE WHEN lu.single_geom_mode THEN ' -S' ELSE ' ' END::text, lu.table_name, lu.lookup_name ]) 
+				|| COALESCE(E'\n' ||lu.post_load_process , '') , ARRAY['loader','table_name','lookup_name'], ARRAY[platform.loader  || CASE WHEN lu.single_geom_mode THEN ' -S' ELSE ' ' END::text, lu.table_name, lu.lookup_name ])
 				FROM loader_lookuptables AS lu
 				WHERE level_county = true AND load = true AND lookup_name IN('tract','bg','tabblock')
-				ORDER BY process_order, lookup_name), E'\n') ::text 
-	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'state_fold', 'website_root', 'state_abbrev','state_fips'], 
+				ORDER BY process_order, lookup_name), E'\n') ::text
+	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'state_fold', 'website_root', 'state_abbrev','state_fips'],
 	ARRAY[platform.psql,  variables.data_schema, variables.staging_schema, variables.staging_fold, s.state_fold,variables.website_root, s.state_abbrev, s.state_fips::text])
 			AS shell_code
 FROM loader_variables As variables
-		CROSS JOIN (SELECT name As state, abbrev As state_abbrev, lpad(st_code::text,2,'0') As state_fips, 
-			 lpad(st_code::text,2,'0') || '_' 
+		CROSS JOIN (SELECT name As state, abbrev As state_abbrev, lpad(st_code::text,2,'0') As state_fips,
+			 lpad(st_code::text,2,'0') || '_'
 	|| replace(name, ' ', '_') As state_fold
 FROM state_lookup) As s CROSS JOIN loader_platform As platform
 WHERE $1 @> ARRAY[state_abbrev::text]      -- If state is contained in list of states input generate script for it

Modified: trunk/extras/tiger_geocoder/tiger_loader_2015.sql
===================================================================
--- trunk/extras/tiger_geocoder/tiger_loader_2015.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/tiger_loader_2015.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -2,21 +2,21 @@
 -- PostGIS - Spatial Types for PostgreSQL
 -- http://postgis.net
 --
--- Copyright (C) 2012-2015 Regina Obe and Leo Hsu 
+-- Copyright (C) 2012-2015 Regina Obe and Leo Hsu
 -- Paragon Corporation
 --
 -- This is free software; you can redistribute and/or modify it under
 -- the terms of the GNU General Public Licence. See the COPYING file.
 --
 -- Author: Regina Obe and Leo Hsu <lr at pcorp.us>
---  
+--
 -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 SELECT tiger.SetSearchPathForInstall('tiger');
 BEGIN;
-CREATE OR REPLACE FUNCTION create_census_base_tables() 
+CREATE OR REPLACE FUNCTION create_census_base_tables()
 	RETURNS text AS
 $$
-DECLARE var_temp text; 
+DECLARE var_temp text;
 BEGIN
 var_temp := tiger.SetSearchPathForInstall('tiger');
 IF NOT EXISTS(SELECT table_name FROM information_schema.columns WHERE table_schema = 'tiger' AND column_name = 'tract_id' AND table_name = 'tract')  THEN
@@ -101,7 +101,7 @@
 $$
 language 'plpgsql';
 
-CREATE OR REPLACE FUNCTION loader_macro_replace(param_input text, param_keys text[],param_values text[]) 
+CREATE OR REPLACE FUNCTION loader_macro_replace(param_input text, param_keys text[],param_values text[])
 RETURNS text AS
 $$
 	DECLARE var_result text = param_input;
@@ -123,12 +123,12 @@
 $$
 SELECT array_to_string(array_agg('DROP TABLE ' || quote_ident(table_schema) || '.' || quote_ident(table_name) || ';'),E'\n')
 	FROM (SELECT * FROM information_schema.tables
-	WHERE table_schema = $2 AND table_name like lower($1) || '_%' ORDER BY table_name) AS foo; 
+	WHERE table_schema = $2 AND table_name like lower($1) || '_%' ORDER BY table_name) AS foo;
 ;
 $$
   LANGUAGE sql VOLATILE;
-  
--- Helper function that generates script to drop all nation tables (county, state) in a particular schema 
+
+-- Helper function that generates script to drop all nation tables (county, state) in a particular schema
 -- This is useful for loading 2011 because state and county tables aren't broken out into separate state files
 DROP FUNCTION IF EXISTS drop_national_tables_generate_script(text);
 CREATE OR REPLACE FUNCTION drop_nation_tables_generate_script(param_schema text DEFAULT 'tiger_data')
@@ -136,34 +136,34 @@
 $$
 SELECT array_to_string(array_agg('DROP TABLE ' || quote_ident(table_schema) || '.' || quote_ident(table_name) || ';'),E'\n')
 	FROM (SELECT * FROM information_schema.tables
-	WHERE table_schema = $1 AND (table_name ~ E'^[a-z]{2}\_county' or table_name ~ E'^[a-z]{2}\_state' or table_name = 'state_all' or table_name LIKE 'county_all%') ORDER BY table_name) AS foo; 
+	WHERE table_schema = $1 AND (table_name ~ E'^[a-z]{2}\_county' or table_name ~ E'^[a-z]{2}\_state' or table_name = 'state_all' or table_name LIKE 'county_all%') ORDER BY table_name) AS foo;
 ;
 $$
   LANGUAGE sql VOLATILE;
-  
-DO 
+
+DO
 $$
 BEGIN
   IF NOT EXISTS (SELECT * FROM information_schema.tables WHERE table_name = 'loader_platform' AND table_schema = 'tiger') THEN
-      CREATE TABLE loader_platform(os varchar(50) PRIMARY KEY, declare_sect text, pgbin text, wget text, unzip_command text, psql text, path_sep text, loader text, environ_set_command text, county_process_command text);     
-  END IF;   
-END 
+      CREATE TABLE loader_platform(os varchar(50) PRIMARY KEY, declare_sect text, pgbin text, wget text, unzip_command text, psql text, path_sep text, loader text, environ_set_command text, county_process_command text);
+  END IF;
+END
 $$ LANGUAGE 'plpgsql';
 
-DO 
+DO
 $$
 BEGIN
   IF NOT EXISTS (SELECT * FROM information_schema.schemata WHERE schema_name = 'tiger_data') THEN
-       CREATE SCHEMA tiger_data;     
-  END IF;   
-END 
+       CREATE SCHEMA tiger_data;
+  END IF;
+END
 $$ LANGUAGE 'plpgsql';
 
 
 DELETE FROM loader_platform WHERE os IN ('sh', 'windows');
 GRANT SELECT ON TABLE loader_platform TO public;
 INSERT INTO loader_platform(os, wget, pgbin, declare_sect, unzip_command, psql,path_sep,loader, environ_set_command, county_process_command)
-VALUES('windows', '%WGETTOOL%', '%PGBIN%', 
+VALUES('windows', '%WGETTOOL%', '%PGBIN%',
 E'set TMPDIR=${staging_fold}\\temp\\
 set UNZIPTOOL="C:\\Program Files\\7-Zip\\7z.exe"
 set WGETTOOL="C:\\wget\\wget.exe"
@@ -180,14 +180,14 @@
 %PSQL% -c "DROP SCHEMA IF EXISTS ${staging_schema} CASCADE;"
 %PSQL% -c "CREATE SCHEMA ${staging_schema};"
 %PSQL% -c "DO language ''plpgsql'' $$ BEGIN IF NOT EXISTS (SELECT * FROM information_schema.schemata WHERE schema_name = ''${data_schema}'' ) THEN CREATE SCHEMA ${data_schema}; END IF;  END $$"
-for /r %%z in (*.zip) do %UNZIPTOOL% e %%z  -o%TMPDIR% 
-cd %TMPDIR%', E'%PSQL%', E'\\', E'%SHP2PGSQL%', 'set ', 
+for /r %%z in (*.zip) do %UNZIPTOOL% e %%z  -o%TMPDIR%
+cd %TMPDIR%', E'%PSQL%', E'\\', E'%SHP2PGSQL%', 'set ',
 'for /r %%z in (*${table_name}*.dbf) do (${loader} -D -s 4269 -g the_geom -W "latin1" %%z tiger_staging.${state_abbrev}_${table_name} | ${psql} & ${psql} -c "SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}''));")'
 );
 
 
 INSERT INTO loader_platform(os, wget, pgbin, declare_sect, unzip_command, psql, path_sep, loader, environ_set_command, county_process_command)
-VALUES('sh', 'wget', '', 
+VALUES('sh', 'wget', '',
 E'TMPDIR="${staging_fold}/temp/"
 UNZIPTOOL=unzip
 WGETTOOL="/usr/bin/wget"
@@ -206,8 +206,8 @@
 for z in *.zip; do $UNZIPTOOL -o -d $TMPDIR $z; done
 for z in */*.zip; do $UNZIPTOOL -o -d $TMPDIR $z; done
 cd $TMPDIR;\n', '${PSQL}', '/', '${SHP2PGSQL}', 'export ',
-'for z in *${table_name}*.dbf; do 
-${loader} -D -s 4269 -g the_geom -W "latin1" $z ${staging_schema}.${state_abbrev}_${table_name} | ${psql} 
+'for z in *${table_name}*.dbf; do
+${loader} -D -s 4269 -g the_geom -W "latin1" $z ${staging_schema}.${state_abbrev}_${table_name} | ${psql}
 ${PSQL} -c "SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}''));"
 done');
 
@@ -215,9 +215,9 @@
 DO $$
 BEGIN
   IF NOT EXISTS (SELECT * FROM information_schema.tables WHERE table_name = 'loader_variables' AND table_schema = 'tiger') THEN
-      CREATE TABLE loader_variables(tiger_year varchar(4) PRIMARY KEY, website_root text, staging_fold text, data_schema text, staging_schema text);    
-  END IF;   
-END 
+      CREATE TABLE loader_variables(tiger_year varchar(4) PRIMARY KEY, website_root text, staging_fold text, data_schema text, staging_schema text);
+  END IF;
+END
 $$ LANGUAGE 'plpgsql';
 
 TRUNCATE TABLE loader_variables;
@@ -228,18 +228,18 @@
 DO $$
 BEGIN
   IF NOT EXISTS (SELECT * FROM information_schema.tables WHERE table_name = 'loader_lookuptables' AND table_schema = 'tiger') THEN
-   CREATE TABLE loader_lookuptables(process_order integer NOT NULL DEFAULT 1000, 
-		lookup_name text primary key, 
-		table_name text, single_mode boolean NOT NULL DEFAULT true, 
-		load boolean NOT NULL DEFAULT true, 
-		level_county boolean NOT NULL DEFAULT false, 
+   CREATE TABLE loader_lookuptables(process_order integer NOT NULL DEFAULT 1000,
+		lookup_name text primary key,
+		table_name text, single_mode boolean NOT NULL DEFAULT true,
+		load boolean NOT NULL DEFAULT true,
+		level_county boolean NOT NULL DEFAULT false,
 		level_state boolean NOT NULL DEFAULT false,
 		level_nation boolean NOT NULL DEFAULT false,
-		post_load_process text, single_geom_mode boolean DEFAULT false, 
-		insert_mode char(1) NOT NULL DEFAULT 'c', 
-		pre_load_process text,columns_exclude text[], website_root_override text);   
-  END IF;   
-END 
+		post_load_process text, single_geom_mode boolean DEFAULT false,
+		insert_mode char(1) NOT NULL DEFAULT 'c',
+		pre_load_process text,columns_exclude text[], website_root_override text);
+  END IF;
+END
 $$ LANGUAGE 'plpgsql';
 
 TRUNCATE TABLE loader_lookuptables;
@@ -256,7 +256,7 @@
 COMMENT ON COLUMN loader_lookuptables.website_root_override IS 'Path to use for wget instead of that specified in year table.  Needed currently for zcta where they release that only for 2000 and 2010';
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude )
-VALUES(10, 'tract', 'tract', true, false, true,false, 'c', 
+VALUES(10, 'tract', 'tract', true, false, true,false, 'c',
 '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (tract_id) ) INHERITS(tiger.${lookup_name}); " ',
 	'${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${table_name} RENAME geoid TO tract_id;  SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}'')); "
 	${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"
@@ -264,7 +264,7 @@
 	${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"', ARRAY['gid']);
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude )
-VALUES(11, 'tabblock', 'tabblock', true, true, false,false, 'c', 
+VALUES(11, 'tabblock', 'tabblock', true, true, false,false, 'c',
 '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (tabblock_id)) INHERITS(tiger.${lookup_name});" ',
 '${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${lookup_name} RENAME geoid10 TO tabblock_id;"
 ${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
@@ -273,7 +273,7 @@
 
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude )
-VALUES(12, 'bg', 'bg', true,false, true,false, 'c', 
+VALUES(12, 'bg', 'bg', true,false, true,false, 'c',
 '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (bg_id)) INHERITS(tiger.${lookup_name});" ',
 '${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${table_name} RENAME geoid TO bg_id;  SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}'')); "
 ${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
@@ -292,23 +292,23 @@
 	${psql} -c "VACUUM ANALYZE ${data_schema}.${lookup_name}_lookup;" ');
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, level_nation, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(1, 'state_all', 'state', true, false, false,true,false, 'c', 
+VALUES(1, 'state_all', 'state', true, false, false,true,false, 'c',
 	'${psql} -c "CREATE TABLE ${data_schema}.${lookup_name}(CONSTRAINT pk_${lookup_name} PRIMARY KEY (statefp),CONSTRAINT uidx_${lookup_name}_stusps  UNIQUE (stusps), CONSTRAINT uidx_${lookup_name}_gid UNIQUE (gid) ) INHERITS(tiger.state); "',
 	'${psql} -c "SELECT loader_load_staged_data(lower(''${table_name}''), lower(''${lookup_name}'')); "
 	${psql} -c "CREATE INDEX ${data_schema}_${lookup_name}_the_geom_gist ON ${data_schema}.${lookup_name} USING gist(the_geom);"
 	${psql} -c "VACUUM ANALYZE ${data_schema}.${lookup_name}"' );
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(3, 'place', 'place', true, false, true,false, 'c', 
+VALUES(3, 'place', 'place', true, false, true,false, 'c',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (plcidfp) ) INHERITS(tiger.place);" ',
 	'${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${table_name} RENAME geoid TO plcidfp;SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}'')); ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT uidx_${state_abbrev}_${lookup_name}_gid UNIQUE (gid);"
-${psql} -c "CREATE INDEX idx_${state_abbrev}_${lookup_name}_soundex_name ON ${data_schema}.${state_abbrev}_${lookup_name} USING btree (soundex(name));" 
+${psql} -c "CREATE INDEX idx_${state_abbrev}_${lookup_name}_soundex_name ON ${data_schema}.${state_abbrev}_${lookup_name} USING btree (soundex(name));"
 ${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"
-${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"'  
+${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"'
 	);
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(4, 'cousub', 'cousub', true, false, true,false, 'c', 
+VALUES(4, 'cousub', 'cousub', true, false, true,false, 'c',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (cosbidfp), CONSTRAINT uidx_${state_abbrev}_${lookup_name}_gid UNIQUE (gid)) INHERITS(tiger.${lookup_name});" ',
 	'${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${table_name} RENAME geoid TO cosbidfp;SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}'')); ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 ${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"
@@ -316,7 +316,7 @@
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, level_nation, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude, website_root_override  )
 -- this is a bit of a lie that its county.  It's really state but works better with column routine
-VALUES(4, 'zcta5', 'zcta510', true,true, false,false, false, 'a', 
+VALUES(4, 'zcta5', 'zcta510', true,true, false,false, false, 'a',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (zcta5ce,statefp), CONSTRAINT uidx_${state_abbrev}_${lookup_name}_gid UNIQUE (gid)) INHERITS(tiger.${lookup_name});" ',
 	'${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 ${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"'
@@ -324,7 +324,7 @@
 
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(6, 'faces', 'faces', true, true, false,false, 'c', 
+VALUES(6, 'faces', 'faces', true, true, false,false, 'c',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${table_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (gid)) INHERITS(tiger.${lookup_name});" ',
 	'${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${table_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"
 	${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_tfid ON ${data_schema}.${state_abbrev}_${lookup_name} USING btree (tfid);"
@@ -333,7 +333,7 @@
 	${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"');
 
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude )
-VALUES(7, 'featnames', 'featnames', true, true, false,false, 'a', 
+VALUES(7, 'featnames', 'featnames', true, true, false,false, 'a',
 '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${table_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (gid)) INHERITS(tiger.${table_name});ALTER TABLE ${data_schema}.${state_abbrev}_${table_name} ALTER COLUMN statefp SET DEFAULT ''${state_fips}'';" ',
 '${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_snd_name ON ${data_schema}.${state_abbrev}_${table_name} USING btree (soundex(name));"
 ${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_lname ON ${data_schema}.${state_abbrev}_${table_name} USING btree (lower(name));"
@@ -342,7 +342,7 @@
 ${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"', ARRAY['gid','statefp']);
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process )
-VALUES(8, 'edges', 'edges', true, true, false,false, 'a', 
+VALUES(8, 'edges', 'edges', true, true, false,false, 'a',
 '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${table_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (gid)) INHERITS(tiger.${table_name});" ',
 '${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${table_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 ${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_tlid ON ${data_schema}.${state_abbrev}_${table_name} USING btree (tlid);"
@@ -363,7 +363,7 @@
 ${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_zip_lookup_base_citysnd ON ${data_schema}.${state_abbrev}_zip_lookup_base USING btree(soundex(city));" ');
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process,columns_exclude )
-VALUES(9, 'addr', 'addr', true, true, false,false, 'a', 
+VALUES(9, 'addr', 'addr', true, true, false,false, 'a',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (gid)) INHERITS(tiger.${table_name});ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ALTER COLUMN statefp SET DEFAULT ''${state_fips}'';" ',
 	'${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 	${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_least_address ON tiger_data.${state_abbrev}_addr USING btree (least_hn(fromhn,tohn) );"
@@ -375,7 +375,7 @@
 	${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"',  ARRAY['gid','statefp','fromarmid', 'toarmid']);
 	
 INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process,columns_exclude )
-VALUES(9, 'addrfeat', 'addrfeat', false, true, false,true, 'a', 
+VALUES(9, 'addrfeat', 'addrfeat', false, true, false,true, 'a',
 	'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (gid)) INHERITS(tiger.${table_name});ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ALTER COLUMN statefp SET DEFAULT ''${state_fips}'';" ',
 	'${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
 	${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"',  ARRAY['gid','statefp','fromarmid', 'toarmid']);
@@ -384,31 +384,31 @@
   RETURNS SETOF text AS
 $BODY$
 WITH lu AS (SELECT lookup_name, table_name, pre_load_process,post_load_process, process_order, insert_mode, single_geom_mode, level_nation, level_county, level_state
-    FROM  loader_lookuptables 
+    FROM  loader_lookuptables
 				WHERE level_nation = true AND load = true)
-SELECT 
+SELECT
 	loader_macro_replace(
 		replace(
 			loader_macro_replace(declare_sect
-				, ARRAY['staging_fold', 'website_root', 'psql',  'data_schema', 'staging_schema'], 
+				, ARRAY['staging_fold', 'website_root', 'psql',  'data_schema', 'staging_schema'],
 				ARRAY[variables.staging_fold, variables.website_root, platform.psql, variables.data_schema, variables.staging_schema]
 			), '/', platform.path_sep) || '
 '  ||
 	-- Nation level files
 	array_to_string( ARRAY(SELECT loader_macro_replace('cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || variables.website_root  || '/' || upper(table_name)  || '/ --no-parent --relative --recursive --level=1 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || variables.website_root  || '/' || upper(table_name)  || '/ --no-parent --relative --recursive --level=1 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(variables.website_root, 'http://', ''),'ftp://','')  || '/' || upper(table_name)  || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*' || table_name || '.zip ') || '
-' || COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -D -' ||  lu.insert_mode || ' -s 4269 -g the_geom ' 
-		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year 
-	|| '_us_' || lu.table_name || '.dbf tiger_staging.' || lu.table_name || ' | '::text || platform.psql 
-		|| COALESCE(E'\n' || 
+' || COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -D -' ||  lu.insert_mode || ' -s 4269 -g the_geom '
+		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year
+	|| '_us_' || lu.table_name || '.dbf tiger_staging.' || lu.table_name || ' | '::text || platform.psql
+		|| COALESCE(E'\n' ||
 			lu.post_load_process , '') , ARRAY['loader','table_name', 'lookup_name'], ARRAY[platform.loader, lu.table_name, lu.lookup_name ]
 			)
 				FROM lu
-				ORDER BY process_order, lookup_name), E'\n') ::text 
-	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'website_root'], 
+				ORDER BY process_order, lookup_name), E'\n') ::text
+	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'website_root'],
 	ARRAY[platform.psql,  variables.data_schema, variables.staging_schema, variables.staging_fold, variables.website_root])
 			AS shell_code
 FROM loader_variables As variables
@@ -417,50 +417,50 @@
 ;
 $BODY$
   LANGUAGE sql VOLATILE;
-  
+
 CREATE OR REPLACE FUNCTION loader_generate_script(param_states text[], os text)
   RETURNS SETOF text AS
 $BODY$
-SELECT 
+SELECT
 	loader_macro_replace(
 		replace(
 			loader_macro_replace(declare_sect
-				, ARRAY['staging_fold', 'state_fold','website_root', 'psql', 'state_abbrev', 'data_schema', 'staging_schema', 'state_fips'], 
+				, ARRAY['staging_fold', 'state_fold','website_root', 'psql', 'state_abbrev', 'data_schema', 'staging_schema', 'state_fips'],
 				ARRAY[variables.staging_fold, s.state_fold, variables.website_root, platform.psql, s.state_abbrev, variables.data_schema, variables.staging_schema, s.state_fips::text]
 			), '/', platform.path_sep) || '
 ' ||
 	-- State level files - if an override website is specified we use that instead of variable one
 	array_to_string( ARRAY(SELECT 'cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/tl_*_' || s.state_fips || '_* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/tl_*_' || s.state_fips || '_* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name) ), 'http://', ''),'ftp://','')    || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*_' || s.state_fips || '*_' || table_name || '.zip ') || '
-' ||loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -D -' ||  lu.insert_mode || ' -s 4269 -g the_geom ' 
-		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year || '_' || s.state_fips 
-	|| '_' || lu.table_name || '.dbf tiger_staging.' || lower(s.state_abbrev) || '_' || lu.table_name || ' | '::text || platform.psql 
-		|| COALESCE(E'\n' || 
+' ||loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -D -' ||  lu.insert_mode || ' -s 4269 -g the_geom '
+		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year || '_' || s.state_fips
+	|| '_' || lu.table_name || '.dbf tiger_staging.' || lower(s.state_abbrev) || '_' || lu.table_name || ' | '::text || platform.psql
+		|| COALESCE(E'\n' ||
 			lu.post_load_process , '') , ARRAY['loader','table_name', 'lookup_name'], ARRAY[platform.loader, lu.table_name, lu.lookup_name ])
 				FROM loader_lookuptables AS lu
 				WHERE level_state = true AND load = true
-				ORDER BY process_order, lookup_name), E'\n') ::text 
+				ORDER BY process_order, lookup_name), E'\n') ::text
 	-- County Level files
 	|| E'\n' ||
 		array_to_string( ARRAY(SELECT 'cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/tl_*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/tl_*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  || '/'), 'http://', ''),'ftp://','')  || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*_' || s.state_fips || '*_' || table_name || '*.zip ') || '
 ' || loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || COALESCE(county_process_command || E'\n','')
-				|| COALESCE(E'\n' ||lu.post_load_process , '') , ARRAY['loader','table_name','lookup_name'], ARRAY[platform.loader  || ' -D ' || CASE WHEN lu.single_geom_mode THEN ' -S' ELSE ' ' END::text, lu.table_name, lu.lookup_name ]) 
+				|| COALESCE(E'\n' ||lu.post_load_process , '') , ARRAY['loader','table_name','lookup_name'], ARRAY[platform.loader  || ' -D ' || CASE WHEN lu.single_geom_mode THEN ' -S' ELSE ' ' END::text, lu.table_name, lu.lookup_name ])
 				FROM loader_lookuptables AS lu
 				WHERE level_county = true AND load = true
-				ORDER BY process_order, lookup_name), E'\n') ::text 
-	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'state_fold', 'website_root', 'state_abbrev','state_fips'], 
+				ORDER BY process_order, lookup_name), E'\n') ::text
+	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'state_fold', 'website_root', 'state_abbrev','state_fips'],
 	ARRAY[platform.psql,  variables.data_schema, variables.staging_schema, variables.staging_fold, s.state_fold,variables.website_root, s.state_abbrev, s.state_fips::text])
 			AS shell_code
 FROM loader_variables As variables
-		CROSS JOIN (SELECT name As state, abbrev As state_abbrev, lpad(st_code::text,2,'0') As state_fips, 
-			 lpad(st_code::text,2,'0') || '_' 
+		CROSS JOIN (SELECT name As state, abbrev As state_abbrev, lpad(st_code::text,2,'0') As state_fips,
+			 lpad(st_code::text,2,'0') || '_'
 	|| replace(name, ' ', '_') As state_fold
 FROM state_lookup) As s CROSS JOIN loader_platform As platform
 WHERE $1 @> ARRAY[state_abbrev::text]      -- If state is contained in list of states input generate script for it
@@ -472,7 +472,7 @@
 CREATE OR REPLACE FUNCTION loader_load_staged_data(param_staging_table text, param_target_table text, param_columns_exclude text[]) RETURNS integer
 AS
 $$
-DECLARE 
+DECLARE
 	var_sql text;
 	var_staging_schema text; var_data_schema text;
 	var_temp text;
@@ -482,18 +482,18 @@
 -- Assume all the columns are in same order as target
 	SELECT staging_schema, data_schema INTO var_staging_schema, var_data_schema FROM loader_variables;
 	var_sql := 'INSERT INTO ' || var_data_schema || '.' || quote_ident(param_target_table) || '(' ||
-			array_to_string(ARRAY(SELECT quote_ident(column_name::text) 
-				FROM information_schema.columns 
+			array_to_string(ARRAY(SELECT quote_ident(column_name::text)
+				FROM information_schema.columns
 				 WHERE table_name = param_target_table
-					AND table_schema = var_data_schema 
-					AND column_name <> ALL(param_columns_exclude) 
-                    ORDER BY ordinal_position ), ',') || ') SELECT ' 
-					|| array_to_string(ARRAY(SELECT quote_ident(column_name::text) 
-				FROM information_schema.columns 
+					AND table_schema = var_data_schema
+					AND column_name <> ALL(param_columns_exclude)
+                    ORDER BY ordinal_position ), ',') || ') SELECT '
+					|| array_to_string(ARRAY(SELECT quote_ident(column_name::text)
+				FROM information_schema.columns
 				 WHERE table_name = param_staging_table
-					AND table_schema = var_staging_schema 
-					AND column_name <> ALL( param_columns_exclude) 
-                    ORDER BY ordinal_position ), ',') ||' FROM ' 
+					AND table_schema = var_staging_schema
+					AND column_name <> ALL( param_columns_exclude)
+                    ORDER BY ordinal_position ), ',') ||' FROM '
 					|| var_staging_schema || '.' || param_staging_table || ';';
 	RAISE NOTICE '%', var_sql;
 	EXECUTE (var_sql);
@@ -504,16 +504,16 @@
 $$
 LANGUAGE 'plpgsql' VOLATILE;
 
-CREATE OR REPLACE FUNCTION loader_load_staged_data(param_staging_table text, param_target_table text) 
+CREATE OR REPLACE FUNCTION loader_load_staged_data(param_staging_table text, param_target_table text)
 RETURNS integer AS
 $$
--- exclude this set list of columns if no exclusion list is specified 
+-- exclude this set list of columns if no exclusion list is specified
 
    SELECT  loader_load_staged_data($1, $2,(SELECT COALESCE(columns_exclude,ARRAY['gid', 'geoid','cpi','suffix1ce', 'statefp00', 'statefp10', 'countyfp00','countyfp10'
    ,'tractce00','tractce10', 'blkgrpce00', 'blkgrpce10', 'blockce00', 'blockce10'
-      , 'cousubfp00', 'submcdfp00', 'conctyfp00', 'placefp00', 'aiannhfp00', 'aiannhce00', 
-       'comptyp00', 'trsubfp00', 'trsubce00', 'anrcfp00', 'elsdlea00', 'scsdlea00', 
-       'unsdlea00', 'uace00', 'cd108fp', 'sldust00', 'sldlst00', 'vtdst00', 'zcta5ce00', 
+      , 'cousubfp00', 'submcdfp00', 'conctyfp00', 'placefp00', 'aiannhfp00', 'aiannhce00',
+       'comptyp00', 'trsubfp00', 'trsubce00', 'anrcfp00', 'elsdlea00', 'scsdlea00',
+       'unsdlea00', 'uace00', 'cd108fp', 'sldust00', 'sldlst00', 'vtdst00', 'zcta5ce00',
        'tazce00', 'ugace00', 'puma5ce00','vtdst10','tazce10','uace10','puma5ce10','tazce', 'uace', 'vtdst', 'zcta5ce', 'zcta5ce10', 'puma5ce', 'ugace10','pumace10', 'estatefp', 'ugace', 'blockce']) FROM loader_lookuptables WHERE $2 LIKE '%' || lookup_name))
 $$
 language 'sql' VOLATILE;
@@ -522,46 +522,46 @@
   RETURNS SETOF text AS
 $$
 SELECT create_census_base_tables();
-SELECT 
+SELECT
 	loader_macro_replace(
 		replace(
 			loader_macro_replace(declare_sect
-				, ARRAY['staging_fold', 'state_fold','website_root', 'psql', 'state_abbrev', 'data_schema', 'staging_schema', 'state_fips'], 
+				, ARRAY['staging_fold', 'state_fold','website_root', 'psql', 'state_abbrev', 'data_schema', 'staging_schema', 'state_fips'],
 				ARRAY[variables.staging_fold, s.state_fold, variables.website_root, platform.psql, s.state_abbrev, variables.data_schema, variables.staging_schema, s.state_fips::text]
 			), '/', platform.path_sep) || '
 ' ||
 	-- State level files - if an override website is specified we use that instead of variable one
 	array_to_string( ARRAY(SELECT 'cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name) ), 'http://', ''),'ftp://','')    || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*_' || s.state_fips || '*_' || table_name || '.zip ') || '
-' ||loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -' ||  lu.insert_mode || ' -s 4269 -g the_geom ' 
-		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year || '_' || s.state_fips 
-	|| '_' || lu.table_name || '.dbf tiger_staging.' || lower(s.state_abbrev) || '_' || lu.table_name || ' | '::text || platform.psql 
-		|| COALESCE(E'\n' || 
+' ||loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || platform.loader || ' -' ||  lu.insert_mode || ' -s 4269 -g the_geom '
+		|| CASE WHEN lu.single_geom_mode THEN ' -S ' ELSE ' ' END::text || ' -W "latin1" tl_' || variables.tiger_year || '_' || s.state_fips
+	|| '_' || lu.table_name || '.dbf tiger_staging.' || lower(s.state_abbrev) || '_' || lu.table_name || ' | '::text || platform.psql
+		|| COALESCE(E'\n' ||
 			lu.post_load_process , '') , ARRAY['loader','table_name', 'lookup_name'], ARRAY[platform.loader, lu.table_name, lu.lookup_name ])
 				FROM loader_lookuptables AS lu
 				WHERE level_state = true AND load = true AND lookup_name IN('tract','bg','tabblock')
-				ORDER BY process_order, lookup_name), E'\n') ::text 
+				ORDER BY process_order, lookup_name), E'\n') ::text
 	-- County Level files
 	|| E'\n' ||
 		array_to_string( ARRAY(SELECT 'cd ' || replace(variables.staging_fold,'/', platform.path_sep) || '
-' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html 
+' || platform.wget || ' ' || COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  ) || '/*_' || s.state_fips || '* --no-parent --relative --recursive --level=2 --accept=zip --mirror --reject=html
 '
 || 'cd ' ||  replace(variables.staging_fold,'/', platform.path_sep) || '/' || replace(replace(COALESCE(lu.website_root_override,variables.website_root || '/' || upper(table_name)  || '/'), 'http://', ''),'ftp://','')  || '
 ' || replace(platform.unzip_command, '*.zip', 'tl_*_' || s.state_fips || '*_' || table_name || '*.zip ') || '
 ' || loader_macro_replace(COALESCE(lu.pre_load_process || E'\n', '') || COALESCE(county_process_command || E'\n','')
-				|| COALESCE(E'\n' ||lu.post_load_process , '') , ARRAY['loader','table_name','lookup_name'], ARRAY[platform.loader  || CASE WHEN lu.single_geom_mode THEN ' -S' ELSE ' ' END::text, lu.table_name, lu.lookup_name ]) 
+				|| COALESCE(E'\n' ||lu.post_load_process , '') , ARRAY['loader','table_name','lookup_name'], ARRAY[platform.loader  || CASE WHEN lu.single_geom_mode THEN ' -S' ELSE ' ' END::text, lu.table_name, lu.lookup_name ])
 				FROM loader_lookuptables AS lu
 				WHERE level_county = true AND load = true AND lookup_name IN('tract','bg','tabblock')
-				ORDER BY process_order, lookup_name), E'\n') ::text 
-	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'state_fold', 'website_root', 'state_abbrev','state_fips'], 
+				ORDER BY process_order, lookup_name), E'\n') ::text
+	, ARRAY['psql', 'data_schema','staging_schema', 'staging_fold', 'state_fold', 'website_root', 'state_abbrev','state_fips'],
 	ARRAY[platform.psql,  variables.data_schema, variables.staging_schema, variables.staging_fold, s.state_fold,variables.website_root, s.state_abbrev, s.state_fips::text])
 			AS shell_code
 FROM loader_variables As variables
-		CROSS JOIN (SELECT name As state, abbrev As state_abbrev, lpad(st_code::text,2,'0') As state_fips, 
-			 lpad(st_code::text,2,'0') || '_' 
+		CROSS JOIN (SELECT name As state, abbrev As state_abbrev, lpad(st_code::text,2,'0') As state_fips,
+			 lpad(st_code::text,2,'0') || '_'
 	|| replace(name, ' ', '_') As state_fold
 FROM state_lookup) As s CROSS JOIN loader_platform As platform
 WHERE $1 @> ARRAY[state_abbrev::text]      -- If state is contained in list of states input generate script for it

Modified: trunk/extras/tiger_geocoder/topology/tiger_topology_loader.sql
===================================================================
--- trunk/extras/tiger_geocoder/topology/tiger_topology_loader.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/topology/tiger_topology_loader.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,7 +1,7 @@
 /*******************************************************************
  *
  * PostGIS - Spatial Types for PostgreSQL
- * Copyright 2011 Leo Hsu and Regina Obe <lr at pcorp.us> 
+ * Copyright 2011 Leo Hsu and Regina Obe <lr at pcorp.us>
  * Paragon Corporation
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -10,24 +10,24 @@
  * into postgis topology structure
  **********************************************************************/
 
- /** topology_load_tiger: Will load all edges, faces, nodes into 
+ /** topology_load_tiger: Will load all edges, faces, nodes into
  *  topology named toponame
  *	that intersect the specified region
  *  region_type: 'place', 'county'
  *  region_id: the respective fully qualified geoid
  *	 place - plcidfp
- *	 county - cntyidfp 
- * USE CASE: 
- *  The following will create a topology called topo_boston 
+ *	 county - cntyidfp
+ * USE CASE:
+ *  The following will create a topology called topo_boston
  *   in Mass State Plane feet and load Boston, MA tiger data
  *  with tolerance of 1 foot
  * SELECT topology.DropTopology('topo_boston');
  * SELECT topology.CreateTopology('topo_boston', 2249,0.25);
- * SELECT tiger.topology_load_tiger('topo_boston', 'place', '2507000'); 
+ * SELECT tiger.topology_load_tiger('topo_boston', 'place', '2507000');
  * SELECT topology.TopologySummary('topo_boston');
- * SELECT topology.ValidateTopology('topo_boston');  
+ * SELECT topology.ValidateTopology('topo_boston');
  ****/
-CREATE OR REPLACE FUNCTION tiger.topology_load_tiger(IN toponame varchar,  
+CREATE OR REPLACE FUNCTION tiger.topology_load_tiger(IN toponame varchar,
 	region_type varchar, region_id varchar)
   RETURNS text AS
 $$
@@ -52,16 +52,16 @@
                 WHERE name = toponame;
 	var_sql := '
 	CREATE TEMPORARY TABLE tmp_edge
-   				AS 
-	WITH te AS 
+   				AS
+	WITH te AS
    			(SELECT tlid,  ST_GeometryN(ST_SnapToGrid(ST_Transform(ST_LineMerge(the_geom),$3),$4),1) As geom, tnidf, tnidt, tfidl, tfidr , the_geom As orig_geom
-									FROM tiger.edges 
+									FROM tiger.edges
 									WHERE statefp = $1 AND ST_Covers($2, the_geom)
 										)
-					SELECT DISTINCT ON (t.tlid) t.tlid As edge_id,t.geom 
+					SELECT DISTINCT ON (t.tlid) t.tlid As edge_id,t.geom
                         , t.tnidf As start_node, t.tnidt As end_node, COALESCE(t.tfidl,0) As left_face
                         , COALESCE(t.tfidr,0) As right_face, COALESCE(tl.tlid, t.tlid) AS next_left_edge,  COALESCE(tr.tlid, t.tlid) As next_right_edge, t.orig_geom
-						FROM 
+						FROM
 							te AS t LEFT JOIN te As tl ON (t.tnidf = tl.tnidt AND t.tfidl = tl.tfidl)
 							 LEFT JOIN te As tr ON (t.tnidt = tr.tnidf AND t.tfidr = tr.tfidr)				
 						';
@@ -86,10 +86,10 @@
 	EXECUTE var_sql;
 	
 	-- start load in faces
-	var_sql := 'INSERT INTO ' || quote_ident(toponame) || '.face(face_id, mbr) 
-						SELECT f.tfid, ST_Envelope(ST_Transform(f.the_geom,$3)) As mbr 
+	var_sql := 'INSERT INTO ' || quote_ident(toponame) || '.face(face_id, mbr)
+						SELECT f.tfid, ST_Envelope(ST_Transform(f.the_geom,$3)) As mbr
 							FROM tiger.faces AS f
-								WHERE statefp = $1 AND 
+								WHERE statefp = $1 AND
 								(  tfid IN(SELECT left_face FROM tmp_edge)
 									OR tfid IN(SELECT right_face FROM tmp_edge) OR ST_Covers($2, the_geom) )
 							AND tfid NOT IN(SELECT face_id FROM ' || quote_ident(toponame) || '.face) ';
@@ -97,23 +97,23 @@
 	GET DIAGNOSTICS var_rcnt = ROW_COUNT;
 	var_result := var_result || var_rcnt::text || ' faces added. ';
    -- end load in faces
-   
+
    -- add remaining missing edges of present faces --
    var_sql := 'INSERT INTO tmp_edge(edge_id, geom, start_node, end_node, left_face, right_face, next_left_edge, next_right_edge, orig_geom)	
-   			WITH te AS 
-   			(SELECT tlid,  ST_GeometryN(ST_SnapToGrid(ST_Transform(ST_LineMerge(the_geom),$2),$3),1) As geom, tnidf, tnidt, tfidl, tfidr, the_geom As orig_geom 
-									FROM tiger.edges 
+   			WITH te AS
+   			(SELECT tlid,  ST_GeometryN(ST_SnapToGrid(ST_Transform(ST_LineMerge(the_geom),$2),$3),1) As geom, tnidf, tnidt, tfidl, tfidr, the_geom As orig_geom
+									FROM tiger.edges
 									WHERE statefp = $1 AND
 									 (tfidl IN(SELECT face_id FROM ' || quote_ident(toponame) || '.face)
 				OR tfidr IN(SELECT face_id FROM ' || quote_ident(toponame) || '.face) )
 				AND tlid NOT IN(SELECT edge_id FROM tmp_edge)
 				 )
 				
-			SELECT DISTINCT ON (t.tlid) t.tlid As edge_id,t.geom 
+			SELECT DISTINCT ON (t.tlid) t.tlid As edge_id,t.geom
                         , t.tnidf As start_node, t.tnidt As end_node, t.tfidl As left_face
                         , t.tfidr As right_face, tl.tlid AS next_left_edge,  tr.tlid As next_right_edge, t.orig_geom
-				FROM 
-						te AS t LEFT JOIN te As tl 
+				FROM
+						te AS t LEFT JOIN te As tl
 								ON (t.tnidf = tl.tnidt AND t.tfidl = tl.tfidl)
 			LEFT JOIN te As tr ON (t.tnidt = tr.tnidf AND t.tfidr = tr.tfidr)
 			';
@@ -123,14 +123,14 @@
    	-- start load in nodes
 	var_sql := 'INSERT INTO ' || quote_ident(toponame) || '.node(node_id, geom)
 					SELECT DISTINCT ON(tnid) tnid, geom
-						FROM 
-						( 
-							SELECT start_node AS tnid, ST_StartPoint(e.geom) As geom 
+						FROM
+						(
+							SELECT start_node AS tnid, ST_StartPoint(e.geom) As geom
 								FROM tmp_edge As e LEFT JOIN ' || quote_ident(toponame) || '.node AS n ON e.start_node = n.node_id
-						UNION ALL 
-							SELECT end_node AS tnid, ST_EndPoint(e.geom) As geom 
-							FROM tmp_edge As e LEFT JOIN ' || quote_ident(toponame) || '.node AS n ON e.end_node = n.node_id 
-							WHERE n.node_id IS NULL) As f 
+						UNION ALL
+							SELECT end_node AS tnid, ST_EndPoint(e.geom) As geom
+							FROM tmp_edge As e LEFT JOIN ' || quote_ident(toponame) || '.node AS n ON e.end_node = n.node_id
+							WHERE n.node_id IS NULL) As f
 							WHERE tnid NOT IN(SELECT node_id FROM  ' || quote_ident(toponame) || '.node)
 					 ';
 	EXECUTE var_sql USING var_statefp, var_rgeom;
@@ -142,8 +142,8 @@
    	var_sql := 'UPDATE ' || quote_ident(toponame) || '.node AS n
 					SET containing_face = f.tfid
 						FROM (SELECT tfid, the_geom
-							FROM tiger.faces WHERE statefp = $1 
-							AND tfid IN(SELECT face_id FROM ' || quote_ident(toponame) || '.face) 
+							FROM tiger.faces WHERE statefp = $1
+							AND tfid IN(SELECT face_id FROM ' || quote_ident(toponame) || '.face)
 							) As f
 						WHERE ST_ContainsProperly(f.the_geom, ST_Transform(n.geom,4269)) ';
 	EXECUTE var_sql USING var_statefp, var_rgeom;
@@ -159,10 +159,10 @@
    EXECUTE var_sql;
 
    -- force edges start and end points to match the start and end nodes --
-   var_sql := 'UPDATE tmp_edge SET geom = ST_SetPoint(ST_SetPoint(tmp_edge.geom, 0, s.geom), ST_NPoints(tmp_edge.geom) - 1,e.geom)  
+   var_sql := 'UPDATE tmp_edge SET geom = ST_SetPoint(ST_SetPoint(tmp_edge.geom, 0, s.geom), ST_NPoints(tmp_edge.geom) - 1,e.geom)
                 FROM ' || quote_ident(toponame) || '.node AS s, ' || quote_ident(toponame) || '.node As e
-                WHERE s.node_id = tmp_edge.start_node AND e.node_id = tmp_edge.end_node AND 
-                    ( NOT ST_Equals(s.geom, ST_StartPoint(tmp_edge.geom) ) OR NOT ST_Equals(e.geom, ST_EndPoint(tmp_edge.geom) ) ) '  ;   
+                WHERE s.node_id = tmp_edge.start_node AND e.node_id = tmp_edge.end_node AND
+                    ( NOT ST_Equals(s.geom, ST_StartPoint(tmp_edge.geom) ) OR NOT ST_Equals(e.geom, ST_EndPoint(tmp_edge.geom) ) ) '  ;
     EXECUTE var_sql;
     GET DIAGNOSTICS var_rcnt = ROW_COUNT;
     var_result := var_result || ' ' || var_rcnt::text || ' edge start end corrected. ';
@@ -170,7 +170,7 @@
    var_sql := '
    	INSERT INTO ' || quote_ident(toponame) || '.edge(edge_id, geom, start_node, end_node, left_face, right_face, next_left_edge, next_right_edge)
 					SELECT t.edge_id, t.geom, t.start_node, t.end_node, COALESCE(t.left_face,0) As left_face, COALESCE(t.right_face,0) As right_face, t.next_left_edge, t.next_right_edge
-						FROM 
+						FROM
 							tmp_edge AS t
 							WHERE t.edge_id NOT IN(SELECT edge_id FROM ' || quote_ident(toponame) || '.edge) 				
 						';

Modified: trunk/extras/tiger_geocoder/upgrade_geocode.sql
===================================================================
--- trunk/extras/tiger_geocoder/upgrade_geocode.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/upgrade_geocode.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -8,12 +8,12 @@
 -- the terms of the GNU General Public Licence. See the COPYING file.
 --
 -- Author: Regina Obe and Leo Hsu <lr at pcorp.us>
---  
+--
 -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 --
 \i utility/set_search_path.sql;
 -- Tiger is where we're going to create the functions, but we need
--- the PostGIS functions/types which may be anywhere 
+-- the PostGIS functions/types which may be anywhere
 -- we'll assume user has postgis functions and other contribs as part of search path
 -- the below call will put tiger schema in front so all objects in this script
 -- will get created in search path
@@ -116,7 +116,7 @@
 -- This is s bit dangerous since it could potentially drop peoples tables
 -- TODO: put in logic to check if any tables have norm_addy and don't drop if they do
 -- Remarking this out for now since we aren't changing norm_addy anyway
-/*DROP TYPE IF EXISTS norm_addy CASCADE; 
+/*DROP TYPE IF EXISTS norm_addy CASCADE;
 CREATE TYPE norm_addy AS (
     address INTEGER,
     preDirAbbrev VARCHAR,
@@ -207,32 +207,32 @@
         ('USFS ROAD', 'USFS Rd')
            ) t(name, abbrev)
            WHERE t.name NOT IN(SELECT name FROM street_type_lookup);
-           
-DELETE FROM street_type_lookup WHERE name IN(SELECT name FROM temp_types);         
-INSERT INTO street_type_lookup (name, abbrev, is_hw) 
+
+DELETE FROM street_type_lookup WHERE name IN(SELECT name FROM temp_types);
+INSERT INTO street_type_lookup (name, abbrev, is_hw)
 SELECT name, abbrev, true
     FROM temp_types As t
            WHERE t.name NOT IN(SELECT name FROM street_type_lookup);
-DROP TABLE temp_types;           
+DROP TABLE temp_types;
 DELETE FROM street_type_lookup WHERE name = 'FOREST';
 UPDATE street_type_lookup SET is_hw = false WHERE abbrev = 'Loop';
 
 CREATE TEMPORARY TABLE temp_types AS
 SELECT name, abbrev
-    FROM (VALUES 
+    FROM (VALUES
  ('LOOP', 'Loop'),
  ('SERVICE DRIVE', 'Svc Dr'),
  ('SERVICE DR', 'Svc Dr'),
  ('SERVICE ROAD', 'Svc Rd'),
- ('SERVICE RD', 'Svc Rd') 
+ ('SERVICE RD', 'Svc Rd')
     ) t(name, abbrev);
- 
-DELETE FROM street_type_lookup WHERE name IN(SELECT name FROM temp_types);         
-INSERT INTO street_type_lookup (name, abbrev, is_hw) 
+
+DELETE FROM street_type_lookup WHERE name IN(SELECT name FROM temp_types);
+INSERT INTO street_type_lookup (name, abbrev, is_hw)
 SELECT name, abbrev, false
     FROM temp_types As t
            WHERE t.name NOT IN(SELECT name FROM street_type_lookup);
- 
+
 SELECT tiger.SetSearchPathForInstall('tiger');
 \i geocode_settings.sql
 -- new census loader
@@ -292,6 +292,6 @@
 \a
 --\o 'drop_dup_feat_create_index.sql'
 --\i generate_drop_dupe_featnames.sql
-\o 
+\o
 --\i drop_dup_feat_create_index.sql
 \echo 'Missing index Install completed'
\ No newline at end of file

Modified: trunk/extras/tiger_geocoder/utility/set_search_path.sql
===================================================================
--- trunk/extras/tiger_geocoder/utility/set_search_path.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/extras/tiger_geocoder/utility/set_search_path.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,5 +1,5 @@
- /*** 
- * 
+ /***
+ *
  * Copyright (C) 2012 Regina Obe and Leo Hsu (Paragon Corporation)
  **/
 -- Adds a schema to  the front of search path so that functions, tables etc get installed by default in set schema
@@ -15,7 +15,7 @@
 BEGIN
 	SELECT reset_val INTO var_cur_search_path FROM pg_settings WHERE name = 'search_path';
 
-	EXECUTE 'SET search_path = ' || quote_ident(a_schema_name) || ', ' || var_cur_search_path; 
+	EXECUTE 'SET search_path = ' || quote_ident(a_schema_name) || ', ' || var_cur_search_path;
 	var_result := a_schema_name || ' has been made primary for install ';
   RETURN var_result;
 END

Modified: trunk/liblwgeom/bytebuffer.c
===================================================================
--- trunk/liblwgeom/bytebuffer.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/bytebuffer.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -30,7 +30,7 @@
 /**
 * Allocate a new bytebuffer_t. Use bytebuffer_destroy to free.
 */
-bytebuffer_t* 
+bytebuffer_t*
 bytebuffer_create(void)
 {
 	LWDEBUG(2,"Entered bytebuffer_create");
@@ -40,7 +40,7 @@
 /**
 * Allocate a new bytebuffer_t. Use bytebuffer_destroy to free.
 */
-bytebuffer_t* 
+bytebuffer_t*
 bytebuffer_create_with_size(size_t size)
 {
 	LWDEBUGF(2,"Entered bytebuffer_create_with_size %d", size);
@@ -59,7 +59,7 @@
 * Allocate just the internal buffer of an existing bytebuffer_t
 * struct. Useful for allocating short-lived bytebuffers off the stack.
 */
-void 
+void
 bytebuffer_init_with_size(bytebuffer_t *b, size_t size)
 {
 	b->buf_start = lwalloc(size);
@@ -71,19 +71,19 @@
 /**
 * Free the bytebuffer_t and all memory managed within it.
 */
-void 
+void
 bytebuffer_destroy(bytebuffer_t *s)
 {
 	LWDEBUG(2,"Entered bytebuffer_destroy");
 	LWDEBUGF(4,"The buffer has used %d bytes",bytebuffer_getlength(s));
 	
-	if ( s->buf_start ) 
+	if ( s->buf_start )
 	{
 		LWDEBUGF(4,"let's free buf_start %p",s->buf_start);
 		lwfree(s->buf_start);
 		LWDEBUG(4,"buf_start is freed");
 	}
-	if ( s ) 
+	if ( s )
 	{
 		lwfree(s);		
 		LWDEBUG(4,"bytebuffer_t is freed");
@@ -94,7 +94,7 @@
 /**
 * Set the read cursor to the beginning
 */
-void 
+void
 bytebuffer_reset_reading(bytebuffer_t *s)
 {
 	s->readcursor = s->buf_start;
@@ -105,7 +105,7 @@
 * without the expense of freeing and re-allocating a new
 * bytebuffer_t.
 */
-void 
+void
 bytebuffer_clear(bytebuffer_t *s)
 {
 	s->readcursor = s->writecursor = s->buf_start;
@@ -115,7 +115,7 @@
 * If necessary, expand the bytebuffer_t internal buffer to accomodate the
 * specified additional size.
 */
-static inline void 
+static inline void
 bytebuffer_makeroom(bytebuffer_t *s, size_t size_to_add)
 {
 	LWDEBUGF(2,"Entered bytebuffer_makeroom with space need of %d", size_to_add);
@@ -141,7 +141,7 @@
 /**
 * Writes a uint8_t value to the buffer
 */
-void 
+void
 bytebuffer_append_byte(bytebuffer_t *s, const uint8_t val)
 {	
 	LWDEBUGF(2,"Entered bytebuffer_append_byte with value %d", val);	
@@ -155,7 +155,7 @@
 /**
 * Writes a uint8_t value to the buffer
 */
-void 
+void
 bytebuffer_append_bulk(bytebuffer_t *s, void * start, size_t size)
 {	
 	LWDEBUGF(2,"bytebuffer_append_bulk with size %d",size);	
@@ -168,7 +168,7 @@
 /**
 * Writes a uint8_t value to the buffer
 */
-void 
+void
 bytebuffer_append_bytebuffer(bytebuffer_t *write_to,bytebuffer_t *write_from )
 {	
 	LWDEBUG(2,"bytebuffer_append_bytebuffer");	
@@ -183,7 +183,7 @@
 /**
 * Writes a signed varInt to the buffer
 */
-void 
+void
 bytebuffer_append_varint(bytebuffer_t *b, const int64_t val)
 {	
 	size_t size;
@@ -196,7 +196,7 @@
 /**
 * Writes a unsigned varInt to the buffer
 */
-void 
+void
 bytebuffer_append_uvarint(bytebuffer_t *b, const uint64_t val)
 {	
 	size_t size;
@@ -297,7 +297,7 @@
 /**
 * Reads a signed varInt from the buffer
 */
-int64_t 
+int64_t
 bytebuffer_read_varint(bytebuffer_t *b)
 {
 	size_t size;
@@ -309,7 +309,7 @@
 /**
 * Reads a unsigned varInt from the buffer
 */
-uint64_t 
+uint64_t
 bytebuffer_read_uvarint(bytebuffer_t *b)
 {	
 	size_t size;
@@ -321,7 +321,7 @@
 /**
 * Returns the length of the current buffer
 */
-size_t 
+size_t
 bytebuffer_getlength(bytebuffer_t *s)
 {
 	return (size_t) (s->writecursor - s->buf_start);

Modified: trunk/liblwgeom/cunit/cu_buildarea.c
===================================================================
--- trunk/liblwgeom/cunit/cu_buildarea.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/cunit/cu_buildarea.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -178,9 +178,9 @@
 
 /*
        +-----------+
-       |  +-----+  | This time the innermost ring has 
+       |  +-----+  | This time the innermost ring has
        |  | +-+ |  | more points than the other (outer) two.
-       |  | | | |  | 
+       |  | | | |  |
        |  | +-+ |  |
        |  +-----+  |
        +-----------+
@@ -213,13 +213,13 @@
 }
 
 /*
-       +---------------+   
-       |  +---------+  |   
-       |  | +--+--+ |  |   
-       |  | |  |  | |  |   
-       |  | +--+--+ |  |   
-       |  +---------+  |   
-       +---------------+   
+       +---------------+
+       |  +---------+  |
+       |  | +--+--+ |  |
+       |  | |  |  | |  |
+       |  | +--+--+ |  |
+       |  +---------+  |
+       +---------------+
 */
 static void buildarea5(void)
 {

Modified: trunk/liblwgeom/cunit/cu_clean.c
===================================================================
--- trunk/liblwgeom/cunit/cu_clean.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/cunit/cu_clean.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -56,7 +56,7 @@
 
 	/* We're really only interested in avoiding a crash in here.
 	 * See http://trac.osgeo.org/postgis/ticket/1738
-	 * TODO: enhance the test if we find a workaround 
+	 * TODO: enhance the test if we find a workaround
 	 *       to the excepion:
 	 * See http://trac.osgeo.org/postgis/ticket/1735
 	 */
@@ -95,7 +95,7 @@
 	ewkt = lwgeom_to_ewkt(gout);
 	/* printf("c = %s\n", ewkt); */
 	/*
-	 TODO: This doesn't work on windows returns in different order. 
+	 TODO: This doesn't work on windows returns in different order.
 	 strk figure out why. For now will replace with normalized version
 	*/
 /*	CU_ASSERT_STRING_EQUAL(ewkt,

Modified: trunk/liblwgeom/cunit/cu_force_sfs.c
===================================================================
--- trunk/liblwgeom/cunit/cu_force_sfs.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/cunit/cu_force_sfs.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -41,7 +41,7 @@
 	g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE);
 	h = lwgeom_force_sfs(g, 110);
 	if(h->type != type)
-		fprintf(stderr, "\nIn:   %s\nOut:  %s\nExp:  %s\n", 
+		fprintf(stderr, "\nIn:   %s\nOut:  %s\nExp:  %s\n",
 			in, lwtype_name(h->type), lwtype_name(type));
 	CU_ASSERT_EQUAL(h->type, type);
 	lwgeom_free(h);

Modified: trunk/liblwgeom/cunit/cu_geodetic.c
===================================================================
--- trunk/liblwgeom/cunit/cu_geodetic.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/cunit/cu_geodetic.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -124,8 +124,8 @@
 	CU_ASSERT_DOUBLE_EQUAL(s.lon, 0.0, 1e-14);
 	CU_ASSERT_DOUBLE_EQUAL(s.lat, 0.0, 1e-14);
 
-	geographic_point_init(0, 0.2, &e);  
-	geographic_point_init(0, 0.4, &s);  
+	geographic_point_init(0, 0.2, &e);
+	geographic_point_init(0, 0.4, &s);
 	dist1 = sphere_distance(&s, &e);
 	dir1 = sphere_direction(&e, &s, dist1);
 	/* GeodSolve -i -E -p 16 -e 1 0 --input-string "0.2 0 0.4 0" */
@@ -133,42 +133,42 @@
 	CU_ASSERT_DOUBLE_EQUAL(dist1, 0.0034906585039887, 1e-14);
 
 	geographic_point_init(0, 1, &s); /* same start point for remainder of tests */
-	geographic_point_init(0, 2, &e);  
+	geographic_point_init(0, 2, &e);
 	dist2 = sphere_distance(&s, &e);
 	dir2 = sphere_direction(&s, &e, dist2);
 	/* GeodSolve -i -E -p 16 -e 1 0 --input-string "1 0 2 0" */
 	CU_ASSERT_DOUBLE_EQUAL(dir2, 0.0, 1e-14);
 	CU_ASSERT_DOUBLE_EQUAL(dist2, 0.0174532925199433, 1e-14);
 	
-	geographic_point_init(1, 1, &e);  
+	geographic_point_init(1, 1, &e);
 	dist2 = sphere_distance(&s, &e);
 	dir2 = sphere_direction(&s, &e, dist2);
 	/* GeodSolve -i -E -p 16 -e 1 0 --input-string "1 0 1 1" */
 	CU_ASSERT_DOUBLE_EQUAL(dir2, 89.991273575329292895136 * M_PI / 180.0, 1e-14);
 	CU_ASSERT_DOUBLE_EQUAL(dist2, 0.0174506342314906, 1e-14);
 
-	geographic_point_init(0, 0, &e);  
+	geographic_point_init(0, 0, &e);
 	dist2 = sphere_distance(&s, &e);
 	dir2 = sphere_direction(&s, &e, dist2);
 	/* GeodSolve -i -E -p 16 -e 1 0 --input-string "1 0 0 0" */
 	CU_ASSERT_DOUBLE_EQUAL(dir2, M_PI, 1e-14);
 	CU_ASSERT_DOUBLE_EQUAL(dist2, 0.0174532925199433, 1e-14);
 
-	geographic_point_init(-1, 1, &e);  
+	geographic_point_init(-1, 1, &e);
 	dist2 = sphere_distance(&s, &e);
 	dir2 = sphere_direction(&s, &e, dist2);
 	/* GeodSolve -i -E -p 16 -e 1 0 --input-string "1 0 1 -1" */
 	CU_ASSERT_DOUBLE_EQUAL(dir2, -89.991273575329292895136 * M_PI / 180.0, 1e-14);
 	CU_ASSERT_DOUBLE_EQUAL(dist2, 0.0174506342314906, 1e-14);
 
-	geographic_point_init(1, 2, &e);  
+	geographic_point_init(1, 2, &e);
 	dist2 = sphere_distance(&s, &e);
 	dir2 = sphere_direction(&s, &e, dist2);
 	/* GeodSolve -i -E -p 16 -e 1 0 --input-string "1 0 2 1" */
 	CU_ASSERT_DOUBLE_EQUAL(dir2, 44.978182941465044354783 * M_PI / 180.0, 1e-14);
 	CU_ASSERT_DOUBLE_EQUAL(dist2, 0.0246782972905467, 1e-14);
 
-	geographic_point_init(-1, 0, &e);  
+	geographic_point_init(-1, 0, &e);
 	dist2 = sphere_distance(&s, &e);
 	dir2 = sphere_direction(&s, &e, dist2);
 	/* GeodSolve -i -E -p 16 -e 1 0 --input-string "1 0 0 -1" */
@@ -210,7 +210,7 @@
 		/* Ramsey */
 		unit_normal(&A1, &A2, &Nc);
 
-		if ( i > 0 ) 
+		if ( i > 0 )
 		{
 			printf("\n- %d -------------------- %.24g ------------------------\n", i, p2.y);
 			printf("Skea:         %.24g,%.24g,%.24g\n", Nr.x, Nr.y, Nr.z);
@@ -571,7 +571,7 @@
 	POINTARRAY *pa;
 	POINT2D p1, p2;
 	GEOGRAPHIC_POINT g1, g2;
-	if ( ! l ) 
+	if ( ! l )
 	{
 		printf("BAD WKT FOUND in test_edge_intersects:\n  %s\n\n", wkt);
 		exit(0);
@@ -762,7 +762,7 @@
 	// printf("CLOSE POINT(%g %g)\n", closest.lon,  closest.lat);
 	// printf(" ORIG POINT(%g %g)\n", g.lon, g.lat);
 	CU_ASSERT_DOUBLE_EQUAL(g.lat, closest.lat, 0.00001);
-	CU_ASSERT_DOUBLE_EQUAL(g.lon, closest.lon, 0.00001);		 
+	CU_ASSERT_DOUBLE_EQUAL(g.lon, closest.lon, 0.00001);		
 }
 
 static void test_edge_distance_to_edge(void)

Modified: trunk/liblwgeom/cunit/cu_in_geojson.c
===================================================================
--- trunk/liblwgeom/cunit/cu_in_geojson.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/cunit/cu_in_geojson.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -26,7 +26,7 @@
 	size_t size;
 
 	g = lwgeom_from_geojson(in, &srs);
-	if ( ! g ) 
+	if ( ! g )
 	{
 		fprintf(stderr, "\nIn:   %s\nExp:  %s\nObt: %s\n", in, exp, cu_error_msg);
 		CU_ASSERT(g != NULL);
@@ -35,26 +35,26 @@
 
 	h = lwgeom_to_wkt(g, WKT_EXTENDED, 15, &size);
 
-	if (strcmp(h, exp)) 
+	if (strcmp(h, exp))
 	{
 		fprintf(stderr, "\nIn:   %s\nExp:  %s\nObt: %s\n", in, exp, h);
 		CU_ASSERT_STRING_EQUAL(h, exp);
 	}
 
-	if ( exp_srs ) 
+	if ( exp_srs )
 	{
-		if ( ! srs ) 
+		if ( ! srs )
 		{
 			fprintf(stderr, "\nIn:   %s\nExp:  %s\nObt: (null)\n", in, exp_srs);
 			CU_ASSERT_EQUAL(srs, exp_srs);
 		}
-		else if (strcmp(srs, exp_srs)) 
+		else if (strcmp(srs, exp_srs))
 		{
 			fprintf(stderr, "\nIn:   %s\nExp:  %s\nObt: %s\n", in, exp_srs, srs);
 			CU_ASSERT_STRING_EQUAL(srs, exp_srs);
 		}
-	} 
-	else if ( srs ) 
+	}
+	else if ( srs )
 	{
 		fprintf(stderr, "\nIn:   %s\nExp:  (null)\nObt: %s\n", in, srs);
 		CU_ASSERT_EQUAL(srs, exp_srs);

Modified: trunk/liblwgeom/cunit/cu_in_wkb.c
===================================================================
--- trunk/liblwgeom/cunit/cu_in_wkb.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/cunit/cu_in_wkb.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -72,7 +72,7 @@
 
 	/* Turn WKT into geom */
 	lwgeom_parse_wkt(&pr, wkt, LW_PARSER_CHECK_NONE);
-	if ( pr.errcode ) 
+	if ( pr.errcode )
 	{
 		printf("ERROR: %s\n", pr.message);
 		printf("POSITION: %d\n", pr.errlocation);
@@ -152,7 +152,7 @@
 	CU_ASSERT_STRING_EQUAL(hex_a, hex_b);
 }
 
-static void test_wkb_in_multipoint(void) 
+static void test_wkb_in_multipoint(void)
 {
 	cu_wkb_in("SRID=4;MULTIPOINT(0 0 0,0 1 0,1 1 0,1 0 0,0 0 1)");
 	CU_ASSERT_STRING_EQUAL(hex_a, hex_b);
@@ -183,7 +183,7 @@
 
 }
 
-static void test_wkb_in_circularstring(void) 
+static void test_wkb_in_circularstring(void)
 {
 	cu_wkb_in("CIRCULARSTRING(0 -2,-2 0,0 2,2 0,0 -2)");
 	CU_ASSERT_STRING_EQUAL(hex_a, hex_b);
@@ -195,13 +195,13 @@
 	CU_ASSERT_STRING_EQUAL(hex_a, hex_b);
 }
 
-static void test_wkb_in_compoundcurve(void) 
+static void test_wkb_in_compoundcurve(void)
 {
 	cu_wkb_in("COMPOUNDCURVE(CIRCULARSTRING(0 0 0, 0.26794919243112270647255365849413 1 3, 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1),(0.5857864376269049511983112757903 1.4142135623730950488016887242097 1,2 0 0,0 0 0))");
 	CU_ASSERT_STRING_EQUAL(hex_a, hex_b);
 }
 
-static void test_wkb_in_curvpolygon(void) 
+static void test_wkb_in_curvpolygon(void)
 {
 	cu_wkb_in("CURVEPOLYGON(CIRCULARSTRING(-2 0 0 0,-1 -1 1 2,0 0 2 4,1 -1 3 6,2 0 4 8,0 2 2 4,-2 0 0 0),(-1 0 1 2,0 0.5 2 4,1 0 3 6,0 1 3 4,-1 0 1 2))");
 	CU_ASSERT_STRING_EQUAL(hex_a, hex_b);

Modified: trunk/liblwgeom/cunit/cu_libgeom.c
===================================================================
--- trunk/liblwgeom/cunit/cu_libgeom.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/cunit/cu_libgeom.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -790,7 +790,7 @@
 	geom2 = lwgeom_from_hexwkb(in_ewkt, LW_PARSER_CHECK_NONE);
 	lwgeom_force_clockwise(geom2);
 	
-	/** use same check instead of strcmp to account 
+	/** use same check instead of strcmp to account
 	  for difference in endianness **/
 	CU_ASSERT( lwgeom_same(geom, geom2) );
 	lwgeom_free(geom);
@@ -1052,7 +1052,7 @@
 
     CU_ASSERT_TRUE(gbox_same_2d(g1->bbox, g2->bbox));
     CU_ASSERT_FALSE(gbox_same_2d(g1->bbox, g3->bbox));
-    
+
     /* Serializing a GBOX with precise coordinates renders the boxes not strictly equal,
      * but still equal according to gbox_same_2d_float.
      */

Modified: trunk/liblwgeom/cunit/cu_measures.c
===================================================================
--- trunk/liblwgeom/cunit/cu_measures.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/cunit/cu_measures.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -112,12 +112,12 @@
 	DIST2DTEST("GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(MULTIPOINT(0 0)))", "GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(MULTIPOINT(3 4)))", 5.0);
 
 	/*
-	** Linestring vs its start point 
+	** Linestring vs its start point
 	*/
 	DIST2DTEST("LINESTRING(-2 0, -0.2 0)", "POINT(-2 0)", 0);
 
 	/*
-	** Linestring vs its end point 
+	** Linestring vs its end point
 	*/
 	DIST2DTEST("LINESTRING(-0.2 0, -2 0)", "POINT(-2 0)", 0);
 
@@ -132,13 +132,13 @@
 	DIST2DTEST("LINESTRING(-0.2 0, -1e-8 0)", "POINT(-1e-8 0)", 0);
 
 	/*
-	* Circular string and point 
+	* Circular string and point
 	*/
 	DIST2DTEST("CIRCULARSTRING(-1 0, 0 1, 1 0)", "POINT(0 0)", 1);
 	DIST2DTEST("CIRCULARSTRING(-3 0, -2 0, -1 0, 0 1, 1 0)", "POINT(0 0)", 1);
 
 	/*
-	* Circular string and Circular string 
+	* Circular string and Circular string
 	*/
 	DIST2DTEST("CIRCULARSTRING(-1 0, 0 1, 1 0)", "CIRCULARSTRING(0 0, 1 -1, 2 0)", 1);
 
@@ -174,7 +174,7 @@
 	DIST2DTEST(cs1, "CURVEPOLYGON(CIRCULARSTRING(1 4, 2 5, 3 4, 2 3, 1 4))", 0.0);
 
 	/*
-	* MultiSurface and CurvePolygon 
+	* MultiSurface and CurvePolygon
 	*/
 	static char *cs2 = "MULTISURFACE(POLYGON((0 0,0 4,4 4,4 0,0 0)),CURVEPOLYGON(CIRCULARSTRING(8 2,10 4,12 2,10 0,8 2)))";
 	DIST2DTEST(cs2, "CURVEPOLYGON(CIRCULARSTRING(5 2,6 3,7 2,6 1,5 2))", 1);
@@ -628,7 +628,7 @@
 static void
 test_lw_dist2d_arc_arc(void)
 {
-	/* lw_dist2d_arc_arc(const POINT2D *A1, const POINT2D *A2, const POINT2D *A3, 
+	/* lw_dist2d_arc_arc(const POINT2D *A1, const POINT2D *A2, const POINT2D *A3,
 	                     const POINT2D *B1, const POINT2D *B2, const POINT2D *B3,
 	                     DISTPTS *dl) */
 	DISTPTS dl;

Modified: trunk/liblwgeom/cunit/cu_minimum_bounding_circle.c
===================================================================
--- trunk/liblwgeom/cunit/cu_minimum_bounding_circle.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/cunit/cu_minimum_bounding_circle.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -27,8 +27,8 @@
 		p.x = p4.x;
 		p.y = p4.y;
 
-		/* We need to store the distance in a variable before the assert so that 
-		 * it is rounded from its 80-bit representation (on x86) down to 64 bits. 
+		/* We need to store the distance in a variable before the assert so that
+		 * it is rounded from its 80-bit representation (on x86) down to 64 bits.
 		 * */
 		volatile double d = distance2d_pt_pt(result->center, &p);
 

Modified: trunk/liblwgeom/cunit/cu_out_geojson.c
===================================================================
--- trunk/liblwgeom/cunit/cu_out_geojson.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/cunit/cu_out_geojson.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -94,7 +94,7 @@
 	    NULL, 15, 0);
 
 	/* small numbers */
-  /* NOTE: precision of 300 will be converted to max precision (15) 
+  /* NOTE: precision of 300 will be converted to max precision (15)
    *       and being there no significant digit within that range
    *       only zeroes will be returned
    * See http://trac.osgeo.org/postgis/ticket/2051#comment:11

Modified: trunk/liblwgeom/cunit/cu_out_twkb.c
===================================================================
--- trunk/liblwgeom/cunit/cu_out_twkb.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/cunit/cu_out_twkb.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -204,24 +204,24 @@
 	idlist[0] = 2;
 	idlist[1] = 4;
 	cu_twkb_idlist("MULTIPOINT(1 1, 0 0)",idlist, 0, 0, 0, 0);
-	// printf("TWKB: %s\n",s);   
-	// printf("WKT: %s\n",w);   
+	// printf("TWKB: %s\n",s);
+	// printf("WKT: %s\n",w);
 	CU_ASSERT_STRING_EQUAL(s,"040402040802020101");		
 	CU_ASSERT_STRING_EQUAL(w,"MULTIPOINT(1 1,0 0)");		
 
-	/* 
+	/*
 	04 06 multipoint, size/idlist
 	07 size 7 bytes
 	02 two geometries
 	0408 idlist (2, 4)
 	0202 first point @ 1,1
-	0101 second point offset -1,-1 
+	0101 second point offset -1,-1
 	*/
 	idlist[0] = 2;
 	idlist[1] = 4;
 	cu_twkb_idlist("MULTIPOINT(1 1, 0 0)",idlist, 0, 0, 0, TWKB_SIZE);
 	// printf("TWKB: %s\n",s);
-	// printf("WKT: %s\n",w);   
+	// printf("WKT: %s\n",w);
 	CU_ASSERT_STRING_EQUAL(s,"04060702040802020101");		
 	CU_ASSERT_STRING_EQUAL(w,"MULTIPOINT(1 1,0 0)");		
 
@@ -238,7 +238,7 @@
 	idlist[1] = 4;
 	cu_twkb_idlist("MULTIPOINT(1 1, 0 0)",idlist, 0, 0, 0, TWKB_SIZE | TWKB_BBOX);
 	// printf("TWKB: %s\n",s);
-	// printf("WKT: %s\n",w);   
+	// printf("WKT: %s\n",w);
 	CU_ASSERT_STRING_EQUAL(s,"04070B0002000202040802020101");		
 	CU_ASSERT_STRING_EQUAL(w,"MULTIPOINT(1 1,0 0)");		
 

Modified: trunk/liblwgeom/cunit/cu_out_wkb.c
===================================================================
--- trunk/liblwgeom/cunit/cu_out_wkb.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/cunit/cu_out_wkb.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -45,7 +45,7 @@
 }
 
 /*
-** Creating an input from a hexwkb 
+** Creating an input from a hexwkb
 */
 static void cu_wkb_from_hexwkb(char *hexwkb)
 {
@@ -56,7 +56,7 @@
 }
 
 /*
-** Creating an input WKB from a wkb string 
+** Creating an input WKB from a wkb string
 */
 static void cu_wkb(char *wkt)
 {
@@ -134,7 +134,7 @@
 	CU_ASSERT_STRING_EQUAL(s,"000000000300000000");
 }
 
-static void test_wkb_out_multipoint(void) 
+static void test_wkb_out_multipoint(void)
 {
 	cu_wkb("SRID=4;MULTIPOINT(0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)");
 	CU_ASSERT_STRING_EQUAL(s,"00A000000400000004000000050080000001000000000000000000000000000000000000000000000000008000000100000000000000003FF0000000000000000000000000000000800000013FF00000000000003FF0000000000000000000000000000000800000013FF0000000000000000000000000000000000000000000000080000001000000000000000000000000000000000000000000000000");
@@ -173,7 +173,7 @@
 	CU_ASSERT_STRING_EQUAL(s,"000000000700000002000000000200000000000000000500000002000000000200000000000000000200000000");
 }
 
-static void test_wkb_out_circularstring(void) 
+static void test_wkb_out_circularstring(void)
 {
 	cu_wkb("CIRCULARSTRING(0 -2,-2 0,0 2,2 0,0 -2)");
 	CU_ASSERT_STRING_EQUAL(s,"0000000008000000050000000000000000C000000000000000C000000000000000000000000000000000000000000000004000000000000000400000000000000000000000000000000000000000000000C000000000000000");
@@ -185,13 +185,13 @@
 	CU_ASSERT_STRING_EQUAL(s,"00E00000080000002B00000005C014000000000000000000000000000000000000000000004010000000000000000000000000000040140000000000003FF0000000000000400800000000000040140000000000000000000000000000400000000000000040000000000000004024000000000000C01400000000000040080000000000003FF0000000000000402E000000000000000000000000000040100000000000000000000000000000");
 }
 
-static void test_wkb_out_compoundcurve(void) 
+static void test_wkb_out_compoundcurve(void)
 {
 	cu_wkb("COMPOUNDCURVE(CIRCULARSTRING(0 0 0, 0.26794919243112270647255365849413 1 3, 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1),(0.5857864376269049511983112757903 1.4142135623730950488016887242097 1,2 0 0,0 0 0))");
 	CU_ASSERT_STRING_EQUAL(s,"0080000009000000020080000008000000030000000000000000000000000000000000000000000000003FD126145E9ECD563FF000000000000040080000000000003FE2BEC3330188673FF6A09E667F3BCD3FF00000000000000080000002000000033FE2BEC3330188673FF6A09E667F3BCD3FF0000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
 }
 
-static void test_wkb_out_curvpolygon(void) 
+static void test_wkb_out_curvpolygon(void)
 {
 	cu_wkb("CURVEPOLYGON(CIRCULARSTRING(-2 0 0 0,-1 -1 1 2,0 0 2 4,1 -1 3 6,2 0 4 8,0 2 2 4,-2 0 0 0),(-1 0 1 2,0 0.5 2 4,1 0 3 6,0 1 3 4,-1 0 1 2))");
 	CU_ASSERT_STRING_EQUAL(s,"00C000000A0000000200C000000800000007C000000000000000000000000000000000000000000000000000000000000000BFF0000000000000BFF00000000000003FF0000000000000400000000000000000000000000000000000000000000000400000000000000040100000000000003FF0000000000000BFF00000000000004008000000000000401800000000000040000000000000000000000000000000401000000000000040200000000000000000000000000000400000000000000040000000000000004010000000000000C00000000000000000000000000000000000000000000000000000000000000000C000000200000005BFF000000000000000000000000000003FF0000000000000400000000000000000000000000000003FE0000000000000400000000000000040100000000000003FF000000000000000000000000000004008000000000000401800000000000000000000000000003FF000000000000040080000000000004010000000000000BFF000000000000000000000000000003FF00000000000004000000000000000");
@@ -201,7 +201,7 @@
 
 static void test_wkb_out_multisurface(void) {}
 
-static void test_wkb_out_polyhedralsurface(void) 
+static void test_wkb_out_polyhedralsurface(void)
 {
 //	cu_wkb("POLYHEDRALSURFACE(((0 0 0 0,0 0 1 0,0 1 0 2,0 0 0 0)),((0 0 0 0,0 1 0 0,1 0 0 4,0 0 0 0)),((0 0 0 0,1 0 0 0,0 0 1 6,0 0 0 0)),((1 0 0 0,0 1 0 0,0 0 1 0,1 0 0 0)))");
 //	CU_ASSERT_STRING_EQUAL(s, t);		

Modified: trunk/liblwgeom/cunit/cu_out_wkt.c
===================================================================
--- trunk/liblwgeom/cunit/cu_out_wkt.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/cunit/cu_out_wkt.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -20,7 +20,7 @@
 /*
 ** Global variable to hold WKT strings
 */
-char *s = NULL; 
+char *s = NULL;
 
 /*
 ** The suite initialization function.
@@ -47,7 +47,7 @@
 {
 	LWGEOM *g = lwgeom_from_wkt(wkt, LW_PARSER_CHECK_NONE);
 	if ( s ) free(s);
-	if ( ! g ) 
+	if ( ! g )
 	{
 		printf("error converting '%s' to lwgeom\n", wkt);
 		exit(0);

Modified: trunk/liblwgeom/cunit/cu_out_x3d.c
===================================================================
--- trunk/liblwgeom/cunit/cu_out_x3d.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/cunit/cu_out_x3d.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -99,7 +99,7 @@
 
 	/* TODO: Polygon - with internal ring - the answer is clearly wrong */
 	/** do_x3d3_test(
-	    "POLYGON((0 1 3,2 3 3,4 5 3,0 1 3),(6 7 3,8 9 3,10 11 3,6 7 3))", 
+	    "POLYGON((0 1 3,2 3 3,4 5 3,0 1 3),(6 7 3,8 9 3,10 11 3,6 7 3))",
 	        "",
 	    NULL, 0); **/
 

Modified: trunk/liblwgeom/cunit/cu_ptarray.c
===================================================================
--- trunk/liblwgeom/cunit/cu_ptarray.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/cunit/cu_ptarray.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -41,7 +41,7 @@
 	POINT4D p;
 
 	line = lwgeom_as_lwline(lwgeom_from_text("LINESTRING(0 0,1 1)"));
-	p.x = 1; 
+	p.x = 1;
 	p.y = 1;
 	ptarray_append_point(line->points, &p, LW_TRUE);
 	wkt = lwgeom_to_text(lwline_as_lwgeom(line));
@@ -63,35 +63,35 @@
 	POINT4D p;
 
 	line = lwgeom_as_lwline(lwgeom_from_text("LINESTRING EMPTY"));
-	p.x = 1; 
+	p.x = 1;
 	p.y = 1;
 	ptarray_insert_point(line->points, &p, 0);
 	wkt = lwgeom_to_text(lwline_as_lwgeom(line));
 	ASSERT_STRING_EQUAL(wkt,"LINESTRING(1 1)");
 	lwfree(wkt);
 
-	p.x = 2; 
+	p.x = 2;
 	p.y = 20;
 	ptarray_insert_point(line->points, &p, 0);
 	wkt = lwgeom_to_text(lwline_as_lwgeom(line));
 	ASSERT_STRING_EQUAL(wkt,"LINESTRING(2 20,1 1)");
 	lwfree(wkt);
 
-	p.x = 3; 
+	p.x = 3;
 	p.y = 30;
 	ptarray_insert_point(line->points, &p, 1);
 	wkt = lwgeom_to_text(lwline_as_lwgeom(line));
 	ASSERT_STRING_EQUAL(wkt,"LINESTRING(2 20,3 30,1 1)");
 	lwfree(wkt);
 
-	p.x = 4; 
+	p.x = 4;
 	p.y = 40;
 	ptarray_insert_point(line->points, &p, 0);
 	wkt = lwgeom_to_text(lwline_as_lwgeom(line));
 	ASSERT_STRING_EQUAL(wkt,"LINESTRING(4 40,2 20,3 30,1 1)");
 	lwfree(wkt);
 
-	p.x = 5; 
+	p.x = 5;
 	p.y = 50;
 	ptarray_insert_point(line->points, &p, 4);
 	wkt = lwgeom_to_text(lwline_as_lwgeom(line));
@@ -314,7 +314,7 @@
 	lwpoly_free(poly);
 }
 
-static void test_ptarray_signed_area() 
+static void test_ptarray_signed_area()
 {
 	LWLINE *line;
 	double area;
@@ -342,7 +342,7 @@
 
 
 
-static void test_ptarray_unstroke() 
+static void test_ptarray_unstroke()
 {
 	LWGEOM *in, *out;
 	char *str;
@@ -420,8 +420,8 @@
 	// printf("%s\n", str);
 	lwfree(str);		
 	
-	// See http://trac.osgeo.org/postgis/ticket/2425 
-	// and http://trac.osgeo.org/postgis/ticket/2420 
+	// See http://trac.osgeo.org/postgis/ticket/2425
+	// and http://trac.osgeo.org/postgis/ticket/2420
 	in = lwgeom_from_text("LINESTRING(0 0,10 0,10 10,0 10,0 0)");
 	out = lwgeom_unstroke(in);
 	str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
@@ -460,7 +460,7 @@
 
 }
 
-static void test_ptarray_contains_point() 
+static void test_ptarray_contains_point()
 {
 /* int ptarray_contains_point(const POINTARRAY *pa, const POINT2D *pt, int *winding_number) */
 
@@ -549,7 +549,7 @@
 	lwline_free(lwline);
 }
 
-static void test_ptarrayarc_contains_point() 
+static void test_ptarrayarc_contains_point()
 {
 	/* int ptarrayarc_contains_point(const POINTARRAY *pa, const POINT2D *pt) */
 
@@ -687,7 +687,7 @@
 	lwline_free(lwline);
 }
 
-static void test_ptarray_scale() 
+static void test_ptarray_scale()
 {
   LWLINE *line;
   POINTARRAY *pa;
@@ -704,28 +704,28 @@
   wktout = lwgeom_to_text(lwline_as_lwgeom(line));
   ASSERT_STRING_EQUAL(wktout, wkt);
   lwfree(wktout);
-  
+
   factor.x = 2;
   wkt = "LINESTRING ZM (0 1 2 3,2 2 3 0,-4 -3 0 -1,-6 0 -1 -2)";
   ptarray_scale(pa, &factor);
   wktout = lwgeom_to_text(lwline_as_lwgeom(line));
   ASSERT_STRING_EQUAL(wktout, wkt);
   lwfree(wktout);
-  
+
   factor.x = 1; factor.y = 3;
   wkt = "LINESTRING ZM (0 3 2 3,2 6 3 0,-4 -9 0 -1,-6 0 -1 -2)";
   ptarray_scale(pa, &factor);
   wktout = lwgeom_to_text(lwline_as_lwgeom(line));
   ASSERT_STRING_EQUAL(wktout, wkt);
   lwfree(wktout);
-  
+
   factor.x = 1; factor.y = 1; factor.z = -2;
   wkt = "LINESTRING ZM (0 3 -4 3,2 6 -6 0,-4 -9 -0 -1,-6 0 2 -2)";
   ptarray_scale(pa, &factor);
   wktout = lwgeom_to_text(lwline_as_lwgeom(line));
   ASSERT_STRING_EQUAL(wktout, wkt);
   lwfree(wktout);
-  
+
   factor.x = 1; factor.y = 1; factor.z = 1; factor.m = 2;
   wkt = "LINESTRING ZM (0 3 -4 6,2 6 -6 0,-4 -9 -0 -2,-6 0 2 -4)";
   ptarray_scale(pa, &factor);

Modified: trunk/liblwgeom/cunit/cu_triangulate.c
===================================================================
--- trunk/liblwgeom/cunit/cu_triangulate.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/cunit/cu_triangulate.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -29,7 +29,7 @@
 
 	tmp = lwgeom_delaunay_triangulation(in, 0, 0);
 	lwgeom_free(in);
-	out = lwgeom_normalize(tmp); 
+	out = lwgeom_normalize(tmp);
 	lwgeom_free(tmp);
 
         wkt = lwgeom_to_ewkt(out);

Modified: trunk/liblwgeom/cunit/cu_varint.c
===================================================================
--- trunk/liblwgeom/cunit/cu_varint.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/cunit/cu_varint.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -15,7 +15,7 @@
 #include <string.h>
 #include "CUnit/Basic.h"
 #include "CUnit/CUnit.h"
-#include "liblwgeom_internal.h" 
+#include "liblwgeom_internal.h"
 #include "varint.h"
 #include "cu_tester.h"
 
@@ -38,7 +38,7 @@
 	uint8_t buf[16];
 	
 	size = varint_u32_encode_buf(nr, buf);
-	if ( size != expected_size ) 
+	if ( size != expected_size )
 		printf("Expected: %d\nObtained: %d\n", expected_size, size);
 
 	CU_ASSERT_EQUAL(size, expected_size);
@@ -55,7 +55,7 @@
 	char *hex;
 	
 	size = varint_s32_encode_buf(nr, buf);
-	if ( size != expected_size ) 
+	if ( size != expected_size )
 	{
 		printf("Expected: %d\nObtained: %d\n", expected_size, size);
 	}
@@ -73,7 +73,7 @@
 	char *hex;
 	
 	size = varint_u64_encode_buf(nr, buf);
-	if ( size != expected_size ) 
+	if ( size != expected_size )
 	{
 		printf("Expected: %d\nObtained: %d\n", expected_size, size);
 	}
@@ -91,7 +91,7 @@
 	char *hex;
 	
 	size = varint_s64_encode_buf(nr, buf);
-	if ( size != expected_size ) 
+	if ( size != expected_size )
 	{
 		printf("Expected: %d\nObtained: %d\n", expected_size, size);
 	}

Modified: trunk/liblwgeom/effectivearea.c
===================================================================
--- trunk/liblwgeom/effectivearea.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/effectivearea.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -22,7 +22,7 @@
  *
  **********************************************************************/
 
- 
+
  #include "effectivearea.h"
 
 
@@ -58,7 +58,7 @@
 }
 
 
-static void 
+static void
 destroy_minheap(MINHEAP tree)
 {
 	lwfree(tree.key_array);
@@ -106,7 +106,7 @@
 {
 	double v1 =  (*(areanode**)a)->area;
 	double v2 = (*(areanode**)b)->area;
-	/*qsort gives unpredictable results when comaping identical values. 
+	/*qsort gives unpredictable results when comaping identical values.
 	If two values is the same we force returning the last point in hte point array.
 	That way we get the same ordering on diffreent machines and pllatforms*/
 	if (v1==v2)
@@ -535,8 +535,8 @@
 
 	return out;
 }
- 
 
+
 LWGEOM* lwgeom_set_effective_area(const LWGEOM *igeom,int set_area, double trshld)
 {
 	LWDEBUG(2, "Entered  lwgeom_set_effective_area");

Modified: trunk/liblwgeom/effectivearea.h
===================================================================
--- trunk/liblwgeom/effectivearea.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/effectivearea.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -32,7 +32,7 @@
 
 /**
 
-This structure is placed in an array with one member per point. 
+This structure is placed in an array with one member per point.
 It has links into the minheap rtee and kepps track of eliminated points
 */
 typedef struct

Modified: trunk/liblwgeom/g_box.c
===================================================================
--- trunk/liblwgeom/g_box.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/g_box.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -311,7 +311,7 @@
 	return LW_TRUE;
 }
 
-int 
+int
 gbox_overlaps_2d(const GBOX *g1, const GBOX *g2)
 {
 
@@ -327,7 +327,7 @@
 	return LW_TRUE;
 }
 
-int 
+int
 gbox_contains_2d(const GBOX *g1, const GBOX *g2)
 {
 	if ( ( g2->xmin < g1->xmin ) || ( g2->xmax > g1->xmax ) ||
@@ -338,7 +338,7 @@
 	return LW_TRUE;
 }
 
-int 
+int
 gbox_contains_point2d(const GBOX *g, const POINT2D *p)
 {
 	if ( ( g->xmin <= p->x ) && ( g->xmax >= p->x ) &&
@@ -641,8 +641,8 @@
 	{
 		if ( lwgeom_calculate_gbox_cartesian((LWGEOM*)(coll->geoms[i]), &subbox) == LW_SUCCESS )
 		{
-			/* Keep a copy of the sub-bounding box for later 
-			if ( coll->geoms[i]->bbox ) 
+			/* Keep a copy of the sub-bounding box for later
+			if ( coll->geoms[i]->bbox )
 				lwfree(coll->geoms[i]->bbox);
 			coll->geoms[i]->bbox = gbox_copy(&subbox); */
 			if ( first )

Modified: trunk/liblwgeom/g_serialized.c
===================================================================
--- trunk/liblwgeom/g_serialized.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/g_serialized.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -59,8 +59,8 @@
 {
 	  return FLAGS_GET_GEODETIC(gser->flags);
 }
- 
-uint32_t gserialized_max_header_size(void) 
+
+uint32_t gserialized_max_header_size(void)
 {
 	/* read GSERIALIZED size + max bbox according gbox_serialized_size (2 + Z + M) + 1 int for type */
 	return sizeof(GSERIALIZED) + 8 * sizeof(float) + sizeof(int);
@@ -91,7 +91,7 @@
 	srid = (srid<<11)>>11;
 	
 	/* 0 is our internal unknown value. We'll map back and forth here for now */
-	if ( srid == 0 ) 
+	if ( srid == 0 )
 		return SRID_UNKNOWN;
 	else
 		return clamp_srid(srid);
@@ -948,7 +948,7 @@
 	}
 	
 	/*
-	** Harmonize the flags to the state of the lwgeom 
+	** Harmonize the flags to the state of the lwgeom
 	*/
 	if ( geom->bbox )
 		FLAGS_SET_BBOX(geom->flags, 1);
@@ -1297,7 +1297,7 @@
 
 	lwgeom = lwgeom_from_gserialized_buffer(data_ptr, g_flags, &g_size);
 
-	if ( ! lwgeom ) 
+	if ( ! lwgeom )
 		lwerror("lwgeom_from_gserialized: unable create geometry"); /* Ooops! */
 
 	lwgeom->type = g_type;

Modified: trunk/liblwgeom/g_util.c
===================================================================
--- trunk/liblwgeom/g_util.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/g_util.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -137,7 +137,7 @@
 
 static char dump_toupper(int in)
 {
-	if ( in < 0 || in > 127 ) 
+	if ( in < 0 || in > 127 )
 		return '.';
 	return dumb_upper_map[in];
 }

Modified: trunk/liblwgeom/liblwgeom.h.in
===================================================================
--- trunk/liblwgeom/liblwgeom.h.in	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/liblwgeom.h.in	2016-04-27 14:45:28 UTC (rev 14869)
@@ -54,7 +54,7 @@
 * ../loader/shp2pgsql.c are examples of non-PostGIS applications using liblwgeom.
 *
 * Programs using this library can install their custom memory managers and error
-* handlers by calling the lwgeom_set_handlers() function, otherwise the default 
+* handlers by calling the lwgeom_set_handlers() function, otherwise the default
 * ones will be used.
 */
 
@@ -118,7 +118,7 @@
 
 /**********************************************************************
 ** Spherical radius.
-** Moritz, H. (1980). Geodetic Reference System 1980, by resolution of 
+** Moritz, H. (1980). Geodetic Reference System 1980, by resolution of
 ** the XVII General Assembly of the IUGG in Canberra.
 ** http://en.wikipedia.org/wiki/Earth_radius
 ** http://en.wikipedia.org/wiki/World_Geodetic_System
@@ -131,9 +131,9 @@
 
 
 /**
-* Macros for manipulating the 'flags' byte. A uint8_t used as follows: 
+* Macros for manipulating the 'flags' byte. A uint8_t used as follows:
 * VVSRGBMZ
-* Version bit, followed by 
+* Version bit, followed by
 * Validty, Solid, ReadOnly, Geodetic, HasBBox, HasM and HasZ flags.
 */
 #define FLAGS_GET_Z(flags) ((flags) & 0x01)
@@ -187,8 +187,8 @@
 #define SRID_UNKNOWN 0
 #define SRID_IS_UNKNOWN(x) ((int)x<=0)
 
-/* 
-** EPSG WGS84 geographics, OGC standard default SRS, better be in 
+/*
+** EPSG WGS84 geographics, OGC standard default SRS, better be in
 ** the SPATIAL_REF_SYS table!
 */
 #define SRID_DEFAULT 4326
@@ -225,7 +225,7 @@
 * @ingroup system
 * @todo take a structure ?
 */
-extern void lwgeom_set_handlers(lwallocator allocator, 
+extern void lwgeom_set_handlers(lwallocator allocator,
         lwreallocator reallocator, lwfreeor freeor, lwreporter errorreporter,
         lwreporter noticereporter);
 
@@ -241,7 +241,7 @@
  *
  * The return value from interrupted code is undefined,
  * it is the caller responsibility to not take it in consideration.
- * 
+ *
  */
 extern void lwgeom_request_interrupt(void);
 
@@ -280,8 +280,8 @@
 BOX3D;
 
 /******************************************************************
-* GBOX structure. 
-* We include the flags (information about dimensinality), 
+* GBOX structure.
+* We include the flags (information about dimensinality),
 * so we don't have to constantly pass them
 * into functions that use the GBOX.
 */
@@ -387,7 +387,7 @@
 /******************************************************************
 * LWGEOM (any geometry type)
 *
-* Abstract type, note that 'type', 'bbox' and 'srid' are available in 
+* Abstract type, note that 'type', 'bbox' and 'srid' are available in
 * all geometry variants.
 */
 typedef struct
@@ -639,14 +639,14 @@
 extern uint8_t gflags(int hasz, int hasm, int geodetic);
 
 /**
-* Extract the geometry type from the serialized form (it hides in 
+* Extract the geometry type from the serialized form (it hides in
 * the anonymous data area, so this is a handy function).
 */
 extern uint32_t gserialized_get_type(const GSERIALIZED *g);
 
-/** 
-* Returns the size in bytes to read from toast to get the basic 
-* information from a geometry: GSERIALIZED struct, bbox and type 
+/**
+* Returns the size in bytes to read from toast to get the basic
+* information from a geometry: GSERIALIZED struct, bbox and type
 */
 extern uint32_t gserialized_max_header_size(void);
 
@@ -665,8 +665,8 @@
 /**
 * Check if a #GSERIALIZED is empty without deserializing first.
 * Only checks if the number of elements of the parent geometry
-* is zero, will not catch collections of empty, eg: 
-* GEOMETRYCOLLECTION(POINT EMPTY) 
+* is zero, will not catch collections of empty, eg:
+* GEOMETRYCOLLECTION(POINT EMPTY)
 */
 extern int gserialized_is_empty(const GSERIALIZED *g);
 
@@ -711,8 +711,8 @@
 extern void lwgeom_drop_bbox(LWGEOM *lwgeom);
 extern void lwgeom_drop_srid(LWGEOM *lwgeom);
 
-/** 
- * Compute a bbox if not already computed 
+/**
+ * Compute a bbox if not already computed
  *
  * After calling this function lwgeom->bbox is only
  * NULL if the geometry is empty.
@@ -723,7 +723,7 @@
 */
 extern void lwgeom_add_bbox_deep(LWGEOM *lwgeom, GBOX *gbox);
 
-/** 
+/**
  * Get a non-empty geometry bounding box, computing and
  * caching it if not already there
  *
@@ -732,15 +732,15 @@
  */
 extern const GBOX *lwgeom_get_bbox(const LWGEOM *lwgeom);
 
-/** 
-* Determine whether a LWGEOM can contain sub-geometries or not 
+/**
+* Determine whether a LWGEOM can contain sub-geometries or not
 */
 extern int lwgeom_is_collection(const LWGEOM *lwgeom);
 
 /******************************************************************/
 /* Functions that work on type numbers */
 
-/** 
+/**
 * Determine whether a type number is a collection or not
 */
 extern int lwtype_is_collection(uint8_t type);
@@ -751,7 +751,7 @@
 extern int lwtype_get_collectiontype(uint8_t type);
 
 /**
-* Return the type name string associated with a type number 
+* Return the type name string associated with a type number
 * (e.g. Point, LineString, Polygon)
 */
 extern const char *lwtype_name(uint8_t type);
@@ -807,25 +807,25 @@
 extern int getPoint2d_p(const POINTARRAY *pa, int n, POINT2D *point);
 
 /**
-* Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, 
+* Returns a POINT2D pointer into the POINTARRAY serialized_ptlist,
 * suitable for reading from. This is very high performance
-* and declared const because you aren't allowed to muck with the 
+* and declared const because you aren't allowed to muck with the
 * values, only read them.
 */
 extern const POINT2D* getPoint2d_cp(const POINTARRAY *pa, int n);
 
 /**
-* Returns a POINT3DZ pointer into the POINTARRAY serialized_ptlist, 
+* Returns a POINT3DZ pointer into the POINTARRAY serialized_ptlist,
 * suitable for reading from. This is very high performance
-* and declared const because you aren't allowed to muck with the 
+* and declared const because you aren't allowed to muck with the
 * values, only read them.
 */
 extern const POINT3DZ* getPoint3dz_cp(const POINTARRAY *pa, int n);
 
 /**
-* Returns a POINT4D pointer into the POINTARRAY serialized_ptlist, 
+* Returns a POINT4D pointer into the POINTARRAY serialized_ptlist,
 * suitable for reading from. This is very high performance
-* and declared const because you aren't allowed to muck with the 
+* and declared const because you aren't allowed to muck with the
 * values, only read them.
 */
 extern const POINT4D* getPoint4d_cp(const POINTARRAY *pa, int n);
@@ -836,7 +836,7 @@
  * dimension, the appropriate ordinate values
  * will be extracted from it
  *
- * N must be a valid point index 
+ * N must be a valid point index
  */
 extern void ptarray_set_point4d(POINTARRAY *pa, int n, const POINT4D *p4d);
 
@@ -858,7 +858,7 @@
 extern int ptarray_point_size(const POINTARRAY *pa);
 
 
-/** 
+/**
 * Construct an empty pointarray, allocating storage and setting
 * the npoints, but not filling in any information. Should be used in conjunction
 * with ptarray_set_point4d to fill in the information in the array.
@@ -866,12 +866,12 @@
 extern POINTARRAY* ptarray_construct(char hasz, char hasm, uint32_t npoints);
 
 /**
-* Construct a new #POINTARRAY, <em>copying</em> in the data from ptlist 
+* Construct a new #POINTARRAY, <em>copying</em> in the data from ptlist
 */
 extern POINTARRAY* ptarray_construct_copy_data(char hasz, char hasm, uint32_t npoints, const uint8_t *ptlist);
 
 /**
-* Construct a new #POINTARRAY, <em>referencing</em> to the data from ptlist 
+* Construct a new #POINTARRAY, <em>referencing</em> to the data from ptlist
 */
 extern POINTARRAY* ptarray_construct_reference_data(char hasz, char hasm, uint32_t npoints, uint8_t *ptlist);
 
@@ -883,7 +883,7 @@
 extern POINTARRAY* ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints);
 
 /**
-* Append a point to the end of an existing #POINTARRAY 
+* Append a point to the end of an existing #POINTARRAY
 * If allow_duplicate is LW_FALSE, then a duplicate point will
 * not be added.
 */
@@ -971,7 +971,7 @@
 extern LWGEOM* lwgeom_simplify(const LWGEOM *igeom, double dist, int preserve_collapsed);
 extern LWGEOM* lwgeom_set_effective_area(const LWGEOM *igeom, int set_area, double area);
 
-/* 
+/*
  * Force to use SFS 1.1 geometry type
  * (rather than SFS 1.2 and/or SQL/MM)
  */
@@ -1024,8 +1024,8 @@
 extern int lwcompound_add_lwgeom(LWCOMPOUND *comp, LWGEOM *geom);
 
 /**
-* Construct an equivalent compound curve from a linestring. 
-* Compound curves can have linear components, so this works fine 
+* Construct an equivalent compound curve from a linestring.
+* Compound curves can have linear components, so this works fine
 */
 extern LWCOMPOUND* lwcompound_construct_from_lwline(const LWLINE *lwpoly);
 
@@ -1085,7 +1085,7 @@
 
 /*
 * The *_free family of functions frees *all* memory associated
-* with the pointer. When the recursion gets to the level of the 
+* with the pointer. When the recursion gets to the level of the
 * POINTARRAY, the POINTARRAY is only freed if it is not flagged
 * as "read only". LWGEOMs constructed on top of GSERIALIZED
 * from PgSQL use read only point arrays.
@@ -1206,7 +1206,7 @@
 extern int lwgeom_startpoint(const LWGEOM* lwgeom, POINT4D* pt);
 
 /**
-* Ensure the outer ring is clockwise oriented and all inner rings 
+* Ensure the outer ring is clockwise oriented and all inner rings
 * are counter-clockwise.
 */
 extern void lwgeom_force_clockwise(LWGEOM *lwgeom);
@@ -1280,7 +1280,7 @@
  *
  * #GBOX are copied
  *
- * @see ptarray_clone 
+ * @see ptarray_clone
  */
 extern LWGEOM *lwgeom_clone(const LWGEOM *lwgeom);
 
@@ -1306,7 +1306,7 @@
 extern LWPOLY* lwpoly_construct(int srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points);
 extern LWCURVEPOLY* lwcurvepoly_construct(int srid, GBOX *bbox, uint32_t nrings, LWGEOM **geoms);
 extern LWTRIANGLE* lwtriangle_construct(int srid, GBOX *bbox, POINTARRAY *points);
-extern LWCOLLECTION* lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms); 
+extern LWCOLLECTION* lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms);
 /*
 * Empty geometry constructors.
 */
@@ -1382,14 +1382,14 @@
 extern double ptarray_locate_point(const POINTARRAY *pa, const POINT4D *pt, double *dist, POINT4D *p_located);
 
 /**
-* Add a measure dimension to a line, interpolating linearly from the start 
+* Add a measure dimension to a line, interpolating linearly from the start
 * to the end value.
 */
 extern LWLINE *lwline_measured_from_lwline(const LWLINE *lwline, double m_start, double m_end);
 extern LWMLINE* lwmline_measured_from_lwmline(const LWMLINE *lwmline, double m_start, double m_end);
 
 /**
-* Determine the location(s) along a measured line where m occurs and 
+* Determine the location(s) along a measured line where m occurs and
 * return as a multipoint. Offset to left (positive) or right (negative).
 */
 extern LWGEOM* lwgeom_locate_along(const LWGEOM *lwin, double m, double offset);
@@ -1444,7 +1444,7 @@
 
 /*
  * Point density functions
- */ 
+ */
 extern LWMPOINT *lwpoly_to_points(const LWPOLY *poly, int npoints);
 extern LWMPOINT *lwmpoly_to_points(const LWMPOLY *mpoly, int npoints);
 extern LWMPOINT *lwgeom_to_points(const LWGEOM *lwgeom, int npoints);
@@ -1486,7 +1486,7 @@
 LWCOLLECTION* lwgeom_clip_to_ordinate_range(const LWGEOM *lwin, char ordinate, double from, double to, double offset);
 
 /**
- * Macros for specifying GML options. 
+ * Macros for specifying GML options.
  * @{
  */
 /** For GML3 only, include srsDimension attribute in output */
@@ -1504,7 +1504,7 @@
 /** @} */
 
 /**
- * Macros for specifying X3D options. 
+ * Macros for specifying X3D options.
  * @{
  */
 /** For flip X/Y coordinates to Y/X */
@@ -1551,7 +1551,7 @@
 extern void spheroid_init(SPHEROID *s, double a, double b);
 
 /**
-* Calculate the geodetic distance from lwgeom1 to lwgeom2 on the spheroid. 
+* Calculate the geodetic distance from lwgeom1 to lwgeom2 on the spheroid.
 * A spheroid with major axis == minor axis will be treated as a sphere.
 * Pass in a tolerance in spheroid units.
 */
@@ -1563,7 +1563,7 @@
 extern LWPOINT* lwgeom_project_spheroid(const LWPOINT *r, const SPHEROID *spheroid, double distance, double azimuth);
 
 /**
-* Derive a new geometry with vertices added to ensure no vertex is more 
+* Derive a new geometry with vertices added to ensure no vertex is more
 * than max_seg_length (in radians) from any other vertex.
 */
 extern LWGEOM* lwgeom_segmentize_sphere(const LWGEOM *lwg_in, double max_seg_length);
@@ -1607,11 +1607,11 @@
 /* Calculates the minimum circle that encloses all of the points in g, using a
  * two-dimensional implementation of the algorithm proposed in:
  *
- * Welzl, Emo (1991), "Smallest enclosing disks (balls and elipsoids)."  
+ * Welzl, Emo (1991), "Smallest enclosing disks (balls and elipsoids)."
  * New Results and Trends in Computer Science (H. Maurer, Ed.), Lecture Notes
  * in Computer Science, 555 (1991) 359-370.
  *
- * Available online at the time of this writing at 
+ * Available online at the time of this writing at
  * https://www.inf.ethz.ch/personal/emo/PublFiles/SmallEnclDisk_LNCS555_91.pdf
  *
  * Returns NULL if the circle could not be calculated.
@@ -1662,7 +1662,7 @@
  */
 extern LWPOINTITERATOR* lwpointiterator_create_rw(LWGEOM* g);
 
-/** 
+/**
  * Free all memory associated with the iterator
  */
 extern void lwpointiterator_destroy(LWPOINTITERATOR* s);
@@ -1700,7 +1700,7 @@
 extern uint8_t parse_hex(char *str);
 
 /**
-* Convert a char into a human readable hex digit 
+* Convert a char into a human readable hex digit
 */
 extern void deparse_hex(uint8_t str, char *result);
 
@@ -1725,14 +1725,14 @@
 int gserialized_calculate_gbox_geocentric_p(const GSERIALIZED *g, GBOX *g_box);
 
 /**
-* Return a WKT representation of the gserialized geometry. 
+* Return a WKT representation of the gserialized geometry.
 * Caller is responsible for disposing of the char*.
 */
 extern char* gserialized_to_string(const GSERIALIZED *g);
 
 /**
-* Return a copy of the input serialized geometry. 
-*/ 
+* Return a copy of the input serialized geometry.
+*/
 extern GSERIALIZED* gserialized_copy(const GSERIALIZED *g);
 
 /**
@@ -1756,7 +1756,7 @@
 extern void lwgeom_set_geodetic(LWGEOM *geom, int value);
 
 /**
-* Calculate the geodetic bounding box for an LWGEOM. Z/M coordinates are 
+* Calculate the geodetic bounding box for an LWGEOM. Z/M coordinates are
 * ignored for this calculation. Pass in non-null, geodetic bounding box for function
 * to fill out. LWGEOM must have been built from a GSERIALIZED to provide
 * double aligned point arrays.
@@ -1764,7 +1764,7 @@
 extern int lwgeom_calculate_gbox_geodetic(const LWGEOM *geom, GBOX *gbox);
 
 /**
-* Calculate the 2-4D bounding box of a geometry. Z/M coordinates are honored 
+* Calculate the 2-4D bounding box of a geometry. Z/M coordinates are honored
 * for this calculation, though for curves they are not included in calculations
 * of curvature.
 */
@@ -1855,17 +1855,17 @@
 extern GBOX* gbox_from_string(const char *str);
 
 /**
-* Return #LW_TRUE if the #GBOX overlaps, #LW_FALSE otherwise. 
+* Return #LW_TRUE if the #GBOX overlaps, #LW_FALSE otherwise.
 */
 extern int gbox_overlaps(const GBOX *g1, const GBOX *g2);
 
 /**
-* Return #LW_TRUE if the #GBOX overlaps on the 2d plane, #LW_FALSE otherwise. 
+* Return #LW_TRUE if the #GBOX overlaps on the 2d plane, #LW_FALSE otherwise.
 */
 extern int gbox_overlaps_2d(const GBOX *g1, const GBOX *g2);
 
 /**
-* Return #LW_TRUE if the first #GBOX contains the second on the 2d plane, #LW_FALSE otherwise. 
+* Return #LW_TRUE if the first #GBOX contains the second on the 2d plane, #LW_FALSE otherwise.
 */
 extern int  gbox_contains_2d(const GBOX *g1, const GBOX *g2);
 
@@ -1875,7 +1875,7 @@
 extern void gbox_duplicate(const GBOX *original, GBOX *duplicate);
 
 /**
-* Return the number of bytes necessary to hold a #GBOX of this dimension in 
+* Return the number of bytes necessary to hold a #GBOX of this dimension in
 * serialized form.
 */
 extern size_t gbox_serialized_size(uint8_t flags);
@@ -1910,8 +1910,8 @@
 extern int gbox_is_valid(const GBOX *gbox);
 
 /**
-* Utility function to get type number from string. For example, a string 'POINTZ' 
-* would return type of 1 and z of 1 and m of 0. Valid 
+* Utility function to get type number from string. For example, a string 'POINTZ'
+* would return type of 1 and z of 1 and m of 0. Valid
 */
 extern int geometry_type_from_string(const char *str, uint8_t *type, int *z, int *m);
 
@@ -1926,7 +1926,7 @@
 * Allocate a new #GSERIALIZED from an #LWGEOM. For all non-point types, a bounding
 * box will be calculated and embedded in the serialization. The geodetic flag is used
 * to control the box calculation (cartesian or geocentric). If set, the size pointer
-* will contain the size of the final output, which is useful for setting the PgSQL 
+* will contain the size of the final output, which is useful for setting the PgSQL
 * VARSIZE information.
 */
 extern GSERIALIZED* gserialized_from_lwgeom(LWGEOM *geom, size_t *size);
@@ -1947,7 +1947,7 @@
 
 /**
  * Parser check flags
- * 
+ *
  *  @see lwgeom_from_wkb
  *  @see lwgeom_from_hexwkb
  *  @see lwgeom_parse_wkt
@@ -2163,7 +2163,7 @@
  * @param geom1 the geometry to snap
  * @param geom2 the geometry to snap to
  * @param tolerance the distance under which vertices and segments are snapped
- * 
+ *
  * Requires GEOS-3.3.0+
  */
 LWGEOM* lwgeom_snap(const LWGEOM* geom1, const LWGEOM* geom2, double tolerance);

Modified: trunk/liblwgeom/liblwgeom_internal.h
===================================================================
--- trunk/liblwgeom/liblwgeom_internal.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/liblwgeom_internal.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -93,7 +93,7 @@
 #define WKB_BYTE_SIZE 1 /* Internal use only */
 
 /**
-* Well-Known Binary (WKB) Geometry Types 
+* Well-Known Binary (WKB) Geometry Types
 */
 #define WKB_POINT_TYPE 1
 #define WKB_LINESTRING_TYPE 2
@@ -210,7 +210,7 @@
 int signum(double n);
 
 /*
-* The possible ways a pair of segments can interact. Returned by lw_segment_intersects 
+* The possible ways a pair of segments can interact. Returned by lw_segment_intersects
 */
 enum CG_SEGMENT_INTERSECTION_TYPE {
     SEG_ERROR = -1,
@@ -233,29 +233,29 @@
 double lwpoint_get_ordinate(const POINT4D *p, char ordinate);
 void lwpoint_set_ordinate(POINT4D *p, char ordinate, double value);
 
-/* 
+/*
 * Generate an interpolated coordinate p given an interpolation value and ordinate to apply it to
 */
 int point_interpolate(const POINT4D *p1, const POINT4D *p2, POINT4D *p, int hasz, int hasm, char ordinate, double interpolation_value);
 
 
 /**
-* Clip a line based on the from/to range of one of its ordinates. Use for m- and z- clipping 
+* Clip a line based on the from/to range of one of its ordinates. Use for m- and z- clipping
 */
 LWCOLLECTION *lwline_clip_to_ordinate_range(const LWLINE *line, char ordinate, double from, double to);
 
 /**
-* Clip a multi-line based on the from/to range of one of its ordinates. Use for m- and z- clipping 
+* Clip a multi-line based on the from/to range of one of its ordinates. Use for m- and z- clipping
 */
 LWCOLLECTION *lwmline_clip_to_ordinate_range(const LWMLINE *mline, char ordinate, double from, double to);
 
 /**
-* Clip a multi-point based on the from/to range of one of its ordinates. Use for m- and z- clipping 
+* Clip a multi-point based on the from/to range of one of its ordinates. Use for m- and z- clipping
 */
 LWCOLLECTION *lwmpoint_clip_to_ordinate_range(const LWMPOINT *mpoint, char ordinate, double from, double to);
 
 /**
-* Clip a point based on the from/to range of one of its ordinates. Use for m- and z- clipping 
+* Clip a point based on the from/to range of one of its ordinates. Use for m- and z- clipping
 */
 LWCOLLECTION *lwpoint_clip_to_ordinate_range(const LWPOINT *mpoint, char ordinate, double from, double to);
 
@@ -354,7 +354,7 @@
  */
 void closest_point_on_segment(const POINT4D *R, const POINT4D *A, const POINT4D *B, POINT4D *ret);
 
-/* 
+/*
 * Repeated points
 */
 POINTARRAY *ptarray_remove_repeated_points_minpoints(const POINTARRAY *in, double tolerance, int minpoints);
@@ -403,7 +403,7 @@
 POINTARRAY* ptarray_grid(const POINTARRAY *pa, const gridspec *grid);
 
 /*
-* What side of the line formed by p1 and p2 does q fall? 
+* What side of the line formed by p1 and p2 does q fall?
 * Returns -1 for left and 1 for right and 0 for co-linearity
 */
 int lw_segment_side(const POINT2D *p1, const POINT2D *p2, const POINT2D *q);
@@ -431,7 +431,7 @@
 * Return 2 if the point is on the interior of the line (only case in which
 * a split happens).
 *
-* NOTE: the components pushed to the output vector have their SRID stripped 
+* NOTE: the components pushed to the output vector have their SRID stripped
 */
 int lwline_split_by_point_to(const LWLINE* ln, const LWPOINT* pt, LWMLINE* to);
 

Modified: trunk/liblwgeom/lwalgorithm.c
===================================================================
--- trunk/liblwgeom/lwalgorithm.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwalgorithm.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -91,7 +91,7 @@
 }
 
 /**
-* Returns true if P is on the same side of the plane partition 
+* Returns true if P is on the same side of the plane partition
 * defined by A1/A3 as A2 is. Only makes sense if P has already been
 * determined to be on the circle defined by A1/A2/A3.
 */
@@ -118,7 +118,7 @@
 int
 lw_arc_is_pt(const POINT2D *A1, const POINT2D *A2, const POINT2D *A3)
 {
-	if ( A1->x == A2->x && A2->x == A3->x && 
+	if ( A1->x == A2->x && A2->x == A3->x &&
 	     A1->y == A2->y && A2->y == A3->y )
 		return LW_TRUE;
 	else
@@ -143,7 +143,7 @@
 	radius_A = lw_arc_center(A1, A2, A3, &C);
 
 	/* Co-linear! Return linear distance! */
-	if ( radius_A < 0 ) 
+	if ( radius_A < 0 )
 	{
         double dx = A1->x - A3->x;
         double dy = A1->y - A3->y;
@@ -158,11 +158,11 @@
 	/* Determine the orientation of the arc */
 	a2_side = lw_segment_side(A1, A3, A2);
 
-	/* The side of the A1/A3 line that A2 falls on dictates the sweep  
+	/* The side of the A1/A3 line that A2 falls on dictates the sweep
 	   direction from A1 to A3. */
-	if ( a2_side == -1 ) 
+	if ( a2_side == -1 )
 		clockwise = LW_TRUE;
-	else 
+	else
 		clockwise = LW_FALSE;
 		
 	/* Angles of each point that defines the arc section */
@@ -175,7 +175,7 @@
 		if ( a1 > a3 )
 			angle = a1 - a3;
 		else
-			angle = 2*M_PI + a1 - a3; 
+			angle = 2*M_PI + a1 - a3;
 	}
 	else
 	{
@@ -218,8 +218,8 @@
 		return -1 * side_A2;
 	}
 	
-	/* 
-	* Q is inside the arc boundary, so it's not on the side we 
+	/*
+	* Q is inside the arc boundary, so it's not on the side we
 	* might think from examining only the end points
 	*/
 	if ( d < radius_A && side_Q == side_A2 )
@@ -346,7 +346,7 @@
 }
 
 
-static int 
+static int
 lw_seg_interact(const POINT2D *p1, const POINT2D *p2, const POINT2D *q1, const POINT2D *q2)
 {
 	double minq=FP_MIN(q1->x,q2->x);

Modified: trunk/liblwgeom/lwboundingcircle.c
===================================================================
--- trunk/liblwgeom/lwboundingcircle.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwboundingcircle.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -184,7 +184,7 @@
 	{
 		/* If we're entering the function with three supporting points already, our circle
 		 * is already fully constrained - we couldn't add another supporting point if we
-		 * needed to. So, there's no point in proceeding further.  Welzl (1991) provides 
+		 * needed to. So, there's no point in proceeding further.  Welzl (1991) provides
 		 * a much better explanation of why this works.
 		 * */
 		return LW_SUCCESS;
@@ -274,7 +274,7 @@
 	support = supporting_points_create();
 	result = lwboundingcircle_create();
 	/* Technically, a randomized algorithm would demand that we shuffle the input points
-	 * before we call calculate_mbc().  However, we make the (perhaps poor) assumption that 
+	 * before we call calculate_mbc().  However, we make the (perhaps poor) assumption that
 	 * the order we happen to find the points is as good as random, or close enough.
 	 * */
 	success = calculate_mbc((const POINT2D**) points, num_points, support, result);

Modified: trunk/liblwgeom/lwcircstring.c
===================================================================
--- trunk/liblwgeom/lwcircstring.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwcircstring.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -119,7 +119,7 @@
 
 /* @brief Clone LWCIRCSTRING object. Serialized point lists are not copied.
  *
- * @see ptarray_clone 
+ * @see ptarray_clone
  */
 LWCIRCSTRING *
 lwcircstring_clone(const LWCIRCSTRING *g)
@@ -313,7 +313,7 @@
 }
 
 /*
-* Snap to grid 
+* Snap to grid
 */
 LWCIRCSTRING* lwcircstring_grid(const LWCIRCSTRING *line, const gridspec *grid)
 {

Modified: trunk/liblwgeom/lwcollection.c
===================================================================
--- trunk/liblwgeom/lwcollection.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwcollection.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -589,7 +589,7 @@
 	for (i=0; i<coll->ngeoms; i++)
 	{
 		LWGEOM *g = lwgeom_grid(coll->geoms[i], grid);
-		if ( g ) 
+		if ( g )
 			lwcollection_add_lwgeom(newcoll, g);
 	}
 

Modified: trunk/liblwgeom/lwcompound.c
===================================================================
--- trunk/liblwgeom/lwcompound.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwcompound.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -58,7 +58,7 @@
 	if ( memcmp(getPoint_internal( (POINTARRAY *)compound->geoms[0]->data, 0),
 	            getPoint_internal( (POINTARRAY *)compound->geoms[compound->ngeoms - 1]->data,
 	                               npoints - 1),
-	            size) ) 
+	            size) )
 	{
 		return LW_FALSE;
 	}
@@ -146,7 +146,7 @@
 	return LW_FAILURE;
 }
 
-int 
+int
 lwcompound_contains_point(const LWCOMPOUND *comp, const POINT2D *pt)
 {
 	int i;
@@ -164,7 +164,7 @@
 			lwline = lwgeom_as_lwline(lwgeom);
 			if ( comp->ngeoms == 1 )
 			{
-				return ptarray_contains_point(lwline->points, pt); 
+				return ptarray_contains_point(lwline->points, pt);
 			}
 			else
 			{
@@ -191,7 +191,7 @@
 		}
 
 		/* Propogate boundary condition */
-		if ( result == LW_BOUNDARY ) 
+		if ( result == LW_BOUNDARY )
 			return LW_BOUNDARY;
 
 		wn += winding_number;
@@ -214,7 +214,7 @@
   return ogeom;
 }
 
-LWPOINT* 
+LWPOINT*
 lwcompound_get_lwpoint(const LWCOMPOUND *lwcmp, int where)
 {
 	int i;

Modified: trunk/liblwgeom/lwcurvepoly.c
===================================================================
--- trunk/liblwgeom/lwcurvepoly.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwcurvepoly.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -74,7 +74,7 @@
 	int i;
 	
 	/* Can't do anything with NULLs */
-	if( ! poly || ! ring ) 
+	if( ! poly || ! ring )
 	{
 		LWDEBUG(4,"NULL inputs!!! quitting");
 		return LW_FAILURE;

Modified: trunk/liblwgeom/lwgeodetic.c
===================================================================
--- trunk/liblwgeom/lwgeodetic.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwgeodetic.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -175,7 +175,7 @@
 }
 
 /** Returns the angular height (latitudinal span) of the box in radians */
-double 
+double
 gbox_angular_height(const GBOX* gbox)
 {
 	double d[6];
@@ -202,7 +202,7 @@
 }
 
 /** Returns the angular width (longitudinal span) of the box in radians */
-double 
+double
 gbox_angular_width(const GBOX* gbox)
 {
 	double d[6];
@@ -374,7 +374,7 @@
 }
 
 /**
-* Convert cartesion coordinates on unit sphere to spherical coordinates 
+* Convert cartesion coordinates on unit sphere to spherical coordinates
 */
 void cart2geog(const POINT3D *p, GEOGRAPHIC_POINT *g)
 {
@@ -396,7 +396,7 @@
 }
 
 /**
-* Convert cartesion coordinates on unit sphere to lon/lat coordinates 
+* Convert cartesion coordinates on unit sphere to lon/lat coordinates
 static void cart2ll(const POINT3D *p, POINT2D *g)
 {
 	g->x = longitude_degrees_normalize(180.0 * atan2(p->y, p->x) / M_PI);
@@ -531,7 +531,7 @@
 	normalize(normal);
 }
 
-/** 
+/**
 * Rotates v1 through an angle (in radians) within the plane defined by v1/v2, returns
 * the rotated vector in n.
 */
@@ -652,10 +652,10 @@
 
 /**
 * Returns -1 if the point is to the left of the plane formed
-* by the edge, 1 if the point is to the right, and 0 if the 
+* by the edge, 1 if the point is to the right, and 0 if the
 * point is on the plane.
 */
-static int 
+static int
 edge_point_side(const GEOGRAPHIC_EDGE *e, const GEOGRAPHIC_POINT *p)
 {
 	POINT3D normal, pt;
@@ -675,7 +675,7 @@
 	
 	if ( w < 0 )
 		return -1;
-	else 
+	else
 		return 1;
 }
 
@@ -694,7 +694,7 @@
 }
 
 /**
-* Computes the spherical area of a triangle. If C is to the left of A/B, 
+* Computes the spherical area of a triangle. If C is to the left of A/B,
 * the area is negative. If C is to the right of A/B, the area is positive.
 *
 * @param a The first triangle vertex.
@@ -702,7 +702,7 @@
 * @param c The last triangle vertex.
 * @return the signed area in radians.
 */
-static double 
+static double
 sphere_signed_area(const GEOGRAPHIC_POINT *a, const GEOGRAPHIC_POINT *b, const GEOGRAPHIC_POINT *c)
 {
 	double angle_a, angle_b, angle_c;
@@ -722,7 +722,7 @@
 	side = edge_point_side(&e, c);
 	
 	/* Co-linear points implies no area */
-	if ( side == 0 ) 
+	if ( side == 0 )
 		return 0.0;
 
 	/* Add the sign to the area */
@@ -1226,7 +1226,7 @@
 
 /**
 * Calculate the distance between two edges.
-* IMPORTANT: this test does not check for edge intersection!!! (distance == 0) 
+* IMPORTANT: this test does not check for edge intersection!!! (distance == 0)
 * You have to check for intersection before calling this function.
 */
 double edge_distance_to_edge(const GEOGRAPHIC_EDGE *e1, const GEOGRAPHIC_EDGE *e2, GEOGRAPHIC_POINT *closest1, GEOGRAPHIC_POINT *closest2)
@@ -1330,7 +1330,7 @@
 		LWDEBUG(4, "edge is antipodal. setting to maximum size box, and returning");
 		gbox->xmin = gbox->ymin = gbox->zmin = -1.0;
 		gbox->xmax = gbox->ymax = gbox->zmax = 1.0;
-		return LW_SUCCESS; 
+		return LW_SUCCESS;
 	}
 
 	/* Walk along the chord between start and end incrementally,
@@ -1359,12 +1359,12 @@
 /**
 * The magic function, given an edge in spherical coordinates, calculate a
 * 3D bounding box that fully contains it, taking into account the curvature
-* of the sphere on which it is inscribed. 
+* of the sphere on which it is inscribed.
 *
 * Any arc on the sphere defines a plane that bisects the sphere. In this plane,
 * the arc is a portion of a unit circle.
 * Projecting the end points of the axes (1,0,0), (-1,0,0) etc, into the plane
-* and normalizing yields potential extrema points. Those points on the 
+* and normalizing yields potential extrema points. Those points on the
 * side of the plane-dividing line formed by the end points that is opposite
 * the origin of the plane are extrema and should be added to the bounding box.
 */
@@ -1542,7 +1542,7 @@
 * @param pa_in - input point array pointer
 * @param max_seg_length - maximum output segment length in radians
 */
-static POINTARRAY* 
+static POINTARRAY*
 ptarray_segmentize_sphere(const POINTARRAY *pa_in, double max_seg_length)
 {
 	POINTARRAY *pa_out;
@@ -1638,7 +1638,7 @@
 * @param lwg_in = input geometry
 * @param max_seg_length = maximum segment length in radians
 */
-LWGEOM* 
+LWGEOM*
 lwgeom_segmentize_sphere(const LWGEOM *lwg_in, double max_seg_length)
 {
 	POINTARRAY *pa_out;
@@ -1702,7 +1702,7 @@
 * Returns the area of the ring (ring must be closed) in square radians (surface of
 * the sphere is 4*PI).
 */
-double 
+double
 ptarray_area_sphere(const POINTARRAY *pa)
 {
 	int i;
@@ -1993,7 +1993,7 @@
 * @param distance - distance, in units of the spheroid def'n.
 * @param azimuth - azimuth in radians.
 * @return s - location of projected point.
-* 
+*
 */
 LWPOINT* lwgeom_project_spheroid(const LWPOINT *r, const SPHEROID *spheroid, double distance, double azimuth)
 {
@@ -2004,7 +2004,7 @@
 	LWPOINT *lwp;
 
 	/* Check the azimuth validity, convert to radians */
-	if ( azimuth < -2.0 * M_PI || azimuth > 2.0 * M_PI ) 
+	if ( azimuth < -2.0 * M_PI || azimuth > 2.0 * M_PI )
 	{
 		lwerror("Azimuth must be between -2PI and 2PI");
 		return NULL;
@@ -2023,7 +2023,7 @@
 	geographic_point_init(x, y, &geo_source);
 	
 	/* Try the projection */
-	if( spheroid_project(&geo_source, spheroid, distance, azimuth, &geo_dest) == LW_FAILURE ) 
+	if( spheroid_project(&geo_source, spheroid, distance, azimuth, &geo_dest) == LW_FAILURE )
 	{
 		LWDEBUGF(3, "Unable to project from (%g %g) with azimuth %g and distance %g", x, y, azimuth, distance);
 		lwerror("Unable to project from (%g %g) with azimuth %g and distance %g", x, y, azimuth, distance);
@@ -2047,8 +2047,8 @@
 * @param r - location of first point.
 * @param s - location of second point.
 * @param spheroid - spheroid definition.
-* @return azimuth - azimuth in radians. 
-* 
+* @return azimuth - azimuth in radians.
+*
 */
 double lwgeom_azumith_spheroid(const LWPOINT *r, const LWPOINT *s, const SPHEROID *spheroid)
 {
@@ -2205,7 +2205,7 @@
 		LWDEBUG(4, "checking if a point of line is in polygon");
 
 		/* Point in polygon implies zero distance */
-		if ( lwpoly_covers_point2d(lwpoly, p) ) 
+		if ( lwpoly_covers_point2d(lwpoly, p) )
 			return 0.0;
 
 		LWDEBUG(4, "checking ring distances");
@@ -2597,7 +2597,7 @@
 		if ( lwgeom_calculate_gbox_geodetic((LWGEOM*)(coll->geoms[i]), &subbox) == LW_SUCCESS )
 		{
 			/* Keep a copy of the sub-bounding box for later */
-			if ( coll->geoms[i]->bbox ) 
+			if ( coll->geoms[i]->bbox )
 				lwfree(coll->geoms[i]->bbox);
 			coll->geoms[i]->bbox = gbox_copy(&subbox);
 			if ( first )
@@ -2720,7 +2720,7 @@
 
 int lwgeom_check_geodetic(const LWGEOM *geom)
 {
-	if ( lwgeom_is_empty(geom) ) 
+	if ( lwgeom_is_empty(geom) )
 		return LW_TRUE;
 		
 	switch (geom->type)
@@ -2760,13 +2760,13 @@
 		getPoint4d_p(pa, t, &pt);
 		if ( pt.x < -180.0 || pt.x > 180.0 || pt.y < -90.0 || pt.y > 90.0 )
 		{
-			pt.x = longitude_degrees_normalize(pt.x); 
-			pt.y = latitude_degrees_normalize(pt.y); 
+			pt.x = longitude_degrees_normalize(pt.x);
+			pt.y = latitude_degrees_normalize(pt.y);
 			ptarray_set_point4d(pa, t, &pt);
 			changed = LW_TRUE;
 		}
 	}
-	return changed;  
+	return changed;
 }
 
 static int lwpoint_force_geodetic(LWPOINT *point)
@@ -2851,7 +2851,7 @@
 	/* Initialize first point */
 	getPoint4d_p(pa, 0, &p);
 	geographic_point_init(p.x, p.y, &a);
-	if ( hasz ) 
+	if ( hasz )
 		za = p.z;
 
 	/* Loop and sum the length for each segment */
@@ -2860,7 +2860,7 @@
 		seglength = 0.0;
 		getPoint4d_p(pa, i, &p);
 		geographic_point_init(p.x, p.y, &b);
-		if ( hasz ) 
+		if ( hasz )
 			zb = p.z;
 
 		/* Special sphere case */
@@ -2871,7 +2871,7 @@
 			seglength = spheroid_distance(&a, &b, s);
 
 		/* Add in the vertical displacement if we're in 3D */
-		if ( hasz ) 
+		if ( hasz )
 			seglength = sqrt( (zb-za)*(zb-za) + seglength*seglength );
 			
 		/* Add this segment length to the total */
@@ -2933,12 +2933,12 @@
 }
 
 /**
-* When features are snapped or sometimes they are just this way, they are very close to 
+* When features are snapped or sometimes they are just this way, they are very close to
 * the geodetic bounds but slightly over. This routine nudges those points, and only
 * those points, back over to the bounds.
 * http://trac.osgeo.org/postgis/ticket/1292
 */
-static int 
+static int
 ptarray_nudge_geodetic(POINTARRAY *pa)
 {
 
@@ -2985,12 +2985,12 @@
 }
 
 /**
-* When features are snapped or sometimes they are just this way, they are very close to 
+* When features are snapped or sometimes they are just this way, they are very close to
 * the geodetic bounds but slightly over. This routine nudges those points, and only
 * those points, back over to the bounds.
 * http://trac.osgeo.org/postgis/ticket/1292
 */
-int 
+int
 lwgeom_nudge_geodetic(LWGEOM *geom)
 {
 	int type;
@@ -3073,7 +3073,7 @@
 /**
 * Utility function for ptarray_contains_point_sphere()
 */
-static int 
+static int
 point3d_equals(const POINT3D *p1, const POINT3D *p2)
 {
 	return FP_EQUALS(p1->x, p2->x) && FP_EQUALS(p1->y, p2->y) && FP_EQUALS(p1->z, p2->z);
@@ -3095,10 +3095,10 @@
 }
 
 /**
-* Returns non-zero if edges A and B interact. The type of interaction is given in the 
+* Returns non-zero if edges A and B interact. The type of interaction is given in the
 * return value with the bitmask elements defined above.
 */
-int 
+int
 edge_intersects(const POINT3D *A1, const POINT3D *A2, const POINT3D *B1, const POINT3D *B2)
 {
 	POINT3D AN, BN, VN;  /* Normals to plane A and plane B */
@@ -3115,7 +3115,7 @@
 	if ( FP_EQUALS(fabs(ab_dot), 1.0) )
 	{
 		/* Co-linear case */
-		if ( point_in_cone(A1, A2, B1) || point_in_cone(A1, A2, B2) || 
+		if ( point_in_cone(A1, A2, B1) || point_in_cone(A1, A2, B2) ||
 		     point_in_cone(B1, B2, A1) || point_in_cone(B1, B2, A2) )
 		{
 			rv |= PIR_INTERSECTS;

Modified: trunk/liblwgeom/lwgeodetic.h
===================================================================
--- trunk/liblwgeom/lwgeodetic.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwgeodetic.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -152,7 +152,7 @@
 
 /**
 * Notes for rewrite
-* 
+*
 * Define separate POINT types for 2-d-points-in-radiands and 3-d-points-in-geocentric
 * Maintain consistent units (radians?) throughout all calculations
 * Put an index pointer onto LWGEOM itself, and cache the indexed LWGEOM instead of a bare tree

Modified: trunk/liblwgeom/lwgeodetic_tree.c
===================================================================
--- trunk/liblwgeom/lwgeodetic_tree.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwgeodetic_tree.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -36,7 +36,7 @@
 /**
 * Internal nodes have their point references set to NULL.
 */
-static inline int 
+static inline int
 circ_node_is_leaf(const CIRC_NODE* node)
 {
 	return (node->num_nodes == 0);
@@ -46,7 +46,7 @@
 * Recurse from top of node tree and free all children.
 * does not free underlying point array.
 */
-void 
+void
 circ_tree_free(CIRC_NODE* node)
 {
 	int i;
@@ -63,7 +63,7 @@
 /**
 * Create a new leaf node, storing pointers back to the end points for later.
 */
-static CIRC_NODE* 
+static CIRC_NODE*
 circ_node_leaf_new(const POINTARRAY* pa, int i)
 {
 	POINT2D *p1, *p2;
@@ -105,7 +105,7 @@
 	node->num_nodes = 0;
 	node->nodes = NULL;
 	node->edge_num = i;
-    
+
 	/* Zero out metadata */
 	node->pt_outside.x = 0.0;
 	node->pt_outside.y = 0.0;
@@ -117,7 +117,7 @@
 /**
 * Return a point node (zero radius, referencing one point)
 */
-static CIRC_NODE* 
+static CIRC_NODE*
 circ_node_leaf_point_new(const POINTARRAY* pa)
 {
 	CIRC_NODE* tree = lwalloc(sizeof(CIRC_NODE));
@@ -134,9 +134,9 @@
 }
 
 /**
-* Comparing on geohash ensures that nearby nodes will be close 
+* Comparing on geohash ensures that nearby nodes will be close
 * to each other in the list.
-*/  
+*/
 static int
 circ_node_compare(const void* v1, const void* v2)
 {
@@ -180,7 +180,7 @@
 }
 
 /**
-* Where the circ_center_spherical() function fails, we need a fall-back. The failures 
+* Where the circ_center_spherical() function fails, we need a fall-back. The failures
 * happen in short arcs, where the spherical distance between two points is practically
 * the same as the straight-line distance, so our fallback will be to use the straight-line
 * between the two to calculate the new projected center. For proportions far from 0.5
@@ -225,7 +225,7 @@
 * Create a new internal node, calculating the new measure range for the node,
 * and storing pointers to the child nodes.
 */
-static CIRC_NODE* 
+static CIRC_NODE*
 circ_node_internal_new(CIRC_NODE** c, int num_nodes)
 {
 	CIRC_NODE *node = NULL;
@@ -248,7 +248,7 @@
 	/* Merge each remaining circle into the new circle */
 	for ( i = 1; i < num_nodes; i++ )
 	{
-		c1 = new_center; 
+		c1 = new_center;
 		r1 = new_radius;
 		
 		dist = sphere_distance(&c1, &(c[i]->center));
@@ -349,7 +349,7 @@
 /**
 * Build a tree of nodes from a point array, one node per edge.
 */
-CIRC_NODE* 
+CIRC_NODE*
 circ_tree_new(const POINTARRAY* pa)
 {
 	int num_edges;
@@ -413,7 +413,7 @@
 	int num_parents = 0;
 	int j;
 
-	/* TODO, roll geom_type *up* as tree is built, changing to collection types as simple types are merged 
+	/* TODO, roll geom_type *up* as tree is built, changing to collection types as simple types are merged
 	 * TODO, change the distance algorithm to drive down to simple types first, test pip on poly/other cases, then test edges
 	 */
 
@@ -493,8 +493,8 @@
 	
 	LWDEBUG(3, "entered");
 	
-	/* 
-	* If the stabline doesn't cross within the radius of a node, there's no 
+	/*
+	* If the stabline doesn't cross within the radius of a node, there's no
 	* way it can cross.
 	*/
 		
@@ -556,7 +556,7 @@
 	return 0;
 }
 
-static double 
+static double
 circ_node_min_distance(const CIRC_NODE* n1, const CIRC_NODE* n2)
 {
 	double d = sphere_distance(&(n1->center), &(n2->center));
@@ -569,7 +569,7 @@
 	return d - r1 - r2;
 }
 
-static double 
+static double
 circ_node_max_distance(const CIRC_NODE *n1, const CIRC_NODE *n2)
 {
 	return sphere_distance(&(n1->center), &(n2->center)) + n1->radius + n2->radius;
@@ -599,7 +599,7 @@
 	}
 }
 
-static double 
+static double
 circ_tree_distance_tree_internal(const CIRC_NODE* n1, const CIRC_NODE* n2, double threshold, double* min_dist, double* max_dist, GEOGRAPHIC_POINT* closest1, GEOGRAPHIC_POINT* closest2)
 {	
 	double max;
@@ -793,7 +793,7 @@
 
 	if (circ_node_is_leaf(node))
 	{
-		printf("%*s[%d] C(%.5g %.5g) R(%.5g) ((%.5g %.5g),(%.5g,%.5g))", 
+		printf("%*s[%d] C(%.5g %.5g) R(%.5g) ((%.5g %.5g),(%.5g,%.5g))",
 		  3*depth + 6, "NODE", node->edge_num,
 		  node->center.lon, node->center.lat,
 		  node->radius,
@@ -809,12 +809,12 @@
   			printf(" O(%.5g %.5g)", node->pt_outside.x, node->pt_outside.y);
   		}				
   		printf("\n");
-		  
+		
 	}	
 	else
 	{
-		printf("%*s C(%.5g %.5g) R(%.5g)", 
-		  3*depth + 6, "NODE", 
+		printf("%*s C(%.5g %.5g) R(%.5g)",
+		  3*depth + 6, "NODE",
 		  node->center.lon, node->center.lat,
 		  node->radius
 		);

Modified: trunk/liblwgeom/lwgeom.c
===================================================================
--- trunk/liblwgeom/lwgeom.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwgeom.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -376,7 +376,7 @@
 
 
 /**
-* Free the containing LWGEOM and the associated BOX. Leave the underlying 
+* Free the containing LWGEOM and the associated BOX. Leave the underlying
 * geoms/points/point objects intact. Useful for functions that are stripping
 * out subcomponents of complex objects, or building up new temporary objects
 * on top of subcomponents.
@@ -402,7 +402,7 @@
 
 /* @brief Clone LWGEOM object. Serialized point lists are not copied.
  *
- * @see ptarray_clone 
+ * @see ptarray_clone
  */
 LWGEOM *
 lwgeom_clone(const LWGEOM *lwgeom)
@@ -439,8 +439,8 @@
 	}
 }
 
-/** 
-* Deep-clone an #LWGEOM object. #POINTARRAY <em>are</em> copied. 
+/**
+* Deep-clone an #LWGEOM object. #POINTARRAY <em>are</em> copied.
 */
 LWGEOM *
 lwgeom_clone_deep(const LWGEOM *lwgeom)
@@ -589,7 +589,7 @@
 	center.x = cx;
 	center.y = cy;
 
-	if ( distance2d_pt_pt(pt, &center) < rad ) 
+	if ( distance2d_pt_pt(pt, &center) < rad )
 		return LW_TRUE;
 
 	return LW_FALSE;
@@ -620,7 +620,7 @@
 	lwgeom_calculate_gbox(lwgeom, lwgeom->bbox);
 }
 
-void 
+void
 lwgeom_add_bbox_deep(LWGEOM *lwgeom, GBOX *gbox)
 {
 	if ( lwgeom_is_empty(lwgeom) ) return;
@@ -775,7 +775,7 @@
 
 			case COLLECTIONTYPE:
 				col = (LWCOLLECTION*)geom;
-				for ( i = 0; i < col->ngeoms; i++ ) 
+				for ( i = 0; i < col->ngeoms; i++ )
 					col->geoms[i] = lwgeom_force_sfs((LWGEOM*)col->geoms[i], version);
 
 				return lwcollection_as_lwgeom((LWCOLLECTION*)geom);
@@ -821,7 +821,7 @@
 		/* Collection */
 		case COLLECTIONTYPE:
 			col = (LWCOLLECTION*)geom;
-			for ( i = 0; i < col->ngeoms; i++ ) 
+			for ( i = 0; i < col->ngeoms; i++ )
 				col->geoms[i] = lwgeom_force_sfs((LWGEOM*)col->geoms[i], version);
 
 			return lwcollection_as_lwgeom((LWCOLLECTION*)geom);
@@ -831,35 +831,35 @@
 	}
 }
 
-int32_t 
+int32_t
 lwgeom_get_srid(const LWGEOM *geom)
 {
 	if ( ! geom ) return SRID_UNKNOWN;
 	return geom->srid;
 }
 
-uint32_t 
+uint32_t
 lwgeom_get_type(const LWGEOM *geom)
 {
 	if ( ! geom ) return 0;
 	return geom->type;
 }
 
-int 
+int
 lwgeom_has_z(const LWGEOM *geom)
 {
 	if ( ! geom ) return LW_FALSE;
 	return FLAGS_GET_Z(geom->flags);
 }
 
-int 
+int
 lwgeom_has_m(const LWGEOM *geom)
 {
 	if ( ! geom ) return LW_FALSE;
 	return FLAGS_GET_M(geom->flags);
 }
 
-int 
+int
 lwgeom_ndims(const LWGEOM *geom)
 {
 	if ( ! geom ) return 0;
@@ -956,7 +956,7 @@
 	}
 }
 
-int 
+int
 lwgeom_is_closed(const LWGEOM *geom)
 {
 	int type = geom->type;
@@ -987,10 +987,10 @@
 		LWCOLLECTION *col = lwgeom_as_lwcollection(geom);
 		int i;
 		int closed;
-		for ( i = 0; i < col->ngeoms; i++ ) 
+		for ( i = 0; i < col->ngeoms; i++ )
 		{
 			closed = lwgeom_is_closed(col->geoms[i]);
-			if ( ! closed ) 
+			if ( ! closed )
 				return LW_FALSE;
 		}
 		return LW_TRUE;
@@ -1000,7 +1000,7 @@
 	return LW_TRUE;
 }
 
-int 
+int
 lwgeom_is_collection(const LWGEOM *geom)
 {
 	if( ! geom ) return LW_FALSE;
@@ -1035,7 +1035,7 @@
 /**
 * Given an lwtype number, what homogeneous collection can hold it?
 */
-int 
+int
 lwtype_get_collectiontype(uint8_t type)
 {
 	switch (type)
@@ -1169,7 +1169,7 @@
 		result = 1;
 		break;
 	case TRIANGLETYPE:
-	case CIRCSTRINGTYPE: 
+	case CIRCSTRINGTYPE:
 	case LINETYPE:
 		result = lwline_count_vertices((LWLINE *)geom);
 		break;
@@ -1198,8 +1198,8 @@
 }
 
 /**
-* For an #LWGEOM, returns 0 for points, 1 for lines, 
-* 2 for polygons, 3 for volume, and the max dimension 
+* For an #LWGEOM, returns 0 for points, 1 for lines,
+* 2 for polygons, 3 for volume, and the max dimension
 * of a collection.
 */
 int lwgeom_dimension(const LWGEOM *geom)
@@ -1219,7 +1219,7 @@
 	case POINTTYPE:
 	case MULTIPOINTTYPE:
 		return 0;
-	case CIRCSTRINGTYPE: 
+	case CIRCSTRINGTYPE:
 	case LINETYPE:
 	case COMPOUNDTYPE:
 	case MULTICURVETYPE:
@@ -1264,13 +1264,13 @@
 	int result = 0;
 	
 	/* Null? Empty? Zero. */
-	if( ! geom || lwgeom_is_empty(geom) ) 
+	if( ! geom || lwgeom_is_empty(geom) )
 		return 0;
 
 	switch (geom->type)
 	{
 	case POINTTYPE:
-	case CIRCSTRINGTYPE: 
+	case CIRCSTRINGTYPE:
 	case COMPOUNDTYPE:
 	case MULTICURVETYPE:
 	case MULTIPOINTTYPE:
@@ -1422,7 +1422,7 @@
 	LWDEBUGF(4, "lwgeom_remove_repeated_points got type %s",
 	         lwtype_name(in->type));
 
-	if(lwgeom_is_empty(in)) 
+	if(lwgeom_is_empty(in))
 	{
 		return lwgeom_clone_deep(in);
 	}
@@ -1542,7 +1542,7 @@
 	}
 
 	/* only refresh bbox if X or Y changed */
-	if ( in->bbox && (o1 < 2 || o2 < 2) ) 
+	if ( in->bbox && (o1 < 2 || o2 < 2) )
 	{
 		lwgeom_drop_bbox(in);
 		lwgeom_add_bbox(in);
@@ -1706,7 +1706,7 @@
 	int type = geom->type;
 	int i;
 
-	switch(type) 
+	switch(type)
 	{
 		/* Take advantage of fact tht pt/ln/circ/tri have same memory structure */
 		case POINTTYPE:
@@ -1742,7 +1742,7 @@
 					lwgeom_affine(c->geoms[i], affine);
 				}
 			}
-			else 
+			else
 			{
 				lwerror("lwgeom_affine: unable to handle type '%s'", lwtype_name(type));
 			}
@@ -1757,7 +1757,7 @@
 	int type = geom->type;
 	int i;
 
-	switch(type) 
+	switch(type)
 	{
 		/* Take advantage of fact tht pt/ln/circ/tri have same memory structure */
 		case POINTTYPE:
@@ -1793,7 +1793,7 @@
 					lwgeom_scale(c->geoms[i], factor);
 				}
 			}
-			else 
+			else
 			{
 				lwerror("lwgeom_scale: unable to handle type '%s'", lwtype_name(type));
 			}
@@ -1802,7 +1802,7 @@
 
 	/* Recompute bbox if needed */
 
-	if ( geom->bbox ) 
+	if ( geom->bbox )
 	{
 		/* TODO: expose a gbox_scale function */
 		geom->bbox->xmin *= factor->x;
@@ -1819,7 +1819,7 @@
 LWGEOM*
 lwgeom_construct_empty(uint8_t type, int srid, char hasz, char hasm)
 {
-	switch(type) 
+	switch(type)
 	{
 		case POINTTYPE:
 			return lwpoint_as_lwgeom(lwpoint_construct_empty(srid, hasz, hasm));
@@ -1852,7 +1852,7 @@
 	if ( ! lwgeom )
 		return LW_FAILURE;
 		
-	switch( lwgeom->type ) 
+	switch( lwgeom->type )
 	{
 		case POINTTYPE:
 			return ptarray_startpoint(((LWPOINT*)lwgeom)->point, pt);
@@ -1905,7 +1905,7 @@
 
 
 /* Prototype for recursion */
-static int 
+static int
 lwgeom_subdivide_recursive(const LWGEOM *geom, int maxvertices, int depth, LWCOLLECTION *col, const GBOX *clip);
 
 static int
@@ -2048,7 +2048,7 @@
 {
 	int type = geom->type;
 
-	if( type != LINETYPE ) 
+	if( type != LINETYPE )
 	{
 		lwnotice("Geometry is not a LINESTRING");
 		return LW_FALSE;

Modified: trunk/liblwgeom/lwgeom_api.c
===================================================================
--- trunk/liblwgeom/lwgeom_api.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwgeom_api.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -476,9 +476,9 @@
 }
 
 /**
-* Returns a pointer into the POINTARRAY serialized_ptlist, 
+* Returns a pointer into the POINTARRAY serialized_ptlist,
 * suitable for reading from. This is very high performance
-* and declared const because you aren't allowed to muck with the 
+* and declared const because you aren't allowed to muck with the
 * values, only read them.
 */
 const POINT2D*

Modified: trunk/liblwgeom/lwgeom_geos.c
===================================================================
--- trunk/liblwgeom/lwgeom_geos.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwgeom_geos.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -221,10 +221,10 @@
 	const POINT2D *p2d;
 	GEOSCoordSeq sq;
 
-	if ( FLAGS_GET_Z(pa->flags) ) 
+	if ( FLAGS_GET_Z(pa->flags) )
 		dims = 3;
 
-	if ( ! (sq = GEOSCoordSeq_create(pa->npoints, dims)) ) 
+	if ( ! (sq = GEOSCoordSeq_create(pa->npoints, dims)) )
 		lwerror("Error creating GEOS Coordinate Sequence");
 
 	for ( i=0; i < pa->npoints; i++ )
@@ -244,7 +244,7 @@
 		GEOSCoordSeq_setX(sq, i, p2d->x);
 		GEOSCoordSeq_setY(sq, i, p2d->y);
 		
-		if ( dims == 3 ) 
+		if ( dims == 3 )
 			GEOSCoordSeq_setZ(sq, i, p3d->z);
 	}
 	return sq;
@@ -260,14 +260,14 @@
 	if ( autofix )
 	{
 		/* check ring for being closed and fix if not */
-		if ( ! ptarray_is_closed_2d(pa) ) 
+		if ( ! ptarray_is_closed_2d(pa) )
 		{
 			npa = ptarray_addPoint(pa, getPoint_internal(pa, 0), FLAGS_NDIMS(pa->flags), pa->npoints);
 			pa = npa;
 		}
 		/* TODO: check ring for having at least 4 vertices */
 #if 0
-		while ( pa->npoints < 4 ) 
+		while ( pa->npoints < 4 )
 		{
 			npa = ptarray_addPoint(npa, getPoint_internal(pa, 0), FLAGS_NDIMS(pa->flags), pa->npoints);
 		}
@@ -286,7 +286,7 @@
 	GEOSGeometry* envelope;
 	GEOSGeometry* ring;
 	GEOSCoordSequence* seq = GEOSCoordSeq_create(5, 2);
-	if (!seq) 
+	if (!seq)
 	{
 		return NULL;
 	}
@@ -307,14 +307,14 @@
 	GEOSCoordSeq_setY(seq, 4, box->ymin);
 
 	ring = GEOSGeom_createLinearRing(seq);
-	if (!ring) 
+	if (!ring)
 	{
 		GEOSCoordSeq_destroy(seq);
 		return NULL;
 	}
 
 	envelope = GEOSGeom_createPolygon(ring, NULL, 0);
-	if (!envelope) 
+	if (!envelope)
 	{
 		GEOSGeom_destroy(ring);
 		return NULL;
@@ -1140,7 +1140,7 @@
 		const GEOSGeometry *f2er;
         Face* f2 = faces[j];
         if ( f2->parent ) continue; /* hole already assigned */
-        f2er = GEOSGetExteriorRing(f2->geom); 
+        f2er = GEOSGetExteriorRing(f2->geom);
         /* TODO: can be optimized as the ring would have the
          *       same vertices, possibly in different order.
          *       maybe comparing number of points could already be
@@ -1260,7 +1260,7 @@
    * Example:
    *
    *   +---------------+
-   *   |     L0        |  L0 has no parents 
+   *   |     L0        |  L0 has no parents
    *   |  +---------+  |
    *   |  |   L1    |  |  L1 is an hole of L0
    *   |  |  +---+  |  |
@@ -1270,7 +1270,7 @@
    *   |  +---------+  |
    *   |               |
    *   +---------------+
-   * 
+   *
    * See http://trac.osgeo.org/postgis/ticket/1806
    *
    */
@@ -1569,7 +1569,7 @@
 	initGEOS(lwnotice, lwgeom_geos_error);
 
 	g1 = (GEOSGeometry *)LWGEOM2GEOS(lwgeom_in, 0);
-	if ( ! g1 ) 
+	if ( ! g1 )
 	{
 		lwerror("lwgeom_offsetcurve: Geometry could not be converted to GEOS: %s", lwgeom_geos_errmsg);
 		return NULL;
@@ -1653,7 +1653,7 @@
 		// return lwmpoint_construct_empty(lwgeom_get_srid(poly), lwgeom_has_z(poly), lwgeom_has_m(poly));
 	}
 	
-	if (!lwpoly->bbox) 
+	if (!lwpoly->bbox)
 	{
 		lwgeom_calculate_gbox(lwgeom, &bbox);
 	}
@@ -1820,7 +1820,7 @@
 		if(sub_npoints > 0)
 		{
 			LWMPOINT *sub_mpt = lwpoly_to_points(lwmpoly->geoms[i], sub_npoints);
-			if (!mpt) 
+			if (!mpt)
 			{
 				mpt = sub_mpt;
 			}
@@ -1941,7 +1941,7 @@
 	initGEOS(lwnotice, lwgeom_geos_error);
 
 	g1 = (GEOSGeometry *)LWGEOM2GEOS(lwgeom_in, 0);
-	if ( ! g1 ) 
+	if ( ! g1 )
 	{
 		lwerror("lwgeom_delaunay_triangulation: Geometry could not be converted to GEOS: %s", lwgeom_geos_errmsg);
 		return NULL;
@@ -2046,7 +2046,7 @@
 
 	/* Instead of using the standard LWGEOM2GEOS transformer, we read the vertices of the
 	 * LWGEOM directly and put them into a single GEOS CoordinateSeq that can be used to
-	 * define a LineString.  This allows us to process geometry types that may not be 
+	 * define a LineString.  This allows us to process geometry types that may not be
 	 * supported by GEOS, and reduces the memory requirements in cases of many geometries
 	 * with few points (such as LWMPOINT).
 	 */

Modified: trunk/liblwgeom/lwgeom_geos_clean.c
===================================================================
--- trunk/liblwgeom/lwgeom_geos_clean.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwgeom_geos_clean.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -507,7 +507,7 @@
 		GEOSGeometry* new_cut_edges=0;
 
 #ifdef LWGEOM_PROFILE_MAKEVALID
-    lwnotice("ST_MakeValid: building area from %d edges", GEOSGetNumGeometries(geos_cut_edges)); 
+    lwnotice("ST_MakeValid: building area from %d edges", GEOSGetNumGeometries(geos_cut_edges));
 #endif
 
 		/*
@@ -536,7 +536,7 @@
 		 */
 
 #ifdef LWGEOM_PROFILE_MAKEVALID
-    lwnotice("ST_MakeValid: ring built with %d cut edges, saving boundaries", GEOSGetNumGeometries(geos_cut_edges)); 
+    lwnotice("ST_MakeValid: ring built with %d cut edges, saving boundaries", GEOSGetNumGeometries(geos_cut_edges));
 #endif
 
 		/*
@@ -557,7 +557,7 @@
 		}
 
 #ifdef LWGEOM_PROFILE_MAKEVALID
-    lwnotice("ST_MakeValid: running SymDifference with new area"); 
+    lwnotice("ST_MakeValid: running SymDifference with new area");
 #endif
 
 		/*
@@ -587,12 +587,12 @@
 		 *             left, so we don't need to reconsider
 		 *             the whole original boundaries
 		 *
-		 * NOTE: this is an expensive operation. 
+		 * NOTE: this is an expensive operation.
 		 *
 		 */
 
 #ifdef LWGEOM_PROFILE_MAKEVALID
-    lwnotice("ST_MakeValid: computing new cut_edges (GEOSDifference)"); 
+    lwnotice("ST_MakeValid: computing new cut_edges (GEOSDifference)");
 #endif
 
 		new_cut_edges = GEOSDifference(geos_cut_edges, new_area_bound);

Modified: trunk/liblwgeom/lwgeom_geos_cluster.c
===================================================================
--- trunk/liblwgeom/lwgeom_geos_cluster.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwgeom_geos_cluster.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -81,7 +81,7 @@
 			if (box)
 			{
 				tree.envelopes[i] = GBOX2GEOS(box);
-			} 
+			}
 			else
 			{
 				/* Empty geometry */

Modified: trunk/liblwgeom/lwgeom_geos_node.c
===================================================================
--- trunk/liblwgeom/lwgeom_geos_node.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwgeom_geos_node.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -181,7 +181,7 @@
 
 	/*
 	 * Reintroduce endpoints from input, using split-line-by-point.
-	 * Note that by now we can be sure that each point splits at 
+	 * Note that by now we can be sure that each point splits at
 	 * most _one_ segment as any point shared by multiple segments
 	 * would already be a node. Also we can be sure that any of
 	 * the segments endpoints won't split any other segment.

Modified: trunk/liblwgeom/lwgeom_log.h
===================================================================
--- trunk/liblwgeom/lwgeom_log.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwgeom_log.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -87,8 +87,8 @@
 void lwerror(const char *fmt, ...);
 
 /**
- * Write a debug message out. 
- * Don't call this function directly, use the 
+ * Write a debug message out.
+ * Don't call this function directly, use the
  * macros, LWDEBUG() or LWDEBUGF(), for
  * efficiency.
  * @ingroup logging

Modified: trunk/liblwgeom/lwgeom_median.c
===================================================================
--- trunk/liblwgeom/lwgeom_median.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwgeom_median.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -77,7 +77,7 @@
 	 * Fermat-Weber location problem."  Math. Program., Ser. A 90: 559-566.
 	 * DOI 10.1007/s101070100222
 	 *
-	 * Available online at the time of this writing at 
+	 * Available online at the time of this writing at
 	 * http://www.stat.rutgers.edu/home/cunhui/papers/43.pdf
 	 */
 	if (hit)

Modified: trunk/liblwgeom/lwgeom_sfcgal.h
===================================================================
--- trunk/liblwgeom/lwgeom_sfcgal.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwgeom_sfcgal.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -42,6 +42,6 @@
 
 /* No Operation SFCGAL function, used (only) for cunit tests
  * Take a PostGIS geometry, send it to SFCGAL and return it unchanged
- */ 
+ */
 LWGEOM*
 lwgeom_sfcgal_noop(const LWGEOM* geom_in);

Modified: trunk/liblwgeom/lwgeom_transform.c
===================================================================
--- trunk/liblwgeom/lwgeom_transform.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwgeom_transform.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -153,7 +153,7 @@
 		if (*pj_errno_ref == -38)
 		{
 			lwnotice("PostGIS was unable to transform the point because either no grid shift files were found, or the point does not lie within the range for which the grid shift is defined. Refer to the ST_Transform() section of the PostGIS manual for details on how to configure PostGIS to alter this behaviour.");
-			lwerror("transform: couldn't project point (%g %g %g): %s (%d)", 
+			lwerror("transform: couldn't project point (%g %g %g): %s (%d)",
 			        orig_pt.x, orig_pt.y, orig_pt.z, pj_strerrno(*pj_errno_ref), *pj_errno_ref);
 			return 0;
 		}

Modified: trunk/liblwgeom/lwhomogenize.c
===================================================================
--- trunk/liblwgeom/lwhomogenize.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwhomogenize.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -176,7 +176,7 @@
 					lwcollection_add_lwgeom(outcol, bcol->geoms[0]);
 					bcol->ngeoms=0; lwcollection_free(bcol);
 				}
-				else 
+				else
 				{
 					lwcollection_add_lwgeom(outcol, lwcollection_as_lwgeom(bcol));
 				}
@@ -211,7 +211,7 @@
 	LWGEOM *hgeom;
 
 	/* EMPTY Geometry */
-	if (lwgeom_is_empty(geom)) 
+	if (lwgeom_is_empty(geom))
 	{
 		if( lwgeom_is_collection(geom) )
 		{
@@ -260,7 +260,7 @@
 		}
 	
 		/* Work on anonymous collections separately */
-		case COLLECTIONTYPE: 
+		case COLLECTIONTYPE:
 			return lwcollection_homogenize((LWCOLLECTION *) geom);
 	}
 

Modified: trunk/liblwgeom/lwin_geojson.c
===================================================================
--- trunk/liblwgeom/lwin_geojson.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwin_geojson.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -137,7 +137,7 @@
 			/* Initialize Z coordinate, if required */
 			if ( FLAGS_GET_Z(pa->flags) ) pt.z = 0.0;
 		}
-		else 
+		else
 		{
 			/* TODO: should we account for nSize > 3 ? */
 			/* more than 3 coordinates, we're just dropping dimensions here... */
@@ -166,7 +166,7 @@
 	LWDEBUGF(3, "parse_geojson_point called with root_srid = %d.", root_srid );
 
 	coords = findMemberByName( geojson, "coordinates" );
-	if ( ! coords ) 
+	if ( ! coords )
 	{
 		geojson_lwerror("Unable to find 'coordinates' in GeoJSON string", 4);
 		return NULL;
@@ -191,7 +191,7 @@
 	LWDEBUG(2, "parse_geojson_linestring called.");
 
 	points = findMemberByName( geojson, "coordinates" );
-	if ( ! points ) 
+	if ( ! points )
 	{
 		geojson_lwerror("Unable to find 'coordinates' in GeoJSON string", 4);
 	return NULL;
@@ -226,7 +226,7 @@
 	int nRings = 0, nPoints = 0;
 
 	rings = findMemberByName( geojson, "coordinates" );
-	if ( ! rings ) 
+	if ( ! rings )
 	{
 		geojson_lwerror("Unable to find 'coordinates' in GeoJSON string", 4);
 		return NULL;
@@ -295,7 +295,7 @@
 	}
 
 	poObjPoints = findMemberByName( geojson, "coordinates" );
-	if ( ! poObjPoints ) 
+	if ( ! poObjPoints )
 	{
 		geojson_lwerror("Unable to find 'coordinates' in GeoJSON string", 4);
 		return NULL;
@@ -338,7 +338,7 @@
 	}
 
 	poObjLines = findMemberByName( geojson, "coordinates" );
-	if ( ! poObjLines ) 
+	if ( ! poObjLines )
 	{
 		geojson_lwerror("Unable to find 'coordinates' in GeoJSON string", 4);
 		return NULL;
@@ -390,7 +390,7 @@
 	}
 
 	poObjPolys = findMemberByName( geojson, "coordinates" );
-	if ( ! poObjPolys ) 
+	if ( ! poObjPolys )
 	{
 		geojson_lwerror("Unable to find 'coordinates' in GeoJSON string", 4);
 		return NULL;
@@ -453,7 +453,7 @@
 	}
 
 	poObjGeoms = findMemberByName( geojson, "geometries" );
-	if ( ! poObjGeoms ) 
+	if ( ! poObjGeoms )
 	{
 		geojson_lwerror("Unable to find 'geometries' in GeoJSON string", 4);
 		return NULL;
@@ -480,14 +480,14 @@
 	json_object* type = NULL;
 	const char* name;
 
-	if( NULL == geojson ) 
+	if( NULL == geojson )
 	{
 		geojson_lwerror("invalid GeoJSON representation", 2);
 		return NULL;
 	}
 
 	type = findMemberByName( geojson, "type" );
-	if( NULL == type ) 
+	if( NULL == type )
 	{
 		geojson_lwerror("unknown GeoJSON type", 3);
 		return NULL;

Modified: trunk/liblwgeom/lwin_wkb.c
===================================================================
--- trunk/liblwgeom/lwin_wkb.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwin_wkb.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -32,7 +32,7 @@
 /**
 * Used for passing the parse state between the parsing functions.
 */
-typedef struct 
+typedef struct
 {
 	const uint8_t *wkb; /* Points to start of WKB */
 	size_t wkb_size; /* Expected size of WKB */
@@ -119,18 +119,18 @@
 
 
 /**
-* Check that we are not about to read off the end of the WKB 
+* Check that we are not about to read off the end of the WKB
 * array.
 */
 static inline void wkb_parse_state_check(wkb_parse_state *s, size_t next)
 {
 	if( (s->pos + next) > (s->wkb + s->wkb_size) )
 		lwerror("WKB structure does not match expected size!");
-} 
+}
 
 /**
 * Take in an unknown kind of wkb type number and ensure it comes out
-* as an extended WKB type number (with Z/M/SRID flags masked onto the 
+* as an extended WKB type number (with Z/M/SRID flags masked onto the
 * high bits).
 */
 static void lwtype_from_wkb_state(wkb_parse_state *s, uint32_t wkb_type)
@@ -174,10 +174,10 @@
 
 	switch (wkb_simple_type)
 	{
-		case WKB_POINT_TYPE: 
+		case WKB_POINT_TYPE:
 			s->lwtype = POINTTYPE;
 			break;
-		case WKB_LINESTRING_TYPE: 
+		case WKB_LINESTRING_TYPE:
 			s->lwtype = LINETYPE;
 			break;
 		case WKB_POLYGON_TYPE:
@@ -192,7 +192,7 @@
 		case WKB_MULTIPOLYGON_TYPE:
 			s->lwtype = MULTIPOLYGONTYPE;
 			break;
-		case WKB_GEOMETRYCOLLECTION_TYPE: 
+		case WKB_GEOMETRYCOLLECTION_TYPE:
 			s->lwtype = COLLECTIONTYPE;
 			break;
 		case WKB_CIRCULARSTRING_TYPE:
@@ -207,7 +207,7 @@
 		case WKB_MULTICURVE_TYPE:
 			s->lwtype = MULTICURVETYPE;
 			break;
-		case WKB_MULTISURFACE_TYPE: 
+		case WKB_MULTISURFACE_TYPE:
 			s->lwtype = MULTISURFACETYPE;
 			break;
 		case WKB_POLYHEDRALSURFACE_TYPE:
@@ -373,10 +373,10 @@
 
 /**
 * POINT
-* Read a WKB point, starting just after the endian byte, 
+* Read a WKB point, starting just after the endian byte,
 * type number and optional srid number.
 * Advance the parse state forward appropriately.
-* WKB point has just a set of doubles, with the quantity depending on the 
+* WKB point has just a set of doubles, with the quantity depending on the
 * dimension of the point, so this looks like a special case of the above
 * with only one point.
 */
@@ -430,9 +430,9 @@
 
 /**
 * LINESTRING
-* Read a WKB linestring, starting just after the endian byte, 
-* type number and optional srid number. Advance the parse state 
-* forward appropriately. 
+* Read a WKB linestring, starting just after the endian byte,
+* type number and optional srid number. Advance the parse state
+* forward appropriately.
 * There is only one pointarray in a linestring. Optionally
 * check for minimal following of rules (two point minimum).
 */
@@ -454,9 +454,9 @@
 
 /**
 * CIRCULARSTRING
-* Read a WKB circularstring, starting just after the endian byte, 
-* type number and optional srid number. Advance the parse state 
-* forward appropriately. 
+* Read a WKB circularstring, starting just after the endian byte,
+* type number and optional srid number. Advance the parse state
+* forward appropriately.
 * There is only one pointarray in a linestring. Optionally
 * check for minimal following of rules (three point minimum,
 * odd number of points).
@@ -485,9 +485,9 @@
 
 /**
 * POLYGON
-* Read a WKB polygon, starting just after the endian byte, 
-* type number and optional srid number. Advance the parse state 
-* forward appropriately. 
+* Read a WKB polygon, starting just after the endian byte,
+* type number and optional srid number. Advance the parse state
+* forward appropriately.
 * First read the number of rings, then read each ring
 * (which are structured as point arrays)
 */
@@ -538,9 +538,9 @@
 
 /**
 * TRIANGLE
-* Read a WKB triangle, starting just after the endian byte, 
-* type number and optional srid number. Advance the parse state 
-* forward appropriately. 
+* Read a WKB triangle, starting just after the endian byte,
+* type number and optional srid number. Advance the parse state
+* forward appropriately.
 * Triangles are encoded like polygons in WKB, but more like linestrings
 * as lwgeometries.
 */
@@ -623,7 +623,7 @@
 
 /**
 * COLLECTION, MULTIPOINTTYPE, MULTILINETYPE, MULTIPOLYGONTYPE, COMPOUNDTYPE,
-* MULTICURVETYPE, MULTISURFACETYPE, 
+* MULTICURVETYPE, MULTISURFACETYPE,
 * TINTYPE
 */
 static LWCOLLECTION* lwcollection_from_wkb_state(wkb_parse_state *s)
@@ -754,10 +754,10 @@
 /**
 * WKB inputs *must* have a declared size, to prevent malformed WKB from reading
 * off the end of the memory segment (this stops a malevolent user from declaring
-* a one-ring polygon to have 10 rings, causing the WKB reader to walk off the 
+* a one-ring polygon to have 10 rings, causing the WKB reader to walk off the
 * end of the memory).
 *
-* Check is a bitmask of: LW_PARSER_CHECK_MINPOINTS, LW_PARSER_CHECK_ODD, 
+* Check is a bitmask of: LW_PARSER_CHECK_MINPOINTS, LW_PARSER_CHECK_ODD,
 * LW_PARSER_CHECK_CLOSURE, LW_PARSER_CHECK_NONE, LW_PARSER_CHECK_ALL
 */
 LWGEOM* lwgeom_from_wkb(const uint8_t *wkb, const size_t wkb_size, const char check)
@@ -777,7 +777,7 @@
 	s.pos = wkb;
 	
 	/* Hand the check catch-all values */
-	if ( check & LW_PARSER_CHECK_NONE ) 
+	if ( check & LW_PARSER_CHECK_NONE )
 		s.check = 0;
 	else
 		s.check = check;

Modified: trunk/liblwgeom/lwin_wkt.c
===================================================================
--- trunk/liblwgeom/lwin_wkt.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwin_wkt.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -32,7 +32,7 @@
 
 
 /*
-* Error messages for failures in the parser. 
+* Error messages for failures in the parser.
 */
 const char *parser_error_messages[] =
 {
@@ -77,7 +77,7 @@
 	int i = 0;
 	uint8_t flags = 0;
 	
-	if( ! dimensionality ) 
+	if( ! dimensionality )
 		return flags;
 	
 	/* If there's an explicit dimensionality, we use that */
@@ -105,7 +105,7 @@
 	int i = 0;
 	
 	/* Error on junk */
-	if( ! geom ) 
+	if( ! geom )
 		return LW_FAILURE;
 
 	FLAGS_SET_Z(geom->flags, hasz);
@@ -155,7 +155,7 @@
 				wkt_parser_set_dims(poly->rings[i], flags);
 			break;
 		}
-		default: 
+		default:
 		{
 			if ( lwtype_is_collection(geom->type) )
 			{
@@ -193,7 +193,7 @@
 	LWDEBUGF(5,"dimensionality ndims == %d", ndims);
 	LWDEBUGF(5,"FLAGS_NDIMS(pa->flags) == %d", FLAGS_NDIMS(pa->flags));
 	
-	/* 
+	/*
 	* ndims > 2 implies that the flags have something useful to add,
 	* that there is a 'Z' or an 'M' or both.
 	*/
@@ -268,7 +268,7 @@
 	LWDEBUG(4,"entered");
 	
 	/* Error on trouble */
-	if( ! pa ) 
+	if( ! pa )
 	{
 		SET_PARSER_ERROR(PARSER_ERROR_OTHER);
 		return NULL;	
@@ -381,9 +381,9 @@
 
 /**
 * Create a new circularstring. Null point array implies empty. Null dimensionality
-* implies no specified dimensionality in the WKT. 
+* implies no specified dimensionality in the WKT.
 * Circular strings are just like linestrings, except with slighty different
-* validity rules (minpoint == 3, numpoints % 2 == 1). 
+* validity rules (minpoint == 3, numpoints % 2 == 1).
 */
 LWGEOM* wkt_parser_circularstring_new(POINTARRAY *pa, char *dimensionality)
 {
@@ -512,7 +512,7 @@
 	}
 	
 	/* Apply check for not closed rings, if requested. */	
-	if( (global_parser_result.parser_check_flags & LW_PARSER_CHECK_CLOSURE) && 
+	if( (global_parser_result.parser_check_flags & LW_PARSER_CHECK_CLOSURE) &&
 	    ! (dimcheck == 'Z' ? ptarray_is_closed_z(pa) : ptarray_is_closed_2d(pa)) )
 	{
 		ptarray_free(pa);
@@ -564,7 +564,7 @@
 	return poly;
 }
 
-LWGEOM* wkt_parser_curvepolygon_new(LWGEOM *ring) 
+LWGEOM* wkt_parser_curvepolygon_new(LWGEOM *ring)
 {
 	LWGEOM *poly;	
 	LWDEBUG(4,"entered");
@@ -695,7 +695,7 @@
 	return poly;
 }
 
-LWGEOM* wkt_parser_collection_new(LWGEOM *geom) 
+LWGEOM* wkt_parser_collection_new(LWGEOM *geom)
 {
 	LWCOLLECTION *col;
 	LWGEOM **geoms;
@@ -721,7 +721,7 @@
 }
 
 
-LWGEOM* wkt_parser_compound_new(LWGEOM *geom) 
+LWGEOM* wkt_parser_compound_new(LWGEOM *geom)
 {
 	LWCOLLECTION *col;
 	LWGEOM **geoms;
@@ -802,7 +802,7 @@
 	return lwcollection_as_lwgeom(lwcollection_add_lwgeom(lwgeom_as_lwcollection(col), geom));
 }
 
-LWGEOM* wkt_parser_collection_finalize(int lwtype, LWGEOM *geom, char *dimensionality) 
+LWGEOM* wkt_parser_collection_finalize(int lwtype, LWGEOM *geom, char *dimensionality)
 {
 	uint8_t flags = wkt_dimensionality(dimensionality);
 	int flagdims = FLAGS_NDIMS(flags);
@@ -862,7 +862,7 @@
 	LWDEBUGF(4,"geom %p",geom);
 	LWDEBUGF(4,"srid %d",srid);
 
-	if ( geom == NULL ) 
+	if ( geom == NULL )
 	{
 		lwerror("Parsed geometry is null!");
 		return;

Modified: trunk/liblwgeom/lwin_wkt_lex.c
===================================================================
--- trunk/liblwgeom/lwin_wkt_lex.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwin_wkt_lex.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -78,7 +78,7 @@
 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 
 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types. 
+ * if you want the limit (max/min) macros for int types.
  */
 #ifndef __STDC_LIMIT_MACROS
 #define __STDC_LIMIT_MACROS 1
@@ -95,7 +95,7 @@
 typedef signed char flex_int8_t;
 typedef short int flex_int16_t;
 typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t; 
+typedef unsigned char flex_uint8_t;
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
 
@@ -212,7 +212,7 @@
 #define EOB_ACT_LAST_MATCH 2
 
     #define YY_LESS_LINENO(n)
-    
+
 /* Return all but the first "n" matched characters back to the input stream. */
 #define yyless(n) \
 	do \
@@ -269,7 +269,7 @@
 
     int yy_bs_lineno; /**< The line count. */
     int yy_bs_column; /**< The column count. */
-    
+
 	/* Whether to try to fill the input buffer when we reach the
 	 * end of it.
 	 */
@@ -653,29 +653,29 @@
 #include "lwin_wkt_parse.h"
 #include "lwgeom_log.h"
 
-static YY_BUFFER_STATE wkt_yy_buf_state; 
+static YY_BUFFER_STATE wkt_yy_buf_state;
 
 
 /*
 * Set up the lexer!
 */
-void wkt_lexer_init(char *src) 
-{ 
-	wkt_yy_buf_state = wkt_yy_scan_string(src); 
-} 
+void wkt_lexer_init(char *src)
+{
+	wkt_yy_buf_state = wkt_yy_scan_string(src);
+}
 
 /*
 * Clean up the lexer!
 */
-void wkt_lexer_close() 
-{ 
-	wkt_yy_delete_buffer(wkt_yy_buf_state); 
-} 
+void wkt_lexer_close()
+{
+	wkt_yy_delete_buffer(wkt_yy_buf_state);
+}
 
 /*
 * Handle errors due to unexpected junk in WKT strings.
 */
-static void wkt_lexer_unknown() 
+static void wkt_lexer_unknown()
 {
 	/* Set the global error state */
 	global_parser_result.errcode = PARSER_ERROR_OTHER;
@@ -684,8 +684,8 @@
 }
 
 
-/* 
-* This macro is magically run after a rule is found but before the main 
+/*
+* This macro is magically run after a rule is found but before the main
 * action is run. We use it to update the parse location information
 * so we can report on where things fail. Also optionally to dump
 * debugging info.
@@ -697,7 +697,7 @@
 	LWDEBUGF(5,"lex: %s", wkt_yytext); \
 	} while (0);
 
- 
+
 #define YY_NO_INPUT 1
 /* Suppress the default implementations. */
 #line 679 "lwin_wkt_lex.c"
@@ -879,7 +879,7 @@
 	register yy_state_type yy_current_state;
 	register char *yy_cp, *yy_bp;
 	register int yy_act;
-    
+
 #line 67 "lwin_wkt_lex.l"
 
 
@@ -965,19 +965,19 @@
 case 1:
 YY_RULE_SETUP
 #line 69 "lwin_wkt_lex.l"
-{  
+{
 	LWDEBUG(5,"DOUBLE");
-	wkt_yylval.doublevalue = atof(wkt_yytext); 
-	return DOUBLE_TOK; 
+	wkt_yylval.doublevalue = atof(wkt_yytext);
+	return DOUBLE_TOK;
 	}
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
 #line 75 "lwin_wkt_lex.l"
-{ 
+{
 	LWDEBUG(5,"SRID");
-	wkt_yylval.integervalue = wkt_lexer_read_srid(wkt_yytext); 
-	return SRID_TOK; 
+	wkt_yylval.integervalue = wkt_lexer_read_srid(wkt_yytext);
+	return SRID_TOK;
 	}
 	YY_BREAK
 case 3:
@@ -1063,10 +1063,10 @@
 case 19:
 YY_RULE_SETUP
 #line 98 "lwin_wkt_lex.l"
-{ 
+{
 	LWDEBUG(5,"DIMENSIONALITY");
 	wkt_yylval.stringvalue = wkt_yytext;
-	return DIMENSIONALITY_TOK; 
+	return DIMENSIONALITY_TOK;
 	}
 	YY_BREAK
 case 20:
@@ -1099,9 +1099,9 @@
 YY_RULE_SETUP
 #line 111 "lwin_wkt_lex.l"
 { /* Error out and stop parsing on unknown/unexpected characters */
-	LWDEBUG(5,"UNKNOWN"); 
+	LWDEBUG(5,"UNKNOWN");
 	wkt_lexer_unknown();
-	yyterminate(); 
+	yyterminate();
 	}
 	YY_BREAK
 case 26:
@@ -1388,7 +1388,7 @@
 {
 	register yy_state_type yy_current_state;
 	register char *yy_cp;
-    
+
 	yy_current_state = (yy_start);
 
 	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
@@ -1448,7 +1448,7 @@
 
 {
 	int c;
-    
+
 	*(yy_c_buf_p) = (yy_hold_char);
 
 	if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
@@ -1515,12 +1515,12 @@
 
 /** Immediately switch to a different input stream.
  * @param input_file A readable stream.
- * 
+ *
  * @note This function does not reset the start condition to @c INITIAL .
  */
     void wkt_yyrestart  (FILE * input_file )
 {
-    
+
 	if ( ! YY_CURRENT_BUFFER ){
         wkt_yyensure_buffer_stack ();
 		YY_CURRENT_BUFFER_LVALUE =
@@ -1533,11 +1533,11 @@
 
 /** Switch to a different input buffer.
  * @param new_buffer The new input buffer.
- * 
+ *
  */
     void wkt_yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
 {
-    
+
 	/* TODO. We should be able to replace this entire function body
 	 * with
 	 *		wkt_yypop_buffer_state();
@@ -1577,13 +1577,13 @@
 /** Allocate and initialize an input buffer state.
  * @param file A readable stream.
  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
- * 
+ *
  * @return the allocated buffer state.
  */
     YY_BUFFER_STATE wkt_yy_create_buffer  (FILE * file, int  size )
 {
 	YY_BUFFER_STATE b;
-    
+
 	b = (YY_BUFFER_STATE) wkt_yyalloc(sizeof( struct yy_buffer_state )  );
 	if ( ! b )
 		YY_FATAL_ERROR( "out of dynamic memory in wkt_yy_create_buffer()" );
@@ -1606,11 +1606,11 @@
 
 /** Destroy the buffer.
  * @param b a buffer created with wkt_yy_create_buffer()
- * 
+ *
  */
     void wkt_yy_delete_buffer (YY_BUFFER_STATE  b )
 {
-    
+
 	if ( ! b )
 		return;
 
@@ -1631,7 +1631,7 @@
 
 {
 	int oerrno = errno;
-    
+
 	wkt_yy_flush_buffer(b );
 
 	b->yy_input_file = file;
@@ -1647,13 +1647,13 @@
     }
 
         b->yy_is_interactive = 0;
-    
+
 	errno = oerrno;
 }
 
 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
- * 
+ *
  */
     void wkt_yy_flush_buffer (YY_BUFFER_STATE  b )
 {
@@ -1682,7 +1682,7 @@
  *  the current state. This function will allocate the stack
  *  if necessary.
  *  @param new_buffer The new state.
- *  
+ *
  */
 void wkt_yypush_buffer_state (YY_BUFFER_STATE new_buffer )
 {
@@ -1712,7 +1712,7 @@
 
 /** Removes and deletes the top of the stack, if present.
  *  The next element becomes the new top.
- *  
+ *
  */
 void wkt_yypop_buffer_state (void)
 {
@@ -1736,7 +1736,7 @@
 static void wkt_yyensure_buffer_stack (void)
 {
 	yy_size_t num_to_alloc;
-    
+
 	if (!(yy_buffer_stack)) {
 
 		/* First allocation is just for 2 elements, since we don't know if this
@@ -1749,7 +1749,7 @@
 								);
 		if ( ! (yy_buffer_stack) )
 			YY_FATAL_ERROR( "out of dynamic memory in wkt_yyensure_buffer_stack()" );
-								  
+								
 		memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
 				
 		(yy_buffer_stack_max) = num_to_alloc;
@@ -1779,13 +1779,13 @@
 /** Setup the input buffer state to scan directly from a user-specified character buffer.
  * @param base the character buffer
  * @param size the size in bytes of the character buffer
- * 
- * @return the newly allocated buffer state object. 
+ *
+ * @return the newly allocated buffer state object.
  */
 YY_BUFFER_STATE wkt_yy_scan_buffer  (char * base, yy_size_t  size )
 {
 	YY_BUFFER_STATE b;
-    
+
 	if ( size < 2 ||
 	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
 	     base[size-1] != YY_END_OF_BUFFER_CHAR )
@@ -1814,14 +1814,14 @@
 /** Setup the input buffer state to scan a string. The next call to wkt_yylex() will
  * scan from a @e copy of @a str.
  * @param yystr a NUL-terminated string to scan
- * 
+ *
  * @return the newly allocated buffer state object.
  * @note If you want to scan bytes that may contain NUL values, then use
  *       wkt_yy_scan_bytes() instead.
  */
 YY_BUFFER_STATE wkt_yy_scan_string (yyconst char * yystr )
 {
-    
+
 	return wkt_yy_scan_bytes(yystr,strlen(yystr) );
 }
 
@@ -1829,7 +1829,7 @@
  * scan from a @e copy of @a bytes.
  * @param yybytes the byte buffer to scan
  * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
- * 
+ *
  * @return the newly allocated buffer state object.
  */
 YY_BUFFER_STATE wkt_yy_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )
@@ -1838,7 +1838,7 @@
 	char *buf;
 	yy_size_t n;
 	int i;
-    
+
 	/* Get memory for full buffer, including space for trailing EOB's. */
 	n = _yybytes_len + 2;
 	buf = (char *) wkt_yyalloc(n  );
@@ -1892,16 +1892,16 @@
 /* Accessor  methods (get/set functions) to struct members. */
 
 /** Get the current line number.
- * 
+ *
  */
 int wkt_yyget_lineno  (void)
 {
-        
+
     return wkt_yylineno;
 }
 
 /** Get the input stream.
- * 
+ *
  */
 FILE *wkt_yyget_in  (void)
 {
@@ -1909,7 +1909,7 @@
 }
 
 /** Get the output stream.
- * 
+ *
  */
 FILE *wkt_yyget_out  (void)
 {
@@ -1917,7 +1917,7 @@
 }
 
 /** Get the length of the current token.
- * 
+ *
  */
 yy_size_t wkt_yyget_leng  (void)
 {
@@ -1925,7 +1925,7 @@
 }
 
 /** Get the current token.
- * 
+ *
  */
 
 char *wkt_yyget_text  (void)
@@ -1935,18 +1935,18 @@
 
 /** Set the current line number.
  * @param line_number
- * 
+ *
  */
 void wkt_yyset_lineno (int  line_number )
 {
-    
+
     wkt_yylineno = line_number;
 }
 
 /** Set the input stream. This does not discard the current
  * input buffer.
  * @param in_str A readable stream.
- * 
+ *
  * @see wkt_yy_switch_to_buffer
  */
 void wkt_yyset_in (FILE *  in_str )
@@ -2000,7 +2000,7 @@
 /* wkt_yylex_destroy is for both reentrant and non-reentrant scanners. */
 int wkt_yylex_destroy  (void)
 {
-    
+
     /* Pop the buffer stack, destroying each element. */
 	while(YY_CURRENT_BUFFER){
 		wkt_yy_delete_buffer(YY_CURRENT_BUFFER  );

Modified: trunk/liblwgeom/lwin_wkt_parse.c
===================================================================
--- trunk/liblwgeom/lwin_wkt_parse.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwin_wkt_parse.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -118,16 +118,16 @@
 /* Turn on/off verbose parsing (turn off for production) */
 int wkt_yydebug = 0;
 
-/* 
-* Error handler called by the bison parser. Mostly we will be 
+/*
+* Error handler called by the bison parser. Mostly we will be
 * catching our own errors and filling out the message and errlocation
-* from WKT_ERROR in the grammar, but we keep this one 
+* from WKT_ERROR in the grammar, but we keep this one
 * around just in case.
 */
 void wkt_yyerror(const char *str)
 {
 	/* If we haven't already set a message and location, let's set one now. */
-	if ( ! global_parser_result.message ) 
+	if ( ! global_parser_result.message )
 	{
 		global_parser_result.message = parser_error_messages[PARSER_ERROR_OTHER];
 		global_parser_result.errcode = PARSER_ERROR_OTHER;
@@ -167,7 +167,7 @@
 	wkt_lexer_close(); /* Clean up lexer */
 	
 	/* A non-zero parser return is an error. */
-	if ( parse_rv != 0 ) 
+	if ( parse_rv != 0 )
 	{
 		if( ! global_parser_result.errcode )
 		{
@@ -176,9 +176,9 @@
 			global_parser_result.errlocation = wkt_yylloc.last_column;
 		}
 
-		LWDEBUGF(5, "error returned by wkt_yyparse() @ %d: [%d] '%s'", 
-		            global_parser_result.errlocation, 
-		            global_parser_result.errcode, 
+		LWDEBUGF(5, "error returned by wkt_yyparse() @ %d: [%d] '%s'",
+		            global_parser_result.errlocation,
+		            global_parser_result.errcode,
 		            global_parser_result.message);
 		
 		/* Copy the global values into the return pointer */

Modified: trunk/liblwgeom/lwline.c
===================================================================
--- trunk/liblwgeom/lwline.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwline.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -96,7 +96,7 @@
 
 /* @brief Clone LWLINE object. Serialized point lists are not copied.
  *
- * @see ptarray_clone 
+ * @see ptarray_clone
  */
 LWLINE *
 lwline_clone(const LWLINE *g)
@@ -277,7 +277,7 @@
 
 	if ( pa->npoints > 0 )
 		line = lwline_construct(srid, NULL, pa);
-	else 
+	else
 		line = lwline_construct_empty(srid, hasz, hasm);
 	
 	return line;
@@ -298,7 +298,7 @@
 	char hasm = lwgeom_has_m(lwgeom);
 	uint32_t npoints = mpoint->ngeoms;
 
-	if ( lwgeom_is_empty(lwgeom) ) 
+	if ( lwgeom_is_empty(lwgeom) )
 	{
 		return lwline_construct_empty(srid, hasz, hasm);
 	}
@@ -564,7 +564,7 @@
 			ptarray_append_point(pa, &pt, LW_TRUE);
 		}
 		/* Return null for collapse */
-		else 
+		else
 		{
 			ptarray_free(pa);
 			return NULL;

Modified: trunk/liblwgeom/lwout_geojson.c
===================================================================
--- trunk/liblwgeom/lwout_geojson.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwout_geojson.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -53,9 +53,9 @@
 
 	if ( precision > OUT_MAX_DOUBLE_PRECISION ) precision = OUT_MAX_DOUBLE_PRECISION;
 
-	if (has_bbox) 
+	if (has_bbox)
 	{
-		/* Whether these are geography or geometry, 
+		/* Whether these are geography or geometry,
 		   the GeoJSON expects a cartesian bounding box */
 		lwgeom_calculate_gbox_cartesian(geom, &tmp);
 		bbox = &tmp;

Modified: trunk/liblwgeom/lwout_gml.c
===================================================================
--- trunk/liblwgeom/lwout_gml.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwout_gml.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1092,7 +1092,7 @@
 	return output;
 }
 
-static size_t 
+static size_t
 asgml3_compound_size(const LWCOMPOUND *col, const char *srs, int precision, int opts, const char *prefix, const char *id )
 {
 	int i;
@@ -1134,7 +1134,7 @@
 	return size;
 }
 
-static size_t 
+static size_t
 asgml3_compound_buf(const LWCOMPOUND *col, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
 {
 	LWGEOM *subgeom;

Modified: trunk/liblwgeom/lwout_kml.c
===================================================================
--- trunk/liblwgeom/lwout_kml.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwout_kml.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -18,7 +18,7 @@
  *
  **********************************************************************
  *
- * Copyright 2006 Corporacion Autonoma Regional de Santander 
+ * Copyright 2006 Corporacion Autonoma Regional de Santander
  * Copyright 2010 Paul Ramsey <pramsey at cleverelephant.ca>
  *
  **********************************************************************/
@@ -65,7 +65,7 @@
 	return kml;
 }
 
-static int 
+static int
 lwgeom_to_kml2_sb(const LWGEOM *geom, int precision, const char *prefix, stringbuffer_t *sb)
 {
 	switch (geom->type)
@@ -90,7 +90,7 @@
 	}
 }
 
-static int 
+static int
 ptarray_to_kml2_sb(const POINTARRAY *pa, int precision, stringbuffer_t *sb)
 {
 	int i, j;
@@ -110,7 +110,7 @@
 			{
 				if ( stringbuffer_aprintf(sb, "%.*f", precision, d[j]) < 0 ) return LW_FAILURE;
 			}
-			else 
+			else
 			{
 				if ( stringbuffer_aprintf(sb, "%g", d[j]) < 0 ) return LW_FAILURE;
 			}
@@ -121,7 +121,7 @@
 }
 
 
-static int 
+static int
 lwpoint_to_kml2_sb(const LWPOINT *point, int precision, const char *prefix, stringbuffer_t *sb)
 {
 	/* Open point */
@@ -133,7 +133,7 @@
 	return LW_SUCCESS;
 }
 
-static int 
+static int
 lwline_to_kml2_sb(const LWLINE *line, int precision, const char *prefix, stringbuffer_t *sb)
 {
 	/* Open linestring */
@@ -146,7 +146,7 @@
 	return LW_SUCCESS;
 }
 
-static int 
+static int
 lwpoly_to_kml2_sb(const LWPOLY *poly, int precision, const char *prefix, stringbuffer_t *sb)
 {
 	int i, rv;
@@ -178,7 +178,7 @@
 	return LW_SUCCESS;
 }
 
-static int 
+static int
 lwcollection_to_kml2_sb(const LWCOLLECTION *col, int precision, const char *prefix, stringbuffer_t *sb)
 {
 	int i, rv;

Modified: trunk/liblwgeom/lwout_svg.c
===================================================================
--- trunk/liblwgeom/lwout_svg.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwout_svg.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -570,7 +570,7 @@
 
 	ptr = output;
 
-	if (precision >= 0) 
+	if (precision >= 0)
 	{
 		f = pow(10, precision);
 	}

Modified: trunk/liblwgeom/lwout_wkb.c
===================================================================
--- trunk/liblwgeom/lwout_wkb.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwout_wkb.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -36,7 +36,7 @@
 */
 static char *hexchr = "0123456789ABCDEF";
 
-char* hexbytes_from_bytes(uint8_t *bytes, size_t size) 
+char* hexbytes_from_bytes(uint8_t *bytes, size_t size)
 {
 	char *hex;
 	int i;
@@ -67,7 +67,7 @@
 	if ( variant & WKB_NO_SRID )
 		return LW_FALSE;
 		
-	/* We can only add an SRID if the geometry has one, and the 
+	/* We can only add an SRID if the geometry has one, and the
 	   WKB form is extended */	
 	if ( (variant & WKB_EXTENDED) && lwgeom_has_srid(geom) )
 		return LW_TRUE;
@@ -392,7 +392,7 @@
 		buf += size;
 	}
 	/* Copy coordinates one-by-one otherwise */
-	else 
+	else
 	{
 		for ( i = 0; i < pa->npoints; i++ )
 		{
@@ -596,7 +596,7 @@
 
 /*
 * MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION
-* MULTICURVE, COMPOUNDCURVE, MULTISURFACE, CURVEPOLYGON, TIN, 
+* MULTICURVE, COMPOUNDCURVE, MULTISURFACE, CURVEPOLYGON, TIN,
 * POLYHEDRALSURFACE
 */
 static size_t lwcollection_to_wkb_size(const LWCOLLECTION *col, uint8_t variant)
@@ -799,7 +799,7 @@
 	if ( ! (variant & WKB_NDR || variant & WKB_XDR) ||
 	       (variant & WKB_NDR && variant & WKB_XDR) )
 	{
-		if ( getMachineEndian() == NDR ) 
+		if ( getMachineEndian() == NDR )
 			variant = variant | WKB_NDR;
 		else
 			variant = variant | WKB_XDR;

Modified: trunk/liblwgeom/lwout_wkt.c
===================================================================
--- trunk/liblwgeom/lwout_wkt.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwout_wkt.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -64,15 +64,15 @@
 
 /*
 * Write an empty token out, padding with a space if
-* necessary. 
+* necessary.
 */
 static void empty_to_wkt_sb(stringbuffer_t *sb)
 {
 	if ( ! strchr(" ,(", stringbuffer_lastchar(sb)) ) /* "EMPTY" */
-	{ 
-		stringbuffer_append(sb, " "); 
+	{
+		stringbuffer_append(sb, " ");
 	}
-	stringbuffer_append(sb, "EMPTY"); 
+	stringbuffer_append(sb, "EMPTY");
 }
 
 /*
@@ -155,7 +155,7 @@
 		dimension_qualifiers_to_wkt_sb((LWGEOM*)line, sb, variant);
 	}
 	if ( lwline_is_empty(line) )
-	{  
+	{
 		empty_to_wkt_sb(sb);
 		return;
 	}
@@ -513,7 +513,7 @@
 }
 
 /*
-* TRIANGLE 
+* TRIANGLE
 */
 static void lwtriangle_to_wkt_sb(const LWTRIANGLE *tri, stringbuffer_t *sb, int precision, uint8_t variant)
 {
@@ -523,14 +523,14 @@
 		dimension_qualifiers_to_wkt_sb((LWGEOM*)tri, sb, variant);
 	}
 	if ( lwtriangle_is_empty(tri) )
-	{  
+	{
 		empty_to_wkt_sb(sb);
 		return;
 	}
 
 	stringbuffer_append(sb, "("); /* Triangles have extraneous brackets */
 	ptarray_to_wkt_sb(tri->points, sb, precision, variant);
-	stringbuffer_append(sb, ")"); 
+	stringbuffer_append(sb, ")");
 }
 
 /*

Modified: trunk/liblwgeom/lwout_x3d.c
===================================================================
--- trunk/liblwgeom/lwout_x3d.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwout_x3d.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -442,7 +442,7 @@
         case MULTIPOINTTYPE:
             x3dtype = "PointSet";
             if ( dimension == 2 ){ /** Use Polypoint2D instead **/
-                x3dtype = "Polypoint2D";   
+                x3dtype = "Polypoint2D";
                 ptr += sprintf(ptr, "<%s %s point='", x3dtype, defid);
             }
             else {
@@ -466,7 +466,7 @@
             return 0;
     }
     if (dimension == 3){
-		if ( X3D_USE_GEOCOORDS(opts) ) 
+		if ( X3D_USE_GEOCOORDS(opts) )
 			ptr += sprintf(ptr, "<GeoCoordinate geoSystem='\"GD\" \"WE\" \"%s\"' point='", ((opts & LW_X3D_FLIP_XY) ? "latitude_first" : "longitude_first") );
 		else
         	ptr += sprintf(ptr, "<Coordinate point='");
@@ -496,7 +496,7 @@
 	if (dimension == 3){
 	    ptr += sprintf(ptr, "' /></%s>", x3dtype);
 	}
-	else { ptr += sprintf(ptr, "' />"); }    
+	else { ptr += sprintf(ptr, "' />"); }
 	return (ptr-output);
 }
 
@@ -574,7 +574,7 @@
 		j += k;
 	}
 
-	if ( X3D_USE_GEOCOORDS(opts) ) 
+	if ( X3D_USE_GEOCOORDS(opts) )
 		ptr += sprintf(ptr, "'><GeoCoordinate geoSystem='\"GD\" \"WE\" \"%s\"' point='", ( (opts & LW_X3D_FLIP_XY) ? "latitude_first" : "longitude_first") );
 	else ptr += sprintf(ptr, "'><Coordinate point='");
 

Modified: trunk/liblwgeom/lwpoint.c
===================================================================
--- trunk/liblwgeom/lwpoint.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwpoint.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -215,7 +215,7 @@
 
 /* @brief Clone LWPOINT object. Serialized point lists are not copied.
  *
- * @see ptarray_clone 
+ * @see ptarray_clone
  */
 LWPOINT *
 lwpoint_clone(const LWPOINT *g)

Modified: trunk/liblwgeom/lwpoly.c
===================================================================
--- trunk/liblwgeom/lwpoly.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwpoly.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -145,7 +145,7 @@
 
 /* @brief Clone LWLINE object. Serialized point lists are not copied.
  *
- * @see ptarray_clone 
+ * @see ptarray_clone
  */
 LWPOLY *
 lwpoly_clone(const LWPOLY *g)
@@ -182,13 +182,13 @@
 * Add a ring to a polygon. Point array will be referenced, not copied.
 */
 int
-lwpoly_add_ring(LWPOLY *poly, POINTARRAY *pa) 
+lwpoly_add_ring(LWPOLY *poly, POINTARRAY *pa)
 {
-	if( ! poly || ! pa ) 
+	if( ! poly || ! pa )
 		return LW_FAILURE;
 		
 	/* We have used up our storage, add some more. */
-	if( poly->nrings >= poly->maxrings ) 
+	if( poly->nrings >= poly->maxrings )
 	{
 		int new_maxrings = 2 * (poly->nrings + 1);
 		poly->rings = lwrealloc(poly->rings, new_maxrings * sizeof(POINTARRAY*));
@@ -400,7 +400,7 @@
 		/* We'll still let holes collapse, but if we're preserving */
 		/* and this is a shell, we ensure it is kept */
 		if ( preserve_collapsed && i == 0 )
-			minvertices = 4; 
+			minvertices = 4;
 			
 		opts = ptarray_simplify(ipoly->rings[i], dist, minvertices);
 
@@ -444,7 +444,7 @@
 	double poly_area = 0.0;
 	int i;
 	
-	if ( ! poly ) 
+	if ( ! poly )
 		lwerror("lwpoly_area called with null polygon pointer!");
 
 	for ( i=0; i < poly->nrings; i++ )
@@ -453,14 +453,14 @@
 		double ringarea = 0.0;
 
 		/* Empty or messed-up ring. */
-		if ( ring->npoints < 3 ) 
-			continue; 
+		if ( ring->npoints < 3 )
+			continue;
 		
 		ringarea = fabs(ptarray_signed_area(ring));
 		if ( i == 0 ) /* Outer ring, positive area! */
-			poly_area += ringarea; 
+			poly_area += ringarea;
 		else /* Inner ring, negative area! */
-			poly_area -= ringarea; 
+			poly_area -= ringarea;
 	}
 
 	return poly_area;
@@ -508,7 +508,7 @@
 {
 	int i = 0;
 	
-	if ( poly->nrings == 0 ) 
+	if ( poly->nrings == 0 )
 		return LW_TRUE;
 		
 	for ( i = 0; i < poly->nrings; i++ )
@@ -528,7 +528,7 @@
 	return LW_TRUE;
 }
 
-int 
+int
 lwpoly_startpoint(const LWPOLY* poly, POINT4D* pt)
 {
 	if ( poly->nrings < 1 )
@@ -603,7 +603,7 @@
 
 	LWDEBUGF(3, "lwpoly_grid: simplified polygon with %d rings", opoly->nrings);
 
-	if ( ! opoly->nrings ) 
+	if ( ! opoly->nrings )
 	{
 		lwpoly_free(opoly);
 		return NULL;

Modified: trunk/liblwgeom/lwprint.c
===================================================================
--- trunk/liblwgeom/lwprint.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwprint.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -340,7 +340,7 @@
 	{
 		lwerror("Bad format, degrees (DD.DDD) number of digits was greater than our working limit.");
 	}
-	if(deg_piece >= 0) 
+	if(deg_piece >= 0)
 	{
 		sprintf(pieces[deg_piece], "%*.*f", deg_digits, deg_dec_digits, degrees);
 	}

Modified: trunk/liblwgeom/lwstroke.c
===================================================================
--- trunk/liblwgeom/lwstroke.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwstroke.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -78,7 +78,7 @@
 		col = (LWCOLLECTION *)geom;
 		for (i=0; i<col->ngeoms; i++)
 		{
-			if (lwgeom_has_arc(col->geoms[i]) == LW_TRUE) 
+			if (lwgeom_has_arc(col->geoms[i]) == LW_TRUE)
 				return LW_TRUE;
 		}
 		return LW_FALSE;
@@ -141,7 +141,7 @@
 	if ( (radius < 0.0 || p2_side == 0) && ! is_circle )
 	    return NULL;
 		
-	/* The side of the p1/p3 line that p2 falls on dictates the sweep  
+	/* The side of the p1/p3 line that p2 falls on dictates the sweep
 	   direction from p1 to p3. */
 	if ( p2_side == -1 )
 		clockwise = LW_TRUE;
@@ -189,7 +189,7 @@
 
 	/* Sweep from a1 to a3 */
 	ptarray_append_point(pa, p1, LW_FALSE);
-	for ( angle = a1 + increment; clockwise ? angle > a3 : angle < a3; angle += increment ) 
+	for ( angle = a1 + increment; clockwise ? angle > a3 : angle < a3; angle += increment )
 	{
 		pt.x = center.x + radius * cos(angle);
 		pt.y = center.y + radius * sin(angle);
@@ -530,7 +530,7 @@
 	LWDEBUGF(4, "circle_radius=%g, b_distance=%g, diff=%g, percentage=%g", radius, b_distance, diff, diff/radius);
 	
 	/* Is the point b on the circle? */
-	if ( diff < EPSILON_SQLMM ) 
+	if ( diff < EPSILON_SQLMM )
 	{
 		int a2_side = lw_segment_side(t1, t3, t2);
 		int b_side  = lw_segment_side(t1, t3, tb);
@@ -540,7 +540,7 @@
 		/* Is the angle similar to the previous one ? */
 		diff = fabs(angle1 - angle2);
 		LWDEBUGF(4, " angle1: %g, angle2: %g, diff:%g", angle1, angle2, diff);
-		if ( diff > EPSILON_SQLMM ) 
+		if ( diff > EPSILON_SQLMM )
 		{
 			return LW_FALSE;
 		}
@@ -687,7 +687,7 @@
 				lw_arc_center((POINT2D*)&first, (POINT2D*)&b, (POINT2D*)&a1, (POINT2D*)&center);
 				angle = lw_arc_angle((POINT2D*)&first, (POINT2D*)&center, (POINT2D*)&b);
         int p2_side = lw_segment_side((POINT2D*)&first, (POINT2D*)&a1, (POINT2D*)&b);
-        if ( p2_side >= 0 ) angle = -angle; 
+        if ( p2_side >= 0 ) angle = -angle;
 
 				if ( angle < 0 ) angle = 2 * M_PI + angle;
 				num_quadrants = ( 4 * angle ) / ( 2 * M_PI );
@@ -822,7 +822,7 @@
 	return (LWGEOM *)lwcollection_construct(MULTICURVETYPE, mline->srid, NULL, mline->ngeoms, geoms);
 }
 
-LWGEOM * 
+LWGEOM *
 lwmpolygon_unstroke(const LWMPOLY *mpoly)
 {
 	LWGEOM **geoms;

Modified: trunk/liblwgeom/lwtriangle.c
===================================================================
--- trunk/liblwgeom/lwtriangle.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwtriangle.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -93,7 +93,7 @@
 
 /* @brief Clone LWTRIANGLE object. Serialized point lists are not copied.
  *
- * @see ptarray_clone 
+ * @see ptarray_clone
  */
 LWTRIANGLE *
 lwtriangle_clone(const LWTRIANGLE *g)
@@ -180,7 +180,7 @@
 }
 
 /**
- * Find the area of the outer ring 
+ * Find the area of the outer ring
  */
 double
 lwtriangle_area(const LWTRIANGLE *triangle)
@@ -208,17 +208,17 @@
 double
 lwtriangle_perimeter(const LWTRIANGLE *triangle)
 {
-	if( triangle->points ) 
+	if( triangle->points )
 		return ptarray_length(triangle->points);
-	else 
+	else
 		return 0.0;
 }
 
 double
 lwtriangle_perimeter_2d(const LWTRIANGLE *triangle)
 {
-	if( triangle->points ) 
+	if( triangle->points )
 		return ptarray_length_2d(triangle->points);
-	else 
+	else
 		return 0.0;
 }

Modified: trunk/liblwgeom/lwutil.c
===================================================================
--- trunk/liblwgeom/lwutil.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/lwutil.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -188,7 +188,7 @@
 }
 
 /**
- * This function is called by programs which want to set up custom handling 
+ * This function is called by programs which want to set up custom handling
  * for memory management and error reporting
  *
  * Only non-NULL values change their respective handler
@@ -212,7 +212,7 @@
 	if ( debuglogger ) lwdebug_var = debuglogger;
 }
 
-const char* 
+const char*
 lwtype_name(uint8_t type)
 {
 	if ( type > 15 )

Modified: trunk/liblwgeom/measures.c
===================================================================
--- trunk/liblwgeom/measures.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/measures.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -53,13 +53,13 @@
 LWGEOM *
 lwgeom_closest_point(const LWGEOM *lw1, const LWGEOM *lw2)
 {
-  return lw_dist2d_distancepoint(lw1, lw2, lw1->srid, DIST_MIN);  
+  return lw_dist2d_distancepoint(lw1, lw2, lw1->srid, DIST_MIN);
 }
 
 LWGEOM *
 lwgeom_furthest_point(const LWGEOM *lw1, const LWGEOM *lw2)
 {
-  return lw_dist2d_distancepoint(lw1, lw2, lw1->srid, DIST_MAX);  
+  return lw_dist2d_distancepoint(lw1, lw2, lw1->srid, DIST_MAX);
 }
 
 
@@ -348,9 +348,9 @@
 			/*If one of geometries is empty, return. True here only means continue searching. False would have stoped the process*/
 			if (lwgeom_is_empty(g1)||lwgeom_is_empty(g2)) return LW_TRUE;
 
-			if ( (dl->mode != DIST_MAX) && 
-				 (! lw_dist2d_check_overlap(g1, g2)) && 
-			     (g1->type == LINETYPE || g1->type == POLYGONTYPE) && 
+			if ( (dl->mode != DIST_MAX) &&
+				 (! lw_dist2d_check_overlap(g1, g2)) &&
+			     (g1->type == LINETYPE || g1->type == POLYGONTYPE) &&
 			     (g2->type == LINETYPE || g2->type == POLYGONTYPE) )	
 			{
 				if (!lw_dist2d_distribute_fast(g1, g2, dl)) return LW_FALSE;
@@ -750,7 +750,7 @@
 		LWDEBUGF(3, " distance from ring %d: %f, mindist: %f",
 		         i, dl->distance, dl->tolerance);
 		/* just a check if  the answer is already given */
-		if (dl->distance<=dl->tolerance && dl->mode == DIST_MIN) return LW_TRUE; 
+		if (dl->distance<=dl->tolerance && dl->mode == DIST_MIN) return LW_TRUE;
 	}
 
 	/*
@@ -808,8 +808,8 @@
 		if ( ! lw_dist2d_recursive((LWGEOM*)line, poly->rings[i], dl) )
 			return LW_FALSE;
 
-		if ( dl->distance<=dl->tolerance && dl->mode == DIST_MIN ) 
-			return LW_TRUE; 
+		if ( dl->distance<=dl->tolerance && dl->mode == DIST_MIN )
+			return LW_TRUE;
 	}
 
 	for ( i=1; i < poly->nrings; i++ )
@@ -1100,7 +1100,7 @@
 
 	A1 = getPoint2d_cp(pa, 0);
 
-	if ( ! lw_dist2d_pt_pt(p, A1, dl) ) 
+	if ( ! lw_dist2d_pt_pt(p, A1, dl) )
 		return LW_FALSE;
 
 	for ( t=1; t<pa->npoints; t += 2 )
@@ -1109,10 +1109,10 @@
 		A2 = getPoint2d_cp(pa, t);
 		A3 = getPoint2d_cp(pa, t+1);
 		
-		if ( lw_dist2d_pt_arc(p, A1, A2, A3, dl) == LW_FALSE ) 
+		if ( lw_dist2d_pt_arc(p, A1, A2, A3, dl) == LW_FALSE )
 			return LW_FALSE;
 
-		if ( dl->distance <= dl->tolerance && dl->mode == DIST_MIN ) 
+		if ( dl->distance <= dl->tolerance && dl->mode == DIST_MIN )
 			return LW_TRUE; /*just a check if  the answer is already given*/
 			
 		A1 = A3;
@@ -1219,8 +1219,8 @@
 				lw_dist2d_seg_arc(A1, A2, B1, B2, B3, dl);
 
 				/* If we've found a distance within tolerance, we're done */
-				if ( dl->distance <= dl->tolerance && dl->mode == DIST_MIN ) 
-					return LW_TRUE; 
+				if ( dl->distance <= dl->tolerance && dl->mode == DIST_MIN )
+					return LW_TRUE;
 
 				B1 = B3;
 			}
@@ -1269,8 +1269,8 @@
 				lw_dist2d_arc_arc(A1, A2, A3, B1, B2, B3, dl);
 
 				/* If we've found a distance within tolerance, we're done */
-				if ( dl->distance <= dl->tolerance && dl->mode == DIST_MIN ) 
-					return LW_TRUE; 
+				if ( dl->distance <= dl->tolerance && dl->mode == DIST_MIN )
+					return LW_TRUE;
 
 				B1 = B3;
 			}
@@ -1282,9 +1282,9 @@
 
 /**
 * Calculate the shortest distance between an arc and an edge.
-* Line/circle approach from http://stackoverflow.com/questions/1073336/circle-line-collision-detection 
+* Line/circle approach from http://stackoverflow.com/questions/1073336/circle-line-collision-detection
 */
-int 
+int
 lw_dist2d_seg_arc(const POINT2D *A1, const POINT2D *A2, const POINT2D *B1, const POINT2D *B2, const POINT2D *B3, DISTPTS *dl)
 {
 	POINT2D C; /* center of arc circle */
@@ -1464,7 +1464,7 @@
 	{
 		lw_dist2d_pt_pt(P, &X, dl);
 	}
-	else 
+	else
 	{
 		/* Distance is the minimum of the distances to the arc end points */
 		lw_dist2d_pt_pt(A1, P, dl);
@@ -1475,7 +1475,7 @@
 
 
 int
-lw_dist2d_arc_arc(const POINT2D *A1, const POINT2D *A2, const POINT2D *A3, 
+lw_dist2d_arc_arc(const POINT2D *A1, const POINT2D *A2, const POINT2D *A3,
                   const POINT2D *B1, const POINT2D *B2, const POINT2D *B3,
                   DISTPTS *dl)
 {
@@ -1598,7 +1598,7 @@
 		pt_in_arc_A = lw_pt_in_arc(&E, A1, A2, A3);
 		pt_in_arc_B = lw_pt_in_arc(&E, B1, B2, B3);
 
-		if ( pt_in_arc_A && pt_in_arc_B ) 
+		if ( pt_in_arc_A && pt_in_arc_B )
 		{
 			dl->p1 = dl->p2 = E;
 			dl->distance = 0.0;
@@ -1613,13 +1613,13 @@
 		pt_in_arc_A = lw_pt_in_arc(&F, A1, A2, A3);
 		pt_in_arc_B = lw_pt_in_arc(&F, B1, B2, B3);
 
-		if ( pt_in_arc_A && pt_in_arc_B ) 
+		if ( pt_in_arc_A && pt_in_arc_B )
 		{
 			dl->p1 = dl->p2 = F;
 			dl->distance = 0.0;
 			return LW_TRUE;
 		}
-	} 
+	}
 	else
 	{
 		lwerror("lw_dist2d_arc_arc: arcs neither touch, intersect nor are disjoint! INCONCEIVABLE!");
@@ -1801,7 +1801,7 @@
 	int n2 = l2->npoints;
 	
 	LISTSTRUCT *list1, *list2;
-	list1 = (LISTSTRUCT*)lwalloc(sizeof(LISTSTRUCT)*n1); 
+	list1 = (LISTSTRUCT*)lwalloc(sizeof(LISTSTRUCT)*n1);
 	list2 = (LISTSTRUCT*)lwalloc(sizeof(LISTSTRUCT)*n2);
 	
 	LWDEBUG(2, "lw_dist2d_fast_ptarray_ptarray is called");
@@ -1881,7 +1881,7 @@
 
 	if (c1m < c2m)
 	{
-		if (!lw_dist2d_pre_seg_seg(l1,l2,list1,list2,k,dl)) 
+		if (!lw_dist2d_pre_seg_seg(l1,l2,list1,list2,k,dl))
 		{
 			lwfree(list1);
 			lwfree(list2);
@@ -1891,7 +1891,7 @@
 	else
 	{
 		dl->twisted= ((dl->twisted) * (-1));
-		if (!lw_dist2d_pre_seg_seg(l2,l1,list2,list1,k,dl)) 
+		if (!lw_dist2d_pre_seg_seg(l2,l1,list2,list1,k,dl))
 		{
 			lwfree(list1);
 			lwfree(list2);

Modified: trunk/liblwgeom/measures.h
===================================================================
--- trunk/liblwgeom/measures.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/measures.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -40,7 +40,7 @@
 #define DIST_MAX		-1
 #define DIST_MIN		1
 
-/** 
+/**
 * Structure used in distance-calculations
 */
 typedef struct
@@ -103,7 +103,7 @@
 int lw_dist2d_fast_ptarray_ptarray(POINTARRAY *l1,POINTARRAY *l2, DISTPTS *dl,  GBOX *box1, GBOX *box2);
 
 /*
-* Distance calculation primitives. 
+* Distance calculation primitives.
 */
 int lw_dist2d_pt_pt  (const POINT2D *P,  const POINT2D *Q,  DISTPTS *dl);
 int lw_dist2d_pt_seg (const POINT2D *P,  const POINT2D *A1, const POINT2D *A2, DISTPTS *dl);

Modified: trunk/liblwgeom/measures3d.c
===================================================================
--- trunk/liblwgeom/measures3d.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/measures3d.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -63,11 +63,11 @@
 
 
 /**
-This function is used to create a vertical line used for cases where one if the 
-geometries lacks z-values. The vertical line crosses the 2d point that is closest 
+This function is used to create a vertical line used for cases where one if the
+geometries lacks z-values. The vertical line crosses the 2d point that is closest
 and the z-range is from maxz to minz in the geoemtrie that has z values.
 */
-static 
+static
 LWGEOM* create_v_line(const LWGEOM *lwgeom,double x, double y, int srid)
 {
 	
@@ -84,19 +84,19 @@
 	 return (LWGEOM *)lwline_from_ptarray(srid, 2, lwpoints);		
 }
 
-LWGEOM * 
+LWGEOM *
 lwgeom_closest_line_3d(const LWGEOM *lw1, const LWGEOM *lw2)
 {
 	return lw_dist3d_distanceline(lw1, lw2, lw1->srid, DIST_MIN);
 }
 
-LWGEOM * 
+LWGEOM *
 lwgeom_furthest_line_3d(LWGEOM *lw1, LWGEOM *lw2)
 {
 	return lw_dist3d_distanceline(lw1, lw2, lw1->srid, DIST_MAX);
 }
 
-LWGEOM * 
+LWGEOM *
 lwgeom_closest_point_3d(const LWGEOM *lw1, const LWGEOM *lw2)
 {
 	return lw_dist3d_distancepoint(lw1, lw2, lw1->srid, DIST_MIN);
@@ -611,8 +611,8 @@
 
 Computes point to polygon distance
 For mindistance that means:
-1)find the plane of the polygon 
-2)projecting the point to the plane of the polygon 
+1)find the plane of the polygon
+2)projecting the point to the plane of the polygon
 3)finding if that projected point is inside the polygon, if so the distance is measured to that projected point
 4) if not in polygon above, check the distance against the boundary of the polygon
 for max distance it is always point against boundary
@@ -694,7 +694,7 @@
 	if(!define_plane(poly2->rings[0], &plane))
 		return LW_FALSE;
 	
-	/*What we do here is to compare the bondary of one polygon with the other polygon 
+	/*What we do here is to compare the bondary of one polygon with the other polygon
 	and then take the second boudary comparing with the first polygon*/
 	dl->twisted=1;
 	if(!lw_dist3d_ptarray_poly(poly1->rings[0], poly2,&plane, dl))
@@ -894,7 +894,7 @@
 
 Finds the two closest points on two linesegments
 */
-int 
+int
 lw_dist3d_seg_seg(POINT3DZ *s1p1, POINT3DZ *s1p2, POINT3DZ *s2p1, POINT3DZ *s2p2, DISTPTS3D *dl)
 {
 	VECTOR3D v1, v2, vl;
@@ -934,10 +934,10 @@
 	c = DOT(v2,v2);
 	d = DOT(v1,vl);
 	e = DOT(v2,vl);
-	D = a*c - b*b; 
+	D = a*c - b*b;
 
 
-	if (D <0.000000001) 
+	if (D <0.000000001)
 	{        /* the lines are almost parallel*/
 		s1k = 0.0; /*If the lines are paralell we try by using the startpoint of first segment. If that gives a projected point on the second line outside segment 2 it wil be found that s2k is >1 or <0.*/
 		if(b>c)   /* use the largest denominator*/
@@ -949,7 +949,7 @@
 			s2k =e/c;
 		}
 	}
-	else 
+	else
 	{
 		s1k = (b*e - c*d) / D;
 		s2k = (a*e - b*d) / D;
@@ -958,7 +958,7 @@
 	/* Now we check if the projected closest point on the infinite lines is outside our segments. If so the combinations with start and end points will be tested*/
 	if(s1k<0.0||s1k>1.0||s2k<0.0||s2k>1.0)
 	{
-		if(s1k<0.0) 
+		if(s1k<0.0)
 		{
 
 			if (!lw_dist3d_pt_seg(s1p1, s2p1, s2p2, dl))
@@ -1011,7 +1011,7 @@
 
 /**
 
-Checking if the point projected on the plane of the polygon actually is inside that polygon. 
+Checking if the point projected on the plane of the polygon actually is inside that polygon.
 If so the mindistance is between that projected point and our original point.
 If not we check from original point to the bounadary.
 If the projected point is inside a hole of the polygon we check the distance to the boudary of that hole.
@@ -1074,7 +1074,7 @@
 		
 		/*If s1and s2 has different signs that means they are on different sides of the plane of the polygon.
 		That means that the edge between the points crosses the plane and might intersect with the polygon*/
-		if((s1*s2)<=0) 
+		if((s1*s2)<=0)
 		{
 			f=fabs(s1)/(fabs(s1)+fabs(s2)); /*The size of s1 and s2 is the distance from the point to the plane.*/
 			get_3dvector_from_points(&projp1, &projp2,&projp1_projp2);
@@ -1097,7 +1097,7 @@
 						break;
 					}
 				}		
-				if(intersects) 
+				if(intersects)
 				{
 					dl->distance=0.0;
 					dl->p1.x=intersectionp.x;
@@ -1199,7 +1199,7 @@
 
 Finds a point on a plane from where the original point is perpendicular to the plane
 */
-double 
+double
 project_point_on_plane(POINT3DZ *p,  PLANE3D *pl, POINT3DZ *p0)
 {
 /*In our plane definition we have a point on the plane and a normal vektor (pl.pv), perpendicular to the plane
@@ -1217,7 +1217,7 @@
 	
 	p0->x=p->x+pl->pv.x*f;
 	p0->y=p->y+pl->pv.y*f;
-	p0->z=p->z+pl->pv.z*f;      
+	p0->z=p->z+pl->pv.z*f;
 	
 	return f;		
 }

Modified: trunk/liblwgeom/measures3d.h
===================================================================
--- trunk/liblwgeom/measures3d.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/measures3d.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -48,16 +48,16 @@
 
 typedef struct
 {
-	double	x,y,z;  
+	double	x,y,z;
 }
-VECTOR3D; 
+VECTOR3D;
 
 typedef struct
 {
 	POINT3DZ		pop;  /*Point On Plane*/
 	VECTOR3D	pv;  /*Perpendicular normal vector*/
 }
-PLANE3D; 
+PLANE3D;
 
 
 /*

Modified: trunk/liblwgeom/ptarray.c
===================================================================
--- trunk/liblwgeom/ptarray.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/ptarray.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -82,14 +82,14 @@
 	/* Allocate the coordinate array */
 	if ( maxpoints > 0 )
 		pa->serialized_pointlist = lwalloc(maxpoints * ptarray_point_size(pa));
-	else 
+	else
 		pa->serialized_pointlist = NULL;
 
 	return pa;
 }
 
 /*
-* Add a point into a pointarray. Only adds as many dimensions as the 
+* Add a point into a pointarray. Only adds as many dimensions as the
 * pointarray supports.
 */
 int
@@ -99,7 +99,7 @@
 	LWDEBUGF(5,"pa = %p; p = %p; where = %d", pa, p, where);
 	LWDEBUGF(5,"pa->npoints = %d; pa->maxpoints = %d", pa->npoints, pa->maxpoints);
 	
-	if ( FLAGS_GET_READONLY(pa->flags) ) 
+	if ( FLAGS_GET_READONLY(pa->flags) )
 	{
 		lwerror("ptarray_insert_point: called on read-only point array");
 		return LW_FAILURE;
@@ -113,7 +113,7 @@
 	}
 	
 	/* If we have no storage, let's allocate some */
-	if( pa->maxpoints == 0 || ! pa->serialized_pointlist ) 
+	if( pa->maxpoints == 0 || ! pa->serialized_pointlist )
 	{
 		pa->maxpoints = 32;
 		pa->npoints = 0;
@@ -157,7 +157,7 @@
 {
 
 	/* Check for pathology */
-	if( ! pa || ! pt ) 
+	if( ! pa || ! pt )
 	{
 		lwerror("ptarray_append_point: null input");
 		return LW_FAILURE;
@@ -192,7 +192,7 @@
 	unsigned int ptsize;
 
 	/* Check for pathology */
-	if( ! pa1 || ! pa2 ) 
+	if( ! pa1 || ! pa2 )
 	{
 		lwerror("ptarray_append_ptarray: null input");
 		return LW_FAILURE;
@@ -229,11 +229,11 @@
 			--npoints;
 		}
 		else if ( gap_tolerance == 0 || ( gap_tolerance > 0 &&
-		           distance2d_pt_pt(&tmp1, &tmp2) > gap_tolerance ) ) 
+		           distance2d_pt_pt(&tmp1, &tmp2) > gap_tolerance ) )
 		{
 			lwerror("Second line start point too far from first line end point");
 			return LW_FAILURE;
-		} 
+		}
 	}
 
 	/* Check if we need extra space */
@@ -254,7 +254,7 @@
 }
 
 /*
-* Add a point into a pointarray. Only adds as many dimensions as the 
+* Add a point into a pointarray. Only adds as many dimensions as the
 * pointarray supports.
 */
 int
@@ -263,7 +263,7 @@
 	size_t ptsize = ptarray_point_size(pa);
 
 	/* Check for pathology */
-	if( ! pa ) 
+	if( ! pa )
 	{
 		lwerror("ptarray_remove_point: null input");
 		return LW_FAILURE;
@@ -289,7 +289,7 @@
 }
 
 /**
-* Build a new #POINTARRAY, but on top of someone else's ordinate array. 
+* Build a new #POINTARRAY, but on top of someone else's ordinate array.
 * Flag as read-only, so that ptarray_free() does not free the serialized_ptlist
 */
 POINTARRAY* ptarray_construct_reference_data(char hasz, char hasm, uint32_t npoints, uint8_t *ptlist)
@@ -460,7 +460,7 @@
 		{
 			pbuf.x = p1.x + (p2.x-p1.x)/segdist * dist;
 			pbuf.y = p1.y + (p2.y-p1.y)/segdist * dist;
-			if( hasz ) 
+			if( hasz )
 				pbuf.z = p1.z + (p2.z-p1.z)/segdist * dist;
 			if( hasm )
 				pbuf.m = p1.m + (p2.m-p1.m)/segdist * dist;
@@ -673,7 +673,7 @@
 }
 
 /**
-* Check for ring closure using whatever dimensionality is declared on the 
+* Check for ring closure using whatever dimensionality is declared on the
 * pointarray.
 */
 int
@@ -708,13 +708,13 @@
 * Return 1 if the point is inside the POINTARRAY, -1 if it is outside,
 * and 0 if it is on the boundary.
 */
-int 
+int
 ptarray_contains_point(const POINTARRAY *pa, const POINT2D *pt)
 {
 	return ptarray_contains_point_partial(pa, pt, LW_TRUE, NULL);
 }
 
-int 
+int
 ptarray_contains_point_partial(const POINTARRAY *pa, const POINT2D *pt, int check_closed, int *winding_number)
 {
 	int wn = 0;
@@ -744,7 +744,7 @@
 		ymax = FP_MAX(seg1->y, seg2->y);
 		
 		/* Only test segments in our vertical range */
-		if ( pt->y > ymax || pt->y < ymin ) 
+		if ( pt->y > ymax || pt->y < ymin )
 		{
 			seg1 = seg2;
 			continue;
@@ -752,9 +752,9 @@
 
 		side = lw_segment_side(seg1, seg2, pt);
 
-		/* 
-		* A point on the boundary of a ring is not contained. 
-		* WAS: if (fabs(side) < 1e-12), see #852 
+		/*
+		* A point on the boundary of a ring is not contained.
+		* WAS: if (fabs(side) < 1e-12), see #852
 		*/
 		if ( (side == 0) && lw_pt_in_seg(pt, seg1, seg2) )
 		{
@@ -807,13 +807,13 @@
 * and 0 if it is on the boundary.
 */
 
-int 
+int
 ptarrayarc_contains_point(const POINTARRAY *pa, const POINT2D *pt)
 {
 	return ptarrayarc_contains_point_partial(pa, pt, LW_TRUE /* Check closed*/, NULL);
 }
 
-int 
+int
 ptarrayarc_contains_point_partial(const POINTARRAY *pa, const POINT2D *pt, int check_closed, int *winding_number)
 {
 	int wn = 0;
@@ -844,7 +844,7 @@
 	{
 		lwerror("ptarrayarc_contains_point called on unclosed ring");
 		return LW_OUTSIDE;
-	} 
+	}
 	/* OK, it's closed. Is it just one circle? */
 	else if ( p2d_same(seg1, seg3) && pa->npoints == 3 )
 	{
@@ -861,11 +861,11 @@
 		d = distance2d_pt_pt(pt, &c);
 		if ( FP_EQUALS(d, radius) )
 			return LW_BOUNDARY; /* Boundary of circle */
-		else if ( d < radius ) 
+		else if ( d < radius )
 			return LW_INSIDE; /* Inside circle */
-		else 
+		else
 			return LW_OUTSIDE; /* Outside circle */
-	} 
+	}
 	else if ( p2d_same(seg1, pt) || p2d_same(seg3, pt) )
 	{
 		return LW_BOUNDARY; /* Boundary case */
@@ -891,15 +891,15 @@
 		
 		/* Only test segments in our vertical range */
 		lw_arc_calculate_gbox_cartesian_2d(seg1, seg2, seg3, &gbox);
-		if ( pt->y > gbox.ymax || pt->y < gbox.ymin ) 
+		if ( pt->y > gbox.ymax || pt->y < gbox.ymin )
 		{
 			seg1 = seg3;
 			continue;
 		}
 
 		/* Outside of horizontal range, and not between end points we also skip */
-		if ( (pt->x > gbox.xmax || pt->x < gbox.xmin) && 
-			 (pt->y > FP_MAX(seg1->y, seg3->y) || pt->y < FP_MIN(seg1->y, seg3->y)) ) 
+		if ( (pt->x > gbox.xmax || pt->x < gbox.xmin) &&
+			 (pt->y > FP_MAX(seg1->y, seg3->y) || pt->y < FP_MIN(seg1->y, seg3->y)) )
 		{
 			seg1 = seg3;
 			continue;
@@ -926,7 +926,7 @@
 		}
 		
 		/* Inside the arc! */
-		if ( pt->x <= gbox.xmax && pt->x >= gbox.xmin ) 
+		if ( pt->x <= gbox.xmax && pt->x >= gbox.xmin )
 		{
 			POINT2D C;
 			double radius = lw_arc_center(seg1, seg2, seg3, &C);
@@ -943,7 +943,7 @@
 				if ( side < 0 )
 					wn++;
 				/* Right side, decrement winding number */
-				if ( side > 0 ) 
+				if ( side > 0 )
 					wn--;
 			}
 		}
@@ -966,7 +966,7 @@
 }
 
 /**
-* Returns the area in cartesian units. Area is negative if ring is oriented CCW, 
+* Returns the area in cartesian units. Area is negative if ring is oriented CCW,
 * positive if it is oriented CW and zero if the ring is degenerate or flat.
 * http://en.wikipedia.org/wiki/Shoelace_formula
 */
@@ -1028,7 +1028,7 @@
 		if( hasm && ! in_hasm )
 			pt.m = 0.0;
 		ptarray_append_point(pa_out, &pt, LW_TRUE);
-	} 
+	}
 
 	return pa_out;
 }
@@ -1604,7 +1604,7 @@
 
 	if ( pts->npoints % 2 != 1 )
         lwerror("arc point array with even number of points");
-        
+
 	a1 = getPoint2d_cp(pts, 0);
 	
 	for ( i=2; i < pts->npoints; i += 2 )
@@ -1696,7 +1696,7 @@
 	
 	LWDEBUGF(5, "(n=%d, pa.npoints=%d, pa.maxpoints=%d)",n,pa->npoints,pa->maxpoints);
 
-	if ( ( n < 0 ) || 
+	if ( ( n < 0 ) ||
 	     ( n > pa->npoints ) ||
 	     ( n >= pa->maxpoints ) )
 	{
@@ -1857,7 +1857,7 @@
 	return dpa;
 }
 
-int 
+int
 ptarray_npoints_in_rect(const POINTARRAY *pa, const GBOX *gbox)
 {
 	const POINT2D *pt;

Modified: trunk/liblwgeom/stringbuffer.c
===================================================================
--- trunk/liblwgeom/stringbuffer.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/stringbuffer.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -31,7 +31,7 @@
 /**
 * Allocate a new stringbuffer_t. Use stringbuffer_destroy to free.
 */
-stringbuffer_t* 
+stringbuffer_t*
 stringbuffer_create(void)
 {
 	return stringbuffer_create_with_size(STRINGBUFFER_STARTSIZE);
@@ -61,7 +61,7 @@
 /**
 * Allocate a new stringbuffer_t. Use stringbuffer_destroy to free.
 */
-stringbuffer_t* 
+stringbuffer_t*
 stringbuffer_create_with_size(size_t size)
 {
 	stringbuffer_t *s;
@@ -74,7 +74,7 @@
 /**
 * Free the stringbuffer_t and all memory managed within it.
 */
-void 
+void
 stringbuffer_destroy(stringbuffer_t *s)
 {
 	stringbuffer_release(s);
@@ -86,7 +86,7 @@
 * without the expense of freeing and re-allocating a new
 * stringbuffer_t.
 */
-void 
+void
 stringbuffer_clear(stringbuffer_t *s)
 {
 	s->str_start[0] = '\0';
@@ -97,7 +97,7 @@
 * If necessary, expand the stringbuffer_t internal buffer to accomodate the
 * specified additional size.
 */
-static inline void 
+static inline void
 stringbuffer_makeroom(stringbuffer_t *s, size_t size_to_add)
 {
 	size_t current_size = (s->str_end - s->str_start);
@@ -118,10 +118,10 @@
 /**
 * Return the last character in the buffer.
 */
-char 
+char
 stringbuffer_lastchar(stringbuffer_t *s)
 {
-	if( s->str_end == s->str_start ) 
+	if( s->str_end == s->str_start )
 		return 0;
 	
 	return *(s->str_end - 1);
@@ -130,7 +130,7 @@
 /**
 * Append the specified string to the stringbuffer_t.
 */
-void 
+void
 stringbuffer_append(stringbuffer_t *s, const char *a)
 {
 	int alen = strlen(a); /* Length of string to append */
@@ -145,7 +145,7 @@
 * the stringbuffer. The current string will be null-terminated
 * within the internal string.
 */
-const char* 
+const char*
 stringbuffer_getstring(stringbuffer_t *s)
 {
 	return s->str_start;
@@ -156,7 +156,7 @@
 * current state of the string. Caller is responsible for
 * freeing the return value.
 */
-char* 
+char*
 stringbuffer_getstringcopy(stringbuffer_t *s)
 {
 	size_t size = (s->str_end - s->str_start) + 1;
@@ -170,7 +170,7 @@
 * Returns the length of the current string, not including the
 * null terminator (same behavior as strlen()).
 */
-int 
+int
 stringbuffer_getlength(stringbuffer_t *s)
 {
 	return (s->str_end - s->str_start);
@@ -179,7 +179,7 @@
 /**
 * Clear the stringbuffer_t and re-start it with the specified string.
 */
-void 
+void
 stringbuffer_set(stringbuffer_t *s, const char *str)
 {
 	stringbuffer_clear(s);
@@ -189,7 +189,7 @@
 /**
 * Copy the contents of src into dst.
 */
-void 
+void
 stringbuffer_copy(stringbuffer_t *dst, stringbuffer_t *src)
 {
 	stringbuffer_set(dst, stringbuffer_getstring(src));
@@ -200,7 +200,7 @@
 * using the format and argument list provided. Returns -1 on error,
 * check errno for reasons, documented in the printf man page.
 */
-static int 
+static int
 stringbuffer_avprintf(stringbuffer_t *s, const char *fmt, va_list ap)
 {
 	int maxlen = (s->capacity - (s->str_end - s->str_start));
@@ -214,7 +214,7 @@
 	va_end(ap2);
 
 	/* Propogate errors up */
-	if ( len < 0 ) 
+	if ( len < 0 )
 		#if defined(__MINGW64_VERSION_MAJOR)
 		len = _vscprintf(fmt, ap2);/**Assume windows flaky vsnprintf that returns -1 if initial buffer to small and add more space **/
 		#else
@@ -249,7 +249,7 @@
 * Returns -1 on error, check errno for reasons,
 * as documented in the printf man page.
 */
-int 
+int
 stringbuffer_aprintf(stringbuffer_t *s, const char *fmt, ...)
 {
 	int r;
@@ -264,7 +264,7 @@
 * Trims whitespace off the end of the stringbuffer. Returns
 * the number of characters trimmed.
 */
-int 
+int
 stringbuffer_trim_trailing_white(stringbuffer_t *s)
 {
 	char *ptr = s->str_end;
@@ -295,19 +295,19 @@
 * The number has to be the very last thing in the buffer. Only the
 * last number will be trimmed. Returns the number of characters
 * trimmed.
-* 
+*
 * eg: 1.22000 -> 1.22
 *     1.0 -> 1
 *     0.0 -> 0
 */
-int 
+int
 stringbuffer_trim_trailing_zeroes(stringbuffer_t *s)
 {
 	char *ptr = s->str_end;
 	char *decimal_ptr = NULL;
 	int dist;
 	
-	if ( s->str_end - s->str_start < 2) 
+	if ( s->str_end - s->str_start < 2)
 		return 0;
 
 	/* Roll backwards to find the decimal for this number */
@@ -345,8 +345,8 @@
 	if ( ptr == s->str_end )
 		return 0;
 
-	/* If we stopped at the decimal, we want to null that out. 
-	   It we stopped on a numeral, we want to preserve that, so push the 
+	/* If we stopped at the decimal, we want to null that out.
+	   It we stopped on a numeral, we want to preserve that, so push the
 	   pointer forward one space. */
 	if ( *ptr != '.' )
 		ptr++;

Modified: trunk/liblwgeom/varint.c
===================================================================
--- trunk/liblwgeom/varint.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/liblwgeom/varint.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -30,16 +30,16 @@
 
 /* -------------------------------------------------------------------------------- */
 
-static size_t 
+static size_t
 _varint_u64_encode_buf(uint64_t val, uint8_t *buf)
 {
 	uint8_t grp;	
 	uint64_t q = val;
 	uint8_t *ptr = buf;
-	while (1) 
+	while (1)
 	{
 		/* We put the 7 least significant bits in grp */
-		grp = 0x7f & q; 
+		grp = 0x7f & q;
 		/* We rightshift our input value 7 bits */
 		/* which means that the 7 next least significant bits */
 		/* becomes the 7 least significant */
@@ -98,14 +98,14 @@
 }
 
 /* Read from signed 64bit varint */
-int64_t 
+int64_t
 varint_s64_decode(const uint8_t *the_start, const uint8_t *the_end, size_t *size)
 {	
 	return unzigzag64(varint_u64_decode(the_start, the_end, size));
 }
 
 /* Read from unsigned 64bit varint */
-uint64_t 
+uint64_t
 varint_u64_decode(const uint8_t *the_start, const uint8_t *the_end, size_t *size)
 {
 	uint64_t nVal = 0;
@@ -123,16 +123,16 @@
 			/* We get here when there is more to read in the input varInt */
 			/* Here we take the least significant 7 bits of the read */
 			/* byte and put it in the most significant place in the result variable. */
-			nVal |= ((uint64_t)(nByte & 0x7f)) << nShift; 
+			nVal |= ((uint64_t)(nByte & 0x7f)) << nShift;
 			/* move the "cursor" of the input buffer step (8 bits) */
-			ptr++; 
+			ptr++;
 			/* move the cursor in the resulting variable (7 bits) */
 			nShift += 7;
 		}
 		else
 		{
 			/* move the "cursor" one step */
-			ptr++; 
+			ptr++;
 			/* Move the last read byte to the most significant */
 			/* place in the result and return the whole result */
 			*size = ptr - the_start;
@@ -143,7 +143,7 @@
 	return 0;
 }
 
-size_t 
+size_t
 varint_size(const uint8_t *the_start, const uint8_t *the_end)
 {
 	const uint8_t *ptr = the_start;
@@ -182,7 +182,7 @@
 	
 int64_t unzigzag64(uint64_t val)
 {
-        if ( val & 0x01 ) 
+        if ( val & 0x01 )
             return -1 * (int64_t)((val+1) >> 1);
         else
             return (int64_t)(val >> 1);
@@ -190,7 +190,7 @@
 	
 int32_t unzigzag32(uint32_t val)
 {
-        if ( val & 0x01 ) 
+        if ( val & 0x01 )
             return -1 * (int32_t)((val+1) >> 1);
         else
             return (int32_t)(val >> 1);
@@ -198,7 +198,7 @@
 	
 int8_t unzigzag8(uint8_t val)
 {
-        if ( val & 0x01 ) 
+        if ( val & 0x01 )
             return -1 * (int8_t)((val+1) >> 1);
         else
             return (int8_t)(val >> 1);

Modified: trunk/libpgcommon/gserialized_gist.c
===================================================================
--- trunk/libpgcommon/gserialized_gist.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/libpgcommon/gserialized_gist.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -136,7 +136,7 @@
 * encompasses the objects. For geography objects returns geocentric bounding
 * box, for geometry objects returns cartesian bounding box.
 */
-int 
+int
 gserialized_datum_get_gbox_p(Datum gsdatum, GBOX *gbox)
 {
 	char gboxmem[GIDX_MAX_SIZE];
@@ -154,8 +154,8 @@
 
 /**
 * Update the bounding box of a #GSERIALIZED, allocating a fresh one
-* if there is not enough space to just write the new box in. 
-* <em>WARNING</em> if a new object needs to be created, the 
+* if there is not enough space to just write the new box in.
+* <em>WARNING</em> if a new object needs to be created, the
 * input pointer will have to be freed by the caller! Check
 * to see if input == output. Returns null if there's a problem
 * like mismatched dimensions.
@@ -244,7 +244,7 @@
 * full object and return the box based on that. If no box is available,
 * return #LW_FAILURE, otherwise #LW_SUCCESS.
 */
-int 
+int
 gserialized_datum_get_gidx_p(Datum gsdatum, GIDX *gidx)
 {
 	GSERIALIZED *gpart;

Modified: trunk/libpgcommon/gserialized_gist.h
===================================================================
--- trunk/libpgcommon/gserialized_gist.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/libpgcommon/gserialized_gist.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,9 +1,9 @@
 
 /**********************************************************************
-**  GIDX structure. 
+**  GIDX structure.
 **
-**  This is an n-dimensional (practically, the 
-**  implementation is 2-4 dimensions) box used for index keys. The 
+**  This is an n-dimensional (practically, the
+**  implementation is 2-4 dimensions) box used for index keys. The
 **  coordinates are anonymous, so we can have any number of dimensions.
 **  The sizeof a GIDX is 1 + 2 * ndims * sizeof(float).
 **  The order of values in a GIDX is
@@ -27,9 +27,9 @@
 
 
 /**********************************************************************
-**  BOX2DF structure. 
+**  BOX2DF structure.
 **
-**  This is a 2-dimensional key for simple cartesian indexes, 
+**  This is a 2-dimensional key for simple cartesian indexes,
 **  with backwards compatible behavior to previous indexes in
 **  PostGIS
 */
@@ -43,7 +43,7 @@
 /*********************************************************************************
 ** GIDX support functions.
 **
-** We put the GIDX support here rather than libgeom because it is a specialized 
+** We put the GIDX support here rather than libgeom because it is a specialized
 ** type only used for indexing purposes. It also makes use of some PgSQL
 ** infrastructure like the VARSIZE() macros.
 */
@@ -56,7 +56,7 @@
 
 
 /* Generate human readable form for GIDX. */
-char* gidx_to_string(GIDX *a) ; 
+char* gidx_to_string(GIDX *a) ;
 
 /* typedef to correct array-bounds checking for casts to GIDX - do not
    use this ANYWHERE except in the casts below */
@@ -65,7 +65,7 @@
 /* Returns number of dimensions for this GIDX */
 #define GIDX_NDIMS(gidx) ((VARSIZE((gidx)) - VARHDRSZ) / (2 * sizeof(float)))
 /* Minimum accessor. */
-#define GIDX_GET_MIN(gidx, dimension) (*((_gidx_float_array *)(&(gidx)->c)))[2*(dimension)] 
+#define GIDX_GET_MIN(gidx, dimension) (*((_gidx_float_array *)(&(gidx)->c)))[2*(dimension)]
 /* Maximum accessor. */
 #define GIDX_GET_MAX(gidx, dimension) (*((_gidx_float_array *)(&(gidx)->c)))[2*(dimension)+1]
 /* Minimum setter. */

Modified: trunk/libpgcommon/lwgeom_cache.c
===================================================================
--- trunk/libpgcommon/lwgeom_cache.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/libpgcommon/lwgeom_cache.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -16,15 +16,15 @@
 #include "../postgis_config.h"
 #include "lwgeom_cache.h"
 
-/* 
-* Generic statement caching infrastructure. We cache 
+/*
+* Generic statement caching infrastructure. We cache
 * the following kinds of objects:
-* 
+*
 *   geometries-with-trees
 *      PreparedGeometry, RTree, CIRC_TREE, RECT_TREE
 *   srids-with-projections
 *      projPJ
-* 
+*
 * Each GenericCache* has a type, and after that
 * some data. Similar to generic LWGEOM*. Test that
 * the type number is what you expect before casting
@@ -35,11 +35,11 @@
 	char data[1];
 } GenericCache;
 
-/* 
-* Although there are only two basic kinds of 
+/*
+* Although there are only two basic kinds of
 * cache entries, the actual trees stored in the
 * geometries-with-trees pattern are quite diverse,
-* and they might be used in combination, so we have 
+* and they might be used in combination, so we have
 * one slot for each tree type as well as a slot for
 * projections.
 */
@@ -48,25 +48,25 @@
 } GenericCacheCollection;
 
 /**
-* Utility function to read the upper memory context off a function call 
+* Utility function to read the upper memory context off a function call
 * info data.
 */
-static MemoryContext 
+static MemoryContext
 FIContext(FunctionCallInfoData* fcinfo)
 {
 	return fcinfo->flinfo->fn_mcxt;
 }
 
 /**
-* Get the generic collection off the statement, allocate a 
+* Get the generic collection off the statement, allocate a
 * new one if we don't have one already.
-*/ 
-static GenericCacheCollection* 
+*/
+static GenericCacheCollection*
 GetGenericCacheCollection(FunctionCallInfoData* fcinfo)
 {
 	GenericCacheCollection* cache = fcinfo->flinfo->fn_extra;
 
-	if ( ! cache ) 
+	if ( ! cache )
 	{
 		cache = MemoryContextAlloc(FIContext(fcinfo), sizeof(GenericCacheCollection));
 		memset(cache, 0, sizeof(GenericCacheCollection));
@@ -115,12 +115,12 @@
 }
 
 /**
-* Get an appropriate (based on the entry type number) 
+* Get an appropriate (based on the entry type number)
 * GeomCache entry from the generic cache if one exists.
 * Returns a cache pointer if there is a cache hit and we have an
 * index built and ready to use. Returns NULL otherwise.
 */
-GeomCache*            
+GeomCache*
 GetGeomCache(FunctionCallInfoData* fcinfo, const GeomCacheMethods* cache_methods, const GSERIALIZED* g1, const GSERIALIZED* g2)
 {
 	GeomCache* cache;

Modified: trunk/libpgcommon/lwgeom_cache.h
===================================================================
--- trunk/libpgcommon/lwgeom_cache.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/libpgcommon/lwgeom_cache.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -30,9 +30,9 @@
 #define NUM_CACHE_ENTRIES 16
 
 
-/* 
+/*
 * A generic GeomCache just needs space for the cache type,
-* the cache keys (GSERIALIZED geometries), the key sizes, 
+* the cache keys (GSERIALIZED geometries), the key sizes,
 * and the argument number the cached index/tree is going
 * to refer to.
 */
@@ -42,21 +42,21 @@
 	GSERIALIZED*                geom2;
 	size_t                      geom1_size;
 	size_t                      geom2_size;
-	int32                       argnum; 
+	int32                       argnum;
 } GeomCache;
 
 /*
-* Other specific geometry cache types are the 
+* Other specific geometry cache types are the
 * RTreeGeomCache - lwgeom_rtree.h
 * PrepGeomCache - lwgeom_geos_prepared.h
 */
 
-/* 
-* Proj4 caching has it's own mechanism, but is 
+/*
+* Proj4 caching has it's own mechanism, but is
 * integrated into the generic caching system because
 * some geography functions make cached SRID lookup
-* calls and also CircTree accelerated calls, so 
-* there needs to be a management object on 
+* calls and also CircTree accelerated calls, so
+* there needs to be a management object on
 * fcinfo->flinfo->fn_extra to avoid collisions.
 */
 
@@ -88,9 +88,9 @@
 
 /**
 * Generic signature for functions to manage a geometry
-* cache structure.  
+* cache structure.
 */
-typedef struct 
+typedef struct
 {
 	int entry_number; /* What kind of structure is this? */
 	int (*GeomIndexBuilder)(const LWGEOM* lwgeom, GeomCache* cache); /* Build an index/tree and add it to your cache */
@@ -98,7 +98,7 @@
 	GeomCache* (*GeomCacheAllocator)(void); /* Allocate the kind of cache object you use (GeomCache+some extra space) */
 } GeomCacheMethods;
 
-/* 
+/*
 * Cache retrieval functions
 */
 PROJ4PortalCache*  GetPROJ4SRSCache(FunctionCallInfoData *fcinfo);

Modified: trunk/libpgcommon/lwgeom_pg.c
===================================================================
--- trunk/libpgcommon/lwgeom_pg.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/libpgcommon/lwgeom_pg.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -34,9 +34,9 @@
 #define PGC_ERRMSG_MAXLEN 256
 
 /**
-* Utility to convert cstrings to textp pointers 
+* Utility to convert cstrings to textp pointers
 */
-text* 
+text*
 cstring2text(const char *cstring)
 {
 	text *output;
@@ -48,7 +48,7 @@
 		
 	sz = strlen(cstring);
 	output = palloc(sz + VARHDRSZ);
-	if ( ! output ) 
+	if ( ! output )
 		return NULL;
 	SET_VARSIZE(output, sz + VARHDRSZ);
 	if ( sz )
@@ -325,11 +325,11 @@
 	return postgis_guc_name_compare(confa->name, confb->name);
 }
 
-/* 
-* This is copied from the top half of the find_option function 
+/*
+* This is copied from the top half of the find_option function
 * in postgresql's guc.c. We search the guc_variables for our option.
-* Then we make sure it's not a placeholder. Only then are we sure 
-* we have a potential conflict, of the sort experienced during an 
+* Then we make sure it's not a placeholder. Only then are we sure
+* we have a potential conflict, of the sort experienced during an
 * extension upgrade.
 */
 int
@@ -350,7 +350,7 @@
 	
 	/* Found nothing? Good */
 	if ( ! res ) return 0;
-	 
+	
 	/* Hm, you found something, but maybe it's just a placeholder? */
 	/* We'll consider a placehold a "not found" */
 	if ( (*res)->flags & GUC_CUSTOM_PLACEHOLDER )

Modified: trunk/libpgcommon/lwgeom_pg.h
===================================================================
--- trunk/libpgcommon/lwgeom_pg.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/libpgcommon/lwgeom_pg.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -99,7 +99,7 @@
 */
 
 /**
-* Remove the embedded bounding box 
+* Remove the embedded bounding box
 */
 GSERIALIZED* gserialized_drop_gidx(GSERIALIZED *g);
 
@@ -116,7 +116,7 @@
 GSERIALIZED* geography_serialize(LWGEOM *lwgeom);
 
 /**
-* Pull out a gbox bounding box as fast as possible. 
+* Pull out a gbox bounding box as fast as possible.
 * Tries to read cached box from front of serialized vardata.
 * If no cached box, calculates box from scratch.
 * Fails on empty.
@@ -124,20 +124,20 @@
 int gserialized_datum_get_gbox_p(Datum gsdatum, GBOX *gbox);
 
 /**
-* Convert cstrings (null-terminated byte array) to textp pointers 
+* Convert cstrings (null-terminated byte array) to textp pointers
 * (PgSQL varlena structure with VARSIZE header).
 */
 text* cstring2text(const char *cstring);
 
 /**
-* Convert textp (PgSQL varlena structure with VARSIZE header) to 
-* cstrings (null-terminated byte array). 
+* Convert textp (PgSQL varlena structure with VARSIZE header) to
+* cstrings (null-terminated byte array).
 */
 char* text2cstring(const text *textptr);
 
-/* 
+/*
  * For PostgreSQL >= 8.5 redefine the STATRELATT macro to its
- * new value of STATRELATTINH 
+ * new value of STATRELATTINH
  */
 #if POSTGIS_PGSQL_VERSION >= 85
 	#define STATRELATT STATRELATTINH

Modified: trunk/libpgcommon/lwgeom_transform.h
===================================================================
--- trunk/libpgcommon/lwgeom_transform.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/libpgcommon/lwgeom_transform.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -13,7 +13,7 @@
 #include "liblwgeom.h"
 #include "lwgeom_pg.h"
 
-typedef struct srs_precision 
+typedef struct srs_precision
 {
 	int precision_xy;
 	int precision_z;

Modified: trunk/loader/dbfopen.c
===================================================================
--- trunk/loader/dbfopen.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/loader/dbfopen.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -12,7 +12,7 @@
  * option is discussed in more detail in shapelib.html.
  *
  * --
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  * to deal in the Software without restriction, including without limitation
@@ -74,8 +74,8 @@
  *
  * Revision 1.77  2007/12/15 20:25:21  bram
  * dbfopen.c now reads the Code Page information from the DBF file, and exports
- * this information as a string through the DBFGetCodePage function.  This is 
- * either the number from the LDID header field ("LDID/<number>") or as the 
+ * this information as a string through the DBFGetCodePage function.  This is
+ * either the number from the LDID header field ("LDID/<number>") or as the
  * content of an accompanying .CPG file.  When creating a DBF file, the code can
  * be set using DBFCreateEx.
  *
@@ -222,7 +222,7 @@
 
     abyHeader[8] = (unsigned char) (psDBF->nHeaderLength % 256);
     abyHeader[9] = (unsigned char) (psDBF->nHeaderLength / 256);
-    
+
     abyHeader[10] = (unsigned char) (psDBF->nRecordLength % 256);
     abyHeader[11] = (unsigned char) (psDBF->nRecordLength / 256);
 
@@ -234,7 +234,7 @@
 /* -------------------------------------------------------------------- */
     psDBF->sHooks.FSeek( psDBF->fp, 0, 0 );
     psDBF->sHooks.FWrite( abyHeader, XBASE_FLDHDR_SZ, 1, psDBF->fp );
-    psDBF->sHooks.FWrite( psDBF->pszHeader, XBASE_FLDHDR_SZ, psDBF->nFields, 
+    psDBF->sHooks.FWrite( psDBF->pszHeader, XBASE_FLDHDR_SZ, psDBF->nFields,
                           psDBF->fp );
 
 /* -------------------------------------------------------------------- */
@@ -264,17 +264,17 @@
     {
 	psDBF->bCurrentRecordModified = FALSE;
 
-	nRecordOffset = 
-            psDBF->nRecordLength * (SAOffset) psDBF->nCurrentRecord 
+	nRecordOffset =
+            psDBF->nRecordLength * (SAOffset) psDBF->nCurrentRecord
             + psDBF->nHeaderLength;
 
-	if( psDBF->sHooks.FSeek( psDBF->fp, nRecordOffset, 0 ) != 0 
-            || psDBF->sHooks.FWrite( psDBF->pszCurrentRecord, 
-                                     psDBF->nRecordLength, 
+	if( psDBF->sHooks.FSeek( psDBF->fp, nRecordOffset, 0 ) != 0
+            || psDBF->sHooks.FWrite( psDBF->pszCurrentRecord,
+                                     psDBF->nRecordLength,
                                      1, psDBF->fp ) != 1 )
         {
             char szMessage[128];
-            sprintf( szMessage, "Failure writing DBF record %d.", 
+            sprintf( szMessage, "Failure writing DBF record %d.",
                      psDBF->nCurrentRecord );
             psDBF->sHooks.Error( szMessage );
             return FALSE;
@@ -298,7 +298,7 @@
 	if( !DBFFlushRecord( psDBF ) )
             return FALSE;
 
-	nRecordOffset = 
+	nRecordOffset =
             psDBF->nRecordLength * (SAOffset) iRecord + psDBF->nHeaderLength;
 
 	if( psDBF->sHooks.FSeek( psDBF->fp, nRecordOffset, SEEK_SET ) != 0 )
@@ -310,7 +310,7 @@
             return FALSE;
         }
 
-	if( psDBF->sHooks.FRead( psDBF->pszCurrentRecord, 
+	if( psDBF->sHooks.FRead( psDBF->pszCurrentRecord,
                                  psDBF->nRecordLength, 1, psDBF->fp ) != 1 )
         {
             char szMessage[128];
@@ -343,12 +343,12 @@
 
     psDBF->sHooks.FSeek( psDBF->fp, 0, 0 );
     psDBF->sHooks.FRead( abyFileHeader, 32, 1, psDBF->fp );
-    
+
     abyFileHeader[4] = (unsigned char) (psDBF->nRecords % 256);
     abyFileHeader[5] = (unsigned char) ((psDBF->nRecords/256) % 256);
     abyFileHeader[6] = (unsigned char) ((psDBF->nRecords/(256*256)) % 256);
     abyFileHeader[7] = (unsigned char) ((psDBF->nRecords/(256*256*256)) % 256);
-    
+
     psDBF->sHooks.FSeek( psDBF->fp, 0, 0 );
     psDBF->sHooks.FWrite( abyFileHeader, 32, 1, psDBF->fp );
 
@@ -360,7 +360,7 @@
 /*                                                                      */
 /*      Open a .dbf file.                                               */
 /************************************************************************/
-   
+
 DBFHandle SHPAPI_CALL
 DBFOpen( const char * pszFilename, const char * pszAccess )
 
@@ -377,7 +377,7 @@
 /*                                                                      */
 /*      Open a .dbf file.                                               */
 /************************************************************************/
-   
+
 DBFHandle SHPAPI_CALL
 DBFOpenLL( const char * pszFilename, const char * pszAccess, SAHooks *psHooks )
 
@@ -392,14 +392,14 @@
 /* -------------------------------------------------------------------- */
 /*      We only allow the access strings "rb" and "r+".                  */
 /* -------------------------------------------------------------------- */
-    if( strcmp(pszAccess,"r") != 0 && strcmp(pszAccess,"r+") != 0 
+    if( strcmp(pszAccess,"r") != 0 && strcmp(pszAccess,"r+") != 0
         && strcmp(pszAccess,"rb") != 0 && strcmp(pszAccess,"rb+") != 0
         && strcmp(pszAccess,"r+b") != 0 )
         return( NULL );
 
     if( strcmp(pszAccess,"r") == 0 )
         pszAccess = "rb";
- 
+
     if( strcmp(pszAccess,"r+") == 0 )
         pszAccess = "rb+";
 
@@ -409,7 +409,7 @@
 /* -------------------------------------------------------------------- */
     pszBasename = (char *) malloc(strlen(pszFilename)+5);
     strcpy( pszBasename, pszFilename );
-    for( i = strlen(pszBasename)-1; 
+    for( i = strlen(pszBasename)-1;
 	 i > 0 && pszBasename[i] != '.' && pszBasename[i] != '/'
 	       && pszBasename[i] != '\\';
 	 i-- ) {}
@@ -419,7 +419,7 @@
 
     pszFullname = (char *) malloc(strlen(pszBasename) + 5);
     sprintf( pszFullname, "%s.dbf", pszBasename );
-        
+
     psDBF = (DBFHandle) calloc( 1, sizeof(DBFInfo) );
     psDBF->fp = psHooks->FOpen( pszFullname, pszAccess );
     memcpy( &(psDBF->sHooks), psHooks, sizeof(SAHooks) );
@@ -440,7 +440,7 @@
 
     free( pszBasename );
     free( pszFullname );
-    
+
     if( psDBF->fp == NULL )
     {
         free( psDBF );
@@ -465,7 +465,7 @@
         return NULL;
     }
 
-    psDBF->nRecords = 
+    psDBF->nRecords =
      pabyBuf[4] + pabyBuf[5]*256 + pabyBuf[6]*256*256 + pabyBuf[7]*256*256*256;
 
     psDBF->nHeaderLength = nHeadLen = pabyBuf[8] + pabyBuf[9]*256;
@@ -514,7 +514,7 @@
 /* -------------------------------------------------------------------- */
 /*  Read in Field Definitions                                           */
 /* -------------------------------------------------------------------- */
-    
+
     pabyBuf = (unsigned char *) SfRealloc(pabyBuf,nHeadLen);
     psDBF->pszHeader = (char *) pabyBuf;
 
@@ -563,7 +563,7 @@
 	if( iField == 0 )
 	    psDBF->panFieldOffset[iField] = 1;
 	else
-	    psDBF->panFieldOffset[iField] = 
+	    psDBF->panFieldOffset[iField] =
 	      psDBF->panFieldOffset[iField-1] + psDBF->panFieldSize[iField-1];
     }
 
@@ -670,7 +670,7 @@
 /* -------------------------------------------------------------------- */
     pszBasename = (char *) malloc(strlen(pszFilename)+5);
     strcpy( pszBasename, pszFilename );
-    for( i = strlen(pszBasename)-1; 
+    for( i = strlen(pszBasename)-1;
 	 i > 0 && pszBasename[i] != '.' && pszBasename[i] != '/'
 	       && pszBasename[i] != '\\';
 	 i-- ) {}
@@ -687,7 +687,7 @@
     fp = psHooks->FOpen( pszFullname, "wb" );
     if( fp == NULL )
         return( NULL );
-    
+
     psHooks->FWrite( &chZero, 1, 1, fp );
     psHooks->FClose( fp );
 
@@ -731,7 +731,7 @@
     psDBF->nFields = 0;
     psDBF->nRecordLength = 1;
     psDBF->nHeaderLength = 33;
-    
+
     psDBF->panFieldOffset = NULL;
     psDBF->panFieldSize = NULL;
     psDBF->panFieldDecimals = NULL;
@@ -762,7 +762,7 @@
 /************************************************************************/
 
 int SHPAPI_CALL
-DBFAddField(DBFHandle psDBF, const char * pszFieldName, 
+DBFAddField(DBFHandle psDBF, const char * pszFieldName,
             DBFFieldType eType, int nWidth, int nDecimals )
 
 {
@@ -777,7 +777,7 @@
     else
         chNativeType = 'N';
 
-    return DBFAddNativeFieldType( psDBF, pszFieldName, chNativeType, 
+    return DBFAddNativeFieldType( psDBF, pszFieldName, chNativeType,
                                   nWidth, nDecimals );
 }
 
@@ -809,7 +809,7 @@
 /************************************************************************/
 
 int SHPAPI_CALL
-DBFAddNativeFieldType(DBFHandle psDBF, const char * pszFieldName, 
+DBFAddNativeFieldType(DBFHandle psDBF, const char * pszFieldName,
                       char chType, int nWidth, int nDecimals )
 
 {
@@ -842,16 +842,16 @@
 /* -------------------------------------------------------------------- */
     psDBF->nFields++;
 
-    psDBF->panFieldOffset = (int *) 
+    psDBF->panFieldOffset = (int *)
         SfRealloc( psDBF->panFieldOffset, sizeof(int) * psDBF->nFields );
 
-    psDBF->panFieldSize = (int *) 
+    psDBF->panFieldSize = (int *)
         SfRealloc( psDBF->panFieldSize, sizeof(int) * psDBF->nFields );
 
-    psDBF->panFieldDecimals = (int *) 
+    psDBF->panFieldDecimals = (int *)
         SfRealloc( psDBF->panFieldDecimals, sizeof(int) * psDBF->nFields );
 
-    psDBF->pachFieldType = (char *) 
+    psDBF->pachFieldType = (char *)
         SfRealloc( psDBF->pachFieldType, sizeof(char) * psDBF->nFields );
 
 /* -------------------------------------------------------------------- */
@@ -893,7 +893,7 @@
         pszFInfo[16] = (unsigned char) nWidth;
         pszFInfo[17] = (unsigned char) nDecimals;
     }
-    
+
 /* -------------------------------------------------------------------- */
 /*      Make the current record buffer appropriately larger.            */
 /* -------------------------------------------------------------------- */
@@ -1027,7 +1027,7 @@
             *pchDst = '\0';
     }
 #endif
-    
+
     return( pReturnField );
 }
 
@@ -1133,7 +1133,7 @@
       case 'D':
         /* NULL date fields have value "00000000" or blank or empty */
         if (pszValue[0] == '\0' ||                  /* emtpy string */
-            strncmp(pszValue,"00000000",8) == 0 || 
+            strncmp(pszValue,"00000000",8) == 0 ||
             strncmp(pszValue,"        ",8) == 0) {
             return 1;
         } else {
@@ -1239,10 +1239,10 @@
     else if ( psDBF->pachFieldType[iField] == 'D' )
         return ( FTDate );
 
-    else if( psDBF->pachFieldType[iField] == 'N' 
+    else if( psDBF->pachFieldType[iField] == 'N'
              || psDBF->pachFieldType[iField] == 'F' )
     {
-	if( psDBF->panFieldDecimals[iField] > 0 
+	if( psDBF->panFieldDecimals[iField] > 0
             || psDBF->panFieldSize[iField] > 10 )
 	    return( FTDouble );
 	else
@@ -1350,7 +1350,7 @@
             if( (int) sizeof(szSField)-2 < nWidth )
                 nWidth = sizeof(szSField)-2;
 
-	    sprintf( szFormat, "%%%d.%df", 
+	    sprintf( szFormat, "%%%d.%df",
                      nWidth, psDBF->panFieldDecimals[iField] );
 	    sprintf(szSField, szFormat, *((double *) pValue) );
 	    if( (int) strlen(szSField) > psDBF->panFieldSize[iField] )
@@ -1364,7 +1364,7 @@
 	break;
 
       case 'L':
-        if (psDBF->panFieldSize[iField] >= 1  && 
+        if (psDBF->panFieldSize[iField] >= 1  &&
             (*(char*)pValue == 'F' || *(char*)pValue == 'T'))
             *(pabyRec+psDBF->panFieldOffset[iField]) = *(char*)pValue;
         break;
@@ -1612,21 +1612,21 @@
 /************************************************************************/
 
 DBFHandle SHPAPI_CALL
-DBFCloneEmpty(DBFHandle psDBF, const char * pszFilename ) 
+DBFCloneEmpty(DBFHandle psDBF, const char * pszFilename )
 {
     DBFHandle	newDBF;
 
    newDBF = DBFCreateEx ( pszFilename, psDBF->pszCodePage );
-   if ( newDBF == NULL ) return ( NULL ); 
-   
+   if ( newDBF == NULL ) return ( NULL );
+
    newDBF->nFields = psDBF->nFields;
    newDBF->nRecordLength = psDBF->nRecordLength;
    newDBF->nHeaderLength = psDBF->nHeaderLength;
-    
+
    newDBF->pszHeader = (char *) malloc ( newDBF->nHeaderLength );
    memcpy ( newDBF->pszHeader, psDBF->pszHeader, newDBF->nHeaderLength );
-   
-   newDBF->panFieldOffset = (int *) malloc ( sizeof(int) * psDBF->nFields ); 
+
+   newDBF->panFieldOffset = (int *) malloc ( sizeof(int) * psDBF->nFields );
    memcpy ( newDBF->panFieldOffset, psDBF->panFieldOffset, sizeof(int) * psDBF->nFields );
    newDBF->panFieldSize = (int *) malloc ( sizeof(int) * psDBF->nFields );
    memcpy ( newDBF->panFieldSize, psDBF->panFieldSize, sizeof(int) * psDBF->nFields );
@@ -1637,10 +1637,10 @@
 
    newDBF->bNoHeader = TRUE;
    newDBF->bUpdated = TRUE;
-   
+
    DBFWriteHeader ( newDBF );
    DBFClose ( newDBF );
-   
+
    newDBF = DBFOpen ( pszFilename, "rb+" );
 
    return ( newDBF );
@@ -1746,7 +1746,7 @@
 /*                        DBFMarkRecordDeleted()                        */
 /************************************************************************/
 
-int SHPAPI_CALL DBFMarkRecordDeleted( DBFHandle psDBF, int iShape, 
+int SHPAPI_CALL DBFMarkRecordDeleted( DBFHandle psDBF, int iShape,
                                       int bIsDeleted )
 
 {
@@ -1770,7 +1770,7 @@
 /* -------------------------------------------------------------------- */
     if( bIsDeleted )
         chNewFlag = '*';
-    else 
+    else
         chNewFlag = ' ';
 
     if( psDBF->pszCurrentRecord[0] != chNewFlag )
@@ -1835,16 +1835,16 @@
     /* resize fields arrays */
     psDBF->nFields--;
 
-    psDBF->panFieldOffset = (int *) 
+    psDBF->panFieldOffset = (int *)
         SfRealloc( psDBF->panFieldOffset, sizeof(int) * psDBF->nFields );
 
-    psDBF->panFieldSize = (int *) 
+    psDBF->panFieldSize = (int *)
         SfRealloc( psDBF->panFieldSize, sizeof(int) * psDBF->nFields );
 
-    psDBF->panFieldDecimals = (int *) 
+    psDBF->panFieldDecimals = (int *)
         SfRealloc( psDBF->panFieldDecimals, sizeof(int) * psDBF->nFields );
 
-    psDBF->pachFieldType = (char *) 
+    psDBF->pachFieldType = (char *)
         SfRealloc( psDBF->pachFieldType, sizeof(char) * psDBF->nFields );
 
     /* update header information */
@@ -1876,14 +1876,14 @@
     /* shift records to their new positions */
     for (iRecord = 0; iRecord < psDBF->nRecords; iRecord++)
     {
-        nRecordOffset = 
+        nRecordOffset =
             nOldRecordLength * (SAOffset) iRecord + nOldHeaderLength;
 
         /* load record */
         psDBF->sHooks.FSeek( psDBF->fp, nRecordOffset, 0 );
         psDBF->sHooks.FRead( pszRecord, nOldRecordLength, 1, psDBF->fp );
 
-        nRecordOffset = 
+        nRecordOffset =
             psDBF->nRecordLength * (SAOffset) iRecord + psDBF->nHeaderLength;
 
         /* move record in two steps */

Modified: trunk/loader/pgsql2shp-cli.c
===================================================================
--- trunk/loader/pgsql2shp-cli.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/loader/pgsql2shp-cli.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -144,7 +144,7 @@
 				/* OK, this is a schema-qualified table name... */
       if (chrptr)
       {
-        if ( chrptr == strptr ) 
+        if ( chrptr == strptr )
         {
           /* table is ".something" display help  */
           usage(0);

Modified: trunk/loader/pgsql2shp-core.c
===================================================================
--- trunk/loader/pgsql2shp-core.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/loader/pgsql2shp-core.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -855,7 +855,7 @@
 }
 
 
-static int 
+static int
 getTableInfo(SHPDUMPERSTATE *state)
 {
 
@@ -1178,7 +1178,7 @@
 	char *connstring;
 	int connlen;
 	
-	connlen = 64 + 
+	connlen = 64 +
 		(conn->host ? strlen(conn->host) : 0) + (conn->port ? strlen(conn->port) : 0) +
 		(conn->username ? strlen(conn->username) : 0) + (conn->password ? strlen(conn->password) : 0) +
 		(conn->database ? strlen(conn->database) : 0);
@@ -1480,7 +1480,7 @@
 			if (!state->geo_col_name)
 			{
 				/* If either no geo* column name was provided (in which case this is
-				   the first match) or we match the provided column name, we have 
+				   the first match) or we match the provided column name, we have
 				   found our geo* column */
 				if (!state->config->geo_col_name || !strcmp(state->config->geo_col_name, pgfieldname))
 				{
@@ -1989,7 +1989,7 @@
 	if (state->geo_col_name)
 		geocolnum = PQfnumber(state->fetchres, "_geoX");
 
-	/* Process the next record within the batch. First write out all of 
+	/* Process the next record within the batch. First write out all of
 	the non-geo fields */
 	for (i = 0; i < state->fieldcount; i++)
 	{

Modified: trunk/loader/pgsql2shp-core.h
===================================================================
--- trunk/loader/pgsql2shp-core.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/loader/pgsql2shp-core.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -41,7 +41,7 @@
 
 
 /*
- * Structure to hold the dumper configuration options 
+ * Structure to hold the dumper configuration options
  */
 
 typedef struct shp_dumper_config
@@ -67,7 +67,7 @@
 	/* TODO: rename? 0=switch not provided, 1=switch provided */
 	int dswitchprovided;
 
-	/* TODO: replace and combine with below 0=do not include gid column in shapefile, 1=include gid column in shapefile */ 
+	/* TODO: replace and combine with below 0=do not include gid column in shapefile, 1=include gid column in shapefile */
 	int includegid;
 
 	/* TODO: 0=escape column names, 1=do not escape column names */
@@ -89,7 +89,7 @@
 
 
 /*
- * Structure to holder the current dumper state 
+ * Structure to holder the current dumper state
  */
 
 typedef struct shp_dumper_state

Modified: trunk/loader/safileio.c
===================================================================
--- trunk/loader/safileio.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/loader/safileio.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -12,7 +12,7 @@
  * option is discussed in more detail in shapelib.html.
  *
  * --
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  * to deal in the Software without restriction, including without limitation
@@ -45,8 +45,8 @@
  *
  * Revision 1.2  2007/12/15 20:25:30  bram
  * dbfopen.c now reads the Code Page information from the DBF file, and exports
- * this information as a string through the DBFGetCodePage function.  This is 
- * either the number from the LDID header field ("LDID/<number>") or as the 
+ * this information as a string through the DBFGetCodePage function.  This is
+ * either the number from the LDID header field ("LDID/<number>") or as the
  * content of an accompanying .CPG file.  When creating a DBF file, the code can
  * be set using DBFCreateEx.
  *
@@ -104,7 +104,7 @@
 SAOffset SADFRead( void *p, SAOffset size, SAOffset nmemb, SAFile file )
 
 {
-    return (SAOffset) fread( p, (size_t) size, (size_t) nmemb, 
+    return (SAOffset) fread( p, (size_t) size, (size_t) nmemb,
                              (FILE *) file );
 }
 
@@ -115,7 +115,7 @@
 SAOffset SADFWrite( void *p, SAOffset size, SAOffset nmemb, SAFile file )
 
 {
-    return (SAOffset) fwrite( p, (size_t) size, (size_t) nmemb, 
+    return (SAOffset) fwrite( p, (size_t) size, (size_t) nmemb,
                               (FILE *) file );
 }
 
@@ -220,7 +220,7 @@
 {
     int nMulti, nWide;
     wchar_t *pwszFileName;
-    
+
     nMulti = strlen(pszFilename) + 1;
     nWide = MultiByteToWideChar( CP_UTF8, 0, pszFilename, nMulti, 0, 0);
     if( nWide == 0 )
@@ -266,7 +266,7 @@
 int SAUtf8WRemove( const char *pszFilename )
 {
     const wchar_t *pwszFileName = Utf8ToWideChar( pszFilename );
-    int rc = -1; 
+    int rc = -1;
     if( pwszFileName != NULL )
     {
         rc = _wremove( pwszFileName );
@@ -285,7 +285,7 @@
 
 void SASetupUtf8Hooks( SAHooks *psHooks )
 {
-#ifdef SHPAPI_WINDOWS    
+#ifdef SHPAPI_WINDOWS
     psHooks->FOpen   = SAUtf8WFOpen;
     psHooks->Remove  = SAUtf8WRemove;
 #else

Modified: trunk/loader/shapefil.h
===================================================================
--- trunk/loader/shapefil.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/loader/shapefil.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -15,7 +15,7 @@
  * option is discussed in more detail in shapelib.html.
  *
  * --
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  * to deal in the Software without restriction, including without limitation
@@ -72,8 +72,8 @@
  *
  * Revision 1.41  2007/12/15 20:25:32  bram
  * dbfopen.c now reads the Code Page information from the DBF file, and exports
- * this information as a string through the DBFGetCodePage function.  This is 
- * either the number from the LDID header field ("LDID/<number>") or as the 
+ * this information as a string through the DBFGetCodePage function.  This is
+ * either the number from the LDID header field ("LDID/<number>") or as the
  * content of an accompanying .CPG file.  When creating a DBF file, the code can
  * be set using DBFCreateEx.
  *
@@ -164,7 +164,7 @@
 /*      is disabled.                                                    */
 /* -------------------------------------------------------------------- */
 #define DISABLE_MULTIPATCH_MEASURE
-    
+
 /* -------------------------------------------------------------------- */
 /*      SHPAPI_CALL                                                     */
 /*                                                                      */
@@ -211,7 +211,7 @@
 #ifndef SHPAPI_CALL1
 #  define SHPAPI_CALL1(x)      x SHPAPI_CALL
 #endif
-    
+
 /* -------------------------------------------------------------------- */
 /*      Macros for controlling CVSID and ensuring they don't appear     */
 /*      as unreferenced variables resulting in lots of warnings.        */
@@ -281,7 +281,7 @@
     SAFile 	fpSHX;
 
     int		nShapeType;				/* SHPT_* */
-    
+
     unsigned int 	nFileSize;				/* SHP file */
 
     int         nRecords;
@@ -344,7 +344,7 @@
     int		nParts;
     int		*panPartStart;
     int		*panPartType;
-    
+
     int		nVertices;
     double	*padfX;
     double	*padfY;
@@ -373,7 +373,7 @@
 SHPHandle SHPAPI_CALL
       SHPOpen( const char * pszShapeFile, const char * pszAccess );
 SHPHandle SHPAPI_CALL
-      SHPOpenLL( const char *pszShapeFile, const char *pszAccess, 
+      SHPOpenLL( const char *pszShapeFile, const char *pszAccess,
                  SAHooks *psHooks );
 SHPHandle SHPAPI_CALL
       SHPCreate( const char * pszShapeFile, int nShapeType );
@@ -394,15 +394,15 @@
 void SHPAPI_CALL
       SHPComputeExtents( SHPObject * psObject );
 SHPObject SHPAPI_CALL1(*)
-      SHPCreateObject( int nSHPType, int nShapeId, int nParts, 
+      SHPCreateObject( int nSHPType, int nShapeId, int nParts,
                        const int * panPartStart, const int * panPartType,
-                       int nVertices, 
+                       int nVertices,
                        const double * padfX, const double * padfY,
                        const double * padfZ, const double * padfM );
 SHPObject SHPAPI_CALL1(*)
       SHPCreateSimpleObject( int nSHPType, int nVertices,
-                             const double * padfX, 
-                             const double * padfY, 
+                             const double * padfX,
+                             const double * padfY,
                              const double * padfZ );
 
 int SHPAPI_CALL
@@ -440,17 +440,17 @@
 
     int		nSubNodes;
     struct shape_tree_node *apsSubNode[MAX_SUBNODE];
-    
+
 } SHPTreeNode;
 
 typedef struct
 {
     SHPHandle   hSHP;
-    
+
     int		nMaxDepth;
     int		nDimension;
     int         nTotalCount;
-    
+
     SHPTreeNode	*psRoot;
 } SHPTree;
 
@@ -481,8 +481,8 @@
 int     SHPAPI_CALL
       SHPCheckBoundsOverlap( double *, double *, double *, double *, int );
 
-int SHPAPI_CALL1(*) 
-SHPSearchDiskTree( FILE *fp, 
+int SHPAPI_CALL1(*)
+SHPSearchDiskTree( FILE *fp,
                    double *padfBoundsMin, double *padfBoundsMax,
                    int *pnShapeCount );
 
@@ -513,7 +513,7 @@
 
     int         nWorkFieldLength;
     char        *pszWorkField;
-    
+
     int		bNoHeader;
     int		bUpdated;
 
@@ -572,7 +572,7 @@
                          char chType, int nWidth, int nDecimals );
 
 DBFFieldType SHPAPI_CALL
-      DBFGetFieldInfo( DBFHandle psDBF, int iField, 
+      DBFGetFieldInfo( DBFHandle psDBF, int iField,
                        char * pszFieldName, int * pnWidth, int * pnDecimals );
 
 int SHPAPI_CALL
@@ -590,7 +590,7 @@
       DBFIsAttributeNULL( DBFHandle hDBF, int iShape, int iField );
 
 int SHPAPI_CALL
-      DBFWriteIntegerAttribute( DBFHandle hDBF, int iShape, int iField, 
+      DBFWriteIntegerAttribute( DBFHandle hDBF, int iShape, int iField,
                                 int nFieldValue );
 int SHPAPI_CALL
       DBFWriteDoubleAttribute( DBFHandle hDBF, int iShape, int iField,
@@ -613,12 +613,12 @@
       DBFWriteTuple(DBFHandle psDBF, int hEntity, void * pRawTuple );
 
 int SHPAPI_CALL DBFIsRecordDeleted( DBFHandle psDBF, int iShape );
-int SHPAPI_CALL DBFMarkRecordDeleted( DBFHandle psDBF, int iShape, 
+int SHPAPI_CALL DBFMarkRecordDeleted( DBFHandle psDBF, int iShape,
                                       int bIsDeleted );
 
 DBFHandle SHPAPI_CALL
       DBFCloneEmpty(DBFHandle psDBF, const char * pszFilename );
- 
+
 void	SHPAPI_CALL
       DBFClose( DBFHandle hDBF );
 void    SHPAPI_CALL

Modified: trunk/loader/shp2pgsql-cli.c
===================================================================
--- trunk/loader/shp2pgsql-cli.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/loader/shp2pgsql-cli.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -58,7 +58,7 @@
 	          "      attribute column. (default: \"UTF-8\")\n" ));
 	printf(_( "  -N <policy> NULL geometries handling policy (insert*,skip,abort).\n" ));
 	printf(_( "  -n  Only import DBF file.\n" ));
-	printf(_( "  -T <tablespace> Specify the tablespace for the new table.\n" 
+	printf(_( "  -T <tablespace> Specify the tablespace for the new table.\n"
                   "      Note that indexes will still use the default tablespace unless the\n"
                   "      -X flag is also used.\n"));
 	printf(_( "  -X <tablespace> Specify the tablespace for the table's indexes.\n"
@@ -270,7 +270,7 @@
 		/* OK, this is a schema-qualified table name... */
 		if (chrptr)
 		{
-			if ( chrptr == strptr ) 
+			if ( chrptr == strptr )
 			{
 				/* ".something" ??? */
 				usage();

Modified: trunk/loader/shp2pgsql-core.c
===================================================================
--- trunk/loader/shp2pgsql-core.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/loader/shp2pgsql-core.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -2,7 +2,7 @@
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.net
- * 
+ *
  * Copyright (C) 2008 OpenGeo.org
  * Copyright (C) 2009 Mark Cave-Ayland <mark.cave-ayland at siriusit.co.uk>
  *
@@ -56,7 +56,7 @@
 
 
 /* Return allocated string containing UTF8 string converted from encoding fromcode */
-static int 
+static int
 utf8(const char *fromcode, char *inputbuf, char **outputbuf)
 {
 	iconv_t cd;
@@ -524,9 +524,9 @@
 		pt2.x = inner->list[1].x;
 		pt2.y = inner->list[1].y;
 
-		/* 
-		* If we assume that the case of the "big polygon w/o hole 
-		* containing little polygon w/ hold" is ordered so that the 
+		/*
+		* If we assume that the case of the "big polygon w/o hole
+		* containing little polygon w/ hold" is ordered so that the
 		* big polygon comes first, then checking the list in reverse
 		* will assign the little polygon's hole to the little polygon
 		* w/o a lot of extra fancy containment logic here
@@ -563,11 +563,11 @@
 	}
 
 	*Out = Outer;
-	/* 
+	/*
 	* Only free the containing Inner array, not the ring elements, because
 	* the rings are now owned by the linked lists in the Outer array elements.
 	*/
-	free(Inner); 
+	free(Inner);
 
 	return out_index;
 }

Modified: trunk/loader/shp2pgsql-core.h
===================================================================
--- trunk/loader/shp2pgsql-core.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/loader/shp2pgsql-core.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -15,7 +15,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <locale.h> 
+#include <locale.h>
 #include <ctype.h>
 #include <unistd.h>
 #include <errno.h>
@@ -77,7 +77,7 @@
 #define ENCODING_DEFAULT "UTF-8"
 
 /*
- * Structure to hold the loader configuration options 
+ * Structure to hold the loader configuration options
  */
 typedef struct shp_loader_config
 {
@@ -91,7 +91,7 @@
 	char *schema;
 
 	/* geometry/geography column name specified by the user, may be null. */
-	char *geo_col; 
+	char *geo_col;
 
 	/* the shape file (without the .shp extension) */
 	char *shp_file;
@@ -151,7 +151,7 @@
 
 
 /*
- * Structure to holder the current loader state 
+ * Structure to holder the current loader state
  */
 typedef struct shp_loader_state
 {
@@ -215,7 +215,7 @@
 
 	/* geometry/geography column name to use.  Will be set to the default if the config did
 	   not specify a column name. */
-	char *geo_col; 
+	char *geo_col;
 	
 	/* Column map */
   colmap column_map;

Modified: trunk/loader/shp2pgsql-gui.c
===================================================================
--- trunk/loader/shp2pgsql-gui.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/loader/shp2pgsql-gui.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -507,7 +507,7 @@
 /* === Progress window functions === */
 
 static void
-pgui_action_progress_cancel(GtkDialog *dialog, gint response_id, gpointer user_data) 
+pgui_action_progress_cancel(GtkDialog *dialog, gint response_id, gpointer user_data)
 {
 	/* Stop the current import */
 	is_running = FALSE;
@@ -592,7 +592,7 @@
 		config->readshape = 0;
 		
 		/* There will be no spatial column so don't create a spatial index */
-		config->createindex = 0; 
+		config->createindex = 0;
 	}
 	else
 		config->readshape = 1;
@@ -718,7 +718,7 @@
 				geocol_name = PQgetvalue(geocol_result, j, PQfnumber(geocol_result, "attname"));
 			
 				gtk_list_store_insert_before(dumper_geocol_combo_list, &geocol_iter, (GtkTreeIter *)TABLECHOOSER_GEOCOL_COMBO_TEXT);
-				gtk_list_store_set(dumper_geocol_combo_list, &geocol_iter, 
+				gtk_list_store_set(dumper_geocol_combo_list, &geocol_iter,
 						TABLECHOOSER_GEOCOL_COMBO_TEXT, geocol_name,
 						-1);
 			}
@@ -729,7 +729,7 @@
 			geocol_name = NULL;
 			
 			gtk_list_store_insert_before(dumper_geocol_combo_list, &geocol_iter, (GtkTreeIter *)TABLECHOOSER_GEOCOL_COMBO_TEXT);
-			gtk_list_store_set(dumper_geocol_combo_list, &geocol_iter, 
+			gtk_list_store_set(dumper_geocol_combo_list, &geocol_iter,
 						TABLECHOOSER_GEOCOL_COMBO_TEXT, _("(None)"),
 						-1);
 		}	
@@ -975,7 +975,7 @@
 	                   IMPORT_SRID_COLUMN, srid,
 	                   IMPORT_MODE_COLUMN, _("Create"),
 	                   -1);	
-		   
+		
 	/* Update the filename field width */
 	update_filename_field_width();
 	
@@ -1026,10 +1026,10 @@
 	memcpy(dumper_table_config, global_dumper_config, sizeof(SHPDUMPERCONFIG));
 	
 	/* Grab the values from the current iter */
-	gtk_tree_model_get(GTK_TREE_MODEL(chooser_filtered_table_list_store), iter, 
+	gtk_tree_model_get(GTK_TREE_MODEL(chooser_filtered_table_list_store), iter,
 			   TABLECHOOSER_SCHEMA_COLUMN, &schema,
 			   TABLECHOOSER_TABLE_COLUMN, &table,
-			   TABLECHOOSER_GEO_COLUMN, &geocol, 
+			   TABLECHOOSER_GEO_COLUMN, &geocol,
 			   TABLECHOOSER_HASGEO_COLUMN, &hasgeo,
 			   -1);	
 	
@@ -1064,7 +1064,7 @@
 			   EXPORT_GEOMETRY_COLUMN, dumper_table_config->geo_col_name,
 			   EXPORT_FILENAME_COLUMN, dumper_table_config->shp_file,
 			   -1);
-			  
+			
 	/* If we have supplied the table_chooser store for additional information, use it */
 	if (chooser_liststore)
 	{
@@ -1072,7 +1072,7 @@
 		gtk_tree_model_get(GTK_TREE_MODEL(chooser_liststore), chooser_iter,
 				   TABLECHOOSER_GEO_LISTSTORE_COLUMN, &geocol_liststore,
 				   -1);
-				   
+				
 		gtk_list_store_set(export_table_list_store, &iter,
 				   EXPORT_GEOMETRY_LISTSTORE_COLUMN, geocol_liststore,
 				   -1);
@@ -1225,7 +1225,7 @@
 						/* Flag a warning if we can't find a match */
 						if (!found)
 						{
-							pgui_logf(_("Warning: DBF Field '%s' within file %s could not be matched to a column within table %s.%s"), 
+							pgui_logf(_("Warning: DBF Field '%s' within file %s could not be matched to a column within table %s.%s"),
 								  state->field_names[i], config->shp_file, config->schema, config->table);
 							response = SHPLOADERWARN;
 						}
@@ -1535,7 +1535,7 @@
 		}
 
 		/* For progress display, only show the "core" filename */
-		for (i = strlen(loader_file_config->shp_file); i >= 0 
+		for (i = strlen(loader_file_config->shp_file); i >= 0
 			&& loader_file_config->shp_file[i - 1] != '\\' && loader_file_config->shp_file[i - 1] != '/'; i--);
 
 		progress_shapefile = malloc(strlen(loader_file_config->shp_file));
@@ -1578,10 +1578,10 @@
 		{
             int numrecords = ShpLoaderGetRecordCount(state);
             int records_per_tick = (numrecords / 200) - 1;
-            
-            if ( records_per_tick < 1 ) 
+
+            if ( records_per_tick < 1 )
                 records_per_tick = 1;
-		    
+		
 			/* If we are in COPY (dump format) mode, output the COPY statement and enter COPY mode */
 			if (state->config->dump_format)
 			{
@@ -2152,7 +2152,7 @@
 	}
 	
 	/* Update the selection in the listview with the text from the combo */
-	gtk_tree_model_get(GTK_TREE_MODEL(loader_mode_combo_list), new_iter, LOADER_MODE_COMBO_TEXT, &combo_text, -1); 
+	gtk_tree_model_get(GTK_TREE_MODEL(loader_mode_combo_list), new_iter, LOADER_MODE_COMBO_TEXT, &combo_text, -1);
 	gtk_list_store_set(import_file_list_store, &iter, IMPORT_MODE_COLUMN, combo_text, -1);
 	
 	return;	
@@ -2319,7 +2319,7 @@
 		dumper_table_config->geo_col_name = strdup(geocol_name);
 	}
 	
-	gtk_list_store_set(export_table_list_store, &iter, 
+	gtk_list_store_set(export_table_list_store, &iter,
 			   EXPORT_GEOMETRY_COLUMN, geocol_name,
 			   -1);
 	
@@ -2367,7 +2367,7 @@
 /* === Connection Window functions === */
 
 /* Set the connection details UI from the current configuration */
-static void 
+static void
 update_conn_ui_from_conn_config(void)
 {
 	if (conn->username)
@@ -2569,7 +2569,7 @@
 	GtkFileFilter *file_filter_shape;
 	
 	/* Create the dialog */
-	dialog_filechooser = gtk_file_chooser_dialog_new( _("Select a Shape File"), GTK_WINDOW (window_main), 
+	dialog_filechooser = gtk_file_chooser_dialog_new( _("Select a Shape File"), GTK_WINDOW (window_main),
 		GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CLOSE, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
 
 	/* Filter for .shp files */
@@ -2596,7 +2596,7 @@
 	GtkFileFilter *file_filter_shape;
 	
 	/* Create the dialog */
-	dialog_folderchooser = gtk_file_chooser_dialog_new( _("Select an output folder"), GTK_WINDOW (window_main), 
+	dialog_folderchooser = gtk_file_chooser_dialog_new( _("Select an output folder"), GTK_WINDOW (window_main),
 		GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_STOCK_CANCEL, GTK_RESPONSE_CLOSE, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
 
 	/* Filter for .shp files */
@@ -2813,9 +2813,9 @@
 	/* Because we want to do selective filtering on the treeview content, we now implement a GtkTreeModel
 	   filter on top of the original tree model */
 	chooser_filtered_table_list_store = (GtkListStore *)gtk_tree_model_filter_new(GTK_TREE_MODEL(chooser_table_list_store), NULL);
-	gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(chooser_filtered_table_list_store), 
+	gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(chooser_filtered_table_list_store),
 					(GtkTreeModelFilterVisibleFunc)table_chooser_visibility_func, NULL, NULL);
-					 
+					
 	/* Create the view and such */
 	chooser_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(chooser_filtered_table_list_store));
 	chooser_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(chooser_tree));
@@ -2992,29 +2992,29 @@
 	gtk_tree_view_append_column(GTK_TREE_VIEW(import_tree), import_srid_column);
 
 	/* Mode Combo Field */
-	loader_mode_combo_list = gtk_list_store_new(LOADER_MODE_COMBO_COLUMNS, 
+	loader_mode_combo_list = gtk_list_store_new(LOADER_MODE_COMBO_COLUMNS,
 					G_TYPE_STRING,
 					G_TYPE_CHAR);
 	
 	gtk_list_store_insert(loader_mode_combo_list, &iter, CREATE_MODE);
 	gtk_list_store_set(loader_mode_combo_list, &iter,
-	                   LOADER_MODE_COMBO_TEXT, _("Create"), 
-			   LOADER_MODE_COMBO_OPTION_CHAR, 'c',			   
+	                   LOADER_MODE_COMBO_TEXT, _("Create"),
+			   LOADER_MODE_COMBO_OPTION_CHAR, 'c',			
 			   -1);
 	gtk_list_store_insert(loader_mode_combo_list, &iter, APPEND_MODE);
 	gtk_list_store_set(loader_mode_combo_list, &iter,
-	                   LOADER_MODE_COMBO_TEXT, _("Append"), 
-			   LOADER_MODE_COMBO_OPTION_CHAR, 'a', 
+	                   LOADER_MODE_COMBO_TEXT, _("Append"),
+			   LOADER_MODE_COMBO_OPTION_CHAR, 'a',
 			   -1);
 	gtk_list_store_insert(loader_mode_combo_list, &iter, DELETE_MODE);
 	gtk_list_store_set(loader_mode_combo_list, &iter,
-	                   LOADER_MODE_COMBO_TEXT, _("Delete"), 
-			   LOADER_MODE_COMBO_OPTION_CHAR, 'd', 
+	                   LOADER_MODE_COMBO_TEXT, _("Delete"),
+			   LOADER_MODE_COMBO_OPTION_CHAR, 'd',
 			   -1);
 	gtk_list_store_insert(loader_mode_combo_list, &iter, PREPARE_MODE);
 	gtk_list_store_set(loader_mode_combo_list, &iter,
-	                   LOADER_MODE_COMBO_TEXT, _("Prepare"), 
-			   LOADER_MODE_COMBO_OPTION_CHAR, 'p', 
+	                   LOADER_MODE_COMBO_TEXT, _("Prepare"),
+			   LOADER_MODE_COMBO_OPTION_CHAR, 'p',
 			   -1);
 	loader_mode_combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(loader_mode_combo_list));
 	import_mode_renderer = gtk_cell_renderer_combo_new();
@@ -3146,10 +3146,10 @@
 	export_geom_column_renderer = gtk_cell_renderer_combo_new();
 	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(export_geom_column_combo),
 	                           export_geom_column_renderer, TRUE);
-	g_object_set(export_geom_column_renderer, 
+	g_object_set(export_geom_column_renderer,
 		     "editable", TRUE,
 		     "has-entry", FALSE,
-	             "text-column", TABLECHOOSER_GEOCOL_COMBO_TEXT, 
+	             "text-column", TABLECHOOSER_GEOCOL_COMBO_TEXT,
 		     NULL);
 	export_geom_column = gtk_tree_view_column_new_with_attributes(_("Geo Column"),
 	               export_geom_column_renderer,
@@ -3253,7 +3253,7 @@
 	entry_pg_db   = gtk_entry_new();
 	gtk_table_attach_defaults(GTK_TABLE(table_pg), label, 0, 1, 3, 4 );
 	gtk_table_attach_defaults(GTK_TABLE(table_pg), entry_pg_db, 1, 3, 3, 4 );
-			 
+			
 	/* Add table into containing frame */
 	gtk_container_add(GTK_CONTAINER(frame_pg), table_pg);
 

Modified: trunk/loader/shpcommon.c
===================================================================
--- trunk/loader/shpcommon.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/loader/shpcommon.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -21,8 +21,8 @@
 
 
 /**
- * Escape strings that are to be used as part of a PostgreSQL connection string. If no 
- * characters require escaping, simply return the input pointer. Otherwise return a 
+ * Escape strings that are to be used as part of a PostgreSQL connection string. If no
+ * characters require escaping, simply return the input pointer. Otherwise return a
  * new allocated string.
  */
 char *
@@ -134,7 +134,7 @@
   char linebuffer[1024];
   char *tmpstr;
   int curmapsize, fieldnamesize;
-  
+
   /* Read column map file and load the colmap_dbffieldnames
    * and colmap_pgfieldnames arrays */
   fptr = fopen(filename, "r");
@@ -145,22 +145,22 @@
                      filename);
     return 0;
   }
-  
+
   /* First count how many columns we have... */
   while (fgets(linebuffer, 1024, fptr) != NULL) ++map->size;
-  
+
   /* Now we know the final size, allocate the arrays and load the data */
   fseek(fptr, 0, SEEK_SET);
   map->pgfieldnames = (char **)malloc(sizeof(char *) * map->size);
   map->dbffieldnames = (char **)malloc(sizeof(char *) * map->size);
-  
+
   /* Read in a line at a time... */
   curmapsize = 0;
   while (fgets(linebuffer, 1024, fptr) != NULL)
   {
     /* Split into two separate strings: pgfieldname and dbffieldname */
     /* First locate end of first column (pgfieldname) */
-    fieldnamesize = strcspn(linebuffer, "\t\n "); 
+    fieldnamesize = strcspn(linebuffer, "\t\n ");
     tmpstr = linebuffer;
 
     /* Allocate memory and copy the string ensuring it is terminated */
@@ -170,23 +170,23 @@
 
     /* Now swallow up any whitespace */
     tmpstr = linebuffer + fieldnamesize;
-    tmpstr += strspn(tmpstr, "\t\n "); 
+    tmpstr += strspn(tmpstr, "\t\n ");
 
     /* Finally locate end of second column (dbffieldname) */
-    fieldnamesize = strcspn(tmpstr, "\t\n "); 
+    fieldnamesize = strcspn(tmpstr, "\t\n ");
 
     /* Allocate memory and copy the string ensuring it is terminated */
     map->dbffieldnames[curmapsize] = malloc(fieldnamesize + 1);
     strncpy(map->dbffieldnames[curmapsize], tmpstr, fieldnamesize);
     map->dbffieldnames[curmapsize][fieldnamesize] = '\0';
-    
+
     /* Error out if the dbffieldname is > 10 chars */
     if (strlen(map->dbffieldnames[curmapsize]) > 10)
     {
       snprintf(errbuf, errbuflen, _("ERROR: column map file specifies a DBF field name \"%s\" which is longer than 10 characters"), map->dbffieldnames[curmapsize]);
       return 0;
     }
-    
+
     ++curmapsize;
   }
 
@@ -198,7 +198,7 @@
 
 /*
 * Code page info will come out of dbfopen as either a bare codepage number
-* (e.g. 1256) or as "LDID/1234" from the DBF hreader. We want to look up 
+* (e.g. 1256) or as "LDID/1234" from the DBF hreader. We want to look up
 * the equivalent iconv encoding string so we can use iconv to transcode
 * the data into UTF8
 */
@@ -208,10 +208,10 @@
     int cpglen;
     int is_ldid = 0;
     int num, i;
-    
+
     /* Do nothing on nothing. */
     if ( ! cpg ) return NULL;
-    
+
     /* Is this an LDID string? */
     /* If so, note it and move past the "LDID/" tag */
     cpglen = strlen(cpg);
@@ -227,10 +227,10 @@
             return NULL;
         }
     }
-    
+
     /* Read the number */
     num = atoi(cpg);
-    
+
     /* Can we find this number in our lookup table? */
     for ( i = is_ldid ; i < num_code_pages; i++ )
     {
@@ -245,10 +245,10 @@
                 return strdup(code_pages[i].iconv);
         }
     }
-    
+
     /* Didn't find a matching entry */
     return NULL;
-    
+
 }
 
 /*

Modified: trunk/loader/shpcommon.h
===================================================================
--- trunk/loader/shpcommon.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/loader/shpcommon.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -26,7 +26,7 @@
 
 
 
-typedef struct 
+typedef struct
 {
     int ldid;
     int cpg;
@@ -142,7 +142,7 @@
 } colmap;
 
 /**
- * Read the content of filename into a symbol map 
+ * Read the content of filename into a symbol map
  *
  * The content of the file is lines of two names separated by
  * white space and no trailing or leading space:

Modified: trunk/loader/shpopen.c
===================================================================
--- trunk/loader/shpopen.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/loader/shpopen.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -12,7 +12,7 @@
  * option is discussed in more detail in shapelib.html.
  *
  * --
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  * to deal in the Software without restriction, including without limitation
@@ -344,7 +344,7 @@
     int32	i32;
     double	dValue;
     int32	*panSHX;
-    
+
     if (psSHP->fpSHX == NULL)
     {
         psSHP->sHooks.Error( "SHPWriteHeader failed : SHX file is closed");
@@ -363,11 +363,11 @@
     i32 = psSHP->nFileSize/2;				/* file size */
     ByteCopy( &i32, abyHeader+24, 4 );
     if( !bBigEndian ) SwapWord( 4, abyHeader+24 );
-    
+
     i32 = 1000;						/* version */
     ByteCopy( &i32, abyHeader+28, 4 );
     if( bBigEndian ) SwapWord( 4, abyHeader+28 );
-    
+
     i32 = psSHP->nShapeType;				/* shape type */
     ByteCopy( &i32, abyHeader+32, 4 );
     if( bBigEndian ) SwapWord( 4, abyHeader+32 );
@@ -407,7 +407,7 @@
 /* -------------------------------------------------------------------- */
 /*      Write .shp file header.                                         */
 /* -------------------------------------------------------------------- */
-    if( psSHP->sHooks.FSeek( psSHP->fpSHP, 0, 0 ) != 0 
+    if( psSHP->sHooks.FSeek( psSHP->fpSHP, 0, 0 ) != 0
         || psSHP->sHooks.FWrite( abyHeader, 100, 1, psSHP->fpSHP ) != 1 )
     {
         psSHP->sHooks.Error( "Failure writing .shp header" );
@@ -420,8 +420,8 @@
     i32 = (psSHP->nRecords * 2 * sizeof(int32) + 100)/2;   /* file size */
     ByteCopy( &i32, abyHeader+24, 4 );
     if( !bBigEndian ) SwapWord( 4, abyHeader+24 );
-    
-    if( psSHP->sHooks.FSeek( psSHP->fpSHX, 0, 0 ) != 0 
+
+    if( psSHP->sHooks.FSeek( psSHP->fpSHX, 0, 0 ) != 0
         || psSHP->sHooks.FWrite( abyHeader, 100, 1, psSHP->fpSHX ) != 1 )
     {
         psSHP->sHooks.Error( "Failure writing .shx header" );
@@ -441,7 +441,7 @@
         if( !bBigEndian ) SwapWord( 4, panSHX+i*2+1 );
     }
 
-    if( (int)psSHP->sHooks.FWrite( panSHX, sizeof(int32)*2, psSHP->nRecords, psSHP->fpSHX ) 
+    if( (int)psSHP->sHooks.FWrite( panSHX, sizeof(int32)*2, psSHP->nRecords, psSHP->fpSHX )
         != psSHP->nRecords )
     {
         psSHP->sHooks.Error( "Failure writing .shx contents" );
@@ -477,18 +477,18 @@
 /*      Open the .shp and .shx files based on the basename of the       */
 /*      files or either file name.                                      */
 /************************************************************************/
-   
+
 SHPHandle SHPAPI_CALL
 SHPOpenLL( const char * pszLayer, const char * pszAccess, SAHooks *psHooks )
 
 {
     char		*pszFullname, *pszBasename;
     SHPHandle		psSHP;
-    
+
     uchar		*pabyBuf;
     int			i;
     double		dValue;
-    
+
 /* -------------------------------------------------------------------- */
 /*      Ensure the access string is one of the legal ones.  We          */
 /*      ensure the result string indicates binary to avoid common       */
@@ -499,7 +499,7 @@
         pszAccess = "r+b";
     else
         pszAccess = "rb";
-    
+
 /* -------------------------------------------------------------------- */
 /*	Establish the byte order on this machine.			*/
 /* -------------------------------------------------------------------- */
@@ -523,7 +523,7 @@
 /* -------------------------------------------------------------------- */
     pszBasename = (char *) malloc(strlen(pszLayer)+5);
     strcpy( pszBasename, pszLayer );
-    for( i = strlen(pszBasename)-1; 
+    for( i = strlen(pszBasename)-1;
          i > 0 && pszBasename[i] != '.' && pszBasename[i] != '/'
              && pszBasename[i] != '\\';
          i-- ) {}
@@ -543,11 +543,11 @@
         sprintf( pszFullname, "%s.SHP", pszBasename );
         psSHP->fpSHP = psSHP->sHooks.FOpen(pszFullname, pszAccess );
     }
-    
+
     if( psSHP->fpSHP == NULL )
     {
         char *pszMessage = (char *) malloc(strlen(pszBasename)*2+256);
-        sprintf( pszMessage, "Unable to open %s.shp or %s.SHP.", 
+        sprintf( pszMessage, "Unable to open %s.shp or %s.SHP.",
                   pszBasename, pszBasename );
         psHooks->Error( pszMessage );
         free( pszMessage );
@@ -564,11 +564,11 @@
         sprintf( pszFullname, "%s.SHX", pszBasename );
         psSHP->fpSHX = psSHP->sHooks.FOpen(pszFullname, pszAccess );
     }
-    
+
     if( psSHP->fpSHX == NULL )
     {
         char *pszMessage = (char *) malloc(strlen(pszBasename)*2+256);
-        sprintf( pszMessage, "Unable to open %s.shx or %s.SHX.", 
+        sprintf( pszMessage, "Unable to open %s.shx or %s.SHX.",
                   pszBasename, pszBasename );
         psHooks->Error( pszMessage );
         free( pszMessage );
@@ -597,10 +597,10 @@
 /* -------------------------------------------------------------------- */
 /*  Read SHX file Header info                                           */
 /* -------------------------------------------------------------------- */
-    if( psSHP->sHooks.FRead( pabyBuf, 100, 1, psSHP->fpSHX ) != 1 
-        || pabyBuf[0] != 0 
-        || pabyBuf[1] != 0 
-        || pabyBuf[2] != 0x27 
+    if( psSHP->sHooks.FRead( pabyBuf, 100, 1, psSHP->fpSHX ) != 1
+        || pabyBuf[0] != 0
+        || pabyBuf[1] != 0
+        || pabyBuf[2] != 0x27
         || (pabyBuf[3] != 0x0a && pabyBuf[3] != 0x0d) )
     {
         psSHP->sHooks.Error( ".shx file is unreadable, or corrupt." );
@@ -620,12 +620,12 @@
     if( psSHP->nRecords < 0 || psSHP->nRecords > 256000000 )
     {
         char szError[200];
-        
-        sprintf( szError, 
+
+        sprintf( szError,
                  "Record count in .shp header is %d, which seems\n"
                  "unreasonable.  Assuming header is corrupt.",
                  psSHP->nRecords );
-        psSHP->sHooks.Error( szError );				       
+        psSHP->sHooks.Error( szError );				
         psSHP->sHooks.FClose( psSHP->fpSHP );
         psSHP->sHooks.FClose( psSHP->fpSHX );
         free( psSHP );
@@ -656,11 +656,11 @@
     if( bBigEndian ) SwapWord( 8, pabyBuf+68 );		/* z */
     memcpy( &dValue, pabyBuf+68, 8 );
     psSHP->adBoundsMin[2] = dValue;
-    
+
     if( bBigEndian ) SwapWord( 8, pabyBuf+76 );
     memcpy( &dValue, pabyBuf+76, 8 );
     psSHP->adBoundsMax[2] = dValue;
-    
+
     if( bBigEndian ) SwapWord( 8, pabyBuf+84 );		/* z */
     memcpy( &dValue, pabyBuf+84, 8 );
     psSHP->adBoundsMin[3] = dValue;
@@ -689,9 +689,9 @@
     {
         char szError[200];
 
-        sprintf(szError, 
+        sprintf(szError,
                 "Not enough memory to allocate requested memory (nRecords=%d).\n"
-                "Probably broken SHP file", 
+                "Probably broken SHP file",
                 psSHP->nRecords );
         psSHP->sHooks.Error( szError );
         psSHP->sHooks.FClose( psSHP->fpSHP );
@@ -703,12 +703,12 @@
         return( NULL );
     }
 
-    if( (int) psSHP->sHooks.FRead( pabyBuf, 8, psSHP->nRecords, psSHP->fpSHX ) 
+    if( (int) psSHP->sHooks.FRead( pabyBuf, 8, psSHP->nRecords, psSHP->fpSHX )
         != psSHP->nRecords )
     {
         char szError[200];
 
-        sprintf( szError, 
+        sprintf( szError,
                  "Failed to read all values for %d records in .shx file.",
                  psSHP->nRecords );
         psSHP->sHooks.Error( szError );
@@ -723,7 +723,7 @@
 
         return( NULL );
     }
-    
+
     /* In read-only mode, we can close the SHX now */
     if (strcmp(pszAccess, "rb") == 0)
     {
@@ -782,7 +782,7 @@
     {
         free( psSHP->pabyRec );
     }
-    
+
     free( psSHP );
 }
 
@@ -801,7 +801,7 @@
 
     if( psSHP == NULL )
         return;
-    
+
     if( pnEntities != NULL )
         *pnEntities = psSHP->nRecords;
 
@@ -852,7 +852,7 @@
     uchar     	abyHeader[100];
     int32	i32;
     double	dValue;
-    
+
 /* -------------------------------------------------------------------- */
 /*      Establish the byte order on this system.                        */
 /* -------------------------------------------------------------------- */
@@ -868,7 +868,7 @@
 /* -------------------------------------------------------------------- */
     pszBasename = (char *) malloc(strlen(pszLayer)+5);
     strcpy( pszBasename, pszLayer );
-    for( i = strlen(pszBasename)-1; 
+    for( i = strlen(pszBasename)-1;
          i > 0 && pszBasename[i] != '.' && pszBasename[i] != '/'
              && pszBasename[i] != '\\';
          i-- ) {}
@@ -911,11 +911,11 @@
     i32 = 50;						/* file size */
     ByteCopy( &i32, abyHeader+24, 4 );
     if( !bBigEndian ) SwapWord( 4, abyHeader+24 );
-    
+
     i32 = 1000;						/* version */
     ByteCopy( &i32, abyHeader+28, 4 );
     if( bBigEndian ) SwapWord( 4, abyHeader+28 );
-    
+
     i32 = nShapeType;					/* shape type */
     ByteCopy( &i32, abyHeader+32, 4 );
     if( bBigEndian ) SwapWord( 4, abyHeader+32 );
@@ -941,7 +941,7 @@
     i32 = 50;						/* file size */
     ByteCopy( &i32, abyHeader+24, 4 );
     if( !bBigEndian ) SwapWord( 4, abyHeader+24 );
-    
+
     if( psHooks->FWrite( abyHeader, 100, 1, fpSHX ) != 1 )
     {
         psHooks->Error( "Failed to write .shx header." );
@@ -1000,7 +1000,7 @@
 
 {
     int		i;
-    
+
 /* -------------------------------------------------------------------- */
 /*      Build extents for this object.                                  */
 /* -------------------------------------------------------------------- */
@@ -1011,7 +1011,7 @@
         psObject->dfZMin = psObject->dfZMax = psObject->padfZ[0];
         psObject->dfMMin = psObject->dfMMax = psObject->padfM[0];
     }
-    
+
     for( i = 0; i < psObject->nVertices; i++ )
     {
         psObject->dfXMin = MIN(psObject->dfXMin, psObject->padfX[i]);
@@ -1092,7 +1092,7 @@
 
         psObject->panPartStart[0] = 0;
         psObject->panPartType[0] = SHPP_RING;
-        
+
         for( i = 0; i < nParts; i++ )
         {
             if( psObject->panPartStart != NULL )
@@ -1158,7 +1158,7 @@
     return( SHPCreateObject( nSHPType, -1, 0, NULL, NULL,
                              nVertices, padfX, padfY, padfZ, NULL ) );
 }
-                                  
+
 /************************************************************************/
 /*                           SHPWriteObject()                           */
 /*                                                                      */
@@ -1168,7 +1168,7 @@
 
 int SHPAPI_CALL
 SHPWriteObject(SHPHandle psSHP, int nShapeId, SHPObject * psObject )
-		      
+		
 {
     unsigned int	       	nRecordOffset, nRecordSize=0;
     int i;
@@ -1181,7 +1181,7 @@
 /*      Ensure that shape object matches the type of the file it is     */
 /*      being written to.                                               */
 /* -------------------------------------------------------------------- */
-    assert( psObject->nSHPType == psSHP->nShapeType 
+    assert( psObject->nSHPType == psSHP->nShapeType
             || psObject->nSHPType == SHPT_NULL );
 
 /* -------------------------------------------------------------------- */
@@ -1189,7 +1189,7 @@
 /*      assertion, or if they are disabled, set the shapeid to -1       */
 /*      for appends.                                                    */
 /* -------------------------------------------------------------------- */
-    assert( nShapeId == -1 
+    assert( nShapeId == -1
             || (nShapeId >= 0 && nShapeId < psSHP->nRecords) );
 
     if( nShapeId != -1 && nShapeId >= psSHP->nRecords )
@@ -1202,25 +1202,25 @@
     {
         psSHP->nMaxRecords =(int) ( psSHP->nMaxRecords * 1.3 + 100);
 
-        psSHP->panRecOffset = (unsigned int *) 
+        psSHP->panRecOffset = (unsigned int *)
             SfRealloc(psSHP->panRecOffset,sizeof(unsigned int) * psSHP->nMaxRecords );
-        psSHP->panRecSize = (unsigned int *) 
+        psSHP->panRecSize = (unsigned int *)
             SfRealloc(psSHP->panRecSize,sizeof(unsigned int) * psSHP->nMaxRecords );
     }
 
 /* -------------------------------------------------------------------- */
 /*      Initialize record.                                              */
 /* -------------------------------------------------------------------- */
-    pabyRec = (uchar *) malloc(psObject->nVertices * 4 * sizeof(double) 
+    pabyRec = (uchar *) malloc(psObject->nVertices * 4 * sizeof(double)
                                + psObject->nParts * 8 + 128);
-    
+
 /* -------------------------------------------------------------------- */
 /*  Extract vertices for a Polygon or Arc.				*/
 /* -------------------------------------------------------------------- */
     if( psObject->nSHPType == SHPT_POLYGON
         || psObject->nSHPType == SHPT_POLYGONZ
         || psObject->nSHPType == SHPT_POLYGONM
-        || psObject->nSHPType == SHPT_ARC 
+        || psObject->nSHPType == SHPT_ARC
         || psObject->nSHPType == SHPT_ARCZ
         || psObject->nSHPType == SHPT_ARCM
         || psObject->nSHPType == SHPT_MULTIPATCH )
@@ -1276,7 +1276,7 @@
 
             if( bBigEndian )
                 SwapWord( 8, pabyRec + nRecordSize );
-            
+
             if( bBigEndian )
                 SwapWord( 8, pabyRec + nRecordSize + 8 );
 
@@ -1293,7 +1293,7 @@
             ByteCopy( &(psObject->dfZMin), pabyRec + nRecordSize, 8 );
             if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
             nRecordSize += 8;
-            
+
             ByteCopy( &(psObject->dfZMax), pabyRec + nRecordSize, 8 );
             if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
             nRecordSize += 8;
@@ -1312,16 +1312,16 @@
         if( psObject->bMeasureIsUsed
             && (psObject->nSHPType == SHPT_POLYGONM
                 || psObject->nSHPType == SHPT_ARCM
-#ifndef DISABLE_MULTIPATCH_MEASURE            
+#ifndef DISABLE_MULTIPATCH_MEASURE
                 || psObject->nSHPType == SHPT_MULTIPATCH
-#endif            
+#endif
                 || psObject->nSHPType == SHPT_POLYGONZ
                 || psObject->nSHPType == SHPT_ARCZ) )
         {
             ByteCopy( &(psObject->dfMMin), pabyRec + nRecordSize, 8 );
             if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
             nRecordSize += 8;
-            
+
             ByteCopy( &(psObject->dfMMax), pabyRec + nRecordSize, 8 );
             if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
             nRecordSize += 8;
@@ -1372,7 +1372,7 @@
             ByteCopy( &(psObject->dfZMax), pabyRec + nRecordSize, 8 );
             if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
             nRecordSize += 8;
-            
+
             for( i = 0; i < psObject->nVertices; i++ )
             {
                 ByteCopy( psObject->padfZ + i, pabyRec + nRecordSize, 8 );
@@ -1392,7 +1392,7 @@
             ByteCopy( &(psObject->dfMMax), pabyRec + nRecordSize, 8 );
             if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
             nRecordSize += 8;
-            
+
             for( i = 0; i < psObject->nVertices; i++ )
             {
                 ByteCopy( psObject->padfM + i, pabyRec + nRecordSize, 8 );
@@ -1416,14 +1416,14 @@
         if( bBigEndian ) SwapWord( 8, pabyRec + 20 );
 
         nRecordSize = 28;
-        
+
         if( psObject->nSHPType == SHPT_POINTZ )
         {
             ByteCopy( psObject->padfZ, pabyRec + nRecordSize, 8 );
             if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
             nRecordSize += 8;
         }
-        
+
         if( psObject->bMeasureIsUsed
             && (psObject->nSHPType == SHPT_POINTZ
                 || psObject->nSHPType == SHPT_POINTM) )
@@ -1479,7 +1479,7 @@
         nRecordOffset = psSHP->panRecOffset[nShapeId];
         psSHP->panRecSize[nShapeId] = nRecordSize-8;
     }
-    
+
 /* -------------------------------------------------------------------- */
 /*      Set the shape type, record number, and record size.             */
 /* -------------------------------------------------------------------- */
@@ -1510,7 +1510,7 @@
         free( pabyRec );
         return -1;
     }
-    
+
     free( pabyRec );
 
 /* -------------------------------------------------------------------- */
@@ -1587,7 +1587,7 @@
             /* Reallocate previous successfull size for following features */
             psSHP->pabyRec = malloc(psSHP->nBufSize);
 
-            sprintf( szError, 
+            sprintf( szError,
                      "Not enough memory to allocate requested memory (nBufSize=%d). "
                      "Probably broken SHP file", psSHP->nBufSize );
             psSHP->sHooks.Error( szError );
@@ -1648,7 +1648,7 @@
     {
         snprintf(szErrorMsg, sizeof(szErrorMsg),
                  "Corrupted .shp file : shape %d : nEntitySize = %d",
-                 hEntity, nEntitySize); 
+                 hEntity, nEntitySize);
         psSHP->sHooks.Error( szErrorMsg );
         SHPDestroyObject(psShape);
         return NULL;
@@ -1674,7 +1674,7 @@
         {
             snprintf(szErrorMsg, sizeof(szErrorMsg),
                      "Corrupted .shp file : shape %d : nEntitySize = %d",
-                     hEntity, nEntitySize); 
+                     hEntity, nEntitySize);
             psSHP->sHooks.Error( szErrorMsg );
             SHPDestroyObject(psShape);
             return NULL;
@@ -1711,7 +1711,7 @@
             SHPDestroyObject(psShape);
             return NULL;
         }
-        
+
         /* With the previous checks on nPoints and nParts, */
         /* we should not overflow here and after */
         /* since 50 M * (16 + 8 + 8) = 1 600 MB */
@@ -1745,7 +1745,7 @@
         psShape->nParts = nParts;
         psShape->panPartStart = (int *) calloc(nParts,sizeof(int));
         psShape->panPartType = (int *) calloc(nParts,sizeof(int));
-        
+
         if (psShape->padfX == NULL ||
             psShape->padfY == NULL ||
             psShape->padfZ == NULL ||
@@ -1779,7 +1779,7 @@
             {
                 snprintf(szErrorMsg, sizeof(szErrorMsg),
                          "Corrupted .shp file : shape %d : panPartStart[%d] = %d, nVertices = %d",
-                         hEntity, i, psShape->panPartStart[i], psShape->nVertices); 
+                         hEntity, i, psShape->panPartStart[i], psShape->nVertices);
                 psSHP->sHooks.Error( szErrorMsg );
                 SHPDestroyObject(psShape);
                 return NULL;
@@ -1788,7 +1788,7 @@
             {
                 snprintf(szErrorMsg, sizeof(szErrorMsg),
                          "Corrupted .shp file : shape %d : panPartStart[%d] = %d, panPartStart[%d] = %d",
-                         hEntity, i, psShape->panPartStart[i], i - 1, psShape->panPartStart[i - 1]); 
+                         hEntity, i, psShape->panPartStart[i], i - 1, psShape->panPartStart[i - 1]);
                 psSHP->sHooks.Error( szErrorMsg );
                 SHPDestroyObject(psShape);
                 return NULL;
@@ -1810,7 +1810,7 @@
 
             nOffset += 4*nParts;
         }
-        
+
 /* -------------------------------------------------------------------- */
 /*      Copy out the vertices from the record.                          */
 /* -------------------------------------------------------------------- */
@@ -1829,7 +1829,7 @@
         }
 
         nOffset += 16*nPoints;
-        
+
 /* -------------------------------------------------------------------- */
 /*      If we have a Z coordinate, collect that now.                    */
 /* -------------------------------------------------------------------- */
@@ -1839,10 +1839,10 @@
         {
             memcpy( &(psShape->dfZMin), psSHP->pabyRec + nOffset, 8 );
             memcpy( &(psShape->dfZMax), psSHP->pabyRec + nOffset + 8, 8 );
-            
+
             if( bBigEndian ) SwapWord( 8, &(psShape->dfZMin) );
             if( bBigEndian ) SwapWord( 8, &(psShape->dfZMax) );
-            
+
             for( i = 0; i < nPoints; i++ )
             {
                 memcpy( psShape->padfZ + i,
@@ -1863,10 +1863,10 @@
         {
             memcpy( &(psShape->dfMMin), psSHP->pabyRec + nOffset, 8 );
             memcpy( &(psShape->dfMMax), psSHP->pabyRec + nOffset + 8, 8 );
-            
+
             if( bBigEndian ) SwapWord( 8, &(psShape->dfMMin) );
             if( bBigEndian ) SwapWord( 8, &(psShape->dfMMax) );
-            
+
             for( i = 0; i < nPoints; i++ )
             {
                 memcpy( psShape->padfM + i,
@@ -1891,7 +1891,7 @@
         {
             snprintf(szErrorMsg, sizeof(szErrorMsg),
                      "Corrupted .shp file : shape %d : nEntitySize = %d",
-                     hEntity, nEntitySize); 
+                     hEntity, nEntitySize);
             psSHP->sHooks.Error( szErrorMsg );
             SHPDestroyObject(psShape);
             return NULL;
@@ -1904,7 +1904,7 @@
         {
             snprintf(szErrorMsg, sizeof(szErrorMsg),
                      "Corrupted .shp file : shape %d : nPoints = %d",
-                     hEntity, nPoints); 
+                     hEntity, nPoints);
             psSHP->sHooks.Error( szErrorMsg );
             SHPDestroyObject(psShape);
             return NULL;
@@ -1919,12 +1919,12 @@
         {
             snprintf(szErrorMsg, sizeof(szErrorMsg),
                      "Corrupted .shp file : shape %d : nPoints = %d, nEntitySize = %d",
-                     hEntity, nPoints, nEntitySize); 
+                     hEntity, nPoints, nEntitySize);
             psSHP->sHooks.Error( szErrorMsg );
             SHPDestroyObject(psShape);
             return NULL;
         }
-        
+
         psShape->nVertices = nPoints;
         psShape->padfX = (double *) calloc(nPoints,sizeof(double));
         psShape->padfY = (double *) calloc(nPoints,sizeof(double));
@@ -1954,7 +1954,7 @@
         }
 
         nOffset = 48 + 16*nPoints;
-        
+
 /* -------------------------------------------------------------------- */
 /*	Get the X/Y bounds.						*/
 /* -------------------------------------------------------------------- */
@@ -1975,10 +1975,10 @@
         {
             memcpy( &(psShape->dfZMin), psSHP->pabyRec + nOffset, 8 );
             memcpy( &(psShape->dfZMax), psSHP->pabyRec + nOffset + 8, 8 );
-            
+
             if( bBigEndian ) SwapWord( 8, &(psShape->dfZMin) );
             if( bBigEndian ) SwapWord( 8, &(psShape->dfZMax) );
-            
+
             for( i = 0; i < nPoints; i++ )
             {
                 memcpy( psShape->padfZ + i,
@@ -1999,10 +1999,10 @@
         {
             memcpy( &(psShape->dfMMin), psSHP->pabyRec + nOffset, 8 );
             memcpy( &(psShape->dfMMax), psSHP->pabyRec + nOffset + 8, 8 );
-            
+
             if( bBigEndian ) SwapWord( 8, &(psShape->dfMMin) );
             if( bBigEndian ) SwapWord( 8, &(psShape->dfMMax) );
-            
+
             for( i = 0; i < nPoints; i++ )
             {
                 memcpy( psShape->padfM + i,
@@ -2021,7 +2021,7 @@
              || psShape->nSHPType == SHPT_POINTZ )
     {
         int	nOffset;
-        
+
         psShape->nVertices = 1;
         psShape->padfX = (double *) calloc(1,sizeof(double));
         psShape->padfY = (double *) calloc(1,sizeof(double));
@@ -2032,7 +2032,7 @@
         {
             snprintf(szErrorMsg, sizeof(szErrorMsg),
                      "Corrupted .shp file : shape %d : nEntitySize = %d",
-                     hEntity, nEntitySize); 
+                     hEntity, nEntitySize);
             psSHP->sHooks.Error( szErrorMsg );
             SHPDestroyObject(psShape);
             return NULL;
@@ -2044,16 +2044,16 @@
         if( bBigEndian ) SwapWord( 8, psShape->padfY );
 
         nOffset = 20 + 8;
-        
+
 /* -------------------------------------------------------------------- */
 /*      If we have a Z coordinate, collect that now.                    */
 /* -------------------------------------------------------------------- */
         if( psShape->nSHPType == SHPT_POINTZ )
         {
             memcpy( psShape->padfZ, psSHP->pabyRec + nOffset, 8 );
-        
+
             if( bBigEndian ) SwapWord( 8, psShape->padfZ );
-            
+
             nOffset += 8;
         }
 
@@ -2066,7 +2066,7 @@
         if( nEntitySize >= nOffset + 8 )
         {
             memcpy( psShape->padfM, psSHP->pabyRec + nOffset, 8 );
-        
+
             if( bBigEndian ) SwapWord( 8, psShape->padfM );
             psShape->bMeasureIsUsed = TRUE;
         }
@@ -2108,7 +2108,7 @@
 
       case SHPT_MULTIPOINT:
         return "MultiPoint";
-        
+
       case SHPT_POINTZ:
         return "PointZ";
 
@@ -2120,7 +2120,7 @@
 
       case SHPT_MULTIPOINTZ:
         return "MultiPointZ";
-        
+
       case SHPT_POINTM:
         return "PointM";
 
@@ -2153,7 +2153,7 @@
     {
       case SHPP_TRISTRIP:
         return "TriangleStrip";
-        
+
       case SHPP_TRIFAN:
         return "TriangleFan";
 
@@ -2184,7 +2184,7 @@
 {
     if( psShape == NULL )
         return;
-    
+
     if( psShape->padfX != NULL )
         free( psShape->padfX );
     if( psShape->padfY != NULL )
@@ -2258,14 +2258,14 @@
 
             if( iCheckRing == iOpRing )
                 continue;
-            
+
             nVertStart = psObject->panPartStart[iCheckRing];
 
             if( iCheckRing == psObject->nParts-1 )
-                nVertCount = psObject->nVertices 
+                nVertCount = psObject->nVertices
                     - psObject->panPartStart[iCheckRing];
             else
-                nVertCount = psObject->panPartStart[iCheckRing+1] 
+                nVertCount = psObject->panPartStart[iCheckRing+1]
                     - psObject->panPartStart[iCheckRing];
 
             for( iEdge = 0; iEdge < nVertCount; iEdge++ )
@@ -2289,9 +2289,9 @@
                     /* Rule #2:
                      * Test if edge-ray intersection is on the right from the test point (dfTestY,dfTestY)
                      */
-                    double const intersect = 
+                    double const intersect =
                         ( psObject->padfX[iEdge+nVertStart]
-                          + ( dfTestY - psObject->padfY[iEdge+nVertStart] ) 
+                          + ( dfTestY - psObject->padfY[iEdge+nVertStart] )
                           / ( psObject->padfY[iNext+nVertStart] - psObject->padfY[iEdge+nVertStart] )
                           * ( psObject->padfX[iNext+nVertStart] - psObject->padfX[iEdge+nVertStart] ) );
 
@@ -2299,7 +2299,7 @@
                     {
                         bInner = !bInner;
                     }
-                }    
+                }
             }
         } /* for iCheckRing */
 
@@ -2312,7 +2312,7 @@
         if( iOpRing == psObject->nParts-1 )
             nVertCount = psObject->nVertices - psObject->panPartStart[iOpRing];
         else
-            nVertCount = psObject->panPartStart[iOpRing+1] 
+            nVertCount = psObject->panPartStart[iOpRing+1]
                 - psObject->panPartStart[iOpRing];
 
         if (nVertCount < 2)
@@ -2340,13 +2340,13 @@
 
                 /* Swap X */
                 dfSaved = psObject->padfX[nVertStart+i];
-                psObject->padfX[nVertStart+i] = 
+                psObject->padfX[nVertStart+i] =
                     psObject->padfX[nVertStart+nVertCount-i-1];
                 psObject->padfX[nVertStart+nVertCount-i-1] = dfSaved;
 
                 /* Swap Y */
                 dfSaved = psObject->padfY[nVertStart+i];
-                psObject->padfY[nVertStart+i] = 
+                psObject->padfY[nVertStart+i] =
                     psObject->padfY[nVertStart+nVertCount-i-1];
                 psObject->padfY[nVertStart+nVertCount-i-1] = dfSaved;
 
@@ -2354,7 +2354,7 @@
                 if( psObject->padfZ )
                 {
                     dfSaved = psObject->padfZ[nVertStart+i];
-                    psObject->padfZ[nVertStart+i] = 
+                    psObject->padfZ[nVertStart+i] =
                         psObject->padfZ[nVertStart+nVertCount-i-1];
                     psObject->padfZ[nVertStart+nVertCount-i-1] = dfSaved;
                 }
@@ -2363,7 +2363,7 @@
                 if( psObject->padfM )
                 {
                     dfSaved = psObject->padfM[nVertStart+i];
-                    psObject->padfM[nVertStart+i] = 
+                    psObject->padfM[nVertStart+i] =
                         psObject->padfM[nVertStart+nVertCount-i-1];
                     psObject->padfM[nVertStart+nVertCount-i-1] = dfSaved;
                 }

Modified: trunk/postgis/geography.h
===================================================================
--- trunk/postgis/geography.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/geography.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -25,7 +25,7 @@
 
 
 /**********************************************************************
-**  Useful functions for all GSERIALIZED handlers. 
+**  Useful functions for all GSERIALIZED handlers.
 **  TODO: Move to common.h in pgcommon
 */
 

Modified: trunk/postgis/geography_inout.c
===================================================================
--- trunk/postgis/geography_inout.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/geography_inout.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -159,7 +159,7 @@
 		/* TODO: 20101206: No parser checks! This is inline with current 1.5 behavior, but needs discussion */
 		lwgeom = lwgeom_from_hexwkb(str, LW_PARSER_CHECK_NONE);
 		/* Error out if something went sideways */
-		if ( ! lwgeom ) 
+		if ( ! lwgeom )
 			ereport(ERROR,(errmsg("parse error - invalid geometry")));
 	}
 	/* WKT then. */
@@ -305,7 +305,7 @@
 
 	/* Revert lat/lon only with long SRS */
 	if (option & 1) lwopts |= LW_GML_IS_DEGREE;
-	if (option & 2) lwopts &= ~LW_GML_IS_DIMS; 
+	if (option & 2) lwopts &= ~LW_GML_IS_DIMS;
 
 	if (version == 2)
 		gml = lwgeom_to_gml2(lwgeom, srs, precision, prefix);
@@ -316,7 +316,7 @@
 	PG_FREE_IF_COPY(g, 1);
 
 	/* Return null on null */
-	if ( ! gml ) 
+	if ( ! gml )
 		PG_RETURN_NULL();
 
 	/* Turn string result into text for return */

Modified: trunk/postgis/geography_measurement.c
===================================================================
--- trunk/postgis/geography_measurement.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/geography_measurement.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -75,7 +75,7 @@
 	GSERIALIZED *g2 = NULL;
 	double distance;
 	double tolerance = FP_TOLERANCE;
-	bool use_spheroid = false; /* must use sphere, can't get index to harmonize with spheroid */ 
+	bool use_spheroid = false; /* must use sphere, can't get index to harmonize with spheroid */
 	SPHEROID s;
 
 	/* Get our geometry objects loaded into memory. */
@@ -138,7 +138,7 @@
 	GSERIALIZED *g2 = NULL;
 	double distance;
 	double tolerance = FP_TOLERANCE;
-	bool use_spheroid = true; 
+	bool use_spheroid = true;
 	SPHEROID s;
 
 	/* Get our geometry objects loaded into memory. */
@@ -148,7 +148,7 @@
 	/* Read our tolerance value. */
 	if ( PG_NARGS() > 2 && ! PG_ARGISNULL(2) )
 		tolerance = PG_GETARG_FLOAT8(2);
-    
+
 	/* Read our calculation type. */
 	if ( PG_NARGS() > 3 && ! PG_ARGISNULL(3) )
 		use_spheroid = PG_GETARG_BOOL(3);
@@ -706,7 +706,7 @@
 	gbox_pt_outside(&gbox, &pt);
 
 	lwpoint = (LWGEOM*) lwpoint_make2d(4326, pt.x, pt.y);
-	/* TODO: Investigate where this is used, this was probably not 
+	/* TODO: Investigate where this is used, this was probably not
 	* returning a geography object before. How did this miss checking
 	*/
 	lwgeom_set_geodetic(lwpoint, true);
@@ -861,7 +861,7 @@
 	/* Are these data antarctic? Lambert Azimuthal Equal Area South. */
 	if ( center.y < -70.0 && ywidth < 45.0 )
 	{
-		PG_RETURN_INT32(SRID_SOUTH_LAMBERT); 
+		PG_RETURN_INT32(SRID_SOUTH_LAMBERT);
 	}
 
 	/*
@@ -889,7 +889,7 @@
 	}
 
 	/*
-	** Can we fit into a custom LAEA area? (30 degrees high, variable width) 
+	** Can we fit into a custom LAEA area? (30 degrees high, variable width)
 	** We will allow overlap into adjoining areas, but use a slightly narrower test (25) to try
 	** and minimize the worst case.
 	** Again, we are hoping the dateline doesn't trip us up much
@@ -932,7 +932,7 @@
 
 /*
 ** geography_project(GSERIALIZED *g, distance, azimuth)
-** returns point of projection given start point, 
+** returns point of projection given start point,
 ** azimuth in radians (bearing) and distance in meters
 */
 PG_FUNCTION_INFO_V1(geography_project);

Modified: trunk/postgis/geography_measurement_trees.c
===================================================================
--- trunk/postgis/geography_measurement_trees.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/geography_measurement_trees.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -26,7 +26,7 @@
 
 
 /*
-* Specific tree types include all the generic slots and 
+* Specific tree types include all the generic slots and
 * their own slots for their trees. We put the implementation
 * for the CircTreeGeomCache here because we can't shove
 * the PgSQL specific bits of the code (fcinfo) back into
@@ -34,10 +34,10 @@
 */
 typedef struct {
 	int                     type;       // <GeomCache>
-	GSERIALIZED*                geom1;      // 
-	GSERIALIZED*                geom2;      // 
-	size_t                      geom1_size; // 
-	size_t                      geom2_size; // 
+	GSERIALIZED*                geom1;      //
+	GSERIALIZED*                geom2;      //
+	size_t                      geom1_size; //
+	size_t                      geom2_size; //
 	int32                       argnum;     // </GeomCache>
 	CIRC_NODE*                  index;
 } CircTreeGeomCache;
@@ -69,7 +69,7 @@
 CircTreeFreer(GeomCache* cache)
 {
 	CircTreeGeomCache* circ_cache = (CircTreeGeomCache*)cache;
-	if ( circ_cache->index ) 
+	if ( circ_cache->index )
 	{
 		circ_tree_free(circ_cache->index);
 		circ_cache->index = 0;
@@ -139,7 +139,7 @@
 		{
 			POINT2D pt2d_outside; /* latlon */
 			POINT2D pt2d_inside;
-			pt2d_inside.x = in_point->x; 
+			pt2d_inside.x = in_point->x;
 			pt2d_inside.y = in_point->y;
 			/* Calculate a definitive outside point */
 			gbox_pt_outside(&gbox1, &pt2d_outside);
@@ -221,7 +221,7 @@
 		}
 		
 		circtree = lwgeom_calculate_circ_tree(lwgeom);
-		if ( geomtype == POLYGONTYPE || geomtype == MULTIPOLYGONTYPE ) 
+		if ( geomtype == POLYGONTYPE || geomtype == MULTIPOLYGONTYPE )
 		{
 			POINT2D p2d;
 			circ_tree_get_point(circtree_cached, &p2d);
@@ -292,7 +292,7 @@
 	{
 		*distance = 0.0;
 	}
-	else 
+	else
 	{
 		/* Calculate tree/tree distance */
 		*distance = circ_tree_distance_tree(circ_tree1, circ_tree2, s, tolerance);

Modified: trunk/postgis/geometry_inout.c
===================================================================
--- trunk/postgis/geometry_inout.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/geometry_inout.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -177,7 +177,7 @@
 	for ( i = 0; i < path->npts; i++ )
 	{
 		p = path->p[i];
-		pt.x = p.x; 
+		pt.x = p.x;
 		pt.y = p.y;
 		ptarray_append_point(pa, &pt, LW_FALSE);
 	}
@@ -276,7 +276,7 @@
 	{
 		POINT4D pt;
 		p = polygon->p[i % polygon->npts];
-		pt.x = p.x; 
+		pt.x = p.x;
 		pt.y = p.y;
 		ptarray_append_point(pa, &pt, LW_FALSE);
 	}

Modified: trunk/postgis/gserialized_estimate.c
===================================================================
--- trunk/postgis/gserialized_estimate.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/gserialized_estimate.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -25,32 +25,32 @@
 
 
 /**********************************************************************
- THEORY OF OPERATION 
+ THEORY OF OPERATION
 
 The ANALYZE command hooks to a callback (gserialized_analyze_nd) that
-calculates (compute_gserialized_stats_mode) two histograms of occurances of 
-features, once for the 2D domain (and the && operator) one for the 
+calculates (compute_gserialized_stats_mode) two histograms of occurances of
+features, once for the 2D domain (and the && operator) one for the
 ND domain (and the &&& operator).
 
 Queries in PostgreSQL call into the selectivity sub-system to find out
-the relative effectiveness of different clauses in sub-setting 
+the relative effectiveness of different clauses in sub-setting
 relations. Queries with constant arguments call gserialized_gist_sel,
 queries with relations on both sides call gserialized_gist_joinsel.
 
 gserialized_gist_sel sums up the values in the histogram that overlap
 the contant search box.
 
-gserialized_gist_joinsel sums up the product of the overlapping 
+gserialized_gist_joinsel sums up the product of the overlapping
 cells in each relation's histogram.
 
-Depending on the operator and type, the mode of selectivity calculation 
+Depending on the operator and type, the mode of selectivity calculation
 will be 2D or ND.
 
 - geometry && geometry ==> 2D
 - geometry &&& geometry ==> ND
 - geography && geography ==> ND
 
-The 2D mode is put in effect by retrieving the 2D histogram from the 
+The 2D mode is put in effect by retrieving the 2D histogram from the
 statistics cache and then allowing the generic ND calculations to
 go to work.
 
@@ -181,7 +181,7 @@
 
 
 /**
-* N-dimensional statistics structure. Well, actually 
+* N-dimensional statistics structure. Well, actually
 * four-dimensional, but set up to handle arbirary dimensions
 * if necessary (really, we just want to get the 2,3,4-d cases
 * into one shared piece of code).
@@ -225,7 +225,7 @@
 
 
 /**
-* Given that geodetic boxes are X/Y/Z regardless of the 
+* Given that geodetic boxes are X/Y/Z regardless of the
 * underlying geometry dimensionality and other boxes
 * are guided by HAS_Z/HAS_M in their dimesionality,
 * we have a little utility function to make it easy.
@@ -261,9 +261,9 @@
 
 
 /**
-* Integer comparison function for qsort 
+* Integer comparison function for qsort
 */
-static int 
+static int
 cmp_int (const void *a, const void *b)
 {
 	int ia = *((const int*)a);
@@ -273,7 +273,7 @@
 		return 0;
 	else if ( ia > ib )
 		return 1;
-	else 
+	else
 		return -1;
 }
 
@@ -291,7 +291,7 @@
 /**
 * Given double array, return sum of values.
 */
-static double 
+static double
 total_double(const double *vals, int nvals)
 {
 	int i;
@@ -308,7 +308,7 @@
 /**
 * Given int array, return sum of values.
 */
-static int 
+static int
 total_int(const int *vals, int nvals)
 {
 	int i;
@@ -354,7 +354,7 @@
 * Given a position in the n-d histogram (i,j,k) return the
 * position in the 1-d values array.
 */
-static int 
+static int
 nd_stats_value_index(const ND_STATS *stats, int *indexes)
 {
 	int d;
@@ -377,8 +377,8 @@
 	return vdx;
 }
 
-/** 
-* Convert an #ND_BOX to a JSON string for printing 
+/**
+* Convert an #ND_BOX to a JSON string for printing
 */
 static char*
 nd_box_to_json(const ND_BOX *nd_box, int ndims)
@@ -408,7 +408,7 @@
 
 
 /**
-* Convert an #ND_STATS to a JSON representation for 
+* Convert an #ND_STATS to a JSON representation for
 * external use.
 */
 static char*
@@ -455,7 +455,7 @@
 * Caller is responsible for freeing.
 * Currently only prints first two dimensions.
 */
-// static char* 
+// static char*
 // nd_stats_to_grid(const ND_STATS *stats)
 // {
 //  char *rv;
@@ -463,7 +463,7 @@
 //  int sizex = (int)roundf(stats->size[0]);
 //  int sizey = (int)roundf(stats->size[1]);
 //  stringbuffer_t *sb = stringbuffer_create();
-// 
+//
 //  for ( k = 0; k < sizey; k++ )
 //  {
 //      for ( j = 0; j < sizex; j++ )
@@ -472,7 +472,7 @@
 //      }
 //      stringbuffer_append(sb,  "\n");
 //  }
-//      
+//
 //  rv = stringbuffer_getstringcopy(sb);
 //  stringbuffer_destroy(sb);
 //  return rv;
@@ -480,7 +480,7 @@
 
 
 /** Expand the bounds of target to include source */
-static int 
+static int
 nd_box_merge(const ND_BOX *source, ND_BOX *target)
 {
 	int d;
@@ -493,19 +493,19 @@
 }
 
 /** Zero out an ND_BOX */
-static int 
+static int
 nd_box_init(ND_BOX *a)
 {
 	memset(a, 0, sizeof(ND_BOX));
 	return TRUE;
 }
 
-/** 
-* Prepare an ND_BOX for bounds calculation: 
+/**
+* Prepare an ND_BOX for bounds calculation:
 * set the maxes to the smallest thing possible and
-* the mins to the largest. 
+* the mins to the largest.
 */
-static int 
+static int
 nd_box_init_bounds(ND_BOX *a)
 {
 	int d;
@@ -518,7 +518,7 @@
 }
 
 /** Set the values of an #ND_BOX from a #GBOX */
-static void 
+static void
 nd_box_from_gbox(const GBOX *gbox, ND_BOX *nd_box)
 {
 	int d = 0;
@@ -552,7 +552,7 @@
 	return;
 }
 
-/** 
+/**
 * Return TRUE if #ND_BOX a overlaps b, false otherwise.
 */
 static int
@@ -567,7 +567,7 @@
 	return TRUE;
 }
 
-/** 
+/**
 * Return TRUE if #ND_BOX a contains b, false otherwise.
 */
 static int
@@ -586,7 +586,7 @@
 * Expand an #ND_BOX ever so slightly. Expand parameter is the proportion
 * of total width to add.
 */
-static int 
+static int
 nd_box_expand(ND_BOX *nd_box, double expansion_factor)
 {
 	int d;
@@ -601,7 +601,7 @@
 	return TRUE;
 }
 
-/** 
+/**
 * What stats cells overlap with this ND_BOX? Put the lowest cell
 * addresses in ND_IBOX->min and the highest in ND_IBOX->max
 */
@@ -651,14 +651,14 @@
 	
 	for ( d = 0 ; d < ndims; d++ )
 	{
-		if ( b1->max[d] <= b2->min[d] || b1->min[d] >= b2->max[d] ) 
+		if ( b1->max[d] <= b2->min[d] || b1->min[d] >= b2->max[d] )
 			return 0.0; /* Disjoint */
 		
 		if ( b1->min[d] > b2->min[d] || b1->max[d] < b2->max[d] )
 			covered = FALSE;
 	}
 	
-	if ( covered ) 
+	if ( covered )
 		return 1.0;
 
 	for ( d = 0; d < ndims; d++ )
@@ -678,7 +678,7 @@
 		ivol *= iwidth;
 	}
 	
-	if ( vol2 == 0.0 ) 
+	if ( vol2 == 0.0 )
 		return vol2;
 	
 	return ivol / vol2;
@@ -689,7 +689,7 @@
 * Calculate how much a set of boxes is homogenously distributed
 * or contentrated within one dimension, returning the range_quintile of
 * of the overlap counts per cell in a uniform
-* partition of the extent of the dimension. 
+* partition of the extent of the dimension.
 * A uniform distribution of counts will have a small range
 * and will require few cells in a selectivity histogram.
 * A diverse distribution of counts will have a larger range
@@ -697,14 +697,14 @@
 * distinguish between areas of feature density and areas
 * of feature sparseness. This measurement should help us
 * identify cases like X/Y/Z data where there is lots of variability
-* in density in X/Y (diversely in a multi-kilometer range) and far 
+* in density in X/Y (diversely in a multi-kilometer range) and far
 * less in Z (in a few-hundred meter range).
 */
 static int
 nd_box_array_distribution(const ND_BOX **nd_boxes, int num_boxes, const ND_BOX *extent, int ndims, double *distribution)
 {
 	/* How many bins shall we use in figuring out the distribution? */
-	static int num_bins = 50; 
+	static int num_bins = 50;
 	int d, i, k, range;
 	int counts[num_bins];
 	double smin, smax;   /* Spatial min, spatial max */
@@ -713,7 +713,7 @@
 	double average, sdev, sdev_ratio;
 #endif
 	int   bmin, bmax;   /* Bin min, bin max */
-	const ND_BOX *ndb; 
+	const ND_BOX *ndb;
 	
 	/* For each dimension... */	
 	for ( d = 0; d < ndims; d++ )
@@ -788,7 +788,7 @@
 
 /**
 * Given an n-d index array (counter), and a domain to increment it
-* in (ibox) increment it by one, unless it's already at the max of 
+* in (ibox) increment it by one, unless it's already at the max of
 * the domain, in which case return false.
 */
 static inline int
@@ -893,7 +893,7 @@
 * debugging functions are taking human input (table names)
 * and columns, so we have to look those up first.
 * In case of parent tables whith INHERITS, when "only_parent"
-* is TRUE this function only searchs for stats in the parent 
+* is TRUE this function only searchs for stats in the parent
 * table ignoring any statistic collected from the children.
 */
 static ND_STATS*
@@ -912,7 +912,7 @@
 			return NULL;
 		}
 	}
-	else 
+	else
 	{
 		elog(ERROR, "attribute name is null");
 		return NULL;
@@ -924,11 +924,11 @@
 /**
 * Given two statistics histograms, what is the selectivity
 * of a join driven by the && or &&& operator?
-* 
+*
 * Join selectivity is defined as the number of rows returned by the
-* join operator divided by the number of rows that an 
+* join operator divided by the number of rows that an
 * unconstrained join would return (nrows1*nrows2).
-* 
+*
 * To get the estimate of join rows, we walk through the cells
 * of one histogram, and multiply the cell value by the
 * proportion of the cells in the other histogram the cell
@@ -1006,8 +1006,8 @@
 		PG_RETURN_FLOAT8(0.0);
 	}
 	
-	/* 
-	 * First find the index range of the part of the smaller 
+	/*
+	 * First find the index range of the part of the smaller
 	 * histogram that overlaps the larger one.
 	 */
 	if ( ! nd_box_overlap(s1, &extent2, &ibox1) )
@@ -1095,7 +1095,7 @@
 	POSTGIS_DEBUGF(3, "val of histogram = %g", val);
 	
 	/*
-	 * In order to compare our total cell count "val" to the 
+	 * In order to compare our total cell count "val" to the
 	 * ntuples_max, we need to scale val up to reflect a full
 	 * table estimate. So, multiply by ratio of table size to
 	 * sample size.
@@ -1106,7 +1106,7 @@
 	POSTGIS_DEBUGF(3, "val scaled to full table size = %g", val);
 	
 	/*
-	 * Because the cell counts are over-determined due to 
+	 * Because the cell counts are over-determined due to
 	 * double counting of features that overlap multiple cells
 	 * (see the compute_gserialized_stats routine)
 	 * we also have to scale our cell count "val" *down*
@@ -1116,7 +1116,7 @@
 //	val /= (s2->cells_covered / s2->histogram_features);
 
 	/*
-	 * Finally, the selectivity is the estimated number of 
+	 * Finally, the selectivity is the estimated number of
 	 * rows to be returned divided by the maximum possible
 	 * number of rows that can be returned.
 	 */
@@ -1151,7 +1151,7 @@
 }
 
 /**
-* For (geometry && geometry) 
+* For (geometry && geometry)
 * we call into the 2-D mode.
 */
 PG_FUNCTION_INFO_V1(gserialized_gist_joinsel_2d);
@@ -1167,7 +1167,7 @@
 
 /**
 * Join selectivity of the && operator. The selectivity
-* is the ratio of the number of rows we think will be 
+* is the ratio of the number of rows we think will be
 * returned divided the maximum number of rows the join
 * could possibly return (the full combinatoric join).
 *
@@ -1214,8 +1214,8 @@
 	relid1 = getrelid(var1->varno, root->parse->rtable);
 	relid2 = getrelid(var2->varno, root->parse->rtable);
 
-	POSTGIS_DEBUGF(3, "using relations \"%s\" Oid(%d), \"%s\" Oid(%d)", 
-	                 get_rel_name(relid1) ? get_rel_name(relid1) : "NULL", relid1, get_rel_name(relid2) ? get_rel_name(relid2) : "NULL", relid2); 
+	POSTGIS_DEBUGF(3, "using relations \"%s\" Oid(%d), \"%s\" Oid(%d)",
+	                 get_rel_name(relid1) ? get_rel_name(relid1) : "NULL", relid1, get_rel_name(relid2) ? get_rel_name(relid2) : "NULL", relid2);
 
 	/* Pull the stats from the stats system. */
 	stats1 = pg_get_nd_stats(relid1, var1->varattno, mode, FALSE);
@@ -1245,22 +1245,22 @@
 
 
 /**
- * The gserialized_analyze_nd sets this function as a 
+ * The gserialized_analyze_nd sets this function as a
  * callback on the stats object when called by the ANALYZE
- * command. ANALYZE then gathers the requisite number of 
+ * command. ANALYZE then gathers the requisite number of
  * sample rows and then calls this function.
- * 
- * We could also pass stats->extra_data in from 
+ *
+ * We could also pass stats->extra_data in from
  * gserialized_analyze_nd (things like the column type or
- * other stuff from the system catalogs) but so far we 
+ * other stuff from the system catalogs) but so far we
  * don't use that capability.
  *
  * Our job is to build some statistics on the sample data
  * for use by operator estimators.
- * 
- * We will populate an n-d histogram using the provided 
+ *
+ * We will populate an n-d histogram using the provided
  * sample rows. The selectivity estimators (sel and j_oinsel)
- * can then use the histogram 
+ * can then use the histogram
  */
 static void
 compute_gserialized_stats_mode(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
@@ -1370,7 +1370,7 @@
 			continue;
 		}
 
-		/* 
+		/*
 		 * In N-D mode, set the ndims to the maximum dimensionality found
 		 * in the sample. Otherwise, leave at ndims == 2.
 		 */
@@ -1405,7 +1405,7 @@
 		notnull_cnt++;
 		
 		/* Free up memory if our sample geometry was copied */
-		if ( is_copy ) 
+		if ( is_copy )
 			pfree(geom);
 
 		/* Give backend a chance of interrupting us */
@@ -1414,9 +1414,9 @@
 
 	/*
 	 * We'll build a histogram having stats->attr->attstattarget cells
-	 * on each side,  within reason... we'll use ndims*10000 as the 
-	 * maximum number of cells. 
-	 * Also, if we're sampling a relatively small table, we'll try to ensure that 
+	 * on each side,  within reason... we'll use ndims*10000 as the
+	 * maximum number of cells.
+	 * Also, if we're sampling a relatively small table, we'll try to ensure that
 	 * we have an average of 5 features for each cell so the histogram isn't
 	 * so sparse.
 	 */
@@ -1481,29 +1481,29 @@
 		nd_box_merge(ndb, &histo_extent_new);
 	}
 	/*
-	 * Expand the box slightly (1%) to avoid edge effects 
-	 * with objects that are on the boundary 
+	 * Expand the box slightly (1%) to avoid edge effects
+	 * with objects that are on the boundary
 	 */
 	nd_box_expand(&histo_extent_new, 0.01);
 	histo_extent = histo_extent_new;
 	
 	/*
-	 * How should we allocate our histogram cells to the 
+	 * How should we allocate our histogram cells to the
 	 * different dimensions? We can't do it by raw dimensional width,
 	 * because in x/y/z space, the z can have different units
-	 * from the x/y. Similarly for x/y/t space. 
+	 * from the x/y. Similarly for x/y/t space.
 	 * So, we instead calculate how much features overlap
 	 * each other in their dimension to figure out which
-	 *  dimensions have useful selectivity characteristics (more 
+	 *  dimensions have useful selectivity characteristics (more
 	 * variability in density) and therefor would find
 	 * more cells useful (to distinguish between dense places and
 	 * homogeneous places).
-	 */ 
+	 */
 	nd_box_array_distribution(sample_boxes, notnull_cnt, &histo_extent, ndims,
 	                          sample_distribution);
 
-	/* 
-	 * The sample_distribution array now tells us how spread out the 
+	/*
+	 * The sample_distribution array now tells us how spread out the
 	 * data is in each dimension, so we use that data to allocate
 	 * the histogram cells we have available.
 	 * At this point, histo_cells_target is the approximate target number
@@ -1514,7 +1514,7 @@
 	 * Some dimensions have basically a uniform distribution, we want
 	 * to allocate no cells to those dimensions, only to dimensions
 	 * that have some interesting differences in data distribution.
-	 * Here we count up the number of interesting dimensions 
+	 * Here we count up the number of interesting dimensions
 	 */
 	for ( d = 0; d < ndims; d++ )
 	{
@@ -1538,7 +1538,7 @@
 	}
 	else
 	{
-		/* 
+		/*
 		 * We're going to express the amount of variability in each dimension
 		 * as a proportion of the total variability and allocate cells in that
 		 * dimension relative to that proportion.
@@ -1557,9 +1557,9 @@
 			{
 				/* How does this dims variability compare to the total? */
 				float edge_ratio = (float)sample_distribution[d] / (float)total_distribution;
-				/* 
+				/*
 				 * Scale the target cells number by the # of dims and ratio,
-				 * then take the appropriate root to get the estimated number of cells 
+				 * then take the appropriate root to get the estimated number of cells
 				 * on this axis (eg, pow(0.5) for 2d, pow(0.333) for 3d, pow(0.25) for 4d)
 				*/
 				histo_size[d] = (int)pow(histo_cells_target * histo_ndims * edge_ratio, 1/(double)histo_ndims);
@@ -1568,7 +1568,7 @@
 					histo_size[d] = 1;
 			}
 			histo_cells_new *= histo_size[d];
-		} 
+		}
 		POSTGIS_DEBUGF(3, " histo_cells_new: %d", histo_cells_new);
 	}
 	
@@ -1630,7 +1630,7 @@
 		nd_box_overlap(nd_stats, nd_box, &nd_ibox);
 		memset(at, 0, sizeof(int)*ND_DIMS);
 		
-		POSTGIS_DEBUGF(3, " feature %d: ibox (%d, %d, %d, %d) (%d, %d, %d, %d)", i, 
+		POSTGIS_DEBUGF(3, " feature %d: ibox (%d, %d, %d, %d) (%d, %d, %d, %d)", i,
 		  nd_ibox.min[0], nd_ibox.min[1], nd_ibox.min[2], nd_ibox.min[3],
 		  nd_ibox.max[0], nd_ibox.max[1], nd_ibox.max[2], nd_ibox.max[3]);
 
@@ -1649,11 +1649,11 @@
 		/* Add feature volume (area) to our total */
 		total_sample_volume += tmp_volume;
 
-		/* 
-		 * Move through all the overlaped histogram cells values and 
-		 * add the box overlap proportion to them. 
+		/*
+		 * Move through all the overlaped histogram cells values and
+		 * add the box overlap proportion to them.
 		 */
-		do 
+		do
 		{
 			ND_BOX nd_cell;
 			double ratio;
@@ -1664,7 +1664,7 @@
 				nd_cell.max[d] = min[d] + (at[d]+1) * cellsize[d];
 			}
 
-			/* 
+			/*
 			 * If a feature box is completely inside one cell the ratio will be
 			 * 1.0. If a feature box is 50% in two cells, each cell will get
 			 * 0.5 added on.
@@ -1674,7 +1674,7 @@
 			num_cells += ratio;
 			POSTGIS_DEBUGF(3, "               ratio (%.8g)  num_cells (%.8g)", ratio, num_cells);
 			POSTGIS_DEBUGF(3, "               at (%d, %d, %d, %d)", at[0], at[1], at[2], at[3]);
-		} 
+		}
 		while ( nd_increment(&nd_ibox, nd_stats->ndims, at) );
 		
 		/* Keep track of overall number of overlaps counted */
@@ -1738,20 +1738,20 @@
 
 
 /**
-* In order to do useful selectivity calculations in both 2-D and N-D 
+* In order to do useful selectivity calculations in both 2-D and N-D
 * modes, we actually have to generate two stats objects, one for 2-D
-* and one for N-D. 
-* You would think that an N-D histogram would be sufficient for 2-D 
+* and one for N-D.
+* You would think that an N-D histogram would be sufficient for 2-D
 * calculations of selectivity, but you'd be wrong. For features that
 * overlap multiple cells, the N-D histogram over-estimates the number
 * of hits, and can't contain the requisite information to correct
-* that over-estimate. 
-* We use the convenient PgSQL facility of stats slots to store 
+* that over-estimate.
+* We use the convenient PgSQL facility of stats slots to store
 * one 2-D and one N-D stats object, and here in the compute function
 * we just call the computation twice, once in each mode.
 * It would be more efficient to have the computation calculate
 * the two histograms simultaneously, but that would also complicate
-* the (already complicated) logic in the function, 
+* the (already complicated) logic in the function,
 * so we'll take the CPU hit and do the computation twice.
 */
 static void
@@ -1826,7 +1826,7 @@
 *
 * To get our estimate,
 * we need "only" sum up the values * the proportion of each cell
-* in the histogram that falls within the search box, then 
+* in the histogram that falls within the search box, then
 * divide by the number of features that generated the histogram.
 */
 static float8
@@ -1855,7 +1855,7 @@
 	nd_box_from_gbox(box, &nd_box);
 
 	/*
-	 * To return 2D stats on an ND sample, we need to make the 
+	 * To return 2D stats on an ND sample, we need to make the
 	 * 2D box cover the full range of the other dimensions in the
 	 * histogram.
 	 */
@@ -1869,8 +1869,8 @@
 	POSTGIS_DEBUGF(3, " nd_stats->extent: %s", nd_box_to_json(&(nd_stats->extent), nd_stats->ndims));
 	POSTGIS_DEBUGF(3, " nd_box: %s", nd_box_to_json(&(nd_box), gbox_ndims(box)));
 
-	/* 
-	 * Search box completely misses histogram extent? 
+	/*
+	 * Search box completely misses histogram extent?
 	 * We have to intersect in all N dimensions or else we have
 	 * zero interaction under the &&& operator. It's important
 	 * to short circuit in this case, as some of the tests below
@@ -1910,7 +1910,7 @@
 	}
 
 	/* Move through all the overlap values and sum them */
-	do 
+	do
 	{
 		float cell_count, ratio;
 		ND_BOX nd_cell;
@@ -1928,7 +1928,7 @@
 		/* Add the pro-rated count for this cell to the overall total */
 		total_count += cell_count * ratio;	
 		POSTGIS_DEBUGF(4, " cell (%d,%d), cell value %.6f, ratio %.6f", at[0], at[1], cell_count, ratio);	
-	} 
+	}
 	while ( nd_increment(&nd_ibox, nd_stats->ndims, at) );
 
 	/* Scale by the number of features in our histogram to get the proportion */
@@ -1949,7 +1949,7 @@
 
 
 /**
-* Utility function to print the statistics information for a 
+* Utility function to print the statistics information for a
 * given table/column in JSON. Used for debugging the selectivity code.
 */
 PG_FUNCTION_INFO_V1(_postgis_gserialized_stats);
@@ -2025,7 +2025,7 @@
 
 
 /**
-* Utility function to read the calculated join selectivity for a 
+* Utility function to read the calculated join selectivity for a
 * pair of tables. Used for debugging the selectivity code.
 */
 PG_FUNCTION_INFO_V1(_postgis_gserialized_joinsel);
@@ -2044,10 +2044,10 @@
 	nd_stats1 = pg_get_nd_stats_by_name(table_oid1, att_text1, mode, FALSE);
 	nd_stats2 = pg_get_nd_stats_by_name(table_oid2, att_text2, mode, FALSE);
 
-	if ( ! nd_stats1 ) 
+	if ( ! nd_stats1 )
 		elog(ERROR, "stats for \"%s.%s\" do not exist", get_rel_name(table_oid1), text2cstring(att_text1));
 
-	if ( ! nd_stats2 ) 
+	if ( ! nd_stats2 )
 		elog(ERROR, "stats for \"%s.%s\" do not exist", get_rel_name(table_oid2), text2cstring(att_text2));
 
 	/* Check if we've been asked to not use 2d mode */
@@ -2068,7 +2068,7 @@
 }
 
 /**
-* For (geometry && geometry) 
+* For (geometry && geometry)
 * we call into the 2-D mode.
 */
 PG_FUNCTION_INFO_V1(gserialized_gist_sel_2d);
@@ -2129,10 +2129,10 @@
 	
 	POSTGIS_DEBUG(2, "gserialized_gist_sel called");
 
-	/* 
+	/*
 	 * TODO: This is a big one,
 	 * All this statistics code *only* tries to generate a valid
-	 * selectivity for && and &&&. That leaves all the other 
+	 * selectivity for && and &&&. That leaves all the other
 	 * geometry operators with bad stats! The selectivity
 	 * calculation should take account of the incoming operator
 	 * type and do the right thing.
@@ -2253,7 +2253,7 @@
 	nd_stats = pg_get_nd_stats_by_name(tbl_oid, col, 2, only_parent);
 	
 	/* Error out on no stats */
-	if ( ! nd_stats ) 
+	if ( ! nd_stats )
 		elog(ERROR, "stats for \"%s.%s\" do not exist", tbl, text2cstring(col));
 
 	/* Construct the box */
@@ -2275,23 +2275,23 @@
  * looking at gathered statistics (or NULL if
  * no statistics have been gathered).
  */
-  
+
 PG_FUNCTION_INFO_V1(geometry_estimated_extent);
 Datum geometry_estimated_extent(PG_FUNCTION_ARGS)
 {
 	if ( PG_NARGS() == 3 )
 	{
 	    PG_RETURN_DATUM(
-	    DirectFunctionCall3(gserialized_estimated_extent, 
-	    PG_GETARG_DATUM(0), 
-	    PG_GETARG_DATUM(1), 
+	    DirectFunctionCall3(gserialized_estimated_extent,
+	    PG_GETARG_DATUM(0),
+	    PG_GETARG_DATUM(1),
         PG_GETARG_DATUM(2)));
 	}
 	else if ( PG_NARGS() == 2 )
 	{
 	    PG_RETURN_DATUM(
-	    DirectFunctionCall2(gserialized_estimated_extent, 
-	    PG_GETARG_DATUM(0), 
+	    DirectFunctionCall2(gserialized_estimated_extent,
+	    PG_GETARG_DATUM(0),
 	    PG_GETARG_DATUM(1)));
 	}
 

Modified: trunk/postgis/gserialized_gist_2d.c
===================================================================
--- trunk/postgis/gserialized_gist_2d.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/gserialized_gist_2d.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -34,7 +34,7 @@
 ** [3] N. Beckmann, H.-P. Kriegel, R. Schneider, B. Seeger. The R*tree: an
 **     efficient and robust access method for points and rectangles.
 **     Proceedings of the ACM SIGMOD Conference. June 1990.
-** [4] A. Korotkov, "A new double sorting-based node splitting algorithm for R-tree", 
+** [4] A. Korotkov, "A new double sorting-based node splitting algorithm for R-tree",
 **     http://syrcose.ispras.ru/2011/files/SYRCoSE2011_Proceedings.pdf#page=36
 */
 
@@ -81,7 +81,7 @@
 #endif
 
 /*
-** GiST 2D key stubs 
+** GiST 2D key stubs
 */
 Datum box2df_out(PG_FUNCTION_ARGS);
 Datum box2df_in(PG_FUNCTION_ARGS);
@@ -171,7 +171,7 @@
 {
 	POSTGIS_DEBUGF(5, "calculating intersection of %s with %s", box2df_to_string(a), box2df_to_string(b));
 
-	if( a == NULL || b == NULL || n == NULL ) 
+	if( a == NULL || b == NULL || n == NULL )
 		return FALSE;
 		
 	n->xmax = Min(a->xmax, b->xmax);
@@ -192,7 +192,7 @@
 {
 	float result;
 
-	if ( a == NULL ) 
+	if ( a == NULL )
 		return (float)0.0;
 		
 	if ( (a->xmax <= a->xmin) || (a->ymax <= a->ymin) )
@@ -225,7 +225,7 @@
 	if ( b == NULL )
 		return box2df_size(a);
 
-	result = ((double)Max(a->xmax,b->xmax) - (double)Min(a->xmin,b->xmin)) * 
+	result = ((double)Max(a->xmax,b->xmax) - (double)Min(a->xmin,b->xmin)) *
  	         ((double)Max(a->ymax,b->ymax) - (double)Min(a->ymin,b->ymin));
 
 	POSTGIS_DEBUGF(5, "union size of %s and %s is %.8g", box2df_to_string(a), box2df_to_string(b), result);
@@ -254,13 +254,13 @@
 {
 	float tmp;
 	POSTGIS_DEBUGF(5,"validating box2df (%s)", box2df_to_string(b));
-	if ( b->xmax < b->xmin ) 
+	if ( b->xmax < b->xmin )
 	{
 		tmp = b->xmin;
 		b->xmin = b->xmax;
 		b->xmax = tmp;
 	}
-	if ( b->ymax < b->ymin ) 
+	if ( b->ymax < b->ymin )
 	{
 		tmp = b->ymin;
 		b->ymin = b->ymax;
@@ -404,7 +404,7 @@
 
 #if POSTGIS_PGSQL_VERSION < 95
 /**
-* Calculate the The node_box_edge->query_centroid distance 
+* Calculate the The node_box_edge->query_centroid distance
 * between the boxes.
 */
 static double box2df_distance_node_centroid(const BOX2DF *node, const BOX2DF *query)
@@ -474,10 +474,10 @@
 			elog(ERROR, "%s: reached unreachable code", __func__);
         }
     }
-    
+
     return sqrt(d);
 }
-#endif 
+#endif
 
 /* Quick distance function */
 static inline double pt_distance(double ax, double ay, double bx, double by)
@@ -541,7 +541,7 @@
 * full object and return the box based on that. If no box is available,
 * return #LW_FAILURE, otherwise #LW_SUCCESS.
 */
-static int 
+static int
 gserialized_datum_get_box2df_p(Datum gsdatum, BOX2DF *box2df)
 {
 	GSERIALIZED *gpart;
@@ -551,7 +551,7 @@
 	POSTGIS_DEBUG(4, "entered function");
 
 	/*
-	** The most info we need is the 8 bytes of serialized header plus the 
+	** The most info we need is the 8 bytes of serialized header plus the
 	** of floats necessary to hold the bounding box.
 	*/
 	if (VARATT_IS_EXTENDED(gsdatum))
@@ -604,7 +604,7 @@
 * Support function. Based on two datums return true if
 * they satisfy the predicate and false otherwise.
 */
-static int 
+static int
 gserialized_datum_predicate_2d(Datum gs1, Datum gs2, box2df_predicate predicate)
 {
 	BOX2DF b1, b2, *br1=NULL, *br2=NULL;
@@ -633,14 +633,14 @@
 {
 	BOX2DF b1, b2;
 	Datum gs1 = PG_GETARG_DATUM(0);
-	Datum gs2 = PG_GETARG_DATUM(1);    
+	Datum gs2 = PG_GETARG_DATUM(1);
 	
 	POSTGIS_DEBUG(3, "entered function");
 
 	/* Must be able to build box for each argument (ie, not empty geometry). */
 	if ( (gserialized_datum_get_box2df_p(gs1, &b1) == LW_SUCCESS) &&
 	     (gserialized_datum_get_box2df_p(gs2, &b2) == LW_SUCCESS) )
-	{	    
+	{	
 		double distance = box2df_distance_leaf_centroid(&b1, &b2);
 		POSTGIS_DEBUGF(3, "got boxes %s and %s", box2df_to_string(&b1), box2df_to_string(&b2));
 		PG_RETURN_FLOAT8(distance);
@@ -653,14 +653,14 @@
 {
 	BOX2DF b1, b2;
 	Datum gs1 = PG_GETARG_DATUM(0);
-	Datum gs2 = PG_GETARG_DATUM(1);    
+	Datum gs2 = PG_GETARG_DATUM(1);
 	
 	POSTGIS_DEBUG(3, "entered function");
 
 	/* Must be able to build box for each argument (ie, not empty geometry). */
 	if ( (gserialized_datum_get_box2df_p(gs1, &b1) == LW_SUCCESS) &&
 	     (gserialized_datum_get_box2df_p(gs2, &b2) == LW_SUCCESS) )
-	{	    
+	{	
 		double distance = box2df_distance(&b1, &b2);
 		POSTGIS_DEBUGF(3, "got boxes %s and %s", box2df_to_string(&b1), box2df_to_string(&b2));
 		PG_RETURN_FLOAT8(distance);
@@ -1063,7 +1063,7 @@
 /*
 ** GiST support function. Take in a query and an entry and return the "distance"
 ** between them.
-** 
+**
 ** Given an index entry p and a query value q, this function determines the
 ** index entry's "distance" from the query value. This function must be
 ** supplied if the operator class contains any ordering operators. A query
@@ -1072,7 +1072,7 @@
 ** with the operator's semantics. For a leaf index entry the result just
 ** represents the distance to the index entry; for an internal tree node, the
 ** result must be the smallest distance that any child entry could have.
-** 
+**
 ** Strategy 13 = true distance tests <->
 ** Strategy 14 = box-based distance tests <#>
 */
@@ -1090,7 +1090,7 @@
 
 	POSTGIS_DEBUG(4, "[GIST] 'distance' function called");
 
-	/* We are using '13' as the gist true-distance <-> strategy number 
+	/* We are using '13' as the gist true-distance <-> strategy number
 	*  and '14' as the gist distance-between-boxes <#> strategy number */
 	if ( strategy != 13 && strategy != 14 ) {
 		elog(ERROR, "unrecognized strategy number: %d", strategy);

Modified: trunk/postgis/gserialized_gist_nd.c
===================================================================
--- trunk/postgis/gserialized_gist_nd.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/gserialized_gist_nd.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -453,7 +453,7 @@
 * Support function. Based on two datums return true if
 * they satisfy the predicate and false otherwise.
 */
-static int 
+static int
 gserialized_datum_predicate(Datum gs1, Datum gs2, gidx_predicate predicate)
 {
 	/* Put aside some stack memory and use it for GIDX pointers. */
@@ -651,7 +651,7 @@
 /**
 * Return a #GSERIALIZED with an expanded bounding box.
 */
-GSERIALIZED* 
+GSERIALIZED*
 gserialized_expand(GSERIALIZED *g, double distance)
 {
 	char boxmem[GIDX_MAX_SIZE];
@@ -674,8 +674,8 @@
 * GiST N-D Index Operator Functions
 */
 
-/* 
-* Do centroid to centroid n-d distance if you don't have 
+/*
+* Do centroid to centroid n-d distance if you don't have
 * re-check available (PgSQL 9.5+), do "real" n-d distance
 * if you do
 */
@@ -764,7 +764,7 @@
 			m1 = lwgeom_interpolate_point(lw2, lwp2);
 			lwpoint_free(lwp2);
 		}
-		else 
+		else
 		{
 			usebox = true;
 		}
@@ -909,7 +909,7 @@
 		     || ! isfinite(GIDX_GET_MIN(bbox_out, i)) )
 		{
 			gidx_set_unknown(bbox_out);
-			gistentryinit(*entry_out, 
+			gistentryinit(*entry_out,
 			              PointerGetDatum(gidx_copy(bbox_out)),
 			              entry_in->rel, entry_in->page,
 			              entry_in->offset, FALSE);
@@ -1186,9 +1186,9 @@
 	double distance;
 
 	POSTGIS_DEBUGF(3, "[GIST] '%s' function called", __func__);
- 
+
 	/* We are using '13' as the gist geography distance <-> strategy number */
-	if ( strategy != 13  ) 
+	if ( strategy != 13  )
 	{
 		elog(ERROR, "unrecognized strategy number: %d", strategy);
 		PG_RETURN_FLOAT8(FLT_MAX);
@@ -1255,7 +1255,7 @@
 	double distance;
 
 	POSTGIS_DEBUG(4, "[GIST] 'distance' function called");
- 
+
 	/* Strategy 13 is <<->> */
 	/* Strategy 20 is |=| */
 	if ( strategy != 13 && strategy != 20 ) {
@@ -1716,7 +1716,7 @@
 ** The GIDX key must be defined as a PostgreSQL type, even though it is only
 ** ever used internally. These no-op stubs are used to bind the type.
 */
-PG_FUNCTION_INFO_V1(gidx_in); 
+PG_FUNCTION_INFO_V1(gidx_in);
 Datum gidx_in(PG_FUNCTION_ARGS)
 {
 	ereport(ERROR,(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
@@ -1724,7 +1724,7 @@
 	PG_RETURN_POINTER(NULL);
 }
 
-PG_FUNCTION_INFO_V1(gidx_out); 
+PG_FUNCTION_INFO_V1(gidx_out);
 Datum gidx_out(PG_FUNCTION_ARGS)
 {
   GIDX *box = (GIDX *) PG_GETARG_POINTER(0);

Modified: trunk/postgis/gserialized_typmod.c
===================================================================
--- trunk/postgis/gserialized_typmod.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/gserialized_typmod.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -138,13 +138,13 @@
 	/*
 	* #3031: If a user is handing us a MULTIPOINT EMPTY but trying to fit it into
 	* a POINT geometry column, there's a strong chance the reason she has
-	* a MULTIPOINT EMPTY because we gave it to her during data dump, 
-	* converting the internal POINT EMPTY into a EWKB MULTIPOINT EMPTY 
+	* a MULTIPOINT EMPTY because we gave it to her during data dump,
+	* converting the internal POINT EMPTY into a EWKB MULTIPOINT EMPTY
 	* (because EWKB doesn't have a clean way to represent POINT EMPTY).
-	* In such a case, it makes sense to turn the MULTIPOINT EMPTY back into a 
+	* In such a case, it makes sense to turn the MULTIPOINT EMPTY back into a
 	* point EMPTY, rather than throwing an error.
 	*/
-	if ( typmod_type == POINTTYPE && geom_type == MULTIPOINTTYPE && 
+	if ( typmod_type == POINTTYPE && geom_type == MULTIPOINTTYPE &&
 	     gserialized_is_empty(gser) )
 	{
 		LWPOINT *empty_point = lwpoint_construct_empty(geom_srid, geom_z, geom_m);
@@ -243,7 +243,7 @@
 	                  &elem_values, NULL, &n);
 
 	/* Set the SRID to the default value first */
-	if ( is_geography) 
+	if ( is_geography)
 	    TYPMOD_SET_SRID(typmod, SRID_DEFAULT);
 	else
 	    TYPMOD_SET_SRID(typmod, SRID_UNKNOWN);

Modified: trunk/postgis/lwgeom_backend_api.c
===================================================================
--- trunk/postgis/lwgeom_backend_api.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_backend_api.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -232,7 +232,7 @@
 	error_if_srid_mismatch(lwgeom1->srid, lwgeom2->srid);
 	
     mindist = lwgeom_mindistance3d_tolerance(lwgeom1,lwgeom2,0.0);
-    
+
     PG_FREE_IF_COPY(geom1, 0);
     PG_FREE_IF_COPY(geom2, 1);
     /*empty geometries cases should be right handled since return from underlying

Modified: trunk/postgis/lwgeom_box.c
===================================================================
--- trunk/postgis/lwgeom_box.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_box.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -121,7 +121,7 @@
 
 	/* Cannot box empty! */
 	if ( lwgeom_is_empty(lwgeom) )
-		PG_RETURN_NULL(); 
+		PG_RETURN_NULL();
 
 	/* Cannot calculate box? */
 	if ( lwgeom_calculate_gbox(lwgeom, &gbox) == LW_FAILURE )
@@ -383,7 +383,7 @@
 
 	memcpy(result, box, sizeof(GBOX));
     gbox_expand(result, d);
-    
+
 	PG_RETURN_POINTER(result);
 }
 
@@ -538,7 +538,7 @@
 	/* Process X min/max */
 	min = lwpoint_get_x(minpoint);
 	max = lwpoint_get_x(maxpoint);
-	if ( min > max ) 
+	if ( min > max )
 	{
 		tmp = min;
 		min = max;
@@ -550,7 +550,7 @@
 	/* Process Y min/max */
 	min = lwpoint_get_y(minpoint);
 	max = lwpoint_get_y(maxpoint);
-	if ( min > max ) 
+	if ( min > max )
 	{
 		tmp = min;
 		min = max;

Modified: trunk/postgis/lwgeom_box3d.c
===================================================================
--- trunk/postgis/lwgeom_box3d.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_box3d.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -265,7 +265,7 @@
 		points[2] = (POINT4D) { box->xmin, box->ymax, box->zmax };
 		points[3] = (POINT4D) { box->xmin, box->ymin, box->zmax };
 
-		lwpoly = lwpoly_construct_rectangle(LW_TRUE, LW_FALSE, 
+		lwpoly = lwpoly_construct_rectangle(LW_TRUE, LW_FALSE,
 				&points[0], &points[1], &points[2], &points[3]);
 		result = geometry_serialize(lwpoly_as_lwgeom(lwpoly));
 		lwpoly_free(lwpoly);
@@ -282,7 +282,7 @@
 		points[2] = (POINT4D) { box->xmax, box->ymin, box->zmax };
 		points[3] = (POINT4D) { box->xmin, box->ymin, box->zmax };
 
-		lwpoly = lwpoly_construct_rectangle(LW_TRUE, LW_FALSE, 
+		lwpoly = lwpoly_construct_rectangle(LW_TRUE, LW_FALSE,
 				&points[0], &points[1], &points[2], &points[3]);
 		result = geometry_serialize(lwpoly_as_lwgeom(lwpoly));
 		lwpoly_free(lwpoly);
@@ -450,7 +450,7 @@
 }
 
 /**
-* Used in the ST_Extent and ST_Extent3D aggregates, does not read the 
+* Used in the ST_Extent and ST_Extent3D aggregates, does not read the
 * serialized cached bounding box (since that is floating point)
 * but calculates the box in full from the underlying geometry.
 */

Modified: trunk/postgis/lwgeom_btree.c
===================================================================
--- trunk/postgis/lwgeom_btree.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_btree.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -174,7 +174,7 @@
 	PG_FREE_IF_COPY(geom1, 0);
 	PG_FREE_IF_COPY(geom2, 1);
 
-	if  ( empty1 != empty2 ) 
+	if  ( empty1 != empty2 )
 	{
     result = FALSE;
 	}

Modified: trunk/postgis/lwgeom_dump.c
===================================================================
--- trunk/postgis/lwgeom_dump.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_dump.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -322,7 +322,7 @@
 };
 
 /*
-* Break an object up into smaller objects of no more than N vertices 
+* Break an object up into smaller objects of no more than N vertices
 */
 PG_FUNCTION_INFO_V1(ST_Subdivide);
 Datum ST_Subdivide(PG_FUNCTION_ARGS)
@@ -365,13 +365,13 @@
 		oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
 
 		/*
-		* Get the geometry value 
+		* Get the geometry value
 		*/
 		gser = PG_GETARG_GSERIALIZED_P(0);
 		geom = lwgeom_from_gserialized(gser);
 		
 		/*
-		* Get the max vertices value 
+		* Get the max vertices value
 		*/
 		if ( PG_NARGS() > 1 && ! PG_ARGISNULL(1) )
 			maxvertices = PG_GETARG_INT32(1);
@@ -381,7 +381,7 @@
 		*/
 		col = lwgeom_subdivide(geom, maxvertices);
 		
-		if ( ! col ) 
+		if ( ! col )
 			SRF_RETURN_DONE(funcctx);
 
 		/* allocate memory for user context */

Modified: trunk/postgis/lwgeom_export.c
===================================================================
--- trunk/postgis/lwgeom_export.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_export.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -78,7 +78,7 @@
 		elog(NOTICE, "getSRSbySRID: error executing query %d", err);
 		SPI_finish();
 		return NULL;
-	} 
+	}
 
 	/* no entry in spatial_ref_sys */
 	if (SPI_processed <= 0)
@@ -128,7 +128,7 @@
 		SPI_finish();
 		return 0;
 	}
-	sprintf(query, 
+	sprintf(query,
 		"SELECT srid "
 		"FROM spatial_ref_sys, "
 		"regexp_matches('%s', E'([a-z]+):([0-9]+)', 'gi') AS re "
@@ -145,7 +145,7 @@
 	/* no entry in spatial_ref_sys */
 	if (SPI_processed <= 0)
 	{
-		sprintf(query, 
+		sprintf(query,
 			"SELECT srid "
 			"FROM spatial_ref_sys, "
 			"regexp_matches('%s', E'urn:ogc:def:crs:([a-z]+):.*:([0-9]+)', 'gi') AS re "
@@ -270,7 +270,7 @@
 	else if (option & 1) srs = getSRSbySRID(srid, false);
 	else                 srs = getSRSbySRID(srid, true);
 
-	if (option & 2)  lwopts &= ~LW_GML_IS_DIMS; 
+	if (option & 2)  lwopts &= ~LW_GML_IS_DIMS;
 	if (option & 4)  lwopts |= LW_GML_SHORTLINE;
 	if (option & 16) lwopts |= LW_GML_IS_DEGREE;
         if (option & 32) lwopts |= LW_GML_EXTENT;
@@ -283,7 +283,7 @@
 		gml = lwgeom_to_gml2(lwgeom, srs, precision, prefix);
 	else if (version == 3 && lwopts & LW_GML_EXTENT)
 		gml = lwgeom_extent_to_gml3(lwgeom, srs, precision, lwopts, prefix);
-	else if (version == 3) 
+	else if (version == 3)
 		gml = lwgeom_to_gml3(lwgeom, srs, precision, lwopts, prefix, gml_id);
 
 	lwgeom_free(lwgeom);
@@ -365,7 +365,7 @@
 	lwgeom_free(lwgeom);
 	PG_FREE_IF_COPY(geom, 1);
 	
-	if( ! kml ) 
+	if( ! kml )
 		PG_RETURN_NULL();	
 
 	result = cstring2text(kml);
@@ -378,7 +378,7 @@
 /**
  * Encode Feature in GeoJson (Old C Signature)
  * ST_AsGeoJSON(version, geom, precision, options)
- * why was this written with a version param when there 
+ * why was this written with a version param when there
  * is only one version?
  */
 PG_FUNCTION_INFO_V1(LWGEOM_asGeoJson_old);
@@ -386,7 +386,7 @@
 {
 	switch( PG_NARGS() )
 	{
-	case 2: 
+	case 2:
 		return DirectFunctionCall1(LWGEOM_asGeoJson, PG_GETARG_DATUM(1));
 	case 3:
 		return DirectFunctionCall2(LWGEOM_asGeoJson, PG_GETARG_DATUM(1), PG_GETARG_DATUM(2));
@@ -413,7 +413,7 @@
 	char *srs = NULL;
 
 	/* Get the geometry */
-	if ( PG_ARGISNULL(0) ) 
+	if ( PG_ARGISNULL(0) )
 		PG_RETURN_NULL();
 	
 	geom = PG_GETARG_GSERIALIZED_P(0);
@@ -424,7 +424,7 @@
 		precision = PG_GETARG_INT32(1);
 		if ( precision > DBL_DIG )
 			precision = DBL_DIG;
-		else if ( precision < 0 ) 
+		else if ( precision < 0 )
 			precision = 0;
 	}
 
@@ -459,7 +459,7 @@
 			}
 		}
 
-		if (option & 1) 
+		if (option & 1)
 			has_bbox = 1;
 	}
 
@@ -595,7 +595,7 @@
 	if (option & LW_X3D_USE_GEOCOORDS) {
 		if (srid != 4326) {
 			PG_FREE_IF_COPY(geom, 0);
-			/** TODO: we need to support UTM and other coordinate systems supported by X3D eventually 
+			/** TODO: we need to support UTM and other coordinate systems supported by X3D eventually
 			http://www.web3d.org/documents/specifications/19775-1/V3.2/Part01/components/geodata.html#t-earthgeoids **/
 			elog(ERROR, "Only SRID 4326 is supported for geocoordinates.");
 			PG_RETURN_NULL();

Modified: trunk/postgis/lwgeom_functions_analytic.c
===================================================================
--- trunk/postgis/lwgeom_functions_analytic.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_functions_analytic.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -194,7 +194,7 @@
 		else
 			getPoint4d_p(ipa, ipa->npoints-1, &pt);
 
-		opa = ptarray_construct(lwgeom_has_z(geom), lwgeom_has_m(geom), 1); 
+		opa = ptarray_construct(lwgeom_has_z(geom), lwgeom_has_m(geom), 1);
 		ptarray_set_point4d(opa, 0, &pt);
 		
 		point = lwpoint_construct(line->srid, NULL, opa);
@@ -226,7 +226,7 @@
 		{
 			double dseg = (distance - tlength) / slength;
 			interpolate_point4d(&p1, &p2, &pt, dseg);
-			opa = ptarray_construct(lwgeom_has_z(geom), lwgeom_has_m(geom), 1); 
+			opa = ptarray_construct(lwgeom_has_z(geom), lwgeom_has_m(geom), 1);
 			ptarray_set_point4d(opa, 0, &pt);
 			point = lwpoint_construct(line->srid, NULL, opa);
 			PG_RETURN_POINTER(geometry_serialize(lwpoint_as_lwgeom(point)));
@@ -237,7 +237,7 @@
 	/* Return the last point on the line. This shouldn't happen, but
 	 * could if there's some floating point rounding errors. */
 	getPoint4d_p(ipa, ipa->npoints-1, &pt);
-	opa = ptarray_construct(lwgeom_has_z(geom), lwgeom_has_m(geom), 1); 
+	opa = ptarray_construct(lwgeom_has_z(geom), lwgeom_has_m(geom), 1);
 	ptarray_set_point4d(opa, 0, &pt);
 	point = lwpoint_construct(line->srid, NULL, opa);
 	PG_FREE_IF_COPY(gser, 0);
@@ -349,7 +349,7 @@
 	if ( out_lwgeom == NULL ) PG_RETURN_NULL();
 
 	/* COMPUTE_BBOX TAINTING */
-	if ( in_lwgeom->bbox ) 
+	if ( in_lwgeom->bbox )
 		lwgeom_add_bbox(out_lwgeom);
 
 
@@ -957,7 +957,7 @@
                 	}
                 }
                 /* increment the index by the total number of rings in the sub-poly */
-                /* we do this here in case we short-cutted out of the poly before looking at all the rings */ 
+                /* we do this here in case we short-cutted out of the poly before looking at all the rings */
                 i += ringCounts[p];
 	}
 
@@ -1125,7 +1125,7 @@
 	}
 
 	center = geometry_serialize(lwcenter);
-	lwgeom_free(lwcenter); 
+	lwgeom_free(lwcenter);
 
 	get_call_result_type(fcinfo, NULL, &resultTupleDesc);
 	BlessTupleDesc(resultTupleDesc);
@@ -1209,7 +1209,7 @@
 				min_dim = FP_MIN(min_dim, box->zmax - box->zmin);
 
 			/* Apply a lower bound to the computed default tolerance to
-			 * avoid a tolerance of zero in the case of collinear 
+			 * avoid a tolerance of zero in the case of collinear
 			 * points.
 			 */
 			tolerance = FP_MAX(min_default_tolerance, tolerance_coefficient * min_dim);

Modified: trunk/postgis/lwgeom_functions_basic.c
===================================================================
--- trunk/postgis/lwgeom_functions_basic.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_functions_basic.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -387,7 +387,7 @@
 	LWGEOM *lwg_in, *lwg_out;
 
 	/* already 3d */
-	if ( gserialized_ndims(pg_geom_in) == 3 && gserialized_has_z(pg_geom_in) ) 
+	if ( gserialized_ndims(pg_geom_in) == 3 && gserialized_has_z(pg_geom_in) )
 		PG_RETURN_POINTER(pg_geom_in);
 
 	lwg_in = lwgeom_from_gserialized(pg_geom_in);
@@ -409,7 +409,7 @@
 	LWGEOM *lwg_in, *lwg_out;
 
 	/* already 3d */
-	if ( gserialized_ndims(pg_geom_in) == 3 && gserialized_has_m(pg_geom_in) ) 
+	if ( gserialized_ndims(pg_geom_in) == 3 && gserialized_has_m(pg_geom_in) )
 		PG_RETURN_POINTER(pg_geom_in);
 
 	lwg_in = lwgeom_from_gserialized(pg_geom_in);
@@ -431,7 +431,7 @@
 	LWGEOM *lwg_in, *lwg_out;
 
 	/* already 4d */
-	if ( gserialized_ndims(pg_geom_in) == 4 ) 
+	if ( gserialized_ndims(pg_geom_in) == 4 )
 		PG_RETURN_POINTER(pg_geom_in);
 
 	lwg_in = lwgeom_from_gserialized(pg_geom_in);
@@ -516,7 +516,7 @@
 	** automatic bbox addition FOR_COMPLEX_GEOMS.
 	*/
 	if ( gserialized_has_bbox(geom) ) {
-		switch (gserialized_get_type(geom)) 
+		switch (gserialized_get_type(geom))
 		{
 			case MULTIPOINTTYPE:
 			case MULTILINETYPE:
@@ -1134,9 +1134,9 @@
 	type1 = lwgeoms[0]->type;
 	type2 = lwgeoms[1]->type;
 	
-	if ( (type1 == type2) && (!lwgeom_is_collection(lwgeoms[0])) ) 
+	if ( (type1 == type2) && (!lwgeom_is_collection(lwgeoms[0])) )
 		outtype = lwtype_get_collectiontype(type1);
-	else 
+	else
 		outtype = COLLECTIONTYPE;
 
 	POSTGIS_DEBUGF(3, " outtype = %d", outtype);
@@ -1546,7 +1546,7 @@
 	lwline_free((LWLINE*)shell);
 	PG_FREE_IF_COPY(pglwg1, 0);
 
-	for (i=0; i<nholes; i++) 
+	for (i=0; i<nholes; i++)
 	{
 		lwline_free((LWLINE*)holes[i]);
 	}
@@ -1801,13 +1801,13 @@
 
 	ingeom = PG_GETARG_GSERIALIZED_P(0);
 	dist = PG_GETARG_FLOAT8(1);
-	type = gserialized_get_type(ingeom); 
+	type = gserialized_get_type(ingeom);
 
 	/* Avoid types we cannot segmentize. */
-	if ( (type == POINTTYPE) || 
-	     (type == MULTIPOINTTYPE) || 
-	     (type == TRIANGLETYPE) || 
-	     (type == TINTYPE) || 
+	if ( (type == POINTTYPE) ||
+	     (type == MULTIPOINTTYPE) ||
+	     (type == TRIANGLETYPE) ||
+	     (type == TINTYPE) ||
 	     (type == POLYHEDRALSURFACETYPE) )
 	{
 		PG_RETURN_POINTER(ingeom);
@@ -2076,7 +2076,7 @@
 
 	/* Pull only a small amount of the tuple, enough to get the type. */
 	/* header + srid/flags + bbox? + type number */
-	size = VARHDRSZ + 8 + 32 + 4;  
+	size = VARHDRSZ + 8 + 32 + 4;
 
 	geom = PG_GETARG_GSERIALIZED_P_SLICE(0, 0, size);
 
@@ -2788,7 +2788,7 @@
   }
   if ( ! lwpoint->point->npoints )
   {
-    /* empty point, return input untouched */ 
+    /* empty point, return input untouched */
     lwgeom_free(lwgeom1);
     lwgeom_free(lwgeom2);
     PG_FREE_IF_COPY(geom2, 1);

Modified: trunk/postgis/lwgeom_functions_lrs.c
===================================================================
--- trunk/postgis/lwgeom_functions_lrs.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_functions_lrs.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -748,7 +748,7 @@
 
 	if ( lwout == NULL )
 	{
-		lwout = (LWGEOM *)lwcollection_construct_empty(COLLECTIONTYPE, 
+		lwout = (LWGEOM *)lwcollection_construct_empty(COLLECTIONTYPE,
 		            gserialized_get_srid(gin), hasz, hasm);
 	}
 

Modified: trunk/postgis/lwgeom_geos.c
===================================================================
--- trunk/postgis/lwgeom_geos.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_geos.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -378,7 +378,7 @@
 		gser_in = (GSERIALIZED *)DatumGetPointer(value);
 
 		/* Check for SRID mismatch in array elements */
-		if ( gotsrid ) 
+		if ( gotsrid )
 		{
 			error_if_srid_mismatch(srid, gserialized_get_srid(gser_in));
 		}
@@ -405,7 +405,7 @@
 			g = (GEOSGeometry *)POSTGIS2GEOS(gser_in);
 
 			/* Uh oh! Exception thrown at construction... */
-			if ( ! g )  
+			if ( ! g )
 			{
 				HANDLE_GEOS_ERROR("One of the geometries in the set "
 				                  "could not be converted to GEOS");
@@ -963,7 +963,7 @@
 
 
 /*
-* Generate a field of random points within the area of a 
+* Generate a field of random points within the area of a
 * polygon or multipolygon. Throws an error for other geometry
 * types.
 */
@@ -1273,10 +1273,10 @@
 Datum centroid(PG_FUNCTION_ARGS)
 {
 	GSERIALIZED *geom, *result;
-	GEOSGeometry *geosgeom, *geosresult; 
+	GEOSGeometry *geosgeom, *geosresult;
 	LWGEOM *igeom = NULL, *linear_geom = NULL;
 	int32 perQuad= 16;
-	int type = 0; 
+	int type = 0;
 	geom = PG_GETARG_GSERIALIZED_P(0);
 
 	/* Empty.Centroid() == Point Empty */
@@ -1299,9 +1299,9 @@
 		PG_FREE_IF_COPY(geom, 0); /*free memory, we already have a lwgeom geometry copy*/
 		linear_geom = lwgeom_stroke(igeom, perQuad);
 		lwgeom_free(igeom);
-		if (linear_geom == NULL) 
+		if (linear_geom == NULL)
 			PG_RETURN_NULL();
-		 
+		
 		geom = geometry_serialize(linear_geom);
 		lwgeom_free(linear_geom);
 	}
@@ -1403,7 +1403,7 @@
 	lwgeom_free(lwgeom1);
 	PG_FREE_IF_COPY(geom1, 0);
 
-	if ( lwresult == NULL ) 
+	if ( lwresult == NULL )
 		PG_RETURN_NULL();
 
 	result = geometry_serialize(lwresult) ;
@@ -3028,7 +3028,7 @@
 			}
 			return NULL;
 		}
-       	 
+       	
         i++;
 	}
 
@@ -3567,7 +3567,7 @@
  *
  * ST_Voronoi
  *
- * Returns a Voronoi diagram constructed 
+ * Returns a Voronoi diagram constructed
  * from the points of the input geometry.
  *
  ******************************************/

Modified: trunk/postgis/lwgeom_geos_prepared.c
===================================================================
--- trunk/postgis/lwgeom_geos_prepared.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_geos_prepared.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -294,12 +294,12 @@
 * Given a generic GeomCache, and a geometry to prepare,
 * prepare a PrepGeomCache and stick it into the GeomCache->index
 * slot. The PrepGeomCache includes the original GEOS geometry,
-* and the GEOS prepared geometry, and a pointer to the 
-* MemoryContext where the callback functions are registered. 
-* 
+* and the GEOS prepared geometry, and a pointer to the
+* MemoryContext where the callback functions are registered.
+*
 * This function is passed into the generic GetGeomCache function
 * so that it can build an appropriate indexed structure in the case
-* of a cache hit when there is no indexed structure yet 
+* of a cache hit when there is no indexed structure yet
 * available to return.
 */
 static int
@@ -330,8 +330,8 @@
 		AddPrepGeomHashEntry( pghe );		
 	}
 	
-	/* 
-	* Hum, we shouldn't be asked to build a new cache on top of 
+	/*
+	* Hum, we shouldn't be asked to build a new cache on top of
 	* an existing one. Error.
 	*/
 	if ( prepcache->argnum || prepcache->geom || prepcache->prepared_geom )
@@ -375,7 +375,7 @@
 
 /**
 * This function is passed into the generic GetGeomCache function
-* in the case of a cache miss, so that it can free the particular 
+* in the case of a cache miss, so that it can free the particular
 * indexed structure being managed.
 *
 * In the case of prepared geometry, we want to leave the actual
@@ -392,8 +392,8 @@
 	if ( ! prepcache )
 		return LW_FAILURE;
 
-	/* 
-	* Clear out the references to the soon-to-be-freed GEOS objects 
+	/*
+	* Clear out the references to the soon-to-be-freed GEOS objects
 	* from the callback hash entry
 	*/
 	pghe = GetPrepGeomHashEntry(prepcache->context_callback);
@@ -405,7 +405,7 @@
 	pghe->geom = 0;
 	pghe->prepared_geom = 0;
 
-	/* 
+	/*
 	* Free the GEOS objects and free the index tree
 	*/
 	POSTGIS_DEBUGF(3, "PrepGeomCacheFreeer: freeing %p argnum %d", prepcache, prepcache->argnum);

Modified: trunk/postgis/lwgeom_geos_prepared.h
===================================================================
--- trunk/postgis/lwgeom_geos_prepared.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_geos_prepared.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -46,7 +46,7 @@
 * while Contains only requires that the containing argument be checked.
 * Both the Geometry and the PreparedGeometry have to be cached,
 * because the PreparedGeometry contains a reference to the geometry.
-* 
+*
 * Note that the first 6 entries are part of the common GeomCache
 * structure and have to remain in order to allow the overall caching
 * system to share code (the cache checking code is common between
@@ -54,10 +54,10 @@
 */
 typedef struct {
 	int                         type;       // <GeomCache>
-	GSERIALIZED*                geom1;      // 
-	GSERIALIZED*                geom2;      // 
-	size_t                      geom1_size; // 
-	size_t                      geom2_size; // 
+	GSERIALIZED*                geom1;      //
+	GSERIALIZED*                geom2;      //
+	size_t                      geom1_size; //
+	size_t                      geom2_size; //
 	int32                       argnum;     // </GeomCache>
 	MemoryContext               context_statement;
 	MemoryContext               context_callback;

Modified: trunk/postgis/lwgeom_in_geojson.c
===================================================================
--- trunk/postgis/lwgeom_in_geojson.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_in_geojson.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -50,7 +50,7 @@
 	PG_RETURN_NULL();
 #else /* HAVE_LIBJSON  */
 # ifdef JSON_C_VERSION
-	const char *ver = json_c_version(); 
+	const char *ver = json_c_version();
 # else
 	const char *ver = "UNKNOWN";
 # endif
@@ -74,21 +74,21 @@
 	char *srs = NULL;
 
 	/* Get the geojson stream */
-	if (PG_ARGISNULL(0)) 
+	if (PG_ARGISNULL(0))
 		PG_RETURN_NULL();
 	
 	geojson_input = PG_GETARG_TEXT_P(0);
 	geojson = text2cstring(geojson_input);
 
 	lwgeom = lwgeom_from_geojson(geojson, &srs);
-	if ( ! lwgeom ) 
+	if ( ! lwgeom )
 	{
 		/* Shouldn't get here */
 		elog(ERROR, "lwgeom_from_geojson returned NULL");
 		PG_RETURN_NULL();
 	}
 
-	if ( srs ) 
+	if ( srs )
 	{
 		lwgeom_set_srid(lwgeom, getSRIDbySRS(srs));
 		lwfree(srs);

Modified: trunk/postgis/lwgeom_in_gml.c
===================================================================
--- trunk/postgis/lwgeom_in_gml.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_in_gml.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -78,7 +78,7 @@
 
 
 
-static void gml_lwpgerror(char *msg, int error_code) 
+static void gml_lwpgerror(char *msg, int error_code)
 {
         POSTGIS_DEBUGF(3, "ST_GeomFromGML ERROR %i", error_code);
         lwpgerror("%s", msg);
@@ -157,7 +157,7 @@
                                 return true;
 			} else {
                                 xmlFree(ns);
-                                return false; 
+                                return false;
                         }
 		}
 	}
@@ -929,7 +929,7 @@
 
 	if (is_xlink(xnode)) xnode = get_xlink_node(xnode);
 
-	if (xnode->children == NULL) 
+	if (xnode->children == NULL)
 		return lwpoint_as_lwgeom(lwpoint_construct_empty(*root_srid, 0, 0));
 
 	pa = parse_gml_data(xnode->children, hasz, root_srid);
@@ -964,7 +964,7 @@
 
 	if (is_xlink(xnode)) xnode = get_xlink_node(xnode);
 
-	if (xnode->children == NULL) 
+	if (xnode->children == NULL)
 		return lwline_as_lwgeom(lwline_construct_empty(*root_srid, 0, 0));
 		
 	pa = parse_gml_data(xnode->children, hasz, root_srid);
@@ -1111,10 +1111,10 @@
             ||  (*hasz && !ptarray_is_closed_3d(ppa[0])))
 	    gml_lwpgerror("invalid GML representation", 42);
 
-	if (srs.reverse_axis) 
+	if (srs.reverse_axis)
 		ppa[0] = ptarray_flip_coordinates(ppa[0]);
 	
-	if (srs.srid != *root_srid && *root_srid != SRID_UNKNOWN) 
+	if (srs.srid != *root_srid && *root_srid != SRID_UNKNOWN)
 		gml_reproject_pa(ppa[0], srs.srid, *root_srid);
 		
 	geom = (LWGEOM *) lwpoly_construct(*root_srid, NULL, 1, ppa);
@@ -1136,7 +1136,7 @@
 
 	if (is_xlink(xnode)) xnode = get_xlink_node(xnode);
 
-	if (xnode->children == NULL) 
+	if (xnode->children == NULL)
 		return lwpoly_as_lwgeom(lwpoly_construct_empty(*root_srid, 0, 0));
 
 	parse_gml_srs(xnode, &srs);
@@ -1228,7 +1228,7 @@
 
 	if (is_xlink(xnode)) xnode = get_xlink_node(xnode);
 
-	if (xnode->children == NULL) 
+	if (xnode->children == NULL)
 		return lwtriangle_as_lwgeom(lwtriangle_construct_empty(*root_srid, 0, 0));
 
 	/* GML SF is resticted to planar interpolation
@@ -1452,7 +1452,7 @@
 
 	geom = (LWGEOM *)lwcollection_construct_empty(TINTYPE, *root_srid, 1, 0);
 
-	if (xnode->children == NULL) 
+	if (xnode->children == NULL)
 		return geom;
 
 	/* Looking for gml:patches or gml:trianglePatches */
@@ -1502,7 +1502,7 @@
 
 	geom = (LWGEOM *)lwcollection_construct_empty(MULTIPOINTTYPE, *root_srid, 1, 0);
 
-	if (xnode->children == NULL) 
+	if (xnode->children == NULL)
 		return geom;
 
 	for (xa = xnode->children ; xa != NULL ; xa = xa->next)
@@ -1548,7 +1548,7 @@
 
 	geom = (LWGEOM *)lwcollection_construct_empty(MULTILINETYPE, *root_srid, 1, 0);
 
-	if (xnode->children == NULL) 
+	if (xnode->children == NULL)
 		return geom;
 
 	for (xa = xnode->children ; xa != NULL ; xa = xa->next)
@@ -1583,7 +1583,7 @@
 
 	geom = (LWGEOM *)lwcollection_construct_empty(MULTILINETYPE, *root_srid, 1, 0);
 
-	if (xnode->children == NULL) 
+	if (xnode->children == NULL)
 		return geom;
 
 	for (xa = xnode->children ; xa != NULL ; xa = xa->next)
@@ -1630,7 +1630,7 @@
 
 	geom = (LWGEOM *)lwcollection_construct_empty(MULTIPOLYGONTYPE, *root_srid, 1, 0);
 
-	if (xnode->children == NULL) 
+	if (xnode->children == NULL)
 		return geom;
 
 	for (xa = xnode->children ; xa != NULL ; xa = xa->next)
@@ -1665,7 +1665,7 @@
 
 	geom = (LWGEOM *)lwcollection_construct_empty(MULTIPOLYGONTYPE, *root_srid, 1, 0);
 
-	if (xnode->children == NULL) 
+	if (xnode->children == NULL)
 		return geom;
 
 	for (xa = xnode->children ; xa != NULL ; xa = xa->next)
@@ -1713,7 +1713,7 @@
 
 	geom = (LWGEOM *)lwcollection_construct_empty(POLYHEDRALSURFACETYPE, *root_srid, 1, 0);
 
-	if (xnode->children == NULL) 
+	if (xnode->children == NULL)
 		return geom;
 
 	/* Looking for gml:polygonPatches */
@@ -1761,7 +1761,7 @@
 
 	geom = (LWGEOM *)lwcollection_construct_empty(COLLECTIONTYPE, *root_srid, 1, 0);
 
-	if (xnode->children == NULL) 
+	if (xnode->children == NULL)
 		return geom;
 
 	for (xa = xnode->children ; xa != NULL ; xa = xa->next)
@@ -1817,7 +1817,7 @@
 	/* shouldn't we be releasing xmldoc too here ? */
 
 
-	if ( root_srid != SRID_UNKNOWN ) 
+	if ( root_srid != SRID_UNKNOWN )
 		lwgeom->srid = root_srid;
 
 	/* Should we really do this here ? */

Modified: trunk/postgis/lwgeom_in_kml.c
===================================================================
--- trunk/postgis/lwgeom_in_kml.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_in_kml.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -424,7 +424,7 @@
 			if (ppa[0]->npoints < 4)
 				lwpgerror("invalid KML representation");
 
-			if ((!*hasz && !ptarray_is_closed_2d(ppa[0])) || 
+			if ((!*hasz && !ptarray_is_closed_2d(ppa[0])) ||
 			    ( *hasz && !ptarray_is_closed_3d(ppa[0])))
 			{
 				POINT4D pt;
@@ -438,7 +438,7 @@
 	
 	if (outer_rings != 1)
 		lwpgerror("invalid KML representation");
-		 
+		
 	for (ring=1, xa = xnode->children ; xa != NULL ; xa = xa->next)
 	{
 
@@ -460,7 +460,7 @@
 			if (ppa[ring]->npoints < 4)
 				lwpgerror("invalid KML representation");
 
-			if ((!*hasz && !ptarray_is_closed_2d(ppa[ring])) || 
+			if ((!*hasz && !ptarray_is_closed_2d(ppa[ring])) ||
 			    ( *hasz && !ptarray_is_closed_3d(ppa[ring])))
 			{
 				POINT4D pt;

Modified: trunk/postgis/lwgeom_inout.c
===================================================================
--- trunk/postgis/lwgeom_inout.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_inout.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -363,7 +363,7 @@
  * NOTE: wkb is in *binary* not hex form.
  *
  * NOTE: this function parses EWKB (extended form)
- *       which also contains SRID info. 
+ *       which also contains SRID info.
  */
 PG_FUNCTION_INFO_V1(LWGEOMFromEWKB);
 Datum LWGEOMFromEWKB(PG_FUNCTION_ARGS)
@@ -472,7 +472,7 @@
  	bytea *result;
 	srs_precision sp;
 	
-	/*check for null input since we cannot have the sql-function as strict. 
+	/*check for null input since we cannot have the sql-function as strict.
 	That is because we use null as default for optional ID*/	
 	if ( PG_ARGISNULL(0) ) PG_RETURN_NULL();
 	
@@ -545,7 +545,7 @@
  	bytea *result;
 
 	/* The first two arguments are required */
-	if ( PG_NARGS() < 2 || PG_ARGISNULL(0) || PG_ARGISNULL(1) ) 
+	if ( PG_NARGS() < 2 || PG_ARGISNULL(0) || PG_ARGISNULL(1) )
 		PG_RETURN_NULL();
 
 	arr_geoms = PG_GETARG_ARRAYTYPE_P(0);
@@ -571,7 +571,7 @@
 	iter_ids = array_create_iterator(arr_ids, 0);
 #endif
 
-	while( array_iterate(iter_geoms, &val_geom, &null_geom) && 
+	while( array_iterate(iter_geoms, &val_geom, &null_geom) &&
 	       array_iterate(iter_ids, &val_id, &null_id) )
 	{
 		LWGEOM *geom;
@@ -593,7 +593,7 @@
 			has_m = lwgeom_has_m(geom);
 			col = lwcollection_construct_empty(COLLECTIONTYPE, lwgeom_get_srid(geom), has_z, has_m);
 		}
-		if ( ! idlist ) 
+		if ( ! idlist )
 			idlist = palloc0(num_geoms * sizeof(int64_t));
 
 		
@@ -663,11 +663,11 @@
 		variant |= TWKB_BBOX;
 
 	/* Write out the TWKB */
-	twkb = lwgeom_to_twkb_with_idlist(lwcollection_as_lwgeom(col), 
-	                                  idlist, variant, 
-	                                  sp.precision_xy, sp.precision_z, sp.precision_m, 
+	twkb = lwgeom_to_twkb_with_idlist(lwcollection_as_lwgeom(col),
+	                                  idlist, variant,
+	                                  sp.precision_xy, sp.precision_z, sp.precision_m,
 	                                  &twkb_size);
-					  
+					
 	/* Convert to a bytea return type */
 	result = palloc(twkb_size + VARHDRSZ);
 	memcpy(VARDATA(result), twkb, twkb_size);
@@ -734,13 +734,13 @@
 	Datum result;
 
 	/* Unwrap the PgSQL text type into a cstring */
-	wkt = text2cstring(wkt_text); 
+	wkt = text2cstring(wkt_text);
 	
 	/* Now we call over to the geometry_in function */
 	result = DirectFunctionCall1(LWGEOM_in, CStringGetDatum(wkt));
 
 	/* Return null on null */
-	if ( ! result ) 
+	if ( ! result )
 		PG_RETURN_NULL();
 
 	PG_RETURN_DATUM(result);
@@ -801,7 +801,7 @@
 	PG_RETURN_POINTER(
 	  DatumGetPointer(
 	    DirectFunctionCall1(
-	      WKBFromLWGEOM, 
+	      WKBFromLWGEOM,
 	      PG_GETARG_DATUM(0)
 	    )));
 }
@@ -814,7 +814,7 @@
 	PG_RETURN_POINTER(
 	  DatumGetPointer(
 	    DirectFunctionCall1(
-	      WKBFromLWGEOM, 
+	      WKBFromLWGEOM,
 	      PG_GETARG_DATUM(0)
 	    )));
 }

Modified: trunk/postgis/lwgeom_ogc.c
===================================================================
--- trunk/postgis/lwgeom_ogc.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_ogc.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -200,7 +200,7 @@
 
 
 /**
-* numpoints(LINESTRING) -- return the number of points in the 
+* numpoints(LINESTRING) -- return the number of points in the
 * linestring, or NULL if it is not a linestring
 */
 PG_FUNCTION_INFO_V1(LWGEOM_numpoints_linestring);
@@ -366,7 +366,7 @@
 		* If the input geom has a bbox, use it for
 		* the output geom, as exterior ring makes it up !
 		*/
-		if ( poly->bbox ) 
+		if ( poly->bbox )
 			bbox = gbox_copy(poly->bbox);
 
 		line = lwline_construct(poly->srid, bbox, extring);
@@ -383,7 +383,7 @@
 		* If the input geom has a bbox, use it for
 		* the output geom, as exterior ring makes it up !
 		*/
-		if ( triangle->bbox ) 
+		if ( triangle->bbox )
 			bbox = gbox_copy(triangle->bbox);
 		line = lwline_construct(triangle->srid, bbox, triangle->points);
 
@@ -499,7 +499,7 @@
 		ring = poly->rings[wanted_index];
 
 		/* COMPUTE_BBOX==TAINTING */
-		if ( poly->bbox ) 
+		if ( poly->bbox )
 		{
 			bbox = lwalloc(sizeof(GBOX));
 			ptarray_calculate_gbox_cartesian(ring, bbox);
@@ -546,10 +546,10 @@
 	LWPOINT *lwpoint = NULL;
 	int type = lwgeom->type;
 
-	/* If index is negative, count backward */  
+	/* If index is negative, count backward */
 	if( where < 1 )
 	{
-		int count = -1; 
+		int count = -1;
 		if ( type == LINETYPE || type == CIRCSTRINGTYPE || type == COMPOUNDTYPE )
 			count = lwgeom_count_vertices(lwgeom);
 		if(count >0)
@@ -707,8 +707,8 @@
 	PG_RETURN_FLOAT8(p.m);
 }
 
-/** 
-* ST_StartPoint(GEOMETRY) 
+/**
+* ST_StartPoint(GEOMETRY)
 * @return the first point of a linestring.
 * 		Return NULL if there is no LINESTRING
 */
@@ -800,7 +800,7 @@
 	}
 
 	/* read user-requested SRID if any */
-	if ( PG_NARGS() > 1 ) 
+	if ( PG_NARGS() > 1 )
 		lwgeom_set_srid(lwgeom, PG_GETARG_INT32(1));
 
 	geom_result = geometry_serialize(lwgeom);
@@ -814,7 +814,7 @@
  * 		return a geometry.
  *
  * @note that this is a wrapper around
- * 		lwgeom_from_wkb, where we throw 
+ * 		lwgeom_from_wkb, where we throw
  *      a warning if ewkb passed in
  * 		accept EWKB.
  */

Modified: trunk/postgis/lwgeom_rtree.c
===================================================================
--- trunk/postgis/lwgeom_rtree.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_rtree.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -39,7 +39,7 @@
 /**
 * Allocate a fresh clean RTREE_POLY_CACHE
 */
-static RTREE_POLY_CACHE* 
+static RTREE_POLY_CACHE*
 RTreeCacheCreate()
 {
 	RTREE_POLY_CACHE* result;
@@ -52,7 +52,7 @@
 * Recursively frees the child nodes, the interval and the line before
 * freeing the root node.
 */
-static void 
+static void
 RTreeFree(RTREE_NODE* root)
 {
 	POSTGIS_DEBUGF(2, "RTreeFree called for %p", root);
@@ -72,7 +72,7 @@
 /**
 * Free the cache object and all the sub-objects properly.
 */
-static void 
+static void
 RTreeCacheClear(RTREE_POLY_CACHE* cache)
 {
 	int g, r, i;
@@ -95,9 +95,9 @@
 
 
 /**
- * Returns 1 if min < value <= max, 0 otherwise. 
+ * Returns 1 if min < value <= max, 0 otherwise.
 */
-static uint32 
+static uint32
 IntervalIsContained(RTREE_INTERVAL* interval, double value)
 {
 	return FP_CONTAINS_INCL(interval->min, value, interval->max) ? 1 : 0;
@@ -106,7 +106,7 @@
 /**
 * Creates an interval with the total extents of the two given intervals.
 */
-static RTREE_INTERVAL* 
+static RTREE_INTERVAL*
 RTreeMergeIntervals(RTREE_INTERVAL *inter1, RTREE_INTERVAL *inter2)
 {
 	RTREE_INTERVAL *interval;
@@ -144,7 +144,7 @@
 /**
 * Creates an interior node given the children.
 */
-static RTREE_NODE* 
+static RTREE_NODE*
 RTreeCreateInteriorNode(RTREE_NODE* left, RTREE_NODE* right)
 {
 	RTREE_NODE *parent;
@@ -165,7 +165,7 @@
 /**
 * Creates a leaf node given the pointer to the start point of the segment.
 */
-static RTREE_NODE* 
+static RTREE_NODE*
 RTreeCreateLeafNode(POINTARRAY* pa, int startPoint)
 {
 	RTREE_NODE *parent;
@@ -214,7 +214,7 @@
 * Creates an rtree given a pointer to the point array.
 * Must copy the point array.
 */
-static RTREE_NODE* 
+static RTREE_NODE*
 RTreeCreate(POINTARRAY* pointArray)
 {
 	RTREE_NODE* root;
@@ -275,10 +275,10 @@
 }
 
 
-/** 
-* Merges two multilinestrings into a single multilinestring. 
+/**
+* Merges two multilinestrings into a single multilinestring.
 */
-static LWMLINE* 
+static LWMLINE*
 RTreeMergeMultiLines(LWMLINE *line1, LWMLINE *line2)
 {
 	LWGEOM **geoms;
@@ -312,7 +312,7 @@
 * LWGEOM* this function builds and stores an RTREE_POLY_CACHE into the provided
 * GeomCache object.
 */
-static int 
+static int
 RTreeBuilder(const LWGEOM* lwgeom, GeomCache* cache)
 {
 	int i, p, r;
@@ -391,7 +391,7 @@
 }
 
 /**
-* Callback function sent into the GetGeomCache generic caching system. On a 
+* Callback function sent into the GetGeomCache generic caching system. On a
 * cache miss, this function clears the cached index object.
 */
 static int

Modified: trunk/postgis/lwgeom_rtree.h
===================================================================
--- trunk/postgis/lwgeom_rtree.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_rtree.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -66,17 +66,17 @@
 
 typedef struct {
 	int                         type;       // <GeomCache>
-	GSERIALIZED*                geom1;      // 
-	GSERIALIZED*                geom2;      // 
-	size_t                      geom1_size; // 
-	size_t                      geom2_size; // 
+	GSERIALIZED*                geom1;      //
+	GSERIALIZED*                geom2;      //
+	size_t                      geom1_size; //
+	size_t                      geom2_size; //
 	int32                       argnum;     // </GeomCache>
 	RTREE_POLY_CACHE*           index;
 } RTreeGeomCache;
 
 
 /**
-* Retrieves a collection of line segments given the root and crossing value. 
+* Retrieves a collection of line segments given the root and crossing value.
 */
 LWMLINE *RTreeFindLineSegments(RTREE_NODE *root, double value);
 

Modified: trunk/postgis/lwgeom_sfcgal.c
===================================================================
--- trunk/postgis/lwgeom_sfcgal.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_sfcgal.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -697,23 +697,23 @@
     srid_t srid;
 
     sfcgal_postgis_init();
-    
+
     input = PG_GETARG_GSERIALIZED_P(0);
     srid = gserialized_get_srid(input);
 
     geom = POSTGIS2SFCGALGeometry(input);
     PG_FREE_IF_COPY(input, 0);
-    
+
     dx = PG_GETARG_FLOAT8(1);
     dy = PG_GETARG_FLOAT8(2);
     dz = PG_GETARG_FLOAT8(3);
-    
+
     result = sfcgal_geometry_extrude(geom, dx, dy, dz);
     sfcgal_geometry_delete(geom);
-    
+
     output = SFCGALGeometry2POSTGIS(result, 0, srid);
     sfcgal_geometry_delete(result);
-    
+
     PG_RETURN_POINTER(output);
 }
 

Modified: trunk/postgis/lwgeom_sqlmm.c
===================================================================
--- trunk/postgis/lwgeom_sqlmm.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_sqlmm.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -85,7 +85,7 @@
 	ogeom = lwgeom_stroke(igeom, perQuad);
 	lwgeom_free(igeom);
 	
-	if (ogeom == NULL) 
+	if (ogeom == NULL)
 		PG_RETURN_NULL();
 		
 	ret = geometry_serialize(ogeom);

Modified: trunk/postgis/lwgeom_window.c
===================================================================
--- trunk/postgis/lwgeom_window.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/lwgeom_window.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -50,7 +50,7 @@
 typedef struct
 {
 	uint32_t cluster_id;
-	char is_null;        /* NULL may result from a NULL geometry input, or it may be used by 
+	char is_null;        /* NULL may result from a NULL geometry input, or it may be used by
 							algorithms such as DBSCAN that do not assign all inputs to a
 							cluster. */
 } dbscan_cluster_result;

Modified: trunk/postgis/postgis_drop_after.sql
===================================================================
--- trunk/postgis/postgis_drop_after.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/postgis_drop_after.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -55,10 +55,10 @@
 DROP FUNCTION IF EXISTS box2d_same(box2d, box2d);
 DROP FUNCTION IF EXISTS box2d_intersects(box2d, box2d);
 DROP FUNCTION IF EXISTS st_area(geography); -- this one changed to use default parameters
-DROP FUNCTION IF EXISTS ST_AsGeoJson(geometry); -- this one changed to use default args 
-DROP FUNCTION IF EXISTS ST_AsGeoJson(geography); -- this one changed to use default args 
-DROP FUNCTION IF EXISTS ST_AsGeoJson(geometry,int4); -- this one changed to use default args 
-DROP FUNCTION IF EXISTS ST_AsGeoJson(geography,int4); -- this one changed to use default args 
+DROP FUNCTION IF EXISTS ST_AsGeoJson(geometry); -- this one changed to use default args
+DROP FUNCTION IF EXISTS ST_AsGeoJson(geography); -- this one changed to use default args
+DROP FUNCTION IF EXISTS ST_AsGeoJson(geometry,int4); -- this one changed to use default args
+DROP FUNCTION IF EXISTS ST_AsGeoJson(geography,int4); -- this one changed to use default args
 DROP FUNCTION IF EXISTS ST_AsGeoJson(int4,geometry); -- this one changed to use default args
 DROP FUNCTION IF EXISTS ST_AsGeoJson(int4,geography); -- this one changed to use default args
 DROP FUNCTION IF EXISTS ST_AsGeoJson(int4,geometry,int4); -- this one changed to use default args
@@ -112,8 +112,8 @@
 DROP FUNCTION IF EXISTS st_geometry(bytea);
 DROP FUNCTION IF EXISTS st_bytea(geometry);
 DROP FUNCTION IF EXISTS st_addbbox(geometry);
-DROP FUNCTION IF EXISTS st_dropbbox(geometry); 
-DROP FUNCTION IF EXISTS st_hasbbox(geometry); 
+DROP FUNCTION IF EXISTS st_dropbbox(geometry);
+DROP FUNCTION IF EXISTS st_hasbbox(geometry);
 DROP FUNCTION IF EXISTS cache_bbox();
 DROP FUNCTION IF EXISTS st_cache_bbox();
 DROP FUNCTION IF EXISTS ST_GeoHash(geometry); -- changed to use default args

Modified: trunk/postgis/postgis_drop_before.sql
===================================================================
--- trunk/postgis/postgis_drop_before.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/postgis_drop_before.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -22,16 +22,16 @@
 DROP FUNCTION IF EXISTS AddGeometryColumn(varchar,varchar,varchar,varchar,integer,varchar,integer,boolean);
 DROP FUNCTION IF EXISTS ST_MakeEnvelope(float8, float8, float8, float8);
 --changed name of prec arg to be consistent with ST_AsGML/KML
-DROP FUNCTION IF EXISTS ST_AsX3D(geometry, integer, integer); 
+DROP FUNCTION IF EXISTS ST_AsX3D(geometry, integer, integer);
 --changed name of arg: http://trac.osgeo.org/postgis/ticket/1606
 DROP FUNCTION IF EXISTS UpdateGeometrySRID(varchar,varchar,varchar,varchar,integer);
 
---deprecated and removed in 2.1 
--- Hack to fix 2.0 naming 
+--deprecated and removed in 2.1
+-- Hack to fix 2.0 naming
 -- We can't just drop it since its bound to opclass
 -- See ticket 2279 for why we need to do this
 -- We can get rid of this DO code when 3.0 comes along
-DO  language 'plpgsql' $$ 
+DO  language 'plpgsql' $$
 BEGIN
 	-- fix geometry ops --
 	IF EXISTS(SELECT oprname from pg_operator where oprname = '&&' AND oprrest::text = 'geometry_gist_sel_2d') THEN

Modified: trunk/postgis/postgis_module.c
===================================================================
--- trunk/postgis/postgis_module.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/postgis/postgis_module.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -18,7 +18,7 @@
  *
  **********************************************************************
  *
- * Copyright (C) 2011  OpenGeo.org 
+ * Copyright (C) 2011  OpenGeo.org
  *
  **********************************************************************/
 
@@ -46,8 +46,8 @@
 
 #ifdef WIN32
 static void interruptCallback() {
-  if (UNBLOCKED_SIGNAL_QUEUE()) 
-    pgwin32_dispatch_queued_signals(); 
+  if (UNBLOCKED_SIGNAL_QUEUE())
+    pgwin32_dispatch_queued_signals();
 }
 #endif
 
@@ -59,10 +59,10 @@
 _PG_init(void)
 {
 
-  coreIntHandler = pqsignal(SIGINT, handleInterrupt); 
+  coreIntHandler = pqsignal(SIGINT, handleInterrupt);
 
 #ifdef WIN32
-#if POSTGIS_GEOS_VERSION >= 34 
+#if POSTGIS_GEOS_VERSION >= 34
   GEOS_interruptRegisterCallback(interruptCallback);
 #endif
   lwgeom_register_interrupt_callback(interruptCallback);
@@ -129,7 +129,7 @@
 {
   printf("Interrupt requested\n"); fflush(stdout);
 
-#if POSTGIS_GEOS_VERSION >= 34 
+#if POSTGIS_GEOS_VERSION >= 34
   GEOS_interruptRequest();
 #endif
 

Modified: trunk/raster/loader/raster2pgsql.c
===================================================================
--- trunk/raster/loader/raster2pgsql.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/loader/raster2pgsql.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -60,7 +60,7 @@
 	va_end(ap);
 }
 
-static void 
+static void
 rt_init_allocators(void) {
 	rt_set_handlers(
 		default_rt_allocator,
@@ -384,7 +384,7 @@
 	));
 	printf(_(
 		"  -l <overview factor> Create overview of the raster. For more than\n"
-		"      one factor, separate with comma(,). Overview table name follows\n" 
+		"      one factor, separate with comma(,). Overview table name follows\n"
 		"      the pattern o_<overview factor>_<table>. Created overview is\n"
 		"      stored in the database and is not affected by -R.\n"
 	));
@@ -1734,7 +1734,7 @@
 	/* number of tiles */
 	if (info->tile_size[0] != info->dim[0])
 		ntiles[0] = (info->dim[0] + info->tile_size[0]  - 1) / info->tile_size[0];
-	if (info->tile_size[1] != info->dim[1]) 
+	if (info->tile_size[1] != info->dim[1])
 		ntiles[1] = (info->dim[1] + info->tile_size[1]  - 1) / info->tile_size[1];
 
 	/* estimate size of 1 tile */

Modified: trunk/raster/rt_core/librtcore.h
===================================================================
--- trunk/raster/rt_core/librtcore.h	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/rt_core/librtcore.h	2016-04-27 14:45:28 UTC (rev 14869)
@@ -40,7 +40,7 @@
  * of non-PostGIS applications using rt_core.
  *
  * Programs using this library should set up the default memory managers and error
- * handlers by calling rt_set_handlers() function, or rt_install_default_allocators() 
+ * handlers by calling rt_set_handlers() function, or rt_install_default_allocators()
  * if you want no special handling for memory management and error reporting.
  *
  **/
@@ -108,11 +108,11 @@
 #endif
 #endif
 
-#if defined(sun) || defined(__sun) 
-#if !defined(UNIX) 
-#define UNIX 
-#endif 
+#if defined(sun) || defined(__sun)
+#if !defined(UNIX)
+#define UNIX
 #endif
+#endif
 
 /* if we are in Unix define stricmp to be strcasecmp and strnicmp to */
 /* be strncasecmp. I'm not sure if all Unices have these, but Linux */
@@ -702,7 +702,7 @@
 );
 
 /**
- * Get pixel value. If band's isnodata flag is TRUE, value returned 
+ * Get pixel value. If band's isnodata flag is TRUE, value returned
  * will be the band's NODATA value
  *
  * @param band : the band to get pixel value from
@@ -796,7 +796,7 @@
  * Correct value when clamped value is equal to clamped NODATA value.
  * Correction does NOT occur if unclamped value is exactly unclamped
  * NODATA value.
- * 
+ *
  * @param band : the band whose NODATA value will be used for comparison
  * @param val : the value to compare to the NODATA value and correct
  * @param *newval : pointer to corrected value
@@ -814,7 +814,7 @@
 /**
  * Compute summary statistics for a band
  *
- * @param band : the band to query for summary stats 
+ * @param band : the band to query for summary stats
  * @param exclude_nodata_value : if non-zero, ignore nodata values
  * @param sample : percentage of pixels to sample
  * @param inc_vals : flag to include values in return struct
@@ -933,7 +933,7 @@
 
 /**
  * Returns new band with values reclassified
- * 
+ *
  * @param srcband : the band who's values will be reclassified
  * @param pixtype : pixel type of the new band
  * @param hasnodata : indicates if the band has a nodata value
@@ -1432,7 +1432,7 @@
  * Returns a set of "geomval" value, one for each group of pixel
  * sharing the same value for the provided band.
  *
- * A "geomval" value is a complex type composed of a geometry 
+ * A "geomval" value is a complex type composed of a geometry
  * in LWPOLY representation (one for each group of pixel sharing
  * the same value) and the value associated with this geometry.
  *
@@ -1524,7 +1524,7 @@
 
 /**
  * Replace band at provided index with new band
- * 
+ *
  * @param raster: raster of band to be replaced
  * @param band : new band to add to raster
  * @param index : index of band to replace (0-based)

Modified: trunk/raster/rt_core/rt_band.c
===================================================================
--- trunk/raster/rt_core/rt_band.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/rt_core/rt_band.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -135,7 +135,7 @@
 
 	RASTER_DEBUGF(3, "Created rt_band @ %p with pixtype %s",
 		band, rt_pixtype_name(pixtype)
-	); 
+	);
 
 	band->pixtype = pixtype;
 	band->offline = 1;
@@ -194,7 +194,7 @@
 			band->width, band->height,
 			band->pixtype,
 			band->hasnodata, band->nodataval,
-			band->data.offline.bandNum, (const char *) band->data.offline.path 
+			band->data.offline.bandNum, (const char *) band->data.offline.path
 		);
 	}
 	/* online */
@@ -239,7 +239,7 @@
  * @param band : the band to destroy
  */
 void
-rt_band_destroy(rt_band band) { 
+rt_band_destroy(rt_band band) {
 	if (band == NULL)
 		return;
 
@@ -571,7 +571,7 @@
 			return ES_ERROR;
 		}
 	}
-	else 
+	else
 		band->isnodata = (flag) ? 1 : 0;
 
 	return ES_NONE;
@@ -678,12 +678,12 @@
 	}
 
 	RASTER_DEBUGF(3, "rt_band_set_nodata: band->hasnodata = %d", band->hasnodata);
-	RASTER_DEBUGF(3, "rt_band_set_nodata: band->nodataval = %f", band->nodataval); 
+	RASTER_DEBUGF(3, "rt_band_set_nodata: band->nodataval = %f", band->nodataval);
 	/* the nodata value was just set, so this band has NODATA */
 	band->hasnodata = 1;
 
 	/* also set isnodata flag to false */
-	band->isnodata = 0; 
+	band->isnodata = 0;
 
 	if (rt_util_dbl_trunc_warning(
 		val,
@@ -1010,7 +1010,7 @@
 	uint8_t *_vals = NULL;
 	int pixsize = 0;
 	uint8_t *data = NULL;
-	uint32_t offset = 0; 
+	uint32_t offset = 0;
 	uint16_t _nvals = 0;
 	int maxlen = 0;
 	uint8_t *ptr = NULL;
@@ -1073,7 +1073,7 @@
 }
 
 /**
- * Get pixel value. If band's isnodata flag is TRUE, value returned 
+ * Get pixel value. If band's isnodata flag is TRUE, value returned
  * will be the band's NODATA value
  *
  * @param band : the band to set nodata value to
@@ -1093,7 +1093,7 @@
 ) {
 	rt_pixtype pixtype = PT_END;
 	uint8_t* data = NULL;
-	uint32_t offset = 0; 
+	uint32_t offset = 0;
 
 	assert(NULL != band);
 	assert(NULL != value);
@@ -1594,7 +1594,7 @@
  * @return ES_NONE or ES_ERROR
  */
 rt_errorstate
-rt_band_get_nodata(rt_band band, double *nodata) { 
+rt_band_get_nodata(rt_band band, double *nodata) {
 	assert(NULL != band);
 	assert(NULL != nodata);
 
@@ -1689,7 +1689,7 @@
  * Correct value when clamped value is equal to clamped NODATA value.
  * Correction does NOT occur if unclamped value is exactly unclamped
  * NODATA value.
- * 
+ *
  * @param band : the band whose NODATA value will be used for comparison
  * @param val : the value to compare to the NODATA value and correct
  * @param *newval : pointer to corrected value

Modified: trunk/raster/rt_core/rt_geometry.c
===================================================================
--- trunk/raster/rt_core/rt_geometry.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/rt_core/rt_geometry.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -212,7 +212,7 @@
 	rt_raster_get_geotransform_matrix(raster, gt);
 	numband = rt_raster_get_num_bands(raster);
 
-	RASTER_DEBUGF(3, "rt_raster_get_perimeter: raster is %dx%d", raster->width, raster->height); 
+	RASTER_DEBUGF(3, "rt_raster_get_perimeter: raster is %dx%d", raster->width, raster->height);
 
 	/* nband < 0 means all bands */
 	if (nband >= 0) {
@@ -226,7 +226,7 @@
 	else
 		nband = -1;
 	
-	RASTER_DEBUGF(3, "rt_raster_get_perimeter: nband, numband = %d, %d", nband, numband); 
+	RASTER_DEBUGF(3, "rt_raster_get_perimeter: nband, numband = %d, %d", nband, numband);
 
 	_nband = rtalloc(sizeof(uint16_t) * numband);
 	if (_nband == NULL) {
@@ -690,7 +690,7 @@
 		"rt_raster_get_envelope: raster is %dx%d",
 		raster->width,
 		raster->height
-	); 
+	);
 
 	/* return point or line since at least one of the two dimensions is 0 */
 	if ((!raster->width) || (!raster->height)) {
@@ -818,7 +818,7 @@
 	srid = rt_raster_get_srid(raster);
 	rt_raster_get_geotransform_matrix(raster, gt);
 
-	RASTER_DEBUGF(3, "rt_raster_get_convex_hull: raster is %dx%d", raster->width, raster->height); 
+	RASTER_DEBUGF(3, "rt_raster_get_convex_hull: raster is %dx%d", raster->width, raster->height);
 
 	/* return point or line since at least one of the two dimensions is 0 */
 	if ((!raster->width) || (!raster->height)) {
@@ -923,7 +923,7 @@
  * Returns a set of "geomval" value, one for each group of pixel
  * sharing the same value for the provided band.
  *
- * A "geomval" value is a complex type composed of a geometry 
+ * A "geomval" value is a complex type composed of a geometry
  * in LWPOLY representation (one for each group of pixel sharing
  * the same value) and the value associated with this geometry.
  *

Modified: trunk/raster/rt_core/rt_pixel.c
===================================================================
--- trunk/raster/rt_core/rt_pixel.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/rt_core/rt_pixel.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -315,7 +315,7 @@
 	    rterror("rt_pixel_set_array: mask dimensions %d x %d do not match given dims %d x %d", mask->dimx, mask->dimy,  dim[0],  dim[1]);
 	    return ES_ERROR;
 	  }
-	  
+	
 	  if (mask->values == NULL || mask->nodata == NULL) {
 	    rterror("rt_pixel_set_array: Invalid mask");
 	    return ES_ERROR;
@@ -389,7 +389,7 @@
 			nodatas[_y][_x] = 0;
 		}
 		/* mask */
-		else { 
+		else {
 			/* unweighted (boolean) mask */
 			if (mask->weighted == 0) {
 				/* pixel is set to zero or nodata */

Modified: trunk/raster/rt_core/rt_raster.c
===================================================================
--- trunk/raster/rt_core/rt_raster.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/rt_core/rt_raster.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -3,7 +3,7 @@
  * WKTRaster - Raster Types for PostGIS
  * http://trac.osgeo.org/postgis/wiki/WKTRaster
  *
- * Copyright (C) 2013 Bborie Park <dustymugs at gmail.com> 
+ * Copyright (C) 2013 Bborie Park <dustymugs at gmail.com>
  * Copyright (C) 2011-2013 Regents of the University of California
  *   <bkpark at ucdavis.edu>
  * Copyright (C) 2010-2011 Jorge Arevalo <jorge.arevalo at deimos-space.com>
@@ -73,7 +73,7 @@
 	ret->srid = SRID_UNKNOWN;
 
 	ret->numBands = 0;
-	ret->bands = NULL; 
+	ret->bands = NULL;
 
 	return ret;
 }
@@ -749,7 +749,7 @@
  * @param yw : output parameter, Y ordinate of the geographical point
  * @param gt : input/output parameter, 3x2 geotransform matrix
  *
- * @return ES_NONE if success, ES_ERROR if error 
+ * @return ES_NONE if success, ES_ERROR if error
  */
 rt_errorstate
 rt_raster_cell_to_geopoint(
@@ -2400,7 +2400,7 @@
 struct _rti_rasterize_arg_t {
 	uint8_t noband;
 
-	uint32_t numbands; 
+	uint32_t numbands;
 
 	OGRSpatialReferenceH src_sr;
 

Modified: trunk/raster/rt_core/rt_serialize.c
===================================================================
--- trunk/raster/rt_core/rt_serialize.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/rt_core/rt_serialize.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -731,7 +731,7 @@
 	 * See note on SET_VARSIZE in rt_raster_serialize function above.
 	 */
 
-	/* Allocate memory for deserialized raster header */ 
+	/* Allocate memory for deserialized raster header */
 	RASTER_DEBUG(3, "rt_raster_deserialize: Allocating memory for deserialized raster header");
 	rast = (rt_raster) rtalloc(sizeof (struct rt_raster_t));
 	if (!rast) {

Modified: trunk/raster/rt_pg/rtpg_band_properties.c
===================================================================
--- trunk/raster/rt_pg/rtpg_band_properties.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/rt_pg/rtpg_band_properties.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -330,7 +330,7 @@
 	}
 
 	result = (text *) palloc(VARHDRSZ + strlen(bandpath) + 1);
-	SET_VARSIZE(result, VARHDRSZ + strlen(bandpath) + 1); 
+	SET_VARSIZE(result, VARHDRSZ + strlen(bandpath) + 1);
 	strcpy((char *) VARDATA(result), bandpath);
 
 	rt_band_destroy(band);

Modified: trunk/raster/rt_pg/rtpg_create.c
===================================================================
--- trunk/raster/rt_pg/rtpg_create.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/rt_pg/rtpg_create.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -63,7 +63,7 @@
 	if (PG_NARGS() < 9) {
 		elog(ERROR, "RASTER_makeEmpty: ST_MakeEmptyRaster requires 9 args");
 		PG_RETURN_NULL();
-	} 
+	}
 
 	if (!PG_ARGISNULL(0))
 		width = PG_GETARG_UINT16(0);
@@ -716,11 +716,11 @@
 			}
 			else if (numbands > 0 && dstnband > numbands) {
 				elog(NOTICE, "Invalid band index %d for adding bands. Using band index %d", dstnband, numbands);
-				dstnband = numbands + 1; 
+				dstnband = numbands + 1;
 			}
 		}
 		else
-			dstnband = numbands + 1; 
+			dstnband = numbands + 1;
 	}
 
 	/* open outdb raster file */
@@ -1069,7 +1069,7 @@
 		}
 
 		/* raster has bands */
-		numbands = rt_raster_get_num_bands(arg1->raster.raster); 
+		numbands = rt_raster_get_num_bands(arg1->raster.raster);
 		/*
 		if (!numbands) {
 			elog(NOTICE, "Raster provided has no bands");

Modified: trunk/raster/rt_pg/rtpg_gdal.c
===================================================================
--- trunk/raster/rt_pg/rtpg_gdal.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/rt_pg/rtpg_gdal.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -131,7 +131,7 @@
 	/* apply SRID if set */
 	if (srid != -1)
 		rt_raster_set_srid(raster, srid);
- 
+
 	pgraster = rt_raster_serialize(raster);
 	rt_raster_destroy(raster);
 	if (!pgraster)
@@ -274,7 +274,7 @@
 	/* NULL srid means use raster's srid */
 	if (PG_ARGISNULL(3))
 		srid = rt_raster_get_srid(raster);
-	else 
+	else
 		srid = PG_GETARG_INT32(3);
 
 	/* get srs from srid */

Modified: trunk/raster/rt_pg/rtpg_geometry.c
===================================================================
--- trunk/raster/rt_pg/rtpg_geometry.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/rt_pg/rtpg_geometry.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -477,7 +477,7 @@
 			bounds[2] = 1;
 			bounds[3] = rt_raster_get_height(raster);
 		}
-		POSTGIS_RT_DEBUGF(3, "bounds (min x, max x, min y, max y) = (%d, %d, %d, %d)", 
+		POSTGIS_RT_DEBUGF(3, "bounds (min x, max x, min y, max y) = (%d, %d, %d, %d)",
 			bounds[0], bounds[1], bounds[2], bounds[3]);
 
 		/* rowy */
@@ -790,7 +790,7 @@
 	/* based upon LWGEOM_asBinary function in postgis/lwgeom_ogc.c */
 
 	/* Get the geometry */
-	if (PG_ARGISNULL(0)) 
+	if (PG_ARGISNULL(0))
 		PG_RETURN_NULL();
 
 	gser = PG_GETARG_GSERIALIZED_P(0);

Modified: trunk/raster/rt_pg/rtpg_mapalgebra.c
===================================================================
--- trunk/raster/rt_pg/rtpg_mapalgebra.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/rt_pg/rtpg_mapalgebra.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -657,7 +657,7 @@
 
 		ndims = ARR_NDIM(maskArray);
 
-		if (ndims != 2) { 
+		if (ndims != 2) {
 			elog(ERROR, "RASTER_nMapAlgebra: Mask Must be a 2D array");
 			rtpg_nmapalgebra_arg_destroy(arg);
 			PG_RETURN_NULL();
@@ -669,7 +669,7 @@
 			elog(ERROR,"RASTER_nMapAlgebra: Mask dimensions must be odd");
 			rtpg_nmapalgebra_arg_destroy(arg);
 			PG_RETURN_NULL();
-		} 
+		}
 	
 		deconstruct_array(
 			maskArray,
@@ -719,7 +719,7 @@
 			}
 		}
 
-		/*set mask dimensions*/ 
+		/*set mask dimensions*/
 		arg->mask->dimx = maskDims[0];
 		arg->mask->dimy = maskDims[1];
 		if (maskDims[0] == 1 && maskDims[1] == 1) {
@@ -734,7 +734,7 @@
 
 	/* (8) weighted boolean */
 	if (PG_ARGISNULL(8) || !PG_GETARG_BOOL(8)) {
-		if (arg->mask != NULL) 
+		if (arg->mask != NULL)
 			arg->mask->weighted = 0;
 	}else{
 		if(arg->mask !=NULL)
@@ -1550,7 +1550,7 @@
 			if (!isnull) {
 				arg->callback.expr[i].hasval = 1;
 				arg->callback.expr[i].val = DatumGetFloat8(datum);
-			} 
+			}
 
 			if (SPI_tuptable) SPI_freetuptable(tuptable);
 		}
@@ -2276,7 +2276,7 @@
 					iwr->bandarg[0].raster = NULL;
 					break;
 				/* only other type allowed is unionarg */
-				default: 
+				default:
 					if (skiparg)
 						break;
 
@@ -2484,7 +2484,7 @@
 				if (rt_raster_from_two_rasters(
 					iwr->bandarg[i].raster[j], raster,
 					ET_UNION,
-					&iraster, _offset 
+					&iraster, _offset
 				) != ES_NONE) {
 
 					pfree(itrset);
@@ -3676,7 +3676,7 @@
 				for (c = 0; c < dash_n; c++) {
 					/* need to handle: (-9999-100 -> "(", "9999", "100" */
 					if (
-						c < 1 && 
+						c < 1 &&
 						strlen(dash_set[c]) == 1 && (
 							strchr(dash_set[c], '(') != NULL ||
 							strchr(dash_set[c], '[') != NULL ||
@@ -5110,7 +5110,7 @@
     if (NULL == raster) {
 			PG_FREE_IF_COPY(pgraster, 0);
 			elog(ERROR, "RASTER_mapAlgebraFct: Could not deserialize raster");
-			PG_RETURN_NULL();    
+			PG_RETURN_NULL();
     }
 
     POSTGIS_RT_DEBUG(3, "RASTER_mapAlgebraFct: Getting arguments...");
@@ -5124,10 +5124,10 @@
 
     if (nband < 1)
         nband = 1;
-    
+
     POSTGIS_RT_DEBUG(3, "RASTER_mapAlgebraFct: Creating new empty raster...");
 
-    /** 
+    /**
      * Create a new empty raster with having the same georeference as the
      * provided raster
      **/
@@ -5145,7 +5145,7 @@
         PG_RETURN_NULL();
     }
 
-    rt_raster_set_scale(newrast, 
+    rt_raster_set_scale(newrast,
             rt_raster_get_x_scale(raster),
             rt_raster_get_y_scale(raster));
 
@@ -5157,15 +5157,15 @@
             rt_raster_get_x_skew(raster),
             rt_raster_get_y_skew(raster));
 
-    rt_raster_set_srid(newrast, rt_raster_get_srid(raster));            
+    rt_raster_set_srid(newrast, rt_raster_get_srid(raster));
 
 
     /**
      * If this new raster is empty (width = 0 OR height = 0) then there is
      * nothing to compute and we return it right now
      **/
-    if (rt_raster_is_empty(newrast)) 
-    { 
+    if (rt_raster_is_empty(newrast))
+    {
         elog(NOTICE, "Raster is empty. Returning an empty raster");
         rt_raster_destroy(raster);
         PG_FREE_IF_COPY(pgraster, 0);
@@ -5247,7 +5247,7 @@
 
     /**
      * Set the new pixeltype
-     **/    
+     **/
     POSTGIS_RT_DEBUG(3, "RASTER_mapAlgebraFct: Setting pixeltype...");
 
     if (PG_ARGISNULL(2)) {
@@ -5255,13 +5255,13 @@
     }
 
     else {
-        strFromText = text_to_cstring(PG_GETARG_TEXT_P(2)); 
+        strFromText = text_to_cstring(PG_GETARG_TEXT_P(2));
         newpixeltype = rt_pixtype_index_from_name(strFromText);
         pfree(strFromText);
         if (newpixeltype == PT_END)
             newpixeltype = rt_band_get_pixtype(band);
     }
-    
+
     if (newpixeltype == PT_END) {
 
         rt_raster_destroy(raster);
@@ -5270,8 +5270,8 @@
 
         elog(ERROR, "RASTER_mapAlgebraFct: Invalid pixeltype");
         PG_RETURN_NULL();
-    }    
-    
+    }
+
     POSTGIS_RT_DEBUGF(3, "RASTER_mapAlgebraFct: Pixeltype set to %s",
         rt_pixtype_name(newpixeltype));
 
@@ -5322,7 +5322,7 @@
 
     if (cbinfo.fn_nargs == 2)
         k = 1;
-    else 
+    else
         k = 2;
 
     if (func_volatile(oid) == 'v') {
@@ -5336,7 +5336,7 @@
     InitFunctionCallInfoData(cbdata, &cbinfo, 2, InvalidOid, NULL, NULL);
 #endif
     memset(cbdata.argnull, FALSE, sizeof(bool) * cbinfo.fn_nargs);
-    
+
     /* check that the function isn't strict if the args are null. */
     if (PG_ARGISNULL(4)) {
         if (cbinfo.fn_strict) {
@@ -5381,7 +5381,7 @@
         }
 
         SET_VARSIZE(pgrtn, pgrtn->size);
-        PG_RETURN_POINTER(pgrtn);               
+        PG_RETURN_POINTER(pgrtn);
     }
 
 
@@ -5410,9 +5410,9 @@
         }
 
         SET_VARSIZE(pgrtn, pgrtn->size);
-        PG_RETURN_POINTER(pgrtn);      
+        PG_RETURN_POINTER(pgrtn);
     }
-    
+
     POSTGIS_RT_DEBUGF(3, "RASTER_mapAlgebraFct: Main computing loop (%d x %d)",
             width, height);
 
@@ -5454,7 +5454,7 @@
 
                 POSTGIS_RT_DEBUGF(3, "RASTER_mapAlgebraFct: (%dx%d), r = %f",
                     x, y, r);
-                   
+
                 tmpnewval = FunctionCallInvoke(&cbdata);
 
                 if (cbdata.isnull) {
@@ -5464,15 +5464,15 @@
                     newval = DatumGetFloat8(tmpnewval);
                 }
 
-                POSTGIS_RT_DEBUGF(3, "RASTER_mapAlgebraFct: new value = %f", 
+                POSTGIS_RT_DEBUGF(3, "RASTER_mapAlgebraFct: new value = %f",
                     newval);
-                
+
                 rt_band_set_pixel(newband, x, y, newval, NULL);
             }
 
         }
     }
-    
+
     /* The newrast band has been modified */
 
     POSTGIS_RT_DEBUG(3, "RASTER_mapAlgebraFct: raster modified, serializing it.");
@@ -5489,8 +5489,8 @@
     POSTGIS_RT_DEBUG(3, "RASTER_mapAlgebraFct: raster serialized");
 
     POSTGIS_RT_DEBUG(4, "RASTER_mapAlgebraFct: returning raster");
-    
-    SET_VARSIZE(pgrtn, pgrtn->size);    
+
+    SET_VARSIZE(pgrtn, pgrtn->size);
     PG_RETURN_POINTER(pgrtn);
 }
 
@@ -5548,7 +5548,7 @@
     {
 			PG_FREE_IF_COPY(pgraster, 0);
 			elog(ERROR, "RASTER_mapAlgebraFctNgb: Could not deserialize raster");
-			PG_RETURN_NULL();    
+			PG_RETURN_NULL();
     }
 
     POSTGIS_RT_DEBUG(3, "RASTER_mapAlgebraFctNgb: Getting arguments...");
@@ -5562,10 +5562,10 @@
 
     if (nband < 1)
         nband = 1;
-    
+
     POSTGIS_RT_DEBUG(3, "RASTER_mapAlgebraFctNgb: Creating new empty raster...");
 
-    /** 
+    /**
      * Create a new empty raster with having the same georeference as the
      * provided raster
      **/
@@ -5581,7 +5581,7 @@
         PG_RETURN_NULL();
     }
 
-    rt_raster_set_scale(newrast, 
+    rt_raster_set_scale(newrast,
             rt_raster_get_x_scale(raster),
             rt_raster_get_y_scale(raster));
 
@@ -5593,15 +5593,15 @@
             rt_raster_get_x_skew(raster),
             rt_raster_get_y_skew(raster));
 
-    rt_raster_set_srid(newrast, rt_raster_get_srid(raster));            
+    rt_raster_set_srid(newrast, rt_raster_get_srid(raster));
 
 
     /**
      * If this new raster is empty (width = 0 OR height = 0) then there is
      * nothing to compute and we return it right now
      **/
-    if (rt_raster_is_empty(newrast)) 
-    { 
+    if (rt_raster_is_empty(newrast))
+    {
         elog(NOTICE, "Raster is empty. Returning an empty raster");
         rt_raster_destroy(raster);
 				PG_FREE_IF_COPY(pgraster, 0);
@@ -5683,7 +5683,7 @@
 
     /**
      * Set the new pixeltype
-     **/    
+     **/
     POSTGIS_RT_DEBUG(3, "RASTER_mapAlgebraFctNgb: Setting pixeltype...");
 
     if (PG_ARGISNULL(2)) {
@@ -5691,14 +5691,14 @@
     }
 
     else {
-        strFromText = text_to_cstring(PG_GETARG_TEXT_P(2)); 
+        strFromText = text_to_cstring(PG_GETARG_TEXT_P(2));
         POSTGIS_RT_DEBUGF(3, "RASTER_mapAlgebraFctNgb: Pixeltype parameter: %s", strFromText);
         newpixeltype = rt_pixtype_index_from_name(strFromText);
         pfree(strFromText);
         if (newpixeltype == PT_END)
             newpixeltype = rt_band_get_pixtype(band);
     }
-    
+
     if (newpixeltype == PT_END) {
 
         rt_raster_destroy(raster);
@@ -5707,8 +5707,8 @@
 
         elog(ERROR, "RASTER_mapAlgebraFctNgb: Invalid pixeltype");
         PG_RETURN_NULL();
-    }    
-    
+    }
+
     POSTGIS_RT_DEBUGF(3, "RASTER_mapAlgebraFctNgb: Pixeltype set to %s (%d)",
         rt_pixtype_name(newpixeltype), newpixeltype);
 
@@ -5813,7 +5813,7 @@
         }
 
         SET_VARSIZE(pgrtn, pgrtn->size);
-        PG_RETURN_POINTER(pgrtn);               
+        PG_RETURN_POINTER(pgrtn);
     }
 
 
@@ -5842,7 +5842,7 @@
         }
 
         SET_VARSIZE(pgrtn, pgrtn->size);
-        PG_RETURN_POINTER(pgrtn);      
+        PG_RETURN_POINTER(pgrtn);
     }
 
     /* Get the width of the neighborhood */
@@ -5862,7 +5862,7 @@
         }
 
         SET_VARSIZE(pgrtn, pgrtn->size);
-        PG_RETURN_POINTER(pgrtn);      
+        PG_RETURN_POINTER(pgrtn);
     }
 
     ngbwidth = PG_GETARG_INT32(3);
@@ -5885,7 +5885,7 @@
         }
 
         SET_VARSIZE(pgrtn, pgrtn->size);
-        PG_RETURN_POINTER(pgrtn);      
+        PG_RETURN_POINTER(pgrtn);
     }
 
     ngbheight = PG_GETARG_INT32(4);
@@ -5935,14 +5935,14 @@
             }
 
             SET_VARSIZE(pgrtn, pgrtn->size);
-            PG_RETURN_POINTER(pgrtn);      
+            PG_RETURN_POINTER(pgrtn);
         }
     }
     else if (strcmp(strFromText, "NULL") == 0) {
         /* this setting means that the neighborhood should be skipped if any of the values are null */
         nNullSkip = true;
     }
-   
+
     POSTGIS_RT_DEBUGF(3, "RASTER_mapAlgebraFctNgb: Main computing loop (%d x %d)",
             width, height);
 
@@ -6021,7 +6021,7 @@
                 POSTGIS_RT_DEBUGF(3, "RASTER_mapAlgebraFctNgb: (%dx%d), %dx%d neighborhood",
                     x, y, winwidth, winheight);
 
-                neighborDatum = construct_md_array((void *)neighborData, neighborNulls, 2, neighborDims, neighborLbs, 
+                neighborDatum = construct_md_array((void *)neighborData, neighborNulls, 2, neighborDims, neighborLbs,
                     FLOAT8OID, typlen, typbyval, typalign);
 
                 /* Assign the neighbor matrix as the first argument to the user function */
@@ -6038,9 +6038,9 @@
                     newval = DatumGetFloat8(tmpnewval);
                 }
 
-                POSTGIS_RT_DEBUGF(3, "RASTER_mapAlgebraFctNgb: new value = %f", 
+                POSTGIS_RT_DEBUGF(3, "RASTER_mapAlgebraFctNgb: new value = %f",
                     newval);
-                
+
                 rt_band_set_pixel(newband, x, y, newval, NULL);
             }
 
@@ -6055,7 +6055,7 @@
     pfree(neighborData);
     pfree(strFromText);
     pfree(txtCallbackParam);
-    
+
     rt_raster_destroy(raster);
     PG_FREE_IF_COPY(pgraster, 0);
 
@@ -6071,8 +6071,8 @@
 
     POSTGIS_RT_DEBUG(3, "RASTER_mapAlgebraFctNgb: raster serialized");
     POSTGIS_RT_DEBUG(4, "RASTER_mapAlgebraFctNgb: returning raster");
-    
-    SET_VARSIZE(pgrtn, pgrtn->size);    
+
+    SET_VARSIZE(pgrtn, pgrtn->size);
     PG_RETURN_POINTER(pgrtn);
 }
 

Modified: trunk/raster/rt_pg/rtpg_pixel.c
===================================================================
--- trunk/raster/rt_pg/rtpg_pixel.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/rt_pg/rtpg_pixel.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -272,7 +272,7 @@
 		*/
 
 		/* raster has bands */
-		numbands = rt_raster_get_num_bands(raster); 
+		numbands = rt_raster_get_num_bands(raster);
 		if (!numbands) {
 			elog(NOTICE, "Raster provided has no bands");
 			rt_raster_destroy(raster);

Modified: trunk/raster/rt_pg/rtpg_raster_properties.c
===================================================================
--- trunk/raster/rt_pg/rtpg_raster_properties.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/rt_pg/rtpg_raster_properties.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -357,7 +357,7 @@
 
 /**
  * Return the pixel width of the raster. The pixel width is
- * a read-only, dynamically computed value derived from the 
+ * a read-only, dynamically computed value derived from the
  * X Scale and the Y Skew.
  *
  * Pixel Width = sqrt( X Scale * X Scale + Y Skew * Y Skew )
@@ -393,7 +393,7 @@
 
 /**
  * Return the pixel height of the raster. The pixel height is
- * a read-only, dynamically computed value derived from the 
+ * a read-only, dynamically computed value derived from the
  * Y Scale and the X Skew.
  *
  * Pixel Height = sqrt( Y Scale * Y Scale + X Skew * X Skew )
@@ -1073,7 +1073,7 @@
 	if (!pgrtn)
 		PG_RETURN_NULL();
 
-	SET_VARSIZE(pgrtn, pgrtn->size); 
+	SET_VARSIZE(pgrtn, pgrtn->size);
 	PG_RETURN_POINTER(pgrtn);
 }
 
@@ -1121,7 +1121,7 @@
 	rt_raster_destroy(raster);
 	PG_FREE_IF_COPY(pgraster, 0);
 	if (!pgrtn)
-		PG_RETURN_NULL(); 
+		PG_RETURN_NULL();
 
 	SET_VARSIZE(pgrtn, pgrtn->size);
 	PG_RETURN_POINTER(pgrtn);
@@ -1135,7 +1135,7 @@
  * This method will set the rotation about the X axis and Y axis based on
  * the pixel size. This pixel size may not be uniform if rasters have different
  * skew values (the raster cells are diamond-shaped). If a raster has different
- * skew values has a rotation set upon it, this method will remove the 
+ * skew values has a rotation set upon it, this method will remove the
  * diamond distortions of the cells, as each axis will have the same rotation.
  */
 PG_FUNCTION_INFO_V1(RASTER_setRotation);

Modified: trunk/raster/rt_pg/rtpg_utility.c
===================================================================
--- trunk/raster/rt_pg/rtpg_utility.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/rt_pg/rtpg_utility.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -113,7 +113,7 @@
 
 	/*
 		correct pixsize of unsigned pixel types
-		example: for PT_8BUI, the value is CHAR_MIN but if char is signed, 
+		example: for PT_8BUI, the value is CHAR_MIN but if char is signed,
 			the value returned is -127 instead of 0.
 	*/
 	switch (pixtype) {

Modified: trunk/raster/rt_pg/rtpostgis.c
===================================================================
--- trunk/raster/rt_pg/rtpostgis.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/rt_pg/rtpostgis.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -355,7 +355,7 @@
 						strlen(gdal_skip) + 1 + strlen(drv_set[i].short_name) + 1
 					)
 				);
-				strcat(gdal_skip, " "); 
+				strcat(gdal_skip, " ");
 			}
 			strcat(gdal_skip, drv_set[i].short_name);
 		}

Modified: trunk/raster/scripts/plpgsql/_MapAlgebraParts.sql
===================================================================
--- trunk/raster/scripts/plpgsql/_MapAlgebraParts.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/_MapAlgebraParts.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -2,7 +2,7 @@
 --
 --
 -- Copyright (c) 2009-2010 Pierre Racine <pierre.racine at sbf.ulaval.ca>
--- 
+--
 ----------------------------------------------------------------------
 
 -- Note: The functions found in this file are for exclusive usage of ST_MapAlgebra2
@@ -181,8 +181,8 @@
                                                 r2x int,
                                                 r2y int,
                                                 r2w int,
-                                                r2h int) 
-    RETURNS SETOF geometry AS 
+                                                r2h int)
+    RETURNS SETOF geometry AS
     $$
     DECLARE
     BEGIN
@@ -200,8 +200,8 @@
                                                 r2x int,
                                                 r2y int,
                                                 r2w int,
-                                                r2h int) 
-    RETURNS SETOF geometry AS 
+                                                r2h int)
+    RETURNS SETOF geometry AS
     $$
     DECLARE
 	z int[];
@@ -225,8 +225,8 @@
 
 SELECT asbinary(_MapAlgebraAllPartsGeom(0, 0, 1, 1, 1, 0, 1, 1))
 
-CREATE OR REPLACE FUNCTION X1W1X2W2() 
-    RETURNS SETOF record AS 
+CREATE OR REPLACE FUNCTION X1W1X2W2()
+    RETURNS SETOF record AS
     $$
     DECLARE
 	x1w1x2w2 record;
@@ -262,8 +262,8 @@
     $$
     LANGUAGE 'plpgsql';
 
-CREATE OR REPLACE FUNCTION Y1H1Y2H2() 
-    RETURNS SETOF record AS 
+CREATE OR REPLACE FUNCTION Y1H1Y2H2()
+    RETURNS SETOF record AS
     $$
     DECLARE
 	y1h1y2h2 record;
@@ -299,17 +299,17 @@
     $$
     LANGUAGE 'plpgsql';
 
-_MapAlgebraParts(r1x, r1y, r1w, r1h, r2x, r2y, r2w, r2h) 
+_MapAlgebraParts(r1x, r1y, r1w, r1h, r2x, r2y, r2w, r2h)
 
 SELECT nx, x1, w1, x2, w2 FROM X1W1X2W2() as (nx int, x1 int, w1 int, x2 int, w2 int);
 
-SELECT nx, ny, x1, w1, x2, w2, y1, h1, y2, h2 
+SELECT nx, ny, x1, w1, x2, w2, y1, h1, y2, h2
 FROM X1W1X2W2() as (nx int, x1 int, w1 int, x2 int, w2 int), Y1H1Y2H2() as (ny int, y1 int, h1 int, y2 int, h2 int);
 
-SELECT nx, ny, x1, w1, x2, w2, y1, h1, y2, h2, asbinary(_MapAlgebraPartsGeom(nx, ny, x1, y1, w1, h1, x2, y2, w2, h2)) 
+SELECT nx, ny, x1, w1, x2, w2, y1, h1, y2, h2, asbinary(_MapAlgebraPartsGeom(nx, ny, x1, y1, w1, h1, x2, y2, w2, h2))
 FROM X1W1X2W2() as (nx int, x1 int, w1 int, x2 int, w2 int), Y1H1Y2H2() as (ny int, y1 int, h1 int, y2 int, h2 int);
 
-SELECT asbinary(_MapAlgebraPartsGeom(nx, ny, x1, y1, w1, h1, x2, y2, w2, h2)) 
+SELECT asbinary(_MapAlgebraPartsGeom(nx, ny, x1, y1, w1, h1, x2, y2, w2, h2))
 FROM X1W1X2W2() as (nx int, x1 int, w1 int, x2 int, w2 int), Y1H1Y2H2() as (ny int, y1 int, h1 int, y2 int, h2 int);
 
 

Modified: trunk/raster/scripts/plpgsql/st_addband.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_addband.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_addband.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -8,7 +8,7 @@
 -- NOTE: This function is provided merely as an example since a C version was implemented and is now provided in rtpostgis.sql
 
 CREATE OR REPLACE FUNCTION ST_AddBand(rast1 raster, rast2 raster, band int, index int)
-    RETURNS raster AS 
+    RETURNS raster AS
     $$
     DECLARE
         newraster raster;

Modified: trunk/raster/scripts/plpgsql/st_areaweightedsummarystats.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_areaweightedsummarystats.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_areaweightedsummarystats.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -5,22 +5,22 @@
 --
 -- Exemple
 -- SELECT gt.id,
---        (aws).count, 
+--        (aws).count,
 --        (aws).distinctcount,
---        (aws).geom, 
---        (aws).totalarea, 
---        (aws).meanarea, 
---        (aws).totalperimeter, 
---        (aws).meanperimeter, 
---        (aws).weightedsum, 
---        (aws).weightedmean, 
---        (aws).maxareavalue, 
---        (aws).minareavalue, 
---        (aws).maxcombinedareavalue, 
---        (aws).mincombinedareavalue, 
---        (aws).sum, 
---        (aws).mean, 
---        (aws).max, 
+--        (aws).geom,
+--        (aws).totalarea,
+--        (aws).meanarea,
+--        (aws).totalperimeter,
+--        (aws).meanperimeter,
+--        (aws).weightedsum,
+--        (aws).weightedmean,
+--        (aws).maxareavalue,
+--        (aws).minareavalue,
+--        (aws).maxcombinedareavalue,
+--        (aws).mincombinedareavalue,
+--        (aws).sum,
+--        (aws).mean,
+--        (aws).max,
 --        (aws).min
 -- FROM (SELECT ST_AreaWeightedSummaryStats(gv) aws
 --       FROM (SELECT ST_Intersection(rt.rast, gt.geom) gv
@@ -44,11 +44,11 @@
     weightedmean double precision,
     maxareavalue double precision,
     minareavalue double precision,
-    maxcombinedareavalue double precision, 
-    mincombinedareavalue double precision, 
-    sum double precision, 
-    mean double precision, 
-    max  double precision, 
+    maxcombinedareavalue double precision,
+    mincombinedareavalue double precision,
+    sum double precision,
+    mean double precision,
+    max  double precision,
     min double precision
 );
 
@@ -62,9 +62,9 @@
     weightedsum double precision,
     maxareavalue double precision[],
     minareavalue double precision[],
-    combinedweightedareas double precision[], 
-    sum double precision, 
-    max double precision, 
+    combinedweightedareas double precision[],
+    sum double precision,
+    max double precision,
     min double precision
 );
 
@@ -72,7 +72,7 @@
 -- geomval_arealweightedstate
 -- State function used by the ST_AreaWeightedSummaryStats aggregate
 CREATE OR REPLACE FUNCTION geomval_arealweightedstate(aws arealweightedstatsstate, gv geomval)
-    RETURNS arealweightedstatsstate 
+    RETURNS arealweightedstatsstate
     AS $$
     DECLARE
         i int;
@@ -81,35 +81,35 @@
         newgeom geometry := ($2).geom;
         geomtype text := GeometryType(($2).geom);
     BEGIN
-        IF geomtype = 'GEOMETRYCOLLECTION' THEN 
+        IF geomtype = 'GEOMETRYCOLLECTION' THEN
             newgeom := ST_CollectionExtract(newgeom, 3);
         END IF;
-        IF newgeom IS NULL OR ST_IsEmpty(newgeom) OR geomtype = 'POINT' OR geomtype = 'LINESTRING' OR geomtype = 'MULTIPOINT' OR geomtype = 'MULTILINESTRING' THEN 
+        IF newgeom IS NULL OR ST_IsEmpty(newgeom) OR geomtype = 'POINT' OR geomtype = 'LINESTRING' OR geomtype = 'MULTIPOINT' OR geomtype = 'MULTILINESTRING' THEN
             ret := aws;
-        ELSEIF $1 IS NULL THEN 
-            ret := (1, 
-                    ARRAY[($2).val], 
+        ELSEIF $1 IS NULL THEN
+            ret := (1,
+                    ARRAY[($2).val],
                     newgeom,
                     ST_Area(newgeom),
                     ST_Perimeter(newgeom),
-                    ($2).val * ST_Area(newgeom), 
-                    ARRAY[ST_Area(newgeom), ($2).val], 
-                    ARRAY[ST_Area(newgeom), ($2).val], 
-                    ARRAY[ST_Area(newgeom)], 
-                    ($2).val, 
-                    ($2).val, 
-                    ($2).val 
+                    ($2).val * ST_Area(newgeom),
+                    ARRAY[ST_Area(newgeom), ($2).val],
+                    ARRAY[ST_Area(newgeom), ($2).val],
+                    ARRAY[ST_Area(newgeom)],
+                    ($2).val,
+                    ($2).val,
+                    ($2).val
                    )::arealweightedstatsstate;
         ELSE
             -- Search for the new value in the array of distinct values
             SELECT n FROM generate_series(1, array_length(($1).distinctvalues, 1)) n WHERE (($1).distinctvalues)[n] = ($2).val INTO i;
-RAISE NOTICE 'i=% ',i;            
+RAISE NOTICE 'i=% ',i;
             -- If the value already exists, increment the corresponding area with the new area
             IF NOT i IS NULL THEN
                 newcombinedweightedareas[i] := newcombinedweightedareas[i] + ST_Area(newgeom);
             END IF;
-            ret := (($1).count + 1, 
-                    CASE WHEN i IS NULL THEN array_append(($1).distinctvalues, ($2).val) ELSE ($1).distinctvalues END, 
+            ret := (($1).count + 1,
+                    CASE WHEN i IS NULL THEN array_append(($1).distinctvalues, ($2).val) ELSE ($1).distinctvalues END,
                     ST_Union(($1).unionedgeom, newgeom),
                     ($1).totalarea + ST_Area(newgeom),
                     ($1).totalperimeter + ST_Perimeter(newgeom),
@@ -128,16 +128,16 @@
     LANGUAGE 'plpgsql';
 
 CREATE OR REPLACE FUNCTION geomval_arealweightedstate(aws arealweightedstatsstate, geom geometry, val double precision)
-    RETURNS arealweightedstatsstate 
+    RETURNS arealweightedstatsstate
     AS $$
         SELECT geomval_arealweightedstate($1, ($2, $3)::geomval);
     $$ LANGUAGE 'SQL';
 
 ---------------------------------------------------------------------
 -- geomval_arealweightedfinal
--- Final function used by the ST_AreaWeightedSummaryStats aggregate 
+-- Final function used by the ST_AreaWeightedSummaryStats aggregate
 CREATE OR REPLACE FUNCTION geomval_arealweightedfinal(aws arealweightedstatsstate)
-    RETURNS arealweightedstats 
+    RETURNS arealweightedstats
     AS $$
     DECLARE
         a RECORD;
@@ -156,7 +156,7 @@
             IF a.warea < minarea THEN
                 imin := a.n;
                 minarea = a.warea;
-            END IF;    
+            END IF;
         END LOOP;
 
         ret := (($1).count,
@@ -173,7 +173,7 @@
                 (($1).distinctvalues)[imax],
                 (($1).distinctvalues)[imin],
                 ($1).sum,
-                ($1).sum / ($1).count, 
+                ($1).sum / ($1).count,
                 ($1).max,
                 ($1).min
                )::arealweightedstats;
@@ -202,22 +202,22 @@
 
 
 SELECT id,
-       (aws).count, 
+       (aws).count,
        (aws).distinctcount,
-       (aws).geom, 
-       (aws).totalarea, 
-       (aws).meanarea, 
-       (aws).totalperimeter, 
-       (aws).meanperimeter, 
-       (aws).weightedsum, 
-       (aws).weightedmean, 
-       (aws).maxareavalue, 
-       (aws).minareavalue, 
-       (aws).maxcombinedareavalue, 
-       (aws).mincombinedareavalue, 
-       (aws).sum, 
-       (aws).mean, 
-       (aws).max, 
+       (aws).geom,
+       (aws).totalarea,
+       (aws).meanarea,
+       (aws).totalperimeter,
+       (aws).meanperimeter,
+       (aws).weightedsum,
+       (aws).weightedmean,
+       (aws).maxareavalue,
+       (aws).minareavalue,
+       (aws).maxcombinedareavalue,
+       (aws).mincombinedareavalue,
+       (aws).sum,
+       (aws).mean,
+       (aws).max,
        (aws).min
 FROM (SELECT ST_AreaWeightedSummaryStats((geom, weight)::geomval) as aws, id
       FROM (SELECT ST_GeomFromEWKT('SRID=4269;POLYGON((0 0,0 10, 10 10, 10 0, 0 0))') as geom, 'a' as id, 100 as weight

Modified: trunk/raster/scripts/plpgsql/st_asraster.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_asraster.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_asraster.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -5,12 +5,12 @@
 --
 ----------------------------------------------------------------------
 
--- NOTE: The ST_AsRaster() function is already implemented in C. This plpgsql script is provided only as an example. 
+-- NOTE: The ST_AsRaster() function is already implemented in C. This plpgsql script is provided only as an example.
 -- Defining the plpgsql function below might overwrite the current C implementation and brake other functions dependent on it.
 -- Use with caution.
 
-CREATE OR REPLACE FUNCTION ST_AsRaster(geom geometry, rast raster, pixeltype text, nodatavalue float8, val float8) 
-    RETURNS raster AS 
+CREATE OR REPLACE FUNCTION ST_AsRaster(geom geometry, rast raster, pixeltype text, nodatavalue float8, val float8)
+    RETURNS raster AS
     $$
     DECLARE
     numband int := ST_NumBands(rast);

Modified: trunk/raster/scripts/plpgsql/st_clip.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_clip.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_clip.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -7,11 +7,11 @@
 
 -- NOTE: The ST_Clip function found in this file still many improvements before being implemented in C.
 
-CREATE OR REPLACE FUNCTION ST_Clip(rast raster, x int, y int, width int, height int) 
-    RETURNS raster AS 
+CREATE OR REPLACE FUNCTION ST_Clip(rast raster, x int, y int, width int, height int)
+    RETURNS raster AS
     $$
     DECLARE
-        newrast raster := ST_MakeEmptyRaster(width, height, ST_UpperLeftX(rast), ST_UpperLeftY(rast), 
+        newrast raster := ST_MakeEmptyRaster(width, height, ST_UpperLeftX(rast), ST_UpperLeftY(rast),
                           ST_ScaleX(rast), ST_ScaleY(rast), ST_SkewX(rast), ST_SkewY(rast), ST_SRID(rast));
         numband int := ST_Numbands(rast);
     band int;
@@ -35,7 +35,7 @@
 -------------------------------------------------------------------
 -- ST_Clip
 -- Clip the values of a raster to the shape of a polygon.
--- 
+--
 -- rast   - raster to be clipped
 -- band   - limit the result to only one band
 -- geom   - geometry defining the she to clip the raster
@@ -45,9 +45,9 @@
 -- test point
 -- test line
 -- test polygon smaller than pixel
--- test and optimize raster totally included in polygon 
-CREATE OR REPLACE FUNCTION ST_Clip(rast raster, band int, geom geometry, nodata float8 DEFAULT null, trimraster boolean DEFAULT false) 
-    RETURNS raster AS 
+-- test and optimize raster totally included in polygon
+CREATE OR REPLACE FUNCTION ST_Clip(rast raster, band int, geom geometry, nodata float8 DEFAULT null, trimraster boolean DEFAULT false)
+    RETURNS raster AS
     $$
     DECLARE
         sourceraster raster := rast;
@@ -80,17 +80,17 @@
         newpixtype := ST_BandPixelType(rast, bandstart);
         newnodata := coalesce(nodata, ST_BandNodataValue(rast, bandstart), ST_MinPossibleValue(newpixtype));
         newextent := CASE WHEN trimraster THEN 'INTERSECTION' ELSE 'FIRST' END;
-        
+
 --RAISE NOTICE 'newextent=%', newextent;
         -- Convert the geometry to a raster
-        geomrast := ST_AsRaster(geom, rast, ST_BandPixelType(rast, band), 1, newnodata);  
+        geomrast := ST_AsRaster(geom, rast, ST_BandPixelType(rast, band), 1, newnodata);
 
         -- Set the newnodata
         sourceraster := ST_SetBandNodataValue(sourceraster, bandstart, newnodata);
 
         -- Compute the first raster band
         newrast := ST_MapAlgebraExpr(sourceraster, bandstart, geomrast, 1, '[rast1.val]', newpixtype, newextent);
-        
+
         FOR bandi IN bandstart+1..bandend LOOP
 --RAISE NOTICE 'bandi=%', bandi;
             -- for each band we must determine the nodata value
@@ -106,29 +106,29 @@
 
 -- Variant defaulting to band 1
 CREATE OR REPLACE FUNCTION ST_Clip(rast raster, geom geometry, nodata float8 DEFAULT null, trimraster boolean DEFAULT false)
-    RETURNS raster 
+    RETURNS raster
     AS $$
         SELECT ST_Clip($1, 1, $2, $3, $4);
     $$ LANGUAGE 'SQL';
 
 -- Variant defaulting nodata to the one of the raster or the min possible value
 CREATE OR REPLACE FUNCTION ST_Clip(rast raster, band int, geom geometry, trimraster boolean)
-    RETURNS raster 
+    RETURNS raster
     AS $$
         SELECT ST_Clip($1, $2, $3, null, $4);
     $$ LANGUAGE 'SQL';
 
 -- Variant defaulting nodata to the one of the raster or the min possible value
 CREATE OR REPLACE FUNCTION ST_Clip(rast raster, geom geometry, trimraster boolean)
-    RETURNS raster 
+    RETURNS raster
     AS $$
         SELECT ST_Clip($1, 1, $2, null, $3);
     $$ LANGUAGE 'SQL';
 
 -- Test
 
-CREATE OR REPLACE FUNCTION ST_TestRaster(h integer, w integer, val float8) 
-    RETURNS raster AS 
+CREATE OR REPLACE FUNCTION ST_TestRaster(h integer, w integer, val float8)
+    RETURNS raster AS
     $$
     DECLARE
     BEGIN
@@ -140,51 +140,51 @@
 SELECT ST_Clip(ST_TestRaster(10, 10, 2), 1, ST_Buffer(ST_MakePoint(8, 5), 4)) rast
 
 -- Test one band raster
-SELECT ST_AsBinary((gv).geom), (gv).val 
+SELECT ST_AsBinary((gv).geom), (gv).val
 FROM ST_PixelAsPolygons(ST_Clip(ST_TestRaster(10, 10, 2), 1, ST_Buffer(ST_MakePoint(8, 5), 4))) gv
 
 -- Test two bands raster
-SELECT ST_AsBinary((gv).geom), (gv).val 
+SELECT ST_AsBinary((gv).geom), (gv).val
 FROM ST_PixelAsPolygons(ST_Clip(ST_AddBand(ST_TestRaster(10, 10, 2), '16BUI'::text, 4, 0), null, ST_Buffer(ST_MakePoint(8, 5), 4)), 2) gv
 
 -- Test one band raster with trimraster set to true
-SELECT ST_AsBinary((gv).geom), (gv).val 
+SELECT ST_AsBinary((gv).geom), (gv).val
 FROM ST_PixelAsPolygons(ST_Clip(ST_TestRaster(10, 10, 2), 1, ST_Buffer(ST_MakePoint(8, 5), 4), null, true)) gv
 
 -- Test two bands raster with trimraster set to true
-SELECT ST_AsBinary((gv).geom), (gv).val 
+SELECT ST_AsBinary((gv).geom), (gv).val
 FROM ST_PixelAsPolygons(ST_Clip(ST_AddBand(ST_TestRaster(10, 10, 2), '16BUI'::text, 4, 0), null, ST_Buffer(ST_MakePoint(8, 5), 4), null, true), 2) gv
 
 -- Test nodatavalue set by the first raster
-SELECT ST_AsBinary((gv).geom), (gv).val 
+SELECT ST_AsBinary((gv).geom), (gv).val
 FROM ST_PixelAsPolygons(ST_SetBandNoDataValue(ST_Clip(ST_TestRaster(10, 10, 2), 1, ST_Buffer(ST_MakePoint(8, 5), 4)), null)) gv
 
 -- Test nodatavalue set by the parameter
-SELECT ST_AsBinary((gv).geom), (gv).val 
+SELECT ST_AsBinary((gv).geom), (gv).val
 FROM ST_PixelAsPolygons(ST_SetBandNoDataValue(ST_Clip(ST_TestRaster(10, 10, 2), 1, ST_Buffer(ST_MakePoint(8, 5), 4), -10), null)) gv
 
 -- Test nodatavalue set by the min possible value
-SELECT ST_AsBinary((gv).geom), (gv).val 
+SELECT ST_AsBinary((gv).geom), (gv).val
 FROM ST_PixelAsPolygons(ST_SetBandNoDataValue(ST_Clip(ST_SetBandNoDataValue(ST_TestRaster(10, 10, 2), null), 1, ST_Buffer(ST_MakePoint(8, 5), 4)), null)) gv
 
 -- Test the variant defaulting to band 1
 SELECT ST_Numbands(ST_Clip(ST_AddBand(ST_TestRaster(10, 10, 2), '16BUI'::text, 4, 0), ST_Buffer(ST_MakePoint(8, 5), 4))) gv
 
-SELECT ST_AsBinary((gv).geom), (gv).val 
+SELECT ST_AsBinary((gv).geom), (gv).val
 FROM ST_PixelAsPolygons(ST_Clip(ST_AddBand(ST_TestRaster(10, 10, 2), '16BUI'::text, 4, 0), ST_Buffer(ST_MakePoint(8, 5), 4)), 1) gv
 
 -- Test defaulting to min possible value and band 1
-SELECT ST_AsBinary((gv).geom), (gv).val 
+SELECT ST_AsBinary((gv).geom), (gv).val
 FROM ST_PixelAsPolygons(ST_SetBandNoDataValue(ST_Clip(ST_SetBandNoDataValue(ST_TestRaster(10, 10, 2), null), ST_Buffer(ST_MakePoint(8, 5), 4)), null)) gv
 
 -- Test defaulting to nodatavalue set by the first raster and band 1
-SELECT ST_AsBinary((gv).geom), (gv).val 
+SELECT ST_AsBinary((gv).geom), (gv).val
 FROM ST_PixelAsPolygons(ST_SetBandNoDataValue(ST_Clip(ST_TestRaster(10, 10, 2), ST_Buffer(ST_MakePoint(8, 5), 4)), null)) gv
 
 -- Test when band number does not exist
-SELECT ST_AsBinary((gv).geom), (gv).val 
+SELECT ST_AsBinary((gv).geom), (gv).val
 FROM ST_PixelAsPolygons(ST_Clip(ST_TestRaster(10, 10, 2), 2, ST_Buffer(ST_MakePoint(8, 5), 4))) gv
 
 -- Test point -- bug. The produced raster does not have the same alignment
-SELECT ST_AsBinary((gv).geom), (gv).val 
+SELECT ST_AsBinary((gv).geom), (gv).val
 FROM ST_PixelAsPolygons(ST_Clip(ST_TestRaster(10, 10, 2), ST_MakePoint(8.5, 5.5))) gv

Modified: trunk/raster/scripts/plpgsql/st_createindexraster.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_createindexraster.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_createindexraster.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -2,21 +2,21 @@
 -- Create an index raster. Georeference is borrowed from the provided raster.
 -- pixeltype  - The pixeltype of the resulting raster
 -- startvalue - The first index value assigned to the raster. Default to 0.
--- incwithx   - If true, the index increments when the x position of the pixel increments. 
+-- incwithx   - If true, the index increments when the x position of the pixel increments.
 --              The index decrement on x otherwise. Default to true.
--- incwithy   - If true, the index increments when the y position of the pixel increments. 
+-- incwithy   - If true, the index increments when the y position of the pixel increments.
 --              The index decrement on y otherwise. Default to true.
--- columnfirst  - If true, columns are traversed first. 
+-- columnfirst  - If true, columns are traversed first.
 --                Rows are traversed first otherwise. Default to true.
--- rowscanorder - If true, the raster is traversed in "row scan" order. 
+-- rowscanorder - If true, the raster is traversed in "row scan" order.
 --                Row prime order (Boustrophedon) is used otherwise. Default to true.
 -- falsecolinc  - Overwrite the column index increment which is normally equal to ST_Height()
 -- falserowinc  - Overwrite the row index increment which is normally equal to ST_Width()
 ----------------------------------------------------------------------------------------------------------------------
-CREATE OR REPLACE FUNCTION ST_CreateIndexRaster(rast raster, 
-                                                pixeltype text DEFAULT '32BUI', 
-                                                startvalue int DEFAULT 0, 
-                                                incwithx boolean DEFAULT true, 
+CREATE OR REPLACE FUNCTION ST_CreateIndexRaster(rast raster,
+                                                pixeltype text DEFAULT '32BUI',
+                                                startvalue int DEFAULT 0,
+                                                incwithx boolean DEFAULT true,
                                                 incwithy boolean DEFAULT true,
                                                 columnfirst boolean DEFAULT true,
                                                 rowscanorder boolean DEFAULT true,
@@ -52,7 +52,7 @@
             RAISE EXCEPTION 'Row increment (now %) must be greater than the number of index on one row (now % pixel x % = %)...', rowincx, w - 1, colincy, (w - 1) * colincy;
         END IF;
         newraster = ST_SetBandNodataValue(ST_MapAlgebraExpr(newraster, pixeltype, 'abs([rast.x] - (' || w::text || ' ^ ((abs([rast.y] - ' || ydir::text || ' + 1) % 2) | ' || rsflag::text || ' # ' || xdflag::text || '))::int) * ' || colincy::text || ' + abs([rast.y] - ' || ydir::text || ') * ' || rowincx::text || ' + ' || newstartvalue::text), ST_BandNodataValue(newraster));
-    END IF;    
+    END IF;
     RETURN newraster;
 END;
 $BODY$

Modified: trunk/raster/scripts/plpgsql/st_deleteband.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_deleteband.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_deleteband.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -13,8 +13,8 @@
 -- to be found in the script/plpgsql folder
 
 CREATE OR REPLACE FUNCTION ST_DeleteBand(rast raster,
-				         band int) 
-    RETURNS raster AS 
+				         band int)
+    RETURNS raster AS
     $$
     DECLARE
 	numband int := ST_NumBands(rast);

Modified: trunk/raster/scripts/plpgsql/st_geomextent2rastercoord.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_geomextent2rastercoord.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_geomextent2rastercoord.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,5 +1,5 @@
 DROP FUNCTION ST_GeomExtent2RasterCoord(rast raster, geomin geometry);
-CREATE OR REPLACE FUNCTION ST_GeomExtent2RasterCoord(rast raster, 
+CREATE OR REPLACE FUNCTION ST_GeomExtent2RasterCoord(rast raster,
 							geomin geometry)
     RETURNS int[] AS
     $$
@@ -74,7 +74,7 @@
         -- of the raster.
         x2 := int4smaller(x2, st_width(rast));
         y2 := int4smaller(y2, st_height(rast));
-        
+
         RETURN ARRAY[x1, y1, x2, y2];
 
     END;
@@ -93,7 +93,7 @@
 WHERE st_intersects(rast, geom)
 
 
-SELECT rid, id, ST_GeomExtent2RasterCoord(rast, geom) 
+SELECT rid, id, ST_GeomExtent2RasterCoord(rast, geom)
 FROM srtm_22_03_tiled, rect3
 WHERE st_intersects(rast, geom)
 

Modified: trunk/raster/scripts/plpgsql/st_histogram.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_histogram.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_histogram.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -4,17 +4,17 @@
 -- Copyright (c) 2009-2010 Pierre Racine <pierre.racine at sbf.ulaval.ca>
 --
 ----------------------------------------------------------------------
--- NOTE: The ST_Histogram() function is already implemented in C. This plpgsql script is provided only as an example. 
+-- NOTE: The ST_Histogram() function is already implemented in C. This plpgsql script is provided only as an example.
 -- Defining the plpgsql function below might overwrite the current C implementation and brake other functions dependent on it.
 -- Use with caution.
 ----------------------------------------------------------------------
 -- _ST_Values(rast raster, band int)
 -- Return all rast pixels values which center are in a geometry
--- Values are returned as groups of identical adjacent values (value, count) 
+-- Values are returned as groups of identical adjacent values (value, count)
 -- in order to reduce the number of row returned.
 ----------------------------------------------------------------------
-CREATE OR REPLACE FUNCTION _ST_Values(rast raster, band int, geom geometry, OUT val float8, OUT count int) 
-    RETURNS SETOF record AS 
+CREATE OR REPLACE FUNCTION _ST_Values(rast raster, band int, geom geometry, OUT val float8, OUT count int)
+    RETURNS SETOF record AS
     $$
     DECLARE
         geomintersect geometry;
@@ -56,15 +56,15 @@
     END;
     $$
     LANGUAGE 'plpgsql' IMMUTABLE STRICT;
-   
+
 ----------------------------------------------------------------------
 -- _ST_Values(rast raster, band int)
 -- Return all rast pixels values
--- Values are returned as groups of identical adjacent values (value, count) 
+-- Values are returned as groups of identical adjacent values (value, count)
 -- in order to reduce the number of row returned.
 ----------------------------------------------------------------------
-CREATE OR REPLACE FUNCTION _ST_Values(rast raster, band int, OUT val float8, OUT count int) 
-    RETURNS SETOF record AS 
+CREATE OR REPLACE FUNCTION _ST_Values(rast raster, band int, OUT val float8, OUT count int)
+    RETURNS SETOF record AS
     $$
     DECLARE
         x int;
@@ -102,7 +102,7 @@
 CREATE OR REPLACE FUNCTION ST_Histogram(rast raster, band int, OUT val double precision, OUT count bigint)
 RETURNS SETOF record
     AS $$
-    SELECT (vc).val val, sum((vc).count)::bigint count 
+    SELECT (vc).val val, sum((vc).count)::bigint count
     FROM (SELECT _ST_Values($1, $2) vc) foo GROUP BY (vc).val;
     $$
     LANGUAGE SQL;
@@ -110,20 +110,20 @@
 CREATE OR REPLACE FUNCTION ST_Histogram(rast raster, OUT val double precision, OUT count bigint)
 RETURNS SETOF record
     AS $$
-    SELECT (vc).val val, sum((vc).count)::bigint count 
+    SELECT (vc).val val, sum((vc).count)::bigint count
     FROM (SELECT _ST_Values($1, 1) vc) foo GROUP BY (vc).val;
     $$
     LANGUAGE SQL;
 
 ----------------------------------------------------------------------
 -- ST_Histogram(rast raster, band int, geom geometry) group
--- Return a set of (val, count) rows forming the value histogram for the area of a raster covered by a polygon geometry. 
--- Pixels are selected only when their center intersects the polygon 
+-- Return a set of (val, count) rows forming the value histogram for the area of a raster covered by a polygon geometry.
+-- Pixels are selected only when their center intersects the polygon
 ----------------------------------------------------------------------
 CREATE OR REPLACE FUNCTION ST_Histogram(rast raster, band int, geom geometry, OUT val double precision, OUT count bigint)
 RETURNS SETOF record
     AS $$
-    SELECT (vc).val val, sum((vc).count)::bigint count 
+    SELECT (vc).val val, sum((vc).count)::bigint count
     FROM (SELECT _ST_Values($1, $2, $3) vc) foo GROUP BY (vc).val;
     $$
     LANGUAGE SQL;
@@ -131,7 +131,7 @@
 CREATE OR REPLACE FUNCTION ST_Histogram(rast raster, geom geometry, OUT val double precision, OUT count bigint)
 RETURNS SETOF record
     AS $$
-    SELECT (vc).val val, sum((vc).count)::bigint count 
+    SELECT (vc).val val, sum((vc).count)::bigint count
     FROM (SELECT _ST_Values($1, 1, $2) vc) foo GROUP BY (vc).val;
     $$
     LANGUAGE SQL;
@@ -142,8 +142,8 @@
 CREATE OR REPLACE FUNCTION ST_Histogram2(rast raster, band int, OUT val double precision, OUT count bigint)
 RETURNS SETOF record
     AS $$
-    SELECT val, count(*) count 
-    FROM (SELECT ST_Value($1, $2, x, y) val FROM generate_series(1, ST_Width($1)) x , generate_series(1, ST_Height($1)) y) foo 
+    SELECT val, count(*) count
+    FROM (SELECT ST_Value($1, $2, x, y) val FROM generate_series(1, ST_Width($1)) x , generate_series(1, ST_Height($1)) y) foo
     GROUP BY val;
     $$
     LANGUAGE SQL IMMUTABLE;
@@ -155,7 +155,7 @@
 
 ----------------------------------------------------------------------
 -- Other variant (not grouping in the function) (not using an intermediate _ST_Values function)
-----------------------------------------------------------------------    
+----------------------------------------------------------------------
 CREATE OR REPLACE FUNCTION ST_Histogram3(rast raster, band int, OUT val double precision)
 RETURNS SETOF double precision
     AS $$
@@ -174,7 +174,7 @@
 
 ----------------------------------------------------------------------
 -- This might actually be the fasters query to get the histogram
-----------------------------------------------------------------------    
+----------------------------------------------------------------------
 SELECT val, count(*) count
 FROM (SELECT ST_Value(rast, 1, x, y) val
       FROM generate_series(1, 10) x, generate_series(1, 10) y, srtm_22_03_tiled_10x10
@@ -190,10 +190,10 @@
 -- The subquery gets the histogram for each tile
 -- The main query split the resulting records in their two components (val & count)
 -------------------------------
-SELECT rid, 
-       (hist).val, 
-       (hist).count 
-FROM (SELECT rid, 
+SELECT rid,
+       (hist).val,
+       (hist).count
+FROM (SELECT rid,
              ST_Histogram(rast) hist
       FROM srtm_22_03_tiled_25x25
       WHERE rid = 234
@@ -207,12 +207,12 @@
 
 -------------------------------
 -- The subquery gets the histogram for each tile
--- The main query split the resulting records in their two 
+-- The main query split the resulting records in their two
 -- components (val & count) and sum the count over all the tiles
 -------------------------------
-SELECT (hist).val, 
+SELECT (hist).val,
        SUM((hist).count) count
-FROM (SELECT rid, 
+FROM (SELECT rid,
              ST_Histogram(rast) hist
       FROM srtm_22_03_tiled_25x25
      ) foo
@@ -220,20 +220,20 @@
 ORDER BY count DESC
 
 ----------------------------------------------------------------------
--- Example 3: Query returning the mean pixel value for each tile of a 
+-- Example 3: Query returning the mean pixel value for each tile of a
 -- tiled raster (might be very long)
 ----------------------------------------------------------------------
 
 -------------------------------
 -- The subquery gets the histogram for each tile
--- The main query split the resulting records in their two 
+-- The main query split the resulting records in their two
 -- components (val & count) computing a mean value per tile at the same time
 -------------------------------
-SELECT rid, 
-       geom, 
+SELECT rid,
+       geom,
        round(((SUM((hist).val * (hist).count)) / SUM((hist).count))::numeric, 2) meanval
-FROM (SELECT rid, 
-             rast::geometry geom, 
+FROM (SELECT rid,
+             rast::geometry geom,
              ST_Histogram(rast) hist
       FROM srtm_22_03_tiled_25x25
      ) foo
@@ -241,9 +241,9 @@
 ORDER BY rid;
 
 ----------------------------------------------------------------------
--- Example 4: Query returning the most frequent pixel value for each tile 
+-- Example 4: Query returning the most frequent pixel value for each tile
 -- of a tiled raster (might be very long)
--- This example requires an aggregate function tracking the value 
+-- This example requires an aggregate function tracking the value
 -- associated with the maximum count
 ----------------------------------------------------------------------
 CREATE TYPE dblIntSet AS (
@@ -270,16 +270,16 @@
 -------------------------------
 -- Actual query
 -- The subquery gets the histogram for each tile
--- The main query split the resulting records in their two 
+-- The main query split the resulting records in their two
 -- components (val & count) and compute the maximum count and its associated value
 -------------------------------
-SELECT rid, 
-       geom, 
-       maxFromDblIntSet(ROW((hist).count, (hist).val::int)) mostfreqval, 
+SELECT rid,
+       geom,
+       maxFromDblIntSet(ROW((hist).count, (hist).val::int)) mostfreqval,
        MAX((hist).count) count
-FROM (SELECT rid, 
-             rast::geometry geom, 
-             ST_Histogram(rast) hist 
+FROM (SELECT rid,
+             rast::geometry geom,
+             ST_Histogram(rast) hist
       FROM srtm_22_03_tiled_25x25
      ) foo
 GROUP BY rid, geom
@@ -287,17 +287,17 @@
 
 ----------------------------------------------------------------------
 -- Example 5: Query returning the most frequent pixel value per polygon from a raster
--- Do not use when the raster is big, in this case it should be tiled and 
+-- Do not use when the raster is big, in this case it should be tiled and
 -- the next example (6) should be used instead
 ----------------------------------------------------------------------
 SELECT polyid,
-       geom, 
-       maxFromDblIntSet(ROW((hist).count, (hist).val::int)) mostfreqval, 
+       geom,
+       maxFromDblIntSet(ROW((hist).count, (hist).val::int)) mostfreqval,
        MAX((hist).count) count
 FROM (
-      SELECT polyid, 
-             geom, 
-             ST_Histogram(rast, geom) hist 
+      SELECT polyid,
+             geom,
+             ST_Histogram(rast, geom) hist
       FROM srtm_22_03, mypolygons
       WHERE ST_Intersects(rast, geom)
      ) foo
@@ -309,20 +309,20 @@
 
 -------------------------------
 -- The first subquery gets the histogram for each tile
--- The second subquery split the resulting records in their two 
+-- The second subquery split the resulting records in their two
 -- components (val & count) and sum the count for each polygon-value couple
 -- The main query compute the maximum count and its associated value
 -------------------------------
-SELECT polyid, 
-       geom, 
-       maxFromDblIntSet(ROW(count, val)) mostfreqval, 
+SELECT polyid,
+       geom,
+       maxFromDblIntSet(ROW(count, val)) mostfreqval,
        MAX(count) count
-FROM (SELECT polyid, 
-             geom, (hist).val::int val, 
+FROM (SELECT polyid,
+             geom, (hist).val::int val,
              SUM((hist).count) count
-      FROM (SELECT polyid, 
-                   geom, 
-                   ST_Histogram(rast, geom) hist 
+      FROM (SELECT polyid,
+                   geom,
+                   ST_Histogram(rast, geom) hist
             FROM srtm_22_03_tiled_25x25, mypolygons
             WHERE ST_Intersects(rast, geom)
            ) foo
@@ -336,19 +336,19 @@
 
 -------------------------------
 -- The first subquery gets the histogram for each tile
--- The second subquery split the resulting records in their two 
+-- The second subquery split the resulting records in their two
 -- components (val & count) and sum the count for each polygon-value couple
 -- The main query compute the mean pixel value
 -------------------------------
-SELECT polyid, 
-       geom, 
+SELECT polyid,
+       geom,
        round((SUM(val * count) / SUM(count))::numeric, 2) meanval
-FROM (SELECT polyid, 
-             geom, (hist).val::int val, 
+FROM (SELECT polyid,
+             geom, (hist).val::int val,
              SUM((hist).count) count
-      FROM (SELECT polyid, 
-                   geom, 
-                   ST_Histogram(rast, geom) hist 
+      FROM (SELECT polyid,
+                   geom,
+                   ST_Histogram(rast, geom) hist
             FROM srtm_22_03_tiled_25x25, mypolygons
             WHERE ST_Intersects(rast, geom)
            ) foo

Modified: trunk/raster/scripts/plpgsql/st_mapalgebra.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_mapalgebra.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_mapalgebra.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -3,31 +3,31 @@
 -- Copyright (c) 2009-2010 Pierre Racine <pierre.racine at sbf.ulaval.ca>
 --
 ----------------------------------------------------------------------
--- NOTE: The ST_MapAlgebra() function is already implemented in C. This plpgsql script is provided only as an example. 
+-- NOTE: The ST_MapAlgebra() function is already implemented in C. This plpgsql script is provided only as an example.
 -- Defining the plpgsql function below might overwrite the current C implementation and brake other functions dependent on it.
 -- Use with caution.
 ----------------------------------------------------------------------
 
 --------------------------------------------------------------------
--- ST_MapAlgebra - (one raster version) Return a raster which values 
---                 are the result of an SQL expression involving pixel 
+-- ST_MapAlgebra - (one raster version) Return a raster which values
+--                 are the result of an SQL expression involving pixel
 --                 value from the input raster band.
--- Arguments 
--- rast raster -  Raster on which the expression is evaluated. (Referred 
---                by "rast1" in the expression. 
+-- Arguments
+-- rast raster -  Raster on which the expression is evaluated. (Referred
+--                by "rast1" in the expression.
 -- band integer - Band number of the raster to be evaluated. Default to 1.
 -- expression text - SQL expression to apply to with value pixels. Ex.: "rast + 2"
 -- nodatavalueexpr text - SQL expression to apply to nodata value pixels. Ex.: "2"
 -- pixeltype text - Pixeltype assigned to the resulting raster. Expression
---                  results are truncated to this type. Default to the 
+--                  results are truncated to this type. Default to the
 --                  pixeltype of the first raster.
 --
--- NOTE that this function now exist as a C implementation and is provided 
+-- NOTE that this function now exist as a C implementation and is provided
 -- here solely as a plpgsql example.
 --------------------------------------------------------------------
 DROP FUNCTION IF EXISTS ST_MapAlgebra(rast raster, band integer, expression text, nodatavalueexpr text, pixeltype text);
-CREATE OR REPLACE FUNCTION ST_MapAlgebra(rast raster, band integer, expression text, nodatavalueexpr text, pixeltype text) 
-    RETURNS raster AS 
+CREATE OR REPLACE FUNCTION ST_MapAlgebra(rast raster, band integer, expression text, nodatavalueexpr text, pixeltype text)
+    RETURNS raster AS
     $$
     DECLARE
         width integer;
@@ -59,22 +59,22 @@
         newrast := ST_MakeEmptyRaster(width, height, ST_UpperLeftX(rast), ST_UpperLeftY(rast), ST_ScaleX(rast), ST_ScaleY(rast), ST_SkewX(rast), ST_SkewY(rast), ST_SRID(rast));
 
         -- If this new raster is empty (width = 0 OR height = 0) then there is nothing to compute and we return it right now
-        IF ST_IsEmpty(newrast) THEN 
+        IF ST_IsEmpty(newrast) THEN
             RAISE NOTICE 'ST_MapAlgebra: Raster is empty. Returning an empty raster';
             RETURN newrast;
         END IF;
-        
+
         -- Check if rast has the required band. Otherwise return a raster without band
-        IF ST_HasNoBand(rast, band) THEN 
+        IF ST_HasNoBand(rast, band) THEN
             RAISE NOTICE 'ST_MapAlgebra: Raster do not have the required band. Returning a raster without band';
             RETURN newrast;
         END IF;
-        
+
         -- Set the new pixeltype
         newpixeltype := pixeltype;
         IF newpixeltype IS NULL THEN
             newpixeltype := ST_BandPixelType(rast, band);
-        ELSIF newpixeltype != '1BB' AND newpixeltype != '2BUI' AND newpixeltype != '4BUI' AND newpixeltype != '8BSI' AND newpixeltype != '8BUI' AND 
+        ELSIF newpixeltype != '1BB' AND newpixeltype != '2BUI' AND newpixeltype != '4BUI' AND newpixeltype != '8BSI' AND newpixeltype != '8BUI' AND
                newpixeltype != '16BSI' AND newpixeltype != '16BUI' AND newpixeltype != '32BSI' AND newpixeltype != '32BUI' AND newpixeltype != '32BF' AND newpixeltype != '64BF' THEN
             RAISE EXCEPTION 'ST_MapAlgebra: Invalid pixeltype "%". Aborting.', newpixeltype;
         END IF;
@@ -85,8 +85,8 @@
             RAISE NOTICE 'ST_MapAlgebra: Source raster do not have a nodata value or is out of range for the new raster pixeltype, nodata value for new raster set to the min value possible';
             newnodatavalue := ST_MinPossibleValue(newpixeltype);
         END IF;
-        -- We set the initial value of the future band to nodata value. 
-        -- If nodatavalue is null then the raster will be initialise to ST_MinPossibleValue 
+        -- We set the initial value of the future band to nodata value.
+        -- If nodatavalue is null then the raster will be initialise to ST_MinPossibleValue
         -- but all the values should be recomputed anyway.
         newinitialvalue := newnodatavalue;
 
@@ -95,7 +95,7 @@
 
 --RAISE NOTICE '111 initexpr=%, newnodatavalue=%', initexpr,newnodatavalue;
 
-        -- Optimization: If a nodatavalueexpr is provided, recompute the initial value 
+        -- Optimization: If a nodatavalueexpr is provided, recompute the initial value
         -- so we can then initialise the raster with this value and skip the computation
         -- of nodata values one by one in the main computing loop
         IF NOT nodatavalueexpr IS NULL THEN
@@ -110,20 +110,20 @@
         IF ST_BandIsNoData(rast, band) THEN
             RETURN ST_AddBand(newrast, newpixeltype, newinitialvalue, newnodatavalue);
         END IF;
-        
-        -- Optimization: If expression resume to 'RAST' and nodatavalueexpr is NULL or also equal to 'RAST', 
+
+        -- Optimization: If expression resume to 'RAST' and nodatavalueexpr is NULL or also equal to 'RAST',
         -- we can just return the band from the original raster
         IF initexpr = 'SELECT RAST' AND (nodatavalueexpr IS NULL OR initndvexpr = 'SELECT RAST') THEN
-            RETURN ST_AddBand(newrast, rast, band, 1);   -- To be implemented in C       
+            RETURN ST_AddBand(newrast, rast, band, 1);   -- To be implemented in C
         END IF;
-        
-        -- Optimization: If expression resume to a constant (it does not contain RAST) 
+
+        -- Optimization: If expression resume to a constant (it does not contain RAST)
         IF position('RAST' in initexpr) = 0 THEN
 --RAISE NOTICE '444';
             EXECUTE initexpr INTO newval;
 --RAISE NOTICE '555';
             skipcomputation := 1;
-            
+
             IF nodatavalueexpr IS NULL THEN
                 -- Compute the new value, set it and we will return after creating the new raster
                 newinitialvalue := newval;
@@ -133,7 +133,7 @@
                 skipcomputation := 2;
             END IF;
         END IF;
-        
+
         --Create the raster receiving all the computed values. Initialize it to the new initial value.
         newrast := ST_AddBand(newrast, newpixeltype, newinitialvalue, newnodatavalue);
 
@@ -141,7 +141,7 @@
         -- Optimization: If expression is NULL, or all the pixels could be set in a one step, return the initialised raster now
         IF expression IS NULL OR skipcomputation = 2 THEN
             RETURN newrast;
-        END IF;   
+        END IF;
         FOR x IN 1..width LOOP
             FOR y IN 1..height LOOP
                 r := ST_Value(rast, band, x, y);
@@ -170,8 +170,8 @@
     LANGUAGE 'plpgsql';
 
 --Test rasters
-CREATE OR REPLACE FUNCTION ST_TestRaster(val float8) 
-    RETURNS raster AS 
+CREATE OR REPLACE FUNCTION ST_TestRaster(val float8)
+    RETURNS raster AS
     $$
     DECLARE
     BEGIN
@@ -191,56 +191,56 @@
 --SELECT ST_HasNoBand(ST_MapAlgebra(ST_MakeEmptyRaster(10, 10, 0, 0, 1, 1, 1, 1, -1), 1, 'rast + 20', '2', NULL))
 
 -- Test has no nodata value. Should return null and 19.
---SELECT ST_Value(rast, 1, 1), ST_Value(ST_MapAlgebra(ST_SetBandNoDataValue(ST_TestRaster(0, 0, 1), NULL), 1, 'rast + 20', '2', NULL), 1, 1) 
+--SELECT ST_Value(rast, 1, 1), ST_Value(ST_MapAlgebra(ST_SetBandNoDataValue(ST_TestRaster(0, 0, 1), NULL), 1, 'rast + 20', '2', NULL), 1, 1)
 --FROM ST_TestRaster(0, 0, 1) rast;
 
 -- Test has nodata value. Should return null and 2.
---SELECT ST_Value(rast, 1, 1), ST_Value(ST_MapAlgebra(rast, 1, 'rast + 20', 'rast + 3', NULL), 1, 1) 
+--SELECT ST_Value(rast, 1, 1), ST_Value(ST_MapAlgebra(rast, 1, 'rast + 20', 'rast + 3', NULL), 1, 1)
 --FROM ST_TestRaster(0, 0, 1) rast;
 
 -- Test has nodata value. Should return null and null.
---SELECT ST_Value(rast, 1, 1), ST_Value(ST_MapAlgebra(rast, 1, 'rast + 20', NULL, NULL), 1, 1) 
+--SELECT ST_Value(rast, 1, 1), ST_Value(ST_MapAlgebra(rast, 1, 'rast + 20', NULL, NULL), 1, 1)
 --FROM ST_TestRaster(0, 0, 1) rast;
 
 -- Test 'rast' expression. Should be 1 and 1.
---SELECT ST_Value(rast, 1, 2), ST_Value(ST_MapAlgebra(rast, 1, 'rast', 'rast', NULL), 1, 2) 
+--SELECT ST_Value(rast, 1, 2), ST_Value(ST_MapAlgebra(rast, 1, 'rast', 'rast', NULL), 1, 2)
 --FROM ST_TestRaster(0, 0, 0) rast;
 
 -- Test 'rast' expression on a no nodata value raster. Should be null and -1.
---SELECT ST_Value(rast, 1, 1), ST_Value(ST_MapAlgebra(ST_SetBandNoDataValue(rast, NULL), 1, 'rast', NULL, NULL), 1, 1) 
+--SELECT ST_Value(rast, 1, 1), ST_Value(ST_MapAlgebra(ST_SetBandNoDataValue(rast, NULL), 1, 'rast', NULL, NULL), 1, 1)
 --FROM ST_TestRaster(0, 0, -1) rast;
 
 -- Test pixeltype 1. Should return 100 and 15.
---SELECT ST_Value(rast, 1, 2), ST_Value(ST_MapAlgebra(rast, 1, 'rast + 20', 'rast + 2', '4BUI'), 1, 2) 
+--SELECT ST_Value(rast, 1, 2), ST_Value(ST_MapAlgebra(rast, 1, 'rast + 20', 'rast + 2', '4BUI'), 1, 2)
 --FROM ST_TestRaster(0, 0, 100) rast;
 
 -- Test pixeltype 1. Should return an error.
---SELECT ST_Value(rast, 1, 2), ST_Value(ST_MapAlgebra(rast, 1, 'rast + 20', 'rast + 2', '4BUId'), 1, 2) 
+--SELECT ST_Value(rast, 1, 2), ST_Value(ST_MapAlgebra(rast, 1, 'rast + 20', 'rast + 2', '4BUId'), 1, 2)
 --FROM ST_TestRaster(0, 0, 100) rast;
 
 -- Test pixeltype 1. Should return 101 and 3.
---SELECT ST_Value(rast, 1, 2), ST_Value(ST_MapAlgebra(rast, 1, 'rast + 20', 'rast + 2', '2BUI'), 1, 2) 
+--SELECT ST_Value(rast, 1, 2), ST_Value(ST_MapAlgebra(rast, 1, 'rast + 20', 'rast + 2', '2BUI'), 1, 2)
 --FROM ST_TestRaster(0, 0, 101) rast;
 
 
 --------------------------------------------------------------------
 -- ST_SameAlignment
--- Determine if the raster coordinates are aligned. 
+-- Determine if the raster coordinates are aligned.
 -- Scale must be the same and pixels corners must fall on the same grid.
 --------------------------------------------------------------------
-CREATE OR REPLACE FUNCTION ST_SameAlignment(rast1ulx float8, 
-                                            rast1uly float8, 
-                                            rast1scalex float8, 
-                                            rast1scaley float8, 
-                                            rast1skewx float8, 
-                                            rast1skewy float8, 
-                                            rast2ulx float8, 
-                                            rast2uly float8, 
-                                            rast2scalex float8, 
+CREATE OR REPLACE FUNCTION ST_SameAlignment(rast1ulx float8,
+                                            rast1uly float8,
+                                            rast1scalex float8,
+                                            rast1scaley float8,
+                                            rast1skewx float8,
+                                            rast1skewy float8,
+                                            rast2ulx float8,
+                                            rast2uly float8,
+                                            rast2scalex float8,
                                             rast2scaley float8,
-                                            rast2skewx float8, 
-                                            rast2skewy float8) 
-    RETURNS boolean AS 
+                                            rast2skewx float8,
+                                            rast2skewy float8)
+    RETURNS boolean AS
     $$
     DECLARE
         emptyraster2 raster;
@@ -272,7 +272,7 @@
         IF ST_Raster2WorldCoordX(emptyraster2, r2x, r2y) != rast1ulx OR ST_Raster2WorldCoordY(emptyraster2, r2x, r2y) != rast1uly THEN
             RAISE NOTICE 'ST_SameAlignment: alignments are different';
             RETURN FALSE;
-        END IF;       
+        END IF;
         RETURN TRUE;
     END;
     $$
@@ -280,16 +280,16 @@
 
 CREATE OR REPLACE FUNCTION ST_SameAlignment(rast1 raster, rast2 raster)
     RETURNS boolean
-    AS 'select ST_SameAlignment(ST_UpperLeftX($1), 
-                                ST_UpperLeftY($1), 
-                                ST_ScaleX($1), 
-                                ST_ScaleY($1), 
+    AS 'select ST_SameAlignment(ST_UpperLeftX($1),
+                                ST_UpperLeftY($1),
+                                ST_ScaleX($1),
+                                ST_ScaleY($1),
                                 ST_SkewX($1),
                                 ST_SkewY($1),
-                                ST_UpperLeftX($2), 
-                                ST_UpperLeftY($2), 
-                                ST_ScaleX($2), 
-                                ST_ScaleY($2), 
+                                ST_UpperLeftX($2),
+                                ST_UpperLeftY($2),
+                                ST_ScaleX($2),
+                                ST_ScaleY($2),
                                 ST_SkewX($2),
                                 ST_SkewY($2))'
     LANGUAGE 'SQL' IMMUTABLE STRICT;
@@ -354,28 +354,28 @@
 --    AS 'SELECT 10'
 --    LANGUAGE 'SQL' IMMUTABLE STRICT;
 
-DROP FUNCTION IF EXISTS ST_MapAlgebra(rast1 raster, 
-                                         band1 integer, 
-                                         rast2 raster, 
-                                         band2 integer, 
-                                         expression text, 
-                                         pixeltype text, 
-                                         extentexpr text, 
-                                         nodata1expr text, 
+DROP FUNCTION IF EXISTS ST_MapAlgebra(rast1 raster,
+                                         band1 integer,
+                                         rast2 raster,
+                                         band2 integer,
+                                         expression text,
+                                         pixeltype text,
+                                         extentexpr text,
+                                         nodata1expr text,
                                          nodata2expr text,
                                          nodatanodataaexpr text);
-                                         
-CREATE OR REPLACE FUNCTION ST_MapAlgebra(rast1 raster, 
-                                         band1 integer, 
-                                         rast2 raster, 
-                                         band2 integer, 
-                                         expression text, 
-                                         pixeltype text, 
-                                         extentexpr text, 
-                                         nodata1expr text, 
+
+CREATE OR REPLACE FUNCTION ST_MapAlgebra(rast1 raster,
+                                         band1 integer,
+                                         rast2 raster,
+                                         band2 integer,
+                                         expression text,
+                                         pixeltype text,
+                                         extentexpr text,
+                                         nodata1expr text,
                                          nodata2expr text,
-                                         nodatanodataexpr text) 
-    RETURNS raster AS 
+                                         nodatanodataexpr text)
+    RETURNS raster AS
     $$
     DECLARE
         x integer;
@@ -406,15 +406,15 @@
         rast2skewy float8;
         rast2nodataval float8;
         rast2srid int;
-        
+
         rast2offsetx1 int;
         rast2offsety1 int;
         rast2offsetx2 int;
         rast2offsety2 int;
-        
+
         newrast raster;
         newsrid int;
-        
+
         newscalex float8;
         newscaley float8;
         newskewx float8;
@@ -429,41 +429,41 @@
         newoffsety1 int;
         newoffsetx2 int;
         newoffsety2 int;
-        
+
         newval float8;
         newexpr text;
-        
+
     BEGIN
-        -- We have to deal with NULL, empty, hasnoband and hasnodatavalue band rasters... 
+        -- We have to deal with NULL, empty, hasnoband and hasnodatavalue band rasters...
         -- These are respectively tested by "IS NULL", "ST_IsEmpty()", "ST_HasNoBand()" and "ST_BandIsNodata()"
-        
+
         -- If both raster are null, we return NULL. ok
         -- If both raster do not have extent (are empty), we return an empty raster. ok
-        -- If both raster do not have the specified band, 
+        -- If both raster do not have the specified band,
         --     we return a no band raster with the correct extent (according to the extent expression). ok
         -- If both raster bands are nodatavalue and there is no replacement value, we return a nodata value band. ok
-        
+
         -- If only one raster is null or empty or has no band or hasnodata band we treat it as a nodata band raster.
         -- If there is a replacement value we replace the missing raster values with this replacement value. ok
         -- If there is no replacement value, we return a nodata value band. ok
-        
+
         -- What to do when only one raster is NULL or empty
         -- If the extent expression is FIRST and the first raster is null we return NULL. ok
         -- If the extent expression is FIRST and the first raster do not have extent (is empty), we return an empty raster. ok
         -- If the extent expression is SECOND and the second raster is null we return NULL. ok
         -- If the extent expression is SECOND and the second raster do not have extent (is empty), we return an empty raster. ok
         -- If the extent expression is INTERSECTION and one raster is null or do not have extent (is empty), we return an empty raster. ok
-        -- If the extent expression is UNION and one raster is null or do not have extent (is empty), 
+        -- If the extent expression is UNION and one raster is null or do not have extent (is empty),
         --     we return a raster having the extent and the band characteristics of the other raster. ok
 
         -- What to do when only one raster do not have the required band.
-        -- If the extent expression is FIRST and the first raster do not have the specified band, 
+        -- If the extent expression is FIRST and the first raster do not have the specified band,
         --     we return a no band raster with the correct extent (according to the extent expression). ok
-        -- If the extent expression is SECOND and the second raster do not have the specified band, 
+        -- If the extent expression is SECOND and the second raster do not have the specified band,
         --     we return a no band raster with the correct extent (according to the extent expression). ok
-        -- If the extent expression is INTERSECTION and one raster do not have the specified band, 
+        -- If the extent expression is INTERSECTION and one raster do not have the specified band,
         --     we treat it as a nodata raster band. ok
-        -- If the extent expression is UNION and one raster do not have the specified band, 
+        -- If the extent expression is UNION and one raster do not have the specified band,
         --     we treat it as a nodata raster band. ok
 
         -- In all those cases, we make a warning.
@@ -537,9 +537,9 @@
             RAISE EXCEPTION 'ST_MapAlgebra: Provided raster do not have the same alignment. Aborting';
         END IF;
 
-        -- Set new pixel size and skew. We set it to the rast1 scale and skew 
+        -- Set new pixel size and skew. We set it to the rast1 scale and skew
         -- since both rasters are aligned and thus have the same scale and skew
-        newscalex := rast1scalex; 
+        newscalex := rast1scalex;
         newscaley := rast1scaley;
         newskewx := rast1skewx;
         newskewy := rast1skewy;
@@ -554,23 +554,23 @@
         IF extentexpr IS NULL OR upper(extentexpr) = 'FIRST' THEN
 
             -- Check if rast1 is NULL
-            IF rast1 IS NULL  THEN 
+            IF rast1 IS NULL  THEN
                 RAISE NOTICE 'ST_MapAlgebra: FIRST raster is NULL. Returning NULL';
                 RETURN NULL;
             END IF;
-            
+
             -- Check if rast1 is empty
-            IF ST_IsEmpty(rast1) THEN 
+            IF ST_IsEmpty(rast1) THEN
                 RAISE NOTICE 'ST_MapAlgebra: FIRST raster is empty. Returning an empty raster';
                 RETURN ST_MakeEmptyRaster(0, 0, 0, 0, 0, 0, 0, 0, newsrid);
             END IF;
-                        
+
             -- Check if rast1 has the required band
-            IF ST_HasNoBand(rast1, band1) THEN 
+            IF ST_HasNoBand(rast1, band1) THEN
                 RAISE NOTICE 'ST_MapAlgebra: FIRST raster has no band. Returning a raster without band';
                 RETURN ST_MakeEmptyRaster(rast1width, rast1height, rast1ulx, rast1uly, rast1scalex, rast1scaley, rast1skewx, rast1skewy, rast1srid);
             END IF;
-            
+
             newulx := rast1ulx;
             newuly := rast1uly;
             newwidth := rast1width;
@@ -581,19 +581,19 @@
         ELSIF upper(extentexpr) = 'SECOND' THEN
 
             -- Check if rast2 is NULL
-            IF rast2 IS NULL  THEN 
+            IF rast2 IS NULL  THEN
                 RAISE NOTICE 'ST_MapAlgebra: SECOND raster is NULL. Returning NULL';
                 RETURN NULL;
             END IF;
-            
+
             -- Check if rast2 is empty
-            IF ST_IsEmpty(rast2) THEN 
+            IF ST_IsEmpty(rast2) THEN
                 RAISE NOTICE 'ST_MapAlgebra: SECOND raster is empty. Returning an empty raster';
                 RETURN ST_MakeEmptyRaster(0, 0, 0, 0, 0, 0, 0, 0, newsrid);
             END IF;
-            
+
             -- Check if rast2 has the required band
-            IF ST_HasNoBand(rast2, band2) THEN 
+            IF ST_HasNoBand(rast2, band2) THEN
                 RAISE NOTICE 'ST_MapAlgebra: SECOND raster has no band. Returning an empty raster';
                 RETURN ST_MakeEmptyRaster(rast2width, rast2height, rast2ulx, rast2uly, rast2scalex, rast2scaley, rast2skewx, rast2skewy, rast2srid);
             END IF;
@@ -610,14 +610,14 @@
         ELSIF upper(extentexpr) = 'INTERSECTION' THEN
 
             -- Check if the intersection is empty.
-            IF rast2offsetx2 < 0 OR rast2offsetx1 > (rast1width - 1) OR 
+            IF rast2offsetx2 < 0 OR rast2offsetx1 > (rast1width - 1) OR
                rast2offsety2 < 0 OR rast2offsety1 > (rast1height - 1) OR
                rast1 IS NULL OR ST_IsEmpty(rast1) OR
-               rast2 IS NULL OR ST_IsEmpty(rast2) THEN 
+               rast2 IS NULL OR ST_IsEmpty(rast2) THEN
                 RAISE NOTICE 'ST_MapAlgebra: INTERSECTION of provided rasters is empty. Returning an empty raster';
                 RETURN ST_MakeEmptyRaster(0, 0, 0, 0, 0, 0, 0, 0, newsrid);
             END IF;
-            
+
             --Determine the new raster upper left x offset
             newoffsetx1 := 0;
             IF rast2offsetx1 > 0 THEN
@@ -718,14 +718,14 @@
             RAISE NOTICE 'ST_MapAlgebra: Both raster do not have the specified band. Returning a no band raster with the correct extent';
             RETURN ST_MakeEmptyRaster(newwidth, newheight, newulx, newuly, newscalex, newscaley, newskewx, newskewy, newsrid);
         END IF;
-        
+
         -- Check newpixeltype
         newpixeltype := pixeltype;
-        IF newpixeltype NOTNULL AND newpixeltype != '1BB' AND newpixeltype != '2BUI' AND newpixeltype != '4BUI' AND newpixeltype != '8BSI' AND newpixeltype != '8BUI' AND 
+        IF newpixeltype NOTNULL AND newpixeltype != '1BB' AND newpixeltype != '2BUI' AND newpixeltype != '4BUI' AND newpixeltype != '8BSI' AND newpixeltype != '8BUI' AND
                newpixeltype != '16BSI' AND newpixeltype != '16BUI' AND newpixeltype != '32BSI' AND newpixeltype != '32BUI' AND newpixeltype != '32BF' AND newpixeltype != '64BF' THEN
             RAISE EXCEPTION 'ST_MapAlgebra: Invalid pixeltype "%". Aborting.', newpixeltype;
         END IF;
-        
+
         -- If no newpixeltype was provided, get it from the provided rasters.
         IF newpixeltype IS NULL THEN
             IF (upper(extentexpr) = 'SECOND' AND NOT ST_HasNoBand(rast2, band2)) OR ST_HasNoBand(rast1, band1) THEN
@@ -734,7 +734,7 @@
                 newpixeltype := ST_BandPixelType(rast1, band1);
             END IF;
         END IF;
-               
+
          -- Get the nodata value for first raster
         IF NOT ST_HasNoBand(rast1, band1) AND NOT ST_BandNodataValue(rast1, band1) IS NULL THEN
             rast1nodataval := ST_BandNodatavalue(rast1, band1);
@@ -747,7 +747,7 @@
         ELSE
             rast2nodataval := NULL;
         END IF;
-        
+
         -- Determine new notadavalue
         IF (upper(extentexpr) = 'SECOND' AND NOT rast2nodataval IS NULL) THEN
             newnodatavalue := rast2nodataval;
@@ -759,15 +759,15 @@
             RAISE NOTICE 'ST_MapAlgebra: Both source rasters do not have a nodata value, nodata value for new raster set to the minimum value possible';
             newnodatavalue := ST_MinPossibleValue(newrast);
         END IF;
-        
+
         -------------------------------------------------------------------
         --Create the raster receiving all the computed values. Initialize it to the new nodatavalue.
         newrast := ST_AddBand(ST_MakeEmptyRaster(newwidth, newheight, newulx, newuly, newscalex, newscaley, newskewx, newskewy, newsrid), newpixeltype, newnodatavalue, newnodatavalue);
         -------------------------------------------------------------------
 
-        -- If one of the two raster is NULL, empty, do not have the requested band or is only nodata values 
-        -- and there is no replacement value for those missing values 
-        -- and this raster IS involved in the expression 
+        -- If one of the two raster is NULL, empty, do not have the requested band or is only nodata values
+        -- and there is no replacement value for those missing values
+        -- and this raster IS involved in the expression
         -- return NOW with the nodata band raster.
         --IF (rast1 IS NULL OR ST_IsEmpty(rast1) OR ST_HasNoBand(rast1, band1) OR ST_BandIsNoData(rast1, band1)) AND nodatavalrepl IS NULL AND position('RAST1' in upper(expression)) != 0 THEN
         --    RETURN newrast;
@@ -775,13 +775,13 @@
         --IF (rast2 IS NULL OR ST_IsEmpty(rast2) OR ST_HasNoBand(rast2, band2) OR ST_BandIsNoData(rast2, band2)) AND nodatavalrepl IS NULL AND position('RAST2' in upper(expression)) != 0 THEN
         --    RETURN newrast;
         --END IF;
-                
+
         -- There is place for optimization here when doing a UNION we don't want to iterate over the empty space.
         FOR x IN 1..newwidth LOOP
             FOR y IN 1..newheight LOOP
                 r1 := ST_Value(rast1, band1, x - rast1offsetx, y - rast1offsety);
                 r2 := ST_Value(rast2, band2, x - rast2offsetx1, y - rast2offsety1);
-                
+
                 -- Check if both values are outside the extent or nodata values
                 IF (r1 IS NULL OR r1 = rast1nodataval) AND (r2 IS NULL OR r2 = rast1nodataval) THEN
                     IF nodatanodataexpr IS NULL THEN
@@ -810,7 +810,7 @@
 --RAISE NOTICE '222 - %',  newexpr;
                     EXECUTE newexpr INTO newval;
 --RAISE NOTICE '333 - %',  newval;
-                END IF; 
+                END IF;
                 IF newval IS NULL THEN
                     newval := newnodatavalue;
                 END IF;
@@ -824,15 +824,15 @@
 
 
 --------------------------------------------------------------------
--- ST_MapAlgebra (two raster version) variants 
+-- ST_MapAlgebra (two raster version) variants
 --------------------------------------------------------------------
 
 -- Variant 5
-CREATE OR REPLACE FUNCTION ST_MapAlgebra(rast1 raster, 
-                                         rast2 raster, 
-                                         expression text, 
-                                         pixeltype text, 
-                                         extentexpr text, 
+CREATE OR REPLACE FUNCTION ST_MapAlgebra(rast1 raster,
+                                         rast2 raster,
+                                         expression text,
+                                         pixeltype text,
+                                         extentexpr text,
                                          nodata1expr text,
                                          nodata2expr text,
                                          nodatanodataexpr text)
@@ -841,80 +841,80 @@
     LANGUAGE 'SQL' IMMUTABLE;
 
 -- Variant 6
-CREATE OR REPLACE FUNCTION ST_MapAlgebra(rast1 raster, 
-                                         rast2 raster, 
-                                         expression text, 
-                                         pixeltype text, 
+CREATE OR REPLACE FUNCTION ST_MapAlgebra(rast1 raster,
+                                         rast2 raster,
+                                         expression text,
+                                         pixeltype text,
                                          extentexpr text)
     RETURNS raster
     AS 'SELECT ST_MapAlgebra($1, 1, $2, 1, $3, $4, $5, NULL, NULL, NULL)'
     LANGUAGE 'SQL' IMMUTABLE;
 
 -- Variant 7
-CREATE OR REPLACE FUNCTION ST_MapAlgebra(rast1 raster, 
-                                         rast2 raster, 
-                                         expression text, 
+CREATE OR REPLACE FUNCTION ST_MapAlgebra(rast1 raster,
+                                         rast2 raster,
+                                         expression text,
                                          pixeltype text)
     RETURNS raster
     AS 'SELECT ST_MapAlgebra($1, 1, $2, 1, $3, $4, NULL, NULL, NULL, NULL)'
     LANGUAGE 'SQL' IMMUTABLE;
 
-    
+
 -- Variant 8
-CREATE OR REPLACE FUNCTION ST_MapAlgebra(rast1 raster, 
-                                         rast2 raster, 
+CREATE OR REPLACE FUNCTION ST_MapAlgebra(rast1 raster,
+                                         rast2 raster,
                                          expression text)
     RETURNS raster
     AS 'SELECT ST_MapAlgebra($1, 1, $2, 1, $3, NULL, NULL, NULL, NULL, NULL)'
     LANGUAGE 'SQL' IMMUTABLE STRICT;
-    
+
 -- Variant 10
---DROP FUNCTION ST_MapAlgebra(rast1 raster, band1 integer, rast2 raster, band2 integer, expression text, pixeltype text, extentexpr text, rastnodatavalrepl float8);                                        
-CREATE OR REPLACE FUNCTION ST_MapAlgebra(rast1 raster, 
-                                         band1 integer, 
-                                         rast2 raster, 
-                                         band2 integer, 
-                                         expression text, 
-                                         pixeltype text, 
-                                         extentexpr text, 
+--DROP FUNCTION ST_MapAlgebra(rast1 raster, band1 integer, rast2 raster, band2 integer, expression text, pixeltype text, extentexpr text, rastnodatavalrepl float8);
+CREATE OR REPLACE FUNCTION ST_MapAlgebra(rast1 raster,
+                                         band1 integer,
+                                         rast2 raster,
+                                         band2 integer,
+                                         expression text,
+                                         pixeltype text,
+                                         extentexpr text,
                                          nodataexpr text)
     RETURNS raster
     AS 'SELECT ST_MapAlgebra($1, $2, $3, $4, $5, $6, $7, $8, $8, $8)'
     LANGUAGE 'SQL' IMMUTABLE;
 
 -- Variant 11
-CREATE OR REPLACE FUNCTION ST_MapAlgebra(rast1 raster, 
-                                         band1 integer, 
-                                         rast2 raster, 
-                                         band2 integer, 
-                                         expression text, 
-                                         pixeltype text, 
+CREATE OR REPLACE FUNCTION ST_MapAlgebra(rast1 raster,
+                                         band1 integer,
+                                         rast2 raster,
+                                         band2 integer,
+                                         expression text,
+                                         pixeltype text,
                                          extentexpr text)
     RETURNS raster
     AS 'SELECT ST_MapAlgebra($1, $2, $3, $4, $5, $6, $7, NULL, NULL, NULL)'
     LANGUAGE 'SQL' IMMUTABLE;
 
 -- Variant 12
-CREATE OR REPLACE FUNCTION ST_MapAlgebra(rast1 raster, 
-                                         band1 integer, 
-                                         rast2 raster, 
-                                         band2 integer, 
-                                         expression text, 
+CREATE OR REPLACE FUNCTION ST_MapAlgebra(rast1 raster,
+                                         band1 integer,
+                                         rast2 raster,
+                                         band2 integer,
+                                         expression text,
                                          pixeltype text)
     RETURNS raster
     AS 'SELECT ST_MapAlgebra($1, $2, $3, $4, $5, $6, NULL, NULL, NULL, NULL)'
     LANGUAGE 'SQL' IMMUTABLE;
 
 -- Variant 13
-CREATE OR REPLACE FUNCTION ST_MapAlgebra(rast1 raster, 
-                                         band1 integer, 
-                                         rast2 raster, 
-                                         band2 integer, 
+CREATE OR REPLACE FUNCTION ST_MapAlgebra(rast1 raster,
+                                         band1 integer,
+                                         rast2 raster,
+                                         band2 integer,
                                          expression text)
     RETURNS raster
     AS 'SELECT ST_MapAlgebra($1, $2, $3, $4, $5, NULL, NULL, NULL, NULL, NULL)'
     LANGUAGE 'SQL' IMMUTABLE;
-    
+
 --test MapAlgebra with NULL
 --SELECT ST_MapAlgebra(NULL, 1, ST_TestRaster(2, 0), 1, 'rast2', NULL, 'UNION', 0);
 --SELECT AsBinary((rast).geom), (rast).val FROM (SELECT ST_PixelAsPolygons(ST_MapAlgebra(NULL, 1, ST_TestRaster(2, 0), 1, 'rast2', NULL, 'UNION', 0), 1) rast) foo
@@ -923,8 +923,8 @@
 
 
 --Test rasters
-CREATE OR REPLACE FUNCTION ST_TestRaster(ulx float8, uly float8, val float8) 
-    RETURNS raster AS 
+CREATE OR REPLACE FUNCTION ST_TestRaster(ulx float8, uly float8, val float8)
+    RETURNS raster AS
     $$
     DECLARE
     BEGIN
@@ -934,8 +934,8 @@
     LANGUAGE 'plpgsql';
 
 
-CREATE OR REPLACE FUNCTION ST_TestRotatedRaster(ulx float8, uly float8) 
-    RETURNS raster AS 
+CREATE OR REPLACE FUNCTION ST_TestRotatedRaster(ulx float8, uly float8)
+    RETURNS raster AS
     $$
     DECLARE
     BEGIN
@@ -1048,58 +1048,58 @@
 -- Other tests
 
 -- UNION
--- SELECT ST_Value(rast, 1, 1) AS "1, 1", 
---        ST_Value(rast, 2, 1) AS "2, 1", 
---        ST_Value(rast, 3, 1) AS "3, 1", 
---        ST_Value(rast, 1, 2) AS "1, 2", 
---        ST_Value(rast, 2, 2) AS "2, 2", 
+-- SELECT ST_Value(rast, 1, 1) AS "1, 1",
+--        ST_Value(rast, 2, 1) AS "2, 1",
+--        ST_Value(rast, 3, 1) AS "3, 1",
+--        ST_Value(rast, 1, 2) AS "1, 2",
+--        ST_Value(rast, 2, 2) AS "2, 2",
 --        ST_Value(rast, 3, 2) AS "3, 2",
---        ST_BandPixelType(rast, 1), 
---        ST_Width(rast), 
+--        ST_BandPixelType(rast, 1),
+--        ST_Width(rast),
 --        ST_Height(rast)
 -- FROM (SELECT ST_MapAlgebra(ST_TestRaster(0, 0, 1), 1, ST_TestRaster(1, 0, 1), 1, 'rast1 + rast2 + 2*rast2'::text, '8BSI'::text, 'Union'::text, '0'::text) AS rast) foo
 
 -- INTERSECTION
 --SELECT ST_IsEmpty(rast),
---       ST_Value(rast, 1, 1) AS "1, 1", 
---       ST_Value(rast, 1, 2) AS "1, 2", 
---       ST_Value(rast, 2, 1) AS "2, 1", 
---      ST_Value(rast, 2, 2) AS "2, 2", 
---       ST_BandPixelType(rast, 1), 
---       ST_Width(rast), 
+--       ST_Value(rast, 1, 1) AS "1, 1",
+--       ST_Value(rast, 1, 2) AS "1, 2",
+--       ST_Value(rast, 2, 1) AS "2, 1",
+--      ST_Value(rast, 2, 2) AS "2, 2",
+--       ST_BandPixelType(rast, 1),
+--       ST_Width(rast),
 --       ST_Height(rast)
 --FROM (SELECT ST_MapAlgebra(ST_TestRaster(0, 0, 1), 1, ST_TestRaster(1, 0, 1), 1, '(rast1 + rast2)/3::float8', '64BF', 'INTERSECTION', '0'::text) AS rast) foo
 
 
 -- FIRST -- Doesn't work...
---SELECT ST_Value(rast, 1, 1), 
---       ST_Value(rast, 1, 2), 
---       ST_Value(rast, 2, 1), 
---       ST_Value(rast, 2, 2), 
---       ST_BandPixelType(rast, 1), 
---       ST_Width(rast), 
+--SELECT ST_Value(rast, 1, 1),
+--       ST_Value(rast, 1, 2),
+--       ST_Value(rast, 2, 1),
+--       ST_Value(rast, 2, 2),
+--       ST_BandPixelType(rast, 1),
+--       ST_Width(rast),
 --       ST_Height(rast)
 --FROM (SELECT ST_MapAlgebra(ST_TestRaster(0, 0, 1), 1, ST_TestRaster(1, 1, 1), 1, 'rast1 + rast2 + 2*rast2 + toto()', '8BSI', 'FIRST', NULL) AS rast) foo
 
 -- SECOND -- Doesn't work...
---SELECT ST_Value(rast, 1, 1), 
---       ST_Value(rast, 1, 2), 
---       ST_Value(rast, 2, 1), 
---       ST_Value(rast, 2, 2), 
---       ST_BandPixelType(rast, 1), 
---       ST_Width(rast), 
+--SELECT ST_Value(rast, 1, 1),
+--       ST_Value(rast, 1, 2),
+--       ST_Value(rast, 2, 1),
+--       ST_Value(rast, 2, 2),
+--       ST_BandPixelType(rast, 1),
+--       ST_Width(rast),
 --       ST_Height(rast)
 --FROM (SELECT ST_MapAlgebra(ST_TestRaster(0, 0, 1), 1, ST_TestRaster(1, 1, 1), 1, 'rast1 + rast2 + 2*rast2 + toto()', '8BSI', 'SECOND', NULL) AS rast) foo
 
 
 -- INTERSECTION with rotated. -- Doesn't work...
 --SELECT ST_IsEmpty(rast),
---       ST_Value(rast, 1, 1) AS "1, 1", 
---       ST_Value(rast, 1, 2) AS "1, 2", 
---       ST_Value(rast, 2, 1) AS "2, 1", 
---       ST_Value(rast, 2, 2) AS "2, 2", 
---       ST_BandPixelType(rast, 1), 
---       ST_Width(rast), 
+--       ST_Value(rast, 1, 1) AS "1, 1",
+--       ST_Value(rast, 1, 2) AS "1, 2",
+--       ST_Value(rast, 2, 1) AS "2, 1",
+--       ST_Value(rast, 2, 2) AS "2, 2",
+--       ST_BandPixelType(rast, 1),
+--       ST_Width(rast),
 --       ST_Height(rast)
 --FROM (SELECT ST_MapAlgebra(ST_TestRotatedRaster(0, 0), 1, ST_TestRotatedRaster(1.2, -0.8), 1, '(rast1 + rast2)/3::float8', '64BF', 'Union', 0) AS rast) foo
 
@@ -1108,21 +1108,21 @@
 --SELECT AsBinary((rast).geom), (rast).val FROM (SELECT ST_PixelAsPolygons(ST_MapAlgebra(ST_TestRotatedRaster(0, 0), 1, ST_TestRotatedRaster(1.2, -0.8), 1, '(rast1 + rast2)/3::float8', '64BF', 'Union', 0), 1) rast) foo
 
 --SELECT ST_IsEmpty(rast),
---       ST_Value(rast, 1, 1) AS "1, 1", 
---       ST_Value(rast, 1, 2) AS "1, 2", 
---       ST_Value(rast, 2, 1) AS "2, 1", 
---       ST_Value(rast, 2, 2) AS "2, 2", 
- --      ST_BandPixelType(rast, 1), 
---       ST_Width(rast), 
+--       ST_Value(rast, 1, 1) AS "1, 1",
+--       ST_Value(rast, 1, 2) AS "1, 2",
+--       ST_Value(rast, 2, 1) AS "2, 1",
+--       ST_Value(rast, 2, 2) AS "2, 2",
+ --      ST_BandPixelType(rast, 1),
+--       ST_Width(rast),
 --       ST_Height(rast)
 --FROM (SELECT ST_MapAlgebra(ST_TestRaster(0, 0), 1, ST_TestRaster(1, 1), 1, '(rast1 + rast2)/2', '64BF', 'Union', 0) AS rast) foo
 
 --SELECT ST_IsEmpty(rast),
---       ST_Value(rast, 1, 1) AS "1, 1", 
---       ST_Value(rast, 1, 2) AS "1, 2", 
---       ST_Value(rast, 2, 1) AS "2, 1", 
---       ST_Value(rast, 2, 2) AS "2, 2", 
---       ST_BandPixelType(rast, 1), 
---       ST_Width(rast), 
+--       ST_Value(rast, 1, 1) AS "1, 1",
+--       ST_Value(rast, 1, 2) AS "1, 2",
+--       ST_Value(rast, 2, 1) AS "2, 1",
+--       ST_Value(rast, 2, 2) AS "2, 2",
+--       ST_BandPixelType(rast, 1),
+--       ST_Width(rast),
 --       ST_Height(rast)
 --FROM (SELECT ST_MapAlgebra(ST_TestRaster(0, 0), 1, ST_TestRaster(1, 1), 1, 'CASE WHEN rast1 IS NULL THEN rast2 WHEN rast2 IS NULL THEN rast1 ELSE (rast1 + rast2)/2 END', '64BF', 'Union', 0) AS rast) foo

Modified: trunk/raster/scripts/plpgsql/st_mapalgebra_optimized.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_mapalgebra_optimized.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_mapalgebra_optimized.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -7,8 +7,8 @@
 
 -- Note: The functions provided in this script are in developement. Do not use.
 
--- Note: this script is dependent on 
---   _MapAlgebraParts(r1x int, r1y int, r1w int, r1h int, r2x int, r2y int, r2w int, r2h int) 
+-- Note: this script is dependent on
+--   _MapAlgebraParts(r1x int, r1y int, r1w int, r1h int, r2x int, r2y int, r2w int, r2h int)
 --   ST_SameAlignment(rast1ulx float8, rast1uly float8, rast1scalex float8, rast1scaley float8, rast1skewx float8, rast1skewy float8, rast2ulx float8, rast2uly float8, rast2scalex float8, rast2scaley float8, rast2skewx float8, rast2skewy float8)
 --   ST_IsEmpty(raster)
 --   ST_HasNoBand(raster, int)
@@ -16,19 +16,19 @@
 -- to be found in the script/plpgsql folder
 
 --------------------------------------------------------------------
--- ST_MapAlgebra - (two rasters version) Return a raster which 
---                 values are the result of an SQL expression involving 
+-- ST_MapAlgebra - (two rasters version) Return a raster which
+--                 values are the result of an SQL expression involving
 --                 pixel values from input rasters bands.
--- Arguments 
--- rast1 raster -  First raster referred by rast1 in the expression. 
+-- Arguments
+-- rast1 raster -  First raster referred by rast1 in the expression.
 -- band1 integer - Band number of the first raster. Default to 1.
 -- rast2 raster -  Second raster referred by rast2 in the expression.
 -- band2 integer - Band number of the second raster. Default to 1.
 -- expression text - SQL expression. Ex.: "rast1 + 2 * rast2"
 -- pixeltype text - Pixeltype assigned to the resulting raster. Expression
---                  results are truncated to this type. Default to the 
+--                  results are truncated to this type. Default to the
 --                  pixeltype of the first raster.
--- extentexpr text - Raster extent of the result. Can be: 
+-- extentexpr text - Raster extent of the result. Can be:
 --                     -FIRST: Same extent as the first raster. Default.
 --                     -SECOND: Same extent as the second) raster. Default.
 --                     -INTERSECTION: Intersection of extent of the two rasters.
@@ -44,17 +44,17 @@
 -- -Resample the second raster when necessary (Require ST_Resample)
 -- -More test with rotated images
 --------------------------------------------------------------------
-CREATE OR REPLACE FUNCTION ST_MapAlgebra2(rast1 raster, 
-                                         band1 integer, 
-                                         rast2 raster, 
-                                         band2 integer, 
-                                         expression text, 
-                                         pixeltype text, 
-                                         extentexpr text, 
-                                         nodata1expr text, 
+CREATE OR REPLACE FUNCTION ST_MapAlgebra2(rast1 raster,
+                                         band1 integer,
+                                         rast2 raster,
+                                         band2 integer,
+                                         expression text,
+                                         pixeltype text,
+                                         extentexpr text,
+                                         nodata1expr text,
                                          nodata2expr text,
-                                         nodatanodataexpr text) 
-    RETURNS raster AS 
+                                         nodatanodataexpr text)
+    RETURNS raster AS
     $$
     DECLARE
         x integer;
@@ -85,7 +85,7 @@
         rast2skewy float8;
         rast2nodataval float8;
         rast2srid int;
-        
+
         r1x int;
         r1y int;
         r1w int;
@@ -94,14 +94,14 @@
         r2y int;
         r2w int;
         r2h int;
-        
+
         newrx int;
         newry int;
-        
+
         newrast raster;
         tmprast raster;
         newsrid int;
-        
+
         newscalex float8;
         newscaley float8;
         newskewx float8;
@@ -116,7 +116,7 @@
         newoffsety1 int;
         newoffsetx2 int;
         newoffsety2 int;
-        
+
         newval float;
         newexpr text;
         upnodatanodataexpr text;
@@ -125,7 +125,7 @@
         upexpression text;
         nodatanodataval float;
         skipcomputation int;
-        
+
         zones int[];
         z11x int;
         z11y int;
@@ -163,38 +163,38 @@
         zcy int;
         zcw int;
         zch int;
-        
+
     BEGIN
-        -- We have to deal with NULL, empty, hasnoband and hasnodatavalue band rasters... 
+        -- We have to deal with NULL, empty, hasnoband and hasnodatavalue band rasters...
         -- These are respectively tested by "IS NULL", "ST_IsEmpty()", "ST_HasNoBand()" and "ST_BandIsNodata()"
-        
+
         -- If both raster are null, we return NULL. ok
         -- If both raster do not have extent (are empty), we return an empty raster. ok
-        -- If both raster do not have the specified band, 
+        -- If both raster do not have the specified band,
         --     we return a no band raster with the correct extent (according to the extent expression). ok
         -- If both raster bands are nodatavalue and there is no replacement value, we return a nodata value band. ok
-        
+
         -- If only one raster is null or empty or has no band or hasnodata band we treat it as a nodata band raster.
         -- If there is a replacement value we replace the missing raster values with this replacement value. ok
         -- If there is no replacement value, we return a nodata value band. ok
-        
+
         -- What to do when only one raster is NULL or empty
         -- If the extent expression is FIRST and the first raster is null we return NULL. ok
         -- If the extent expression is FIRST and the first raster do not have extent (is empty), we return an empty raster. ok
         -- If the extent expression is SECOND and the second raster is null we return NULL. ok
         -- If the extent expression is SECOND and the second raster do not have extent (is empty), we return an empty raster. ok
         -- If the extent expression is INTERSECTION and one raster is null or do not have extent (is empty), we return an empty raster. ok
-        -- If the extent expression is UNION and one raster is null or do not have extent (is empty), 
+        -- If the extent expression is UNION and one raster is null or do not have extent (is empty),
         --     we return a raster having the extent and the band characteristics of the other raster. ok
 
         -- What to do when only one raster do not have the required band.
-        -- If the extent expression is FIRST and the first raster do not have the specified band, 
+        -- If the extent expression is FIRST and the first raster do not have the specified band,
         --     we return a no band raster with the correct extent (according to the extent expression). ok
-        -- If the extent expression is SECOND and the second raster do not have the specified band, 
+        -- If the extent expression is SECOND and the second raster do not have the specified band,
         --     we return a no band raster with the correct extent (according to the extent expression). ok
-        -- If the extent expression is INTERSECTION and one raster do not have the specified band, 
+        -- If the extent expression is INTERSECTION and one raster do not have the specified band,
         --     we treat it as a nodata raster band. ok
-        -- If the extent expression is UNION and one raster do not have the specified band, 
+        -- If the extent expression is UNION and one raster do not have the specified band,
         --     we treat it as a nodata raster band. ok
 
         -- In all those cases, we make a warning.
@@ -270,9 +270,9 @@
             RAISE EXCEPTION 'ST_MapAlgebra: Provided raster do not have the same alignment. Aborting';
         END IF;
 
-        -- Set new pixel size and skew. We set it to the rast1 scale and skew 
+        -- Set new pixel size and skew. We set it to the rast1 scale and skew
         -- since both rasters are aligned and thus have the same scale and skew
-        newscalex := rast1scalex; 
+        newscalex := rast1scalex;
         newscaley := rast1scaley;
         newskewx := rast1skewx;
         newskewy := rast1skewy;
@@ -290,12 +290,12 @@
             r1y := -r2y;
             r2y := 0;
         END IF;
-        
+
         r1w := rast1width;
         r1h := rast1height;
         r2w := rast2width;
         r2h := rast2height;
-        
+
         zones := _MapAlgebraParts(r1x + 1, r1y + 1, r1w, r1h, r2x + 1, r2y + 1, r2w, r2h);
         z11x := zones[1];
         z11y := zones[2];
@@ -333,28 +333,28 @@
         zcy := zones[34];
         zcw := zones[35];
         zch := zones[36];
-        
+
         -- Compute x and y relative index of master and slave according to the extent expression (FIRST, SECOND, INTERSECTION or UNION)
         IF extentexpr IS NULL OR upper(extentexpr) = 'FIRST' THEN
 
             -- Check if rast1 is NULL
-            IF rast1 IS NULL THEN 
+            IF rast1 IS NULL THEN
                 RAISE NOTICE 'ST_MapAlgebra: FIRST raster is NULL. Returning NULL';
                 RETURN NULL;
             END IF;
-            
+
             -- Check if rast1 is empty
-            IF ST_IsEmpty(rast1) THEN 
+            IF ST_IsEmpty(rast1) THEN
                 RAISE NOTICE 'ST_MapAlgebra: FIRST raster is empty. Returning an empty raster';
                 RETURN ST_MakeEmptyRaster(0, 0, 0, 0, 0, 0, 0, 0, newsrid);
             END IF;
-                        
+
             -- Check if rast1 has the required band
-            IF ST_HasNoBand(rast1, band1) THEN 
+            IF ST_HasNoBand(rast1, band1) THEN
                 RAISE NOTICE 'ST_MapAlgebra: FIRST raster has no band. Returning a raster without band';
                 RETURN ST_MakeEmptyRaster(rast1width, rast1height, rast1ulx, rast1uly, rast1scalex, rast1scaley, rast1skewx, rast1skewy, rast1srid);
             END IF;
-            
+
             newulx := rast1ulx;
             newuly := rast1uly;
             newwidth := rast1width;
@@ -370,19 +370,19 @@
         ELSIF upper(extentexpr) = 'SECOND' THEN
 
             -- Check if rast2 is NULL
-            IF rast2 IS NULL THEN 
+            IF rast2 IS NULL THEN
                 RAISE NOTICE 'ST_MapAlgebra: SECOND raster is NULL. Returning NULL';
                 RETURN NULL;
             END IF;
-            
+
             -- Check if rast2 is empty
-            IF ST_IsEmpty(rast2) THEN 
+            IF ST_IsEmpty(rast2) THEN
                 RAISE NOTICE 'ST_MapAlgebra: SECOND raster is empty. Returning an empty raster';
                 RETURN ST_MakeEmptyRaster(0, 0, 0, 0, 0, 0, 0, 0, newsrid);
             END IF;
-            
+
             -- Check if rast2 has the required band
-            IF ST_HasNoBand(rast2, band2) THEN 
+            IF ST_HasNoBand(rast2, band2) THEN
                 RAISE NOTICE 'ST_MapAlgebra: SECOND raster has no band. Returning an empty raster';
                 RETURN ST_MakeEmptyRaster(rast2width, rast2height, rast2ulx, rast2uly, rast2scalex, rast2scaley, rast2skewx, rast2skewy, rast2srid);
             END IF;
@@ -404,12 +404,12 @@
             -- Check if the intersection is empty.
             IF zcw = 0 OR zch = 0 OR
                rast1 IS NULL OR ST_IsEmpty(rast1) OR
-               rast2 IS NULL OR ST_IsEmpty(rast2) THEN 
+               rast2 IS NULL OR ST_IsEmpty(rast2) THEN
                 RAISE NOTICE 'ST_MapAlgebra: INTERSECTION of provided rasters is empty. Returning an empty raster';
                 RETURN ST_MakeEmptyRaster(0, 0, 0, 0, 0, 0, 0, 0, newsrid);
             END IF;
-            
 
+
             -- Compute the new ulx and uly
             newulx := st_raster2worldcoordx(rast1, zcx - r1x + 1, zcy - r1y + 1);
             newuly := st_raster2worldcoordy(rast1, zcx - r1x + 1, zcy - r1y + 1);
@@ -472,14 +472,14 @@
             RAISE NOTICE 'ST_MapAlgebra: Both raster do not have the specified band. Returning a no band raster with the correct extent';
             RETURN ST_MakeEmptyRaster(newwidth, newheight, newulx, newuly, newscalex, newscaley, newskewx, newskewy, newsrid);
         END IF;
-        
+
         -- Check newpixeltype
         newpixeltype := pixeltype;
-        IF newpixeltype NOTNULL AND newpixeltype != '1BB' AND newpixeltype != '2BUI' AND newpixeltype != '4BUI' AND newpixeltype != '8BSI' AND newpixeltype != '8BUI' AND 
+        IF newpixeltype NOTNULL AND newpixeltype != '1BB' AND newpixeltype != '2BUI' AND newpixeltype != '4BUI' AND newpixeltype != '8BSI' AND newpixeltype != '8BUI' AND
                newpixeltype != '16BSI' AND newpixeltype != '16BUI' AND newpixeltype != '32BSI' AND newpixeltype != '32BUI' AND newpixeltype != '32BF' AND newpixeltype != '64BF' THEN
             RAISE EXCEPTION 'ST_MapAlgebra: Invalid pixeltype "%". Aborting.', newpixeltype;
         END IF;
-        
+
         -- If no newpixeltype was provided, get it from the provided rasters.
         IF newpixeltype IS NULL THEN
             IF (upper(extentexpr) = 'SECOND' AND NOT ST_HasNoBand(rast2, band2)) OR ST_HasNoBand(rast1, band1) THEN
@@ -488,7 +488,7 @@
                 newpixeltype := ST_BandPixelType(rast1, band1);
             END IF;
         END IF;
-               
+
          -- Get the nodata value for first raster
         IF NOT ST_HasNoBand(rast1, band1) AND ST_BandHasNodataValue(rast1, band1) THEN
             rast1nodataval := ST_BandNodatavalue(rast1, band1);
@@ -501,7 +501,7 @@
         ELSE
             rast2nodataval := NULL;
         END IF;
-        
+
         -- Determine new notadavalue
         IF (upper(extentexpr) = 'SECOND' AND NOT rast2nodataval IS NULL) THEN
             newnodatavalue := rast2nodataval;
@@ -511,7 +511,7 @@
             RAISE NOTICE 'ST_MapAlgebra: Both source rasters do not have a nodata value, nodata value for new raster set to the minimum value possible';
             newnodatavalue := ST_MinPossibleValue(newrast);
         END IF;
-         
+
         upnodatanodataexpr := upper(nodatanodataexpr);
         upnodata1expr := upper(nodata1expr);
         upnodata2expr := upper(nodata2expr);
@@ -539,7 +539,7 @@
         IF z11w > 0 AND z11h > 0 AND NOT ST_BandIsNodata(rast1, band1) AND NOT nodata2expr IS NULL THEN
             IF upnodata2expr = 'RAST' THEN
 
-                
+
                 -- IF rast1nodataval != nodatanodataval THEN
 RAISE NOTICE 'ST_MapAlgebra2 222';
                 --     newrast := ST_SetValues(newrast, 1, z11x, z11y, z11w, z11h, nodatanodataval);
@@ -561,7 +561,7 @@
         -- Common zone (zc)
         skipcomputation = 0;
         IF zcw > 0 AND zch > 0 AND (NOT ST_BandIsNodata(rast1, band1) OR NOT ST_BandIsNodata(rast2, band2)) THEN
-            
+
 RAISE NOTICE 'ST_MapAlgebra2 666';
             -- Initialize the zone with nodatavalue. We will not further compute nodata nodata pixels
             -- newrast := ST_SetValues(newrast, 1, zcx + 1, zcy + 1, zcw, zch, newnodatavalue);
@@ -573,7 +573,7 @@
 
                     -- Do nothing
                     skipcomputation = 0;
-                    
+
                 ELSEIF upnodata1expr = 'RAST' THEN
 
                     -- Copy rast2 into newrast
@@ -586,8 +586,8 @@
                         EXECUTE 'SELECT ' || upnodata1expr INTO newval;
                         IF newval IS NULL OR newval = newnodatavalue THEN
                             -- The constant is equal to nodata. We have nothing to compute since newrast was already initialized to nodata
-                            skipcomputation := 2;                    
-                        ELSEIF newnodatavalue IS NULL THEN 
+                            skipcomputation := 2;
+                        ELSEIF newnodatavalue IS NULL THEN
                             -- We can globally initialize to the constant only if there was no newnodatavalue.
                             newrast := ST_SetValues(newrast, 1, zcx, zcy, zcw, zch, newval);
                             skipcomputation := 2;
@@ -627,8 +627,8 @@
     LANGUAGE 'plpgsql';
 
 
-CREATE OR REPLACE FUNCTION ST_TestRaster(ulx float8, uly float8, val float8) 
-    RETURNS raster AS 
+CREATE OR REPLACE FUNCTION ST_TestRaster(ulx float8, uly float8, val float8)
+    RETURNS raster AS
     $$
     DECLARE
     BEGIN

Modified: trunk/raster/scripts/plpgsql/st_mapalgebrafctngb.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_mapalgebrafctngb.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_mapalgebrafctngb.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -13,7 +13,7 @@
     DECLARE
         newval int := 0;
     BEGIN
-        newval := CASE 
+        newval := CASE
             WHEN pixeltype = '1BB' THEN 0
             WHEN pixeltype = '2BUI' THEN 0
             WHEN pixeltype = '4BUI' THEN 0
@@ -34,8 +34,8 @@
 --
 --Test rasters
 --
-CREATE OR REPLACE FUNCTION ST_TestRaster(h integer, w integer, val float8) 
-    RETURNS raster AS 
+CREATE OR REPLACE FUNCTION ST_TestRaster(h integer, w integer, val float8)
+    RETURNS raster AS
     $$
     DECLARE
     BEGIN
@@ -45,14 +45,14 @@
     LANGUAGE 'plpgsql';
 
 --------------------------------------------------------------------
--- ST_MapAlgebraFctNgb - (one raster version) Return a raster which values 
---                 are the result of a PLPGSQL user function involving a 
+-- ST_MapAlgebraFctNgb - (one raster version) Return a raster which values
+--                 are the result of a PLPGSQL user function involving a
 --                 neighborhood of values from the input raster band.
--- Arguments 
+-- Arguments
 -- rast raster -  Raster on which the user function is evaluated.
 -- band integer - Band number of the raster to be evaluated. Default to 1.
 -- pixeltype text - Pixeltype assigned to the resulting raster. User function
---                  results are truncated to this type. Default to the 
+--                  results are truncated to this type. Default to the
 --                  pixeltype of the first raster.
 -- ngbwidth integer - The width of the neighborhood, in cells.
 -- ngbheight integer - The heigh of the neighborhood, in cells.
@@ -60,8 +60,8 @@
 -- args variadic text[] - Arguments to pass into the user function.
 --------------------------------------------------------------------
 DROP FUNCTION IF EXISTS ST_MapAlgebraFctNgb(rast raster, band integer, pixeltype text, ngbwidth integer, ngbheight integer, userfunction text, nodatamode text, variadic args text[]);
-CREATE OR REPLACE FUNCTION ST_MapAlgebraFctNgb(rast raster, band integer, pixeltype text, ngbwidth integer, ngbheight integer, userfunction text, nodatamode text, variadic args text[]) 
-    RETURNS raster AS 
+CREATE OR REPLACE FUNCTION ST_MapAlgebraFctNgb(rast raster, band integer, pixeltype text, ngbwidth integer, ngbheight integer, userfunction text, nodatamode text, variadic args text[])
+    RETURNS raster AS
     $$
     DECLARE
         width integer;
@@ -91,22 +91,22 @@
         newrast := ST_MakeEmptyRaster(width, height, ST_UpperLeftX(rast), ST_UpperLeftY(rast), ST_ScaleX(rast), ST_ScaleY(rast), ST_SkewX(rast), ST_SkewY(rast), ST_SRID(rast));
 
         -- If this new raster is empty (width = 0 OR height = 0) then there is nothing to compute and we return it right now
-        IF ST_IsEmpty(newrast) THEN 
+        IF ST_IsEmpty(newrast) THEN
             RAISE NOTICE 'ST_MapAlgebraFctNgb: Raster is empty. Returning an empty raster';
             RETURN newrast;
         END IF;
-        
+
         -- Check if rast has the required band. Otherwise return a raster without band
-        IF ST_HasNoBand(rast, band) THEN 
+        IF ST_HasNoBand(rast, band) THEN
             RAISE NOTICE 'ST_MapAlgebraFctNgb: Raster does not have the required band. Returning a raster without a band';
             RETURN newrast;
         END IF;
-        
+
         -- Set the new pixeltype
         newpixeltype := pixeltype;
         IF newpixeltype IS NULL THEN
             newpixeltype := ST_BandPixelType(rast, band);
-        ELSIF newpixeltype != '1BB' AND newpixeltype != '2BUI' AND newpixeltype != '4BUI' AND newpixeltype != '8BSI' AND newpixeltype != '8BUI' AND 
+        ELSIF newpixeltype != '1BB' AND newpixeltype != '2BUI' AND newpixeltype != '4BUI' AND newpixeltype != '8BSI' AND newpixeltype != '8BUI' AND
                newpixeltype != '16BSI' AND newpixeltype != '16BUI' AND newpixeltype != '32BSI' AND newpixeltype != '32BUI' AND newpixeltype != '32BF' AND newpixeltype != '64BF' THEN
             RAISE EXCEPTION 'ST_MapAlgebraFctNgb: Invalid pixeltype "%". Aborting.', newpixeltype;
         END IF;
@@ -118,8 +118,8 @@
             newnodatavalue := ST_MinPossibleValue(newpixeltype);
         END IF;
 
-        -- We set the initial value of the future band to nodata value. 
-        -- If nodatavalue is null then the raster will be initialise to ST_MinPossibleValue 
+        -- We set the initial value of the future band to nodata value.
+        -- If nodatavalue is null then the raster will be initialise to ST_MinPossibleValue
         -- but all the values should be recomputed anyway.
         newinitialvalue := newnodatavalue;
 
@@ -127,7 +127,7 @@
         IF ST_BandIsNoData(rast, band) THEN
             RETURN ST_AddBand(newrast, newpixeltype, newinitialvalue, newnodatavalue);
         END IF;
-        
+
         --Create the raster receiving all the computed values. Initialize it to the new initial value.
         newrast := ST_AddBand(newrast, newpixeltype, newinitialvalue, newnodatavalue);
 
@@ -216,8 +216,8 @@
 --SELECT ST_HasNoBand(ST_MapAlgebraFctNgb(ST_MakeEmptyRaster(10, 10, 0, 0, 1, 1, 1, 1, -1), 1, NULL, 1, 1, 'ST_Sum', 'NULL', NULL));
 
 -- Test has no nodata value. Should return null and 7.
---SELECT 
---  ST_Value(rast, 2, 2) IS NULL, 
+--SELECT
+--  ST_Value(rast, 2, 2) IS NULL,
 --  ST_Value(
 --    ST_MapAlgebraFctNgb(
 --      ST_SetBandNoDataValue(rast, NULL), 1, NULL, 1, 1, 'ST_Sum', 'NULL', NULL
@@ -225,56 +225,56 @@
 -- FROM ST_SetValue(ST_TestRaster(3, 3, 1), 2, 2, NULL) AS rast;
 --
 -- Test NULL nodatamode. Should return null and null.
---SELECT 
---  ST_Value(rast, 2, 2) IS NULL, 
+--SELECT
+--  ST_Value(rast, 2, 2) IS NULL,
 --  ST_Value(
 --    ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'ST_Sum', 'NULL', NULL), 2, 2
 --  ) IS NULL
 -- FROM ST_SetValue(ST_TestRaster(3, 3, 1), 2, 2, NULL) AS rast;
 --
 -- Test ignore nodatamode. Should return null and 8.
---SELECT 
---  ST_Value(rast, 2, 2) IS NULL, 
+--SELECT
+--  ST_Value(rast, 2, 2) IS NULL,
 --  ST_Value(
 --    ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'ST_Sum', 'ignore', NULL), 2, 2
 --  ) = 8
 -- FROM ST_SetValue(ST_TestRaster(3, 3, 1), 2, 2, NULL) AS rast;
 --
 -- Test value nodatamode. Should return null and null.
---SELECT 
---  ST_Value(rast, 2, 2) IS NULL, 
+--SELECT
+--  ST_Value(rast, 2, 2) IS NULL,
 --  ST_Value(
 --    ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'ST_Sum', 'value', NULL), 2, 2
---  ) IS NULL 
+--  ) IS NULL
 -- FROM ST_SetValue(ST_TestRaster(3, 3, 1), 2, 2, NULL) AS rast;
 --
 -- Test value nodatamode. Should return null and 9.
---SELECT 
---  ST_Value(rast, 1, 1) IS NULL, 
+--SELECT
+--  ST_Value(rast, 1, 1) IS NULL,
 --  ST_Value(
 --    ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'ST_Sum', 'value', NULL), 2, 2
 --  ) = 9
 -- FROM ST_SetValue(ST_TestRaster(3, 3, 1), 1, 1, NULL) AS rast;
 --
 -- Test value nodatamode. Should return null and 0.
---SELECT 
---  ST_Value(rast, 2, 2) IS NULL, 
+--SELECT
+--  ST_Value(rast, 2, 2) IS NULL,
 --  ST_Value(
 --    ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'ST_Sum', '-8', NULL), 2, 2
 --  ) = 0
 -- FROM ST_SetValue(ST_TestRaster(3, 3, 1), 2, 2, NULL) AS rast;
 --
 -- Test ST_Sum user function. Should be 1 and 9.
---SELECT 
---  ST_Value(rast, 2, 2) = 1, 
+--SELECT
+--  ST_Value(rast, 2, 2) = 1,
 --  ST_Value(
 --    ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'ST_Sum', 'NULL', NULL), 2, 2
 --  ) = 9
 -- FROM ST_TestRaster(3, 3, 1) AS rast;
 --
 -- Test ST_Sum user function on a no nodata value raster. Should be null and -1.
---SELECT 
---  ST_Value(rast, 2, 2) IS NULL, 
+--SELECT
+--  ST_Value(rast, 2, 2) IS NULL,
 --  ST_Value(
 --    ST_MapAlgebraFctNgb(ST_SetBandNoDataValue(rast, NULL), 1, NULL, 1, 1, 'ST_Sum', 'NULL', NULL), 2, 2
 --  ) = -1
@@ -289,16 +289,16 @@
 -- FROM ST_SetBandNoDataValue(ST_TestRaster(3, 3, 2), 1, NULL) AS rast;
 --
 -- Test pixeltype 1. Should return an error.
---SELECT 
---  ST_Value(rast, 2, 2), 
+--SELECT
+--  ST_Value(rast, 2, 2),
 --  ST_Value(
 --    ST_MapAlgebraFctNgb(rast, 1, '4BUId', 1, 1, 'ST_Sum', 'NULL', NULL), 2, 2
 --  )
 -- FROM ST_TestRaster(3, 3, 2) AS rast;
 --
 -- Test pixeltype 1. Should return 1 and 3.
---SELECT 
---  ST_Value(rast, 2, 2) = 1, 
+--SELECT
+--  ST_Value(rast, 2, 2) = 1,
 --  ST_Value(
 --    ST_MapAlgebraFctNgb(rast, 1, '2BUI', 1, 1, 'ST_Sum', 'NULL', NULL), 2, 2
 --  ) = 3
@@ -340,8 +340,8 @@
 --SELECT
 --  ST_NRings(geom) = 2,
 --  ST_NumInteriorRings(geom) = 1,
---  ST_Area(geom) = 16, 
---  val = 9, 
+--  ST_Area(geom) = 16,
+--  val = 9,
 --  ST_Area(ST_BuildArea(ST_InteriorRingN(geom, 1))) = 9
 -- FROM (SELECT
 --    (ST_DumpAsPolygons(
@@ -352,7 +352,7 @@
 -- Test that the neighborhood function leaves a border of NODATA,
 -- and the center pyramids when summed twice, ignoring NODATA values
 --SELECT
---  COUNT(*) = 9, SUM(ST_Area(geom)) = 9, SUM(val) = ((36+54+36) + (54+81+54) + (36+54+36)) 
+--  COUNT(*) = 9, SUM(ST_Area(geom)) = 9, SUM(val) = ((36+54+36) + (54+81+54) + (36+54+36))
 --  --ST_AsText(geom), ST_Area(geom), val
 -- FROM (SELECT
 --    (ST_DumpAsPolygons(

Modified: trunk/raster/scripts/plpgsql/st_multibandmapalgebra.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_multibandmapalgebra.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_multibandmapalgebra.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,12 +1,12 @@
 -----------------------------------------------------------------------
 -- ST_MultiBandMapAlgebra
--- Return the same map algebra expression to all the band of a raster. 
+-- Return the same map algebra expression to all the band of a raster.
 -----------------------------------------------------------------------
-CREATE OR REPLACE FUNCTION ST_MultiBandMapAlgebra(rast1 raster, 
-                                            	  rast2 raster, 
-                                                  expression text, 
-                                            	  extentexpr text) 
-    RETURNS raster AS 
+CREATE OR REPLACE FUNCTION ST_MultiBandMapAlgebra(rast1 raster,
+                                            	  rast2 raster,
+                                                  expression text,
+                                            	  extentexpr text)
+    RETURNS raster AS
     $$
     DECLARE
 		numband int;

Modified: trunk/raster/scripts/plpgsql/st_pixelaspoints.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_pixelaspoints.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_pixelaspoints.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -9,13 +9,13 @@
 );
 -----------------------------------------------------------------------
 -- ST_PixelAsPoints
--- Return all the pixels of a raster as a record composed of a point geometry, a value, a x and a y raster coordinate. 
+-- Return all the pixels of a raster as a record composed of a point geometry, a value, a x and a y raster coordinate.
 -- Should be called like this:
 -- SELECT (gv).geom, (gv).val, (gv).x, (gv).y FROM (SELECT ST_PixelAsPoints(rast) gv FROM mytable) foo
 -----------------------------------------------------------------------
 DROP FUNCTION IF EXISTS ST_PixelAsPoints(rast raster, band integer);
-CREATE OR REPLACE FUNCTION ST_PixelAsPoints(rast raster, band integer) 
-    RETURNS SETOF geomvalxy AS 
+CREATE OR REPLACE FUNCTION ST_PixelAsPoints(rast raster, band integer)
+    RETURNS SETOF geomvalxy AS
     $$
     DECLARE
         rast alias for $1;
@@ -39,7 +39,7 @@
     LANGUAGE 'plpgsql';
 
 DROP FUNCTION IF EXISTS ST_PixelAsPoints(rast raster);
-CREATE FUNCTION ST_PixelAsPoints(raster) RETURNS SETOF geomvalxy AS 
+CREATE FUNCTION ST_PixelAsPoints(raster) RETURNS SETOF geomvalxy AS
 $$
     SELECT ST_PixelAsPoints($1, 1);
 $$

Modified: trunk/raster/scripts/plpgsql/st_pixelaspolygons.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_pixelaspolygons.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_pixelaspolygons.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -17,8 +17,8 @@
 -- Should be called like this:
 -- SELECT (gv).geom, (gv).val FROM (SELECT ST_PixelAsPolygons(rast) gv FROM mytable) foo
 -----------------------------------------------------------------------
-CREATE OR REPLACE FUNCTION ST_PixelAsPolygons(rast raster, band integer) 
-    RETURNS SETOF geomvalxy AS 
+CREATE OR REPLACE FUNCTION ST_PixelAsPolygons(rast raster, band integer)
+    RETURNS SETOF geomvalxy AS
     $$
     DECLARE
         rast alias for $1;
@@ -47,7 +47,7 @@
     $$
     LANGUAGE 'plpgsql';
 
-CREATE FUNCTION ST_PixelAsPolygons(raster) RETURNS SETOF geomvalxy AS 
+CREATE FUNCTION ST_PixelAsPolygons(raster) RETURNS SETOF geomvalxy AS
 $$
     SELECT ST_PixelAsPolygons($1, 1);
 $$

Modified: trunk/raster/scripts/plpgsql/st_reclass.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_reclass.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_reclass.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -4,14 +4,14 @@
 -- Copyright (c) 2009-2010 Pierre Racine <pierre.racine at sbf.ulaval.ca>
 --
 ----------------------------------------------------------------------
--- NOTE: The ST_Reclass() function is already implemented in C. This plpgsql script is provided only as an example. 
+-- NOTE: The ST_Reclass() function is already implemented in C. This plpgsql script is provided only as an example.
 -- Defining the plpgsql function below might overwrite the current C implementation and brake other functions dependent on it.
 -- Use with caution.
 ----------------------------------------------------------------------
 CREATE OR REPLACE FUNCTION ST_Reclass(rast raster,
                       band int,
-                                      reclassexpr text) 
-    RETURNS raster AS 
+                                      reclassexpr text)
+    RETURNS raster AS
     $$
     DECLARE
     -- Create a new raster without the band we will reclassify

Modified: trunk/raster/scripts/plpgsql/st_setarray.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_setarray.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_setarray.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -3,7 +3,7 @@
 ----------------------------------------------------------------------
 
 CREATE OR REPLACE FUNCTION ST_SetArea(rast raster, band, x int, y int, width int, height int, val float8)
-    RETURNS raster AS 
+    RETURNS raster AS
     $$
     DECLARE
 	newraster raster := rast;

Modified: trunk/raster/scripts/plpgsql/st_setvalues.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_setvalues.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_setvalues.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -9,23 +9,23 @@
 
 --------------------------------------------------------------------
 -- ST_SetValues   - Set a range of raster pixels to a value.
--- 
+--
 -- Arguments
 --
 -- rast raster    - Raster to be edited.
 -- band integer   - Band number of the raster to be edited. Default to 1.
--- x, y           - Raster coordinates of the upper left corner of the range 
+-- x, y           - Raster coordinates of the upper left corner of the range
 --                  of pixel to be edited.
 -- width, height  - Width and height of the range of pixel to be edited.
 -- val            - Value to set the range. If NULL, pixels are set to nodata.
 -- keepdestnodata - Flag indicating not to change pixels set to nodata value.
 --                  Default to FALSE.
 --
--- When x, y, width or height are out of the raster range, only the part 
+-- When x, y, width or height are out of the raster range, only the part
 -- of the range intersecting with the raster is set.
 --------------------------------------------------------------------
 CREATE OR REPLACE FUNCTION ST_SetValues(rast raster, band int, x int, y int, width int, height int, val float8, keepdestnodata boolean)
-    RETURNS raster AS 
+    RETURNS raster AS
     $$
     DECLARE
         newraster raster := rast;
@@ -46,21 +46,21 @@
             RAISE NOTICE 'ST_SetValues: No raster provided. Returns NULL';
             RETURN NULL;
         END IF;
-        
+
         IF ST_IsEmpty(rast) OR ST_HasNoBand(rast, band) THEN
             RAISE NOTICE 'ST_SetValues: Empty or no band raster provided. Returns rast';
             RETURN rast;
         END IF;
-        
+
         IF newband IS NULL THEN
             newband := 1;
         END IF;
-        
+
         IF newband < 1 THEN
             RAISE NOTICE 'ST_SetValues: band out of range. Returns rast';
             RETURN rast;
         END IF;
-        
+
         IF width IS NULL OR width < 1 OR height IS NULL OR height < 1 THEN
             RAISE NOTICE 'ST_SetValues: invalid width or height. Returns rast';
             RETURN rast;
@@ -71,23 +71,23 @@
         END IF;
 
         newx := 1 + LEAST(GREATEST(0, oldx - 1), ST_Width(rast));
-        newwidth := GREATEST(LEAST(1 + ST_Width(rast), oldx + newwidth), 1) - newx;        
-                
+        newwidth := GREATEST(LEAST(1 + ST_Width(rast), oldx + newwidth), 1) - newx;
+
         IF y IS NULL THEN
             oldy := 1;
         END IF;
-        
+
         newy := 1 + LEAST(GREATEST(0, oldy - 1), ST_Height(rast));
         newheight := GREATEST(LEAST(1 + ST_Height(rast), oldy + newheight), 1) - newy;
 
         IF newwidth < 1 OR newheight < 1 THEN
             RETURN rast;
         END IF;
-        
+
         IF newkeepdestnodata IS NULL THEN
             newkeepdestnodata := FALSE;
         END IF;
-        
+
         IF newkeepdestnodata THEN
             IF NOT ST_BandNodataValue(rast, newband) IS NULL THEN
                 rastnodataval := ST_BandNoDataValue(rast, newband);
@@ -124,7 +124,7 @@
                 END LOOP;
             END LOOP;
         END IF;
-        
+
         RETURN newraster;
     END;
     $$
@@ -149,8 +149,8 @@
     LANGUAGE 'SQL' IMMUTABLE;
 
 --Test rasters
-CREATE OR REPLACE FUNCTION ST_TestRaster(ulx float8, uly float8, val float8) 
-    RETURNS raster AS 
+CREATE OR REPLACE FUNCTION ST_TestRaster(ulx float8, uly float8, val float8)
+    RETURNS raster AS
     $$
     DECLARE
     BEGIN
@@ -185,27 +185,27 @@
 FROM (SELECT ST_PixelAsPolygons(ST_SetValues(ST_SetBandNoDataValue(ST_TestRaster(0, 0, -1), NULL), 2, 2, 2, 2, 0, TRUE)) as pix) foo
 
 --------------------------------------------------------------------
--- ST_SetValues   - Set a range of raster pixels to values copied from 
+-- ST_SetValues   - Set a range of raster pixels to values copied from
 --                  the corresponding pixels in another raster.
 -- Arguments
 --
 -- rast1 raster   - Raster to be edited.
 -- band1 integer  - Band number of the raster to be edited. Default to 1.
--- x, y           - Raster coordinates of the upper left corner of the 
+-- x, y           - Raster coordinates of the upper left corner of the
 --                  range of pixel to be edited.
 -- width, height  - Width and height of the range of pixel to be edited.
 -- rast2          - Raster values are copied from.
--- band2          - Band number of the raster values are copied from. 
--- keepdestnodata - Flag indicating not to change pixels (in the edited 
+-- band2          - Band number of the raster values are copied from.
+-- keepdestnodata - Flag indicating not to change pixels (in the edited
 --                  raster) set to nodata value. Default to FALSE.
--- keepsourcetnodata - Flag indicating not to copy pixels (from the source 
+-- keepsourcetnodata - Flag indicating not to copy pixels (from the source
 --                  raster) set to nodata value. Default to FALSE.
 --
--- When x, y, width or height are out of the raster range, only the part 
+-- When x, y, width or height are out of the raster range, only the part
 -- of the range intersecting with the raster is set.
 --------------------------------------------------------------------
 CREATE OR REPLACE FUNCTION ST_SetValues(rast1 raster, band1 int, x int, y int, width int, height int, rast2 raster, band2 int, keepdestnodata boolean, keepsourcenodata boolean)
-    RETURNS raster AS 
+    RETURNS raster AS
     $$
     DECLARE
         newraster raster := rast1;
@@ -232,12 +232,12 @@
             RAISE NOTICE 'ST_SetValues: No raster provided. Return NULL';
             RETURN NULL;
         END IF;
-        
+
         IF ST_IsEmpty(rast1) OR ST_HasNoBand(rast1, band1) THEN
             RAISE NOTICE 'ST_SetValues: Empty or no band destination raster provided. Returns rast1';
             RETURN rast1;
         END IF;
-        
+
         IF  rast2 IS NULL OR ST_IsEmpty(rast2) OR ST_HasNoBand(rast2, band2) THEN
             RAISE NOTICE 'ST_SetValues: Empty or no band source raster provided. Returns rast1';
             RETURN rast1;
@@ -246,7 +246,7 @@
         IF newband1 IS NULL THEN
             newband1 := 1;
         END IF;
-        
+
         IF newband1 < 1 THEN
             RAISE NOTICE 'ST_SetValues: band1 out of range. Returns rast';
             RETURN rast1;
@@ -255,29 +255,29 @@
         IF newband2 IS NULL THEN
             newband2 := 1;
         END IF;
-        
+
         IF newband2 < 1 THEN
             RAISE NOTICE 'ST_SetValues: band2 out of range. Returns rast';
             RETURN rast1;
         END IF;
-        
+
         IF x IS NULL THEN
             oldx := 1;
         END IF;
 
         newx := 1 + LEAST(GREATEST(0, oldx - 1), ST_Width(rast1));
         newwidth := GREATEST(LEAST(1 + ST_Width(rast1), oldx + newwidth), 1) - newx;
-        oldx := newx;      
-                
+        oldx := newx;
+
         IF y IS NULL THEN
             oldy := 1;
         END IF;
-        
+
 --RAISE NOTICE 'aaa oldy=%, newheight=%', oldy, newheight;
 
         newy := 1 + LEAST(GREATEST(0, oldy - 1), ST_Height(rast1));
         newheight := GREATEST(LEAST(1 + ST_Height(rast1), oldy + newheight), 1) - newy;
-        oldy := newy;      
+        oldy := newy;
 
 --RAISE NOTICE 'bbb newx=%, newy=%', newx, newy;
 --RAISE NOTICE 'ccc newwidth=%, newheight=%', newwidth, newheight;
@@ -287,14 +287,14 @@
 
         x2 := ST_World2RasterCoordX(rast1, ST_Raster2WorldCoordX(rast2, 1, 1), ST_Raster2WorldCoordY(rast2, 1, 1));
         y2 := ST_World2RasterCoordY(rast1, ST_Raster2WorldCoordY(rast2, 1, 1), ST_Raster2WorldCoordY(rast2, 1, 1));
-    
+
 --RAISE NOTICE '111 x2=%, y2=%', x2, y2;
 
         newx := x2 + LEAST(GREATEST(0, oldx - x2), ST_Width(rast2));
-        newwidth := GREATEST(LEAST(x2 + ST_Width(rast2), oldx + newwidth), x2) - newx; 
+        newwidth := GREATEST(LEAST(x2 + ST_Width(rast2), oldx + newwidth), x2) - newx;
 
         newy := y2 + LEAST(GREATEST(0, oldy - y2), ST_Height(rast2));
-        newheight := GREATEST(LEAST(y2 + ST_Height(rast2), oldy + newheight), y2) - newy; 
+        newheight := GREATEST(LEAST(y2 + ST_Height(rast2), oldy + newheight), y2) - newy;
 
         IF newwidth < 1 OR newheight < 1 THEN
             RETURN rast1;
@@ -306,7 +306,7 @@
         IF newkeepdestnodata IS NULL THEN
             newkeepdestnodata := FALSE;
         END IF;
-        
+
         IF newkeepdestnodata THEN
             IF NOT ST_BandNodataValue(rast1, newband1) IS NULL THEN
                 rast1nodataval := ST_BandNoDataValue(rast1, newband1);
@@ -322,7 +322,7 @@
         IF newkeepsourcenodata IS NULL THEN
             newkeepsourcenodata := FALSE;
         END IF;
-        
+
         IF newkeepsourcenodata THEN
             IF NOT ST_BandNodataValue(rast2, newband2) IS NULL THEN
                 rast2nodataval := ST_BandNoDataValue(rast2, newband2);

Modified: trunk/raster/scripts/plpgsql/st_splittable.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_splittable.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_splittable.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,8 +1,8 @@
 ----------------------------------------------------------------------------------------------------------------------
 -- ST_SplitTable
 -- Split a table into a series of table which names are composed of the concatenation of a prefix
--- and the value of a column. This function is usefull when loading many raster in one operation but 
--- still wanting to split them in different tables afterward. They must have been loaded with the -F 
+-- and the value of a column. This function is usefull when loading many raster in one operation but
+-- still wanting to split them in different tables afterward. They must have been loaded with the -F
 -- raster2pgsql option so that different rasters are identifiable by a column.
 --
 -- sourcetablename   - The name of the table to split into multiple table
@@ -10,7 +10,7 @@
 -- targettableprefix - The prefix of the set of table names to create.
 -- suffixcolumnname  - The name of the column providing the suffix to each table name.
 --
--- Example to split the table 'test' into a set of table starting with 't_' and 
+-- Example to split the table 'test' into a set of table starting with 't_' and
 -- ending with the value of the column 'rid' to be created in the 'public' schema.
 --
 -- SELECT ST_SplitTable('test', 'public', 't_', 'rid');;

Modified: trunk/raster/scripts/plpgsql/st_summarystatsagg.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_summarystatsagg.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_summarystatsagg.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -3,10 +3,10 @@
 -- Compute summary statistics for an aggregation of raster.
 --
 -- Exemple
--- SELECT (ss).count, 
---        (ss).sum, 
---        (ss).mean, 
---        (ss).min, 
+-- SELECT (ss).count,
+--        (ss).sum,
+--        (ss).mean,
+--        (ss).min,
 --        (ss).max
 -- FROM (SELECT ST_SummaryStatsAgg(gv) ss
 --       FROM (SELECT ST_Clip(rt.rast, gt.geom) gv
@@ -19,7 +19,7 @@
 -- raster_summarystatsstate
 -- State function used by the ST_SummaryStatsAgg aggregate
 CREATE OR REPLACE FUNCTION raster_summarystatsstate(ss summarystats, rast raster, nband int DEFAULT 1, exclude_nodata_value boolean DEFAULT TRUE, sample_percent double precision DEFAULT 1)
-    RETURNS summarystats 
+    RETURNS summarystats
     AS $$
     DECLARE
         newstats summarystats;
@@ -30,18 +30,18 @@
         END IF;
         newstats := _ST_SummaryStats(rast, nband, exclude_nodata_value, sample_percent);
         IF $1 IS NULL THEN
-            ret := (newstats.count, 
+            ret := (newstats.count,
                     newstats.sum,
                     null,
                     null,
-                    newstats.min, 
+                    newstats.min,
                     newstats.max)::summarystats;
         ELSE
             ret := (COALESCE(ss.count,0) + COALESCE(newstats.count, 0),
                     COALESCE(ss.sum,0) + COALESCE(newstats.sum, 0),
                     null,
                     null,
-                    least(ss.min, newstats.min), 
+                    least(ss.min, newstats.min),
                     greatest(ss.max, newstats.max))::summarystats;
         END IF;
         RETURN ret;
@@ -50,16 +50,16 @@
     LANGUAGE 'plpgsql';
 
 CREATE OR REPLACE FUNCTION raster_summarystatsstate(ss summarystats, rast raster)
-    RETURNS summarystats 
+    RETURNS summarystats
     AS $$
         SELECT raster_summarystatsstate($1, $2, 1, true, 1);
     $$ LANGUAGE 'SQL';
 
 ---------------------------------------------------------------------
 -- raster_summarystatsfinal
--- Final function used by the ST_SummaryStatsAgg aggregate 
+-- Final function used by the ST_SummaryStatsAgg aggregate
 CREATE OR REPLACE FUNCTION raster_summarystatsfinal(ss summarystats)
-    RETURNS summarystats 
+    RETURNS summarystats
     AS $$
     DECLARE
         ret summarystats;
@@ -92,8 +92,8 @@
 );
 
 -- Test
-CREATE OR REPLACE FUNCTION ST_TestRaster(h integer, w integer, val float8) 
-    RETURNS raster AS 
+CREATE OR REPLACE FUNCTION ST_TestRaster(h integer, w integer, val float8)
+    RETURNS raster AS
     $$
     DECLARE
     BEGIN
@@ -103,11 +103,11 @@
     LANGUAGE 'plpgsql';
 
 SELECT id,
-       (ss).count, 
-       (ss).sum, 
-       (ss).mean, 
-       (ss).stddev, 
-       (ss).min, 
+       (ss).count,
+       (ss).sum,
+       (ss).mean,
+       (ss).stddev,
+       (ss).min,
        (ss).max
 FROM (SELECT ST_SummaryStatsAgg(rast) as ss, id
       FROM (SELECT 1 id, ST_TestRaster(2, 2, 2) rast

Modified: trunk/raster/scripts/plpgsql/st_tile.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_tile.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_tile.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -5,21 +5,21 @@
 --
 ----------------------------------------------------------------------
 -- ST_Tile
--- Split a raster into a set of raster tiles, one tile per row returned. 
--- Works on multiband rasters. There is no way to specify the upper left 
--- corner of the new tiled grid. The grid start at the upperleft corner 
+-- Split a raster into a set of raster tiles, one tile per row returned.
+-- Works on multiband rasters. There is no way to specify the upper left
+-- corner of the new tiled grid. The grid start at the upperleft corner
 -- of the provided raster.
 --
 -- rast   - Raster to be tiled.
 -- width  - Width of the tiles.
 -- height - Height of the tiles
--- padwithnodata - If TRUE, the produced tiles are strictly width x heigth pixels. 
---                 Pixels outside the extent of the passed raster are filled with 
---                 nodata value. When FALSE out of bound tiles are clipped to the 
+-- padwithnodata - If TRUE, the produced tiles are strictly width x heigth pixels.
+--                 Pixels outside the extent of the passed raster are filled with
+--                 nodata value. When FALSE out of bound tiles are clipped to the
 --                 extent of the raster. Default to FALSE.
--- nodatavalue   - nodata value to use to pad the outbound tiles when the provided 
---                 raster do not have a nodata value defined. If not provided and 
---                 the raster do not have a nodata value defined 
+-- nodatavalue   - nodata value to use to pad the outbound tiles when the provided
+--                 raster do not have a nodata value defined. If not provided and
+--                 the raster do not have a nodata value defined
 --                 ST_MinPossibleValue(ST_BandPixelType(rast, band)) is used for each band.
 --
 -- Example producing 120 x 120 pixel tiles
@@ -29,8 +29,8 @@
 -- FROM srtm_22_03;
 ----------------------------------------------------------------------------------------------------------------------
 DROP FUNCTION IF EXISTS ST_Tile(rast raster, width integer, height integer, padwithnodata boolean, nodatavalue double precision);
-CREATE OR REPLACE FUNCTION ST_Tile(rast raster, width integer, height integer, padwithnodata boolean DEFAULT FALSE, nodatavalue double precision DEFAULT NULL) 
-    RETURNS SETOF raster AS 
+CREATE OR REPLACE FUNCTION ST_Tile(rast raster, width integer, height integer, padwithnodata boolean DEFAULT FALSE, nodatavalue double precision DEFAULT NULL)
+    RETURNS SETOF raster AS
     $$
     DECLARE
         gridrast raster;
@@ -50,7 +50,7 @@
         IF rast IS NULL THEN
             RETURN;
         END IF;
-    
+
         nbband := ST_Numbands(rast);
         IF nbband < 1 THEN
                 RAISE NOTICE 'Raster do not have band %. Returning null', band;
@@ -101,20 +101,20 @@
     END;
     $$
     LANGUAGE 'plpgsql';
-    
+
 ----------------------------------------------------------------------
 -- ST_TileAsGeom
--- Split a raster into a set of raster tiles, returning only the geometry 
--- corresponding to each tile. 
--- There is no way to specify the upper left corner of the new tiled grid. 
+-- Split a raster into a set of raster tiles, returning only the geometry
+-- corresponding to each tile.
+-- There is no way to specify the upper left corner of the new tiled grid.
 -- The grid start at the upperleft corner of the provided raster.
 --
 -- rast   - Raster to be tiled.
 -- width  - Width of the tiles.
 -- height - Height of the tiles
--- padwithnodata - If TRUE, the produced tiles are strictly width x heigth pixels. 
---                 Pixels outside the extent of the passed raster are filled with 
---                 nodata value. When FALSE out of bound tiles are clipped to the 
+-- padwithnodata - If TRUE, the produced tiles are strictly width x heigth pixels.
+--                 Pixels outside the extent of the passed raster are filled with
+--                 nodata value. When FALSE out of bound tiles are clipped to the
 --                 extent of the raster. Default to FALSE.
 --
 -- Example producing 120 x 120 pixel tiles
@@ -123,8 +123,8 @@
 -- FROM srtm_22_03;
 ----------------------------------------------------------------------------------------------------------------------
 DROP FUNCTION IF EXISTS ST_TileAsGeom(rast raster, width integer, height integer, padwithnodata boolean);
-CREATE OR REPLACE FUNCTION ST_TileAsGeom(rast raster, width integer, height integer, padwithnodata boolean DEFAULT FALSE) 
-    RETURNS SETOF geometry AS 
+CREATE OR REPLACE FUNCTION ST_TileAsGeom(rast raster, width integer, height integer, padwithnodata boolean DEFAULT FALSE)
+    RETURNS SETOF geometry AS
     $$
     DECLARE
         gridrast raster;
@@ -138,7 +138,7 @@
         IF rast IS NULL THEN
             RETURN;
         END IF;
-    
+
         nbband := ST_Numbands(rast);
         IF nbband < 1 THEN
                 RAISE NOTICE 'Raster do not have band %. Returning null', band;
@@ -172,8 +172,8 @@
 
 
 -- Redefine ST_TestRaster()
-CREATE OR REPLACE FUNCTION ST_TestRaster(ulx float8, uly float8, val float8) 
-    RETURNS raster AS 
+CREATE OR REPLACE FUNCTION ST_TestRaster(ulx float8, uly float8, val float8)
+    RETURNS raster AS
     $$
     DECLARE
     BEGIN

Modified: trunk/raster/scripts/plpgsql/st_union.sql
===================================================================
--- trunk/raster/scripts/plpgsql/st_union.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/scripts/plpgsql/st_union.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -11,23 +11,23 @@
 CREATE TYPE rastexpr AS (
     rast raster,
     f_expression text,
-    f_nodata1expr text, 
+    f_nodata1expr text,
     f_nodata2expr text,
-    f_nodatanodataval double precision 
+    f_nodatanodataval double precision
 );
 
 --DROP FUNCTION MapAlgebra4Union(rast1 raster, rast2 raster, expression text);
-CREATE OR REPLACE FUNCTION MapAlgebra4Union(rast1 raster, 
-                                            rast2 raster, 
-                                            p_expression text, 
-                                            p_nodata1expr text, 
-                                            p_nodata2expr text, 
-                                            p_nodatanodataval double precision, 
-                                            t_expression text, 
-                                            t_nodata1expr text, 
-                                            t_nodata2expr text, 
+CREATE OR REPLACE FUNCTION MapAlgebra4Union(rast1 raster,
+                                            rast2 raster,
+                                            p_expression text,
+                                            p_nodata1expr text,
+                                            p_nodata2expr text,
+                                            p_nodatanodataval double precision,
+                                            t_expression text,
+                                            t_nodata1expr text,
+                                            t_nodata2expr text,
                                             t_nodatanodataval double precision)
-    RETURNS raster AS 
+    RETURNS raster AS
     $$
     DECLARE
         t_raster raster;
@@ -61,7 +61,7 @@
                 t_raster = ST_MapAlgebraExpr(rast1, 2, rast2, 1, t_expression, NULL::text, 'UNION'::text, t_nodata1expr, t_nodata2expr, t_nodatanodataval::double precision);
                 p_raster = ST_MapAlgebraExpr(rast1, 1, rast2, 1, p_expression, NULL::text, 'UNION'::text, p_nodata1expr, p_nodata2expr, p_nodatanodataval::double precision);
                 RETURN ST_AddBand(p_raster, t_raster, 1, 2);
-            END IF;     
+            END IF;
             RETURN ST_MapAlgebraExpr(rast1, 1, rast2, 1, p_expression, NULL, 'UNION'::text, NULL::text, NULL::text, NULL::double precision);
         END IF;
     END;
@@ -69,7 +69,7 @@
     LANGUAGE 'plpgsql';
 
 CREATE OR REPLACE FUNCTION MapAlgebra4UnionFinal3(rast rastexpr)
-    RETURNS raster AS 
+    RETURNS raster AS
     $$
     DECLARE
     BEGIN
@@ -79,7 +79,7 @@
     LANGUAGE 'plpgsql';
 
 CREATE OR REPLACE FUNCTION MapAlgebra4UnionFinal1(rast rastexpr)
-    RETURNS raster AS 
+    RETURNS raster AS
     $$
     DECLARE
     BEGIN
@@ -95,81 +95,81 @@
     LANGUAGE 'plpgsql';
 
 
-CREATE OR REPLACE FUNCTION MapAlgebra4Union(rast1 rastexpr, 
-                        rast2 raster, 
-                        p_expression text, 
-                        p_nodata1expr text, 
-                        p_nodata2expr text, 
-                        p_nodatanodataval double precision, 
-                        t_expression text, 
-                        t_nodata1expr text, 
-                        t_nodata2expr text, 
-                        t_nodatanodataval double precision, 
+CREATE OR REPLACE FUNCTION MapAlgebra4Union(rast1 rastexpr,
+                        rast2 raster,
+                        p_expression text,
+                        p_nodata1expr text,
+                        p_nodata2expr text,
+                        p_nodatanodataval double precision,
+                        t_expression text,
+                        t_nodata1expr text,
+                        t_nodata2expr text,
+                        t_nodatanodataval double precision,
                         f_expression text,
-                        f_nodata1expr text, 
-                        f_nodata2expr text, 
+                        f_nodata1expr text,
+                        f_nodata2expr text,
                         f_nodatanodataval double precision)
-    RETURNS rastexpr 
+    RETURNS rastexpr
     AS $$
         SELECT (MapAlgebra4Union(($1).rast, $2, $3, $4, $5, $6, $7, $8, $9, $10), $11, $12, $13, $14)::rastexpr
     $$ LANGUAGE 'SQL';
 
-CREATE OR REPLACE FUNCTION MapAlgebra4Union(rast1 rastexpr, 
-                        rast2 raster, 
-                        p_expression text, 
-                        t_expression text, 
+CREATE OR REPLACE FUNCTION MapAlgebra4Union(rast1 rastexpr,
+                        rast2 raster,
+                        p_expression text,
+                        t_expression text,
                         f_expression text)
-    RETURNS rastexpr 
+    RETURNS rastexpr
     AS $$
         SELECT (MapAlgebra4Union(($1).rast, $2, $3, NULL, NULL, NULL, $4, NULL, NULL, NULL), $5, NULL, NULL, NULL)::rastexpr
     $$ LANGUAGE 'SQL';
 
-CREATE OR REPLACE FUNCTION MapAlgebra4Union(rast1 rastexpr, 
-                        rast2 raster, 
-                        p_expression text, 
-                        p_nodata1expr text, 
-                        p_nodata2expr text, 
-                        p_nodatanodataval double precision, 
-                        t_expression text, 
-                        t_nodata1expr text, 
-                        t_nodata2expr text, 
+CREATE OR REPLACE FUNCTION MapAlgebra4Union(rast1 rastexpr,
+                        rast2 raster,
+                        p_expression text,
+                        p_nodata1expr text,
+                        p_nodata2expr text,
+                        p_nodatanodataval double precision,
+                        t_expression text,
+                        t_nodata1expr text,
+                        t_nodata2expr text,
                         t_nodatanodataval double precision)
-    RETURNS rastexpr 
+    RETURNS rastexpr
     AS $$
         SELECT (MapAlgebra4Union(($1).rast, $2, $3, $4, $5, $6, $7, $8, $9, $10), NULL, NULL, NULL, NULL)::rastexpr
     $$ LANGUAGE 'SQL';
 
-CREATE OR REPLACE FUNCTION MapAlgebra4Union(rast1 rastexpr, 
-                        rast2 raster, 
-                        p_expression text, 
+CREATE OR REPLACE FUNCTION MapAlgebra4Union(rast1 rastexpr,
+                        rast2 raster,
+                        p_expression text,
                         t_expression text)
-    RETURNS rastexpr 
+    RETURNS rastexpr
     AS $$
         SELECT (MapAlgebra4Union(($1).rast, $2, $3, NULL, NULL, NULL, $4, NULL, NULL, NULL), NULL, NULL, NULL, NULL)::rastexpr
     $$ LANGUAGE 'SQL';
 
-CREATE OR REPLACE FUNCTION MapAlgebra4Union(rast1 rastexpr, 
-                        rast2 raster, 
-                        p_expression text, 
-                        p_nodata1expr text, 
-                        p_nodata2expr text, 
+CREATE OR REPLACE FUNCTION MapAlgebra4Union(rast1 rastexpr,
+                        rast2 raster,
+                        p_expression text,
+                        p_nodata1expr text,
+                        p_nodata2expr text,
                         p_nodatanodataval double precision)
-    RETURNS rastexpr 
+    RETURNS rastexpr
     AS $$
         SELECT (MapAlgebra4Union(($1).rast, $2, $3, $4, $5, $6, NULL, NULL, NULL, NULL), NULL, NULL, NULL, NULL)::rastexpr
     $$ LANGUAGE 'SQL';
 
-CREATE OR REPLACE FUNCTION MapAlgebra4Union(rast1 rastexpr, 
-                        rast2 raster, 
+CREATE OR REPLACE FUNCTION MapAlgebra4Union(rast1 rastexpr,
+                        rast2 raster,
                         p_expression text)
-    RETURNS rastexpr 
+    RETURNS rastexpr
     AS $$
         SELECT (MapAlgebra4Union(($1).rast, $2, $3, NULL, NULL, NULL, NULL, NULL, NULL, NULL), $3, NULL, NULL, NULL)::rastexpr
     $$ LANGUAGE 'SQL';
 
-CREATE OR REPLACE FUNCTION MapAlgebra4Union(rast1 rastexpr, 
+CREATE OR REPLACE FUNCTION MapAlgebra4Union(rast1 rastexpr,
                         rast2 raster)
-    RETURNS rastexpr 
+    RETURNS rastexpr
     AS $$
         SELECT (MapAlgebra4Union(($1).rast, $2, 'LAST', NULL, NULL, NULL, NULL, NULL, NULL, NULL), NULL, NULL, NULL, NULL)::rastexpr
     $$ LANGUAGE 'SQL';
@@ -221,72 +221,72 @@
 );
 
 -- Test ST_TestRaster
-SELECT ST_AsBinary((rast).geom), (rast).val 
+SELECT ST_AsBinary((rast).geom), (rast).val
 FROM (SELECT ST_PixelAsPolygons(ST_TestRaster(0, 0, 2)) rast) foo;
 
 -- Test St_Union
-SELECT ST_AsBinary((rast).geom), (rast).val 
-FROM (SELECT ST_PixelAsPolygons(ST_Union(rast, 'mean'), 1) rast 
-      FROM (SELECT ST_TestRaster(1, 0, 6) AS rast 
-            UNION ALL 
-            SELECT ST_TestRaster(1, 1, 4) AS rast 
-            UNION ALL 
+SELECT ST_AsBinary((rast).geom), (rast).val
+FROM (SELECT ST_PixelAsPolygons(ST_Union(rast, 'mean'), 1) rast
+      FROM (SELECT ST_TestRaster(1, 0, 6) AS rast
+            UNION ALL
+            SELECT ST_TestRaster(1, 1, 4) AS rast
+            UNION ALL
             SELECT ST_TestRaster(-1, 0, 6) AS rast
-            UNION ALL 
-            SELECT ST_TestRaster(0, 0, 2) AS rast 
+            UNION ALL
+            SELECT ST_TestRaster(0, 0, 2) AS rast
             ) foi) foo
 
 -- Test St_Union merging a blending merge of disjoint raster
-SELECT ST_AsBinary((rast).geom), (rast).val 
-FROM (SELECT ST_PixelAsPolygons(ST_Union(rast, 'last'), 1) rast 
-      FROM (SELECT ST_TestRaster(0, 0, 1) AS rast 
-            UNION ALL 
-            SELECT ST_TestRaster(3, 0, 2) AS rast 
-            UNION ALL 
+SELECT ST_AsBinary((rast).geom), (rast).val
+FROM (SELECT ST_PixelAsPolygons(ST_Union(rast, 'last'), 1) rast
+      FROM (SELECT ST_TestRaster(0, 0, 1) AS rast
+            UNION ALL
+            SELECT ST_TestRaster(3, 0, 2) AS rast
+            UNION ALL
             SELECT ST_TestRaster(3, 3, 4) AS rast
-            UNION ALL 
-            SELECT ST_TestRaster(0, 3, 3) AS rast 
+            UNION ALL
+            SELECT ST_TestRaster(0, 3, 3) AS rast
             ) foi) foo
 
-      
+
 -- Explicit implementation of 'MEAN' to make sure directly passing expressions works properly
-SELECT ST_AsBinary((rast).geom), (rast).val 
+SELECT ST_AsBinary((rast).geom), (rast).val
 FROM (SELECT ST_PixelAsPolygons(ST_Union(rast, '[rast1.val] + [rast2.val]'::text, '[rast2.val]'::text, '[rast1.val]'::text, NULL::double precision,
                                                '[rast1.val] + 1'::text, '1'::text, '[rast1.val]'::text, 0::double precision,
-                                               'CASE WHEN [rast2.val] > 0 THEN [rast1.val] / [rast2.val]::float8 ELSE NULL END'::text, NULL::text, NULL::text, NULL::double precision), 1) rast 
-      FROM (SELECT ST_TestRaster(0, 0, 2) AS rast 
-            UNION ALL 
-            SELECT ST_TestRaster(1, 1, 4) AS rast 
-            UNION ALL 
-            SELECT ST_TestRaster(1, 0, 6) AS rast 
-            UNION ALL 
+                                               'CASE WHEN [rast2.val] > 0 THEN [rast1.val] / [rast2.val]::float8 ELSE NULL END'::text, NULL::text, NULL::text, NULL::double precision), 1) rast
+      FROM (SELECT ST_TestRaster(0, 0, 2) AS rast
+            UNION ALL
+            SELECT ST_TestRaster(1, 1, 4) AS rast
+            UNION ALL
+            SELECT ST_TestRaster(1, 0, 6) AS rast
+            UNION ALL
             SELECT ST_TestRaster(-1, 0, 6) AS rast
             ) foi) foo
 
 -- Pseudo-explicit implementation of 'MEAN' using other predefined functions. Do not work yet...
-SELECT ST_AsBinary((rast).geom), (rast).val 
-FROM (SELECT ST_PixelAsPolygons(ST_Union(rast, 'SUM'::text, 
-                                               'COUNT'::text, 
-                                               'CASE WHEN [rast2.val] > 0 THEN [rast1.val] / [rast2.val]::float8 ELSE NULL END'::text), 1) rast 
-      FROM (SELECT ST_TestRaster(0, 0, 2) AS rast 
-            UNION ALL 
-            SELECT ST_TestRaster(1, 1, 4) AS rast 
-            UNION ALL 
-            SELECT ST_TestRaster(1, 0, 6) AS rast 
-            UNION ALL 
+SELECT ST_AsBinary((rast).geom), (rast).val
+FROM (SELECT ST_PixelAsPolygons(ST_Union(rast, 'SUM'::text,
+                                               'COUNT'::text,
+                                               'CASE WHEN [rast2.val] > 0 THEN [rast1.val] / [rast2.val]::float8 ELSE NULL END'::text), 1) rast
+      FROM (SELECT ST_TestRaster(0, 0, 2) AS rast
+            UNION ALL
+            SELECT ST_TestRaster(1, 1, 4) AS rast
+            UNION ALL
+            SELECT ST_TestRaster(1, 0, 6) AS rast
+            UNION ALL
             SELECT ST_TestRaster(-1, 0, 6) AS rast
             ) foi) foo
 
 
-SELECT ST_AsBinary((rast).geom), (rast).val 
-FROM (SELECT ST_PixelAsPolygons(ST_Union(rast), 1) AS rast 
+SELECT ST_AsBinary((rast).geom), (rast).val
+FROM (SELECT ST_PixelAsPolygons(ST_Union(rast), 1) AS rast
       FROM (SELECT ST_TestRaster(0, 0, 1) AS rast UNION ALL SELECT ST_TestRaster(2, 0, 2)
            ) foi
      ) foo
 
 
-SELECT ST_AsBinary((rast).geom), (rast).val 
-FROM (SELECT ST_PixelAsPolygons(ST_Union(rast, 'mean'), 1) AS rast 
+SELECT ST_AsBinary((rast).geom), (rast).val
+FROM (SELECT ST_PixelAsPolygons(ST_Union(rast, 'mean'), 1) AS rast
       FROM (SELECT ST_TestRaster(0, 0, 1) AS rast UNION ALL SELECT ST_TestRaster(1, 0, 2) UNION ALL SELECT ST_TestRaster(0, 1, 6)
            ) foi
      ) foo

Modified: trunk/raster/test/cunit/cu_band_misc.c
===================================================================
--- trunk/raster/test/cunit/cu_band_misc.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/cunit/cu_band_misc.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -177,7 +177,7 @@
 
 	rtn = rt_pixel_set_to_array(
 		npixels, rtn, NULL,
-		-1, 1, 
+		-1, 1,
 		1, 1,
 		&value,
 		&nodata,
@@ -438,19 +438,19 @@
 		1,
 		&npixels
 	);
-       
+
        CU_ASSERT_EQUAL(rtn,8);
-       
+
        	rtn = rt_pixel_set_to_array(
 		npixels, rtn, mask,
-		4,4, 
+		4,4,
 		1, 1,
 		&value,
 		&nodata,
 		&dimx, &dimy
 	);
-				  
-       
+				
+
        rtdealloc(npixels);
        CU_ASSERT_EQUAL(rtn, ES_NONE);
        CU_ASSERT_EQUAL(dimx, 3);
@@ -477,8 +477,8 @@
 	mask->dimx = maskX;
 	mask->dimy = maskY;
 	mask->weighted = 0;
-       
 
+
        rtn = rt_band_get_nearest_pixel(
 		band,
 		4,4,
@@ -486,19 +486,19 @@
 		1,
 		&npixels
 	);
-       
+
        CU_ASSERT_EQUAL(rtn,8);
-       
+
        	rtn = rt_pixel_set_to_array(
 		npixels, rtn, mask,
-		4,4, 
+		4,4,
 		1, 1,
 		&value,
 		&nodata,
 		&dimx, &dimy
 	);
-				  
-       
+				
+
        rtdealloc(npixels);
        CU_ASSERT_EQUAL(rtn, ES_NONE);
        CU_ASSERT_EQUAL(dimx, 3);
@@ -534,19 +534,19 @@
 		1,
 		&npixels
 	);
-       
+
        CU_ASSERT_EQUAL(rtn,8);
-       
+
        	rtn = rt_pixel_set_to_array(
 		npixels, rtn, mask,
-		4,4, 
+		4,4,
 		1, 1,
 		&value,
 		&nodata,
 		&dimx, &dimy
 	);
-				  
-       
+				
+
        rtdealloc(npixels);
        CU_ASSERT_EQUAL(rtn, ES_NONE);
        CU_ASSERT_EQUAL(dimx, 3);

Modified: trunk/raster/test/cunit/cu_gdal.c
===================================================================
--- trunk/raster/test/cunit/cu_gdal.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/cunit/cu_gdal.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -125,7 +125,7 @@
 		for (x = 0; x < rt_band_get_width(band); ++x)
 			for (y = 0; y < rt_band_get_height(band); ++y)
 				rt_band_set_pixel(band, x, y, 0.0, NULL);
-	} 
+	}
 
 	rt_band_set_pixel(band, 3, 1, 1.8, NULL);
 	rt_band_set_pixel(band, 4, 1, 1.8, NULL);

Modified: trunk/raster/test/cunit/cu_mapalgebra.c
===================================================================
--- trunk/raster/test/cunit/cu_mapalgebra.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/cunit/cu_mapalgebra.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -933,7 +933,7 @@
 	colormap->method = CM_INTERPOLATE;
 
 	rtn = rt_raster_colormap(
-		raster, 0, 
+		raster, 0,
 		colormap
 	);
 	CU_ASSERT(rtn != NULL);
@@ -954,7 +954,7 @@
 	colormap->ncolor = 4;
 
 	rtn = rt_raster_colormap(
-		raster, 0, 
+		raster, 0,
 		colormap
 	);
 	CU_ASSERT(rtn != NULL);
@@ -965,7 +965,7 @@
 	colormap->method = CM_EXACT;
 
 	rtn = rt_raster_colormap(
-		raster, 0, 
+		raster, 0,
 		colormap
 	);
 	CU_ASSERT(rtn != NULL);
@@ -990,7 +990,7 @@
 	colormap->method = CM_NEAREST;
 
 	rtn = rt_raster_colormap(
-		raster, 0, 
+		raster, 0,
 		colormap
 	);
 	CU_ASSERT(rtn != NULL);
@@ -1020,7 +1020,7 @@
 	colormap->method = CM_NEAREST;
 
 	rtn = rt_raster_colormap(
-		raster, 0, 
+		raster, 0,
 		colormap
 	);
 	CU_ASSERT(rtn != NULL);
@@ -1144,7 +1144,7 @@
 	colormap->method = CM_INTERPOLATE;
 
 	rtn = rt_raster_colormap(
-		raster, 0, 
+		raster, 0,
 		colormap
 	);
 	CU_ASSERT(rtn != NULL);

Modified: trunk/raster/test/cunit/cu_misc.c
===================================================================
--- trunk/raster/test/cunit/cu_misc.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/cunit/cu_misc.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -134,7 +134,7 @@
 	CU_ASSERT(ds == NULL);
 
 	/* enabled drivers with VSICURL */
-	/* disabled as we don't want network access as a requirement 
+	/* disabled as we don't want network access as a requirement
 	gdal_enabled_drivers = enabled_vsi;
 	ds = rt_util_gdal_open("/vsicurl/http://download.osgeo.org/gdal/data/gtiff/small_world.tif", GA_ReadOnly, 0);
 	CU_ASSERT(ds != NULL);

Modified: trunk/raster/test/cunit/cu_tester.c
===================================================================
--- trunk/raster/test/cunit/cu_tester.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/cunit/cu_tester.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -15,7 +15,7 @@
 #include "cu_tester.h"
 
 /* Internal funcs */
-static void 
+static void
 cu_error_reporter(const char *fmt, va_list ap);
 
 /* ADD YOUR SUITE SETUP FUNCTION HERE (1 of 2) */

Modified: trunk/raster/test/regress/box3d.sql
===================================================================
--- trunk/raster/test/regress/box3d.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/box3d.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -25,11 +25,11 @@
 );
 
 -- 10x20, ip:0.5,0.5 scale:2,3
-INSERT INTO rt_box3d_test 
+INSERT INTO rt_box3d_test
 VALUES ( 0, '10x20, ip:0.5,0.5 scale:2,3 skew:0,0',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -55,11 +55,11 @@
 ,'BOX3D(0.5 0.5,20.5 60.5 0)' -- expected envelope (20x60) == (10*2 x 20*3)
 );
 
-INSERT INTO rt_box3d_test 
+INSERT INTO rt_box3d_test
 VALUES ( 1, '1x1, ip:2.5,2.5 scale:5,5 skew:0,0',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -82,14 +82,14 @@
 ||
 '0100' -- height (uint16 1)
 )::raster
-,'BOX3D(2.5 2.5,7.5 7.5 0)' -- expected envelope 
+,'BOX3D(2.5 2.5,7.5 7.5 0)' -- expected envelope
 );
 
-INSERT INTO rt_box3d_test 
+INSERT INTO rt_box3d_test
 VALUES ( 2, '1x1, ip:7.5,2.5 scale:5,5 skew:0,0',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -112,7 +112,7 @@
 ||
 '0100' -- height (uint16 1)
 )::raster
-,'BOX3D(7.5 2.5,12.5 7.5 0)' -- expected envelope 
+,'BOX3D(7.5 2.5,12.5 7.5 0)' -- expected envelope
 );
 
 -----------------------------------------------------------------------

Modified: trunk/raster/test/regress/bug_test_car5.sql
===================================================================
--- trunk/raster/test/regress/bug_test_car5.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/bug_test_car5.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -20,7 +20,7 @@
 -- on 32-bit platform. The problem was reproduced on 32-bit
 -- Unix 32-bit system (Linux, Ubuntu 8.10) and was not reproduced on
 -- Unix 64-bit system (Linux, Ubuntu 9.04).
--- 
+--
 -- There is likely a bug related to reaster data alignment.
 -- Problem leaked in SVN trunk r3951.
 -----------------------------------------------------------------------

Modified: trunk/raster/test/regress/check_gdal.sql
===================================================================
--- trunk/raster/test/regress/check_gdal.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/check_gdal.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,19 +1,19 @@
 -- postgis.gdal_datapath
-SELECT 
+SELECT
 	CASE
 		WHEN strpos(postgis_gdal_version(), 'GDAL_DATA') <> 0
 			THEN false
 		ELSE NULL
 	END;
 SET postgis.gdal_datapath = '';
-SELECT 
+SELECT
 	CASE
 		WHEN strpos(postgis_gdal_version(), 'GDAL_DATA') <> 0
 			THEN NULL
 		ELSE TRUE
 	END;
 SET postgis.gdal_datapath = default;
-SELECT 
+SELECT
 	CASE
 		WHEN strpos(postgis_gdal_version(), 'GDAL_DATA') <> 0
 			THEN false

Modified: trunk/raster/test/regress/check_raster_columns.sql
===================================================================
--- trunk/raster/test/regress/check_raster_columns.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/check_raster_columns.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -107,7 +107,7 @@
 SELECT AddRasterConstraints(current_schema(), 'test_raster_columns', 'rast'::name, 'regular_blocking');
 SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, ST_AsEWKT(extent) FROM raster_columns WHERE r_table_name = 'test_raster_columns';
 
--- spatially unique, this should fail 
+-- spatially unique, this should fail
 SELECT make_test_raster(0, 3, 3, 0, 0);
 
 -- coverage tile, this should fail

Modified: trunk/raster/test/regress/permitted_gdal_drivers.sql
===================================================================
--- trunk/raster/test/regress/permitted_gdal_drivers.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/permitted_gdal_drivers.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -48,7 +48,7 @@
 		'passwd' AS lbl,
 		'0100000100000000000000F03F000000000000F0BF0000000000000000000000000000000000000000000000000000000000000000110F0000E80301008400003C56525444617461736574207261737465725853697A653D223130303022207261737465725953697A653D2231223E3C56525452617374657242616E642062616E643D22312220737562436C6173733D2256525452617752617374657242616E64223E3C536F7572636546696C656E616D653E2F6574632F7061737377643C2F536F7572636546696C656E616D653E3C2F56525452617374657242616E643E3C2F565254446174617365743E00'::raster AS r
 	UNION ALL
-	SELECT 
+	SELECT
 		'inline' AS lbl,
 		'0100000100000000000000F03F000000000000F03F00000000000020C000000000000020C000000000000000000000000000000000110F000010001000440000000000000101010101010000000000000000010101010101010101010000000000010101010101010101010101000000010101010101010101010101010100000101010101010101010101010101000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010001010101010101010101010101010000010101010101010101010101010100000001010101010101010101010100000000000101010101010101010100000000000000000101010101010000000000'::raster AS r
 ;

Modified: trunk/raster/test/regress/rt_band_properties.sql
===================================================================
--- trunk/raster/test/regress/rt_band_properties.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_band_properties.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -37,7 +37,7 @@
     rast raster
 );
 
-INSERT INTO rt_band_properties_test 
+INSERT INTO rt_band_properties_test
 VALUES ( 1, '1x1, nbband:2 b1pixeltype:4BUI b1hasnodatavalue:true b1nodatavalue:3 b2pixeltype:16BSI b2hasnodatavalue:false b2nodatavalue:13',
         2, --- nbband
         '4BUI', true, 3, 2,   --- b1pixeltype, b1hasnodatavalue, b1nodatavalue, b1val
@@ -45,7 +45,7 @@
         'POLYGON((782325.5 26744042.5,782330.5 26744045.5,782333.5 26744040.5,782328.5 26744037.5,782325.5 26744042.5))',
 (
 '01' -- big endian (uint8 xdr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0200' -- nBands (uint16 2)
@@ -70,7 +70,7 @@
 ||
 '4' -- hasnodatavalue set to true
 ||
-'2' -- first band type (4BUI) 
+'2' -- first band type (4BUI)
 ||
 '03' -- novalue==3
 ||
@@ -86,7 +86,7 @@
 )::raster
 );
 
-INSERT INTO rt_band_properties_test 
+INSERT INTO rt_band_properties_test
 VALUES ( 2, '1x1, nbband:2 b1pixeltype:4BUI b1hasnodatavalue:true b1nodatavalue:3 b2pixeltype:16BSI b2hasnodatavalue:false b2nodatavalue:13',
         2, --- nbband
         '4BUI', true, 3, 2,   --- b1pixeltype, b1hasnodatavalue, b1nodatavalue, b1val
@@ -94,7 +94,7 @@
         'POLYGON((-75.5533328537098 49.2824585505576,-75.5525268884758 49.2826703629415,-75.5523150760919 49.2818643977075,-75.553121041326 49.2816525853236,-75.5533328537098 49.2824585505576))',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0200' -- nBands (uint16 0)
@@ -119,7 +119,7 @@
 ||
 '4' -- hasnodatavalue set to true
 ||
-'2' -- first band type (4BUI) 
+'2' -- first band type (4BUI)
 ||
 '03' -- novalue==3
 ||
@@ -135,7 +135,7 @@
 )::raster
 );
 
-INSERT INTO rt_band_properties_test 
+INSERT INTO rt_band_properties_test
 VALUES ( 3, '1x1, nbband:2 b1pixeltype:4BUI b1hasnodatavalue:true b1nodatavalue:3 b2pixeltype:16BSI b2hasnodatavalue:false b2nodatavalue:13',
         2, --- nbband
         '4BUI', true, 3, 3,   --- b1pixeltype, b1hasnodatavalue, b1nodatavalue, b1val
@@ -143,7 +143,7 @@
         'POLYGON((-75.5533328537098 49.2824585505576,-75.5525268884758 49.2826703629415,-75.5523150760919 49.2818643977075,-75.553121041326 49.2816525853236,-75.5533328537098 49.2824585505576))',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0200' -- nBands (uint16 0)
@@ -168,7 +168,7 @@
 ||
 '6' -- hasnodatavalue and isnodata set to true
 ||
-'2' -- first band type (4BUI) 
+'2' -- first band type (4BUI)
 ||
 '03' -- novalue==3
 ||
@@ -184,7 +184,7 @@
 )::raster
 );
 
-INSERT INTO rt_band_properties_test 
+INSERT INTO rt_band_properties_test
 VALUES ( 4, '1x1, nbband:2 b1pixeltype:4BUI b1hasnodatavalue:true b1nodatavalue:3 b2pixeltype:16BSI b2hasnodatavalue:false b2nodatavalue:13',
         2, --- nbband
         '4BUI', true, 3, 3,   --- b1pixeltype, b1hasnodatavalue, b1nodatavalue, b1val
@@ -192,7 +192,7 @@
         'POLYGON((-75.5533328537098 49.2824585505576,-75.5525268884758 49.2826703629415,-75.5523150760919 49.2818643977075,-75.553121041326 49.2816525853236,-75.5533328537098 49.2824585505576))',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0200' -- nBands (uint16 0)
@@ -217,7 +217,7 @@
 ||
 '4' -- hasnodatavalue set to true and isnodata set to false (should be updated)
 ||
-'2' -- first band type (4BUI) 
+'2' -- first band type (4BUI)
 ||
 '03' -- novalue==3
 ||

Modified: trunk/raster/test/regress/rt_bytea.sql
===================================================================
--- trunk/raster/test/regress/rt_bytea.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_bytea.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -23,11 +23,11 @@
         rast raster
     );
 
-INSERT INTO rt_bytea_test 
+INSERT INTO rt_bytea_test
 VALUES ( 0, '10x20, ip:0.5,0.5 scale:2,3 skew:0,0 srid:10 width:10 height:20',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -52,11 +52,11 @@
 )::raster
 );
 
-INSERT INTO rt_bytea_test 
+INSERT INTO rt_bytea_test
 VALUES ( 1, '1x1, ip:2.5,2.5 scale:5,5 skew:0,0, srid:1, width:1, height:1',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -81,11 +81,11 @@
 )::raster
 );
 
-INSERT INTO rt_bytea_test 
+INSERT INTO rt_bytea_test
 VALUES ( 2, '1x1, ip:7.5,2.5 scale:5,5 skew:0,0, srid:0, width:1, height:1',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -110,11 +110,11 @@
 )::raster
 );
 
-INSERT INTO rt_bytea_test 
+INSERT INTO rt_bytea_test
 VALUES ( 3, '1x1, ip:7.5,2.5 scale:5,5 skew:0,0, srid:-1, width:1, height:1',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -137,13 +137,13 @@
 ||
 '0100' -- height (uint16 1)
 )::raster
-); 
+);
 
 -----------------------------------------------------------------------
 --- Test HEX
 -----------------------------------------------------------------------
 
-SELECT 
+SELECT
 	id,
     name
 FROM rt_bytea_test
@@ -155,7 +155,7 @@
 --- Test Base64
 -----------------------------------------------------------------------
 
-SELECT 
+SELECT
 	id,
     name
 FROM rt_bytea_test
@@ -167,7 +167,7 @@
 --- Test Binary
 -----------------------------------------------------------------------
 
-SELECT 
+SELECT
 	id,
     name
 FROM rt_bytea_test

Modified: trunk/raster/test/regress/rt_dimensions.sql
===================================================================
--- trunk/raster/test/regress/rt_dimensions.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_dimensions.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -32,13 +32,13 @@
     rast raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 0, '10x20, ip:0.5,0.5 scale:2,3 skew:0,0 srid:10 width:10 height:20',
         10, 10, 20, --- SRID, width, height
         2, 3, 0.5, 0.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -63,13 +63,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 1, '1x1, ip:2.5,2.5 scale:5,5 skew:0,0, srid:12, width:1, height:1',
         12, 1, 1, --- SRID, width, height
          5, 5, 2.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -94,13 +94,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 2, '1x1, ip:7.5,2.5 scale:5,5 skew:0,0, srid:0, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -125,13 +125,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 3, '1x1, ip:7.5,2.5 scale:5,5 skew:0,0, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -154,15 +154,15 @@
 ||
 '0100' -- height (uint16 1)
 )::raster
-); 
+);
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 4, '1x1, ip:7.5,2.5 scale:5,5 skew:1,1, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 1, 1, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -187,13 +187,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 5, '1x1, ip:7.5,2.5 scale:5,5 skew:3,7, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 3, 7, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -216,7 +216,7 @@
 ||
 '0100' -- height (uint16 1)
 )::raster
-); 
+);
 
 -----------------------------------------------------------------------
 --- st_width

Modified: trunk/raster/test/regress/rt_dumpvalues.sql
===================================================================
--- trunk/raster/test/regress/rt_dumpvalues.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_dumpvalues.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -106,7 +106,7 @@
 CREATE TABLE raster_tile AS
     WITH foo AS (
         SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 0, 0, 1, -1, 0, 0, 0), 1, '8BUI', 1, 0), 2, '8BUI', 10, 0) AS rast UNION ALL
-        SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 3, 0, 1, -1, 0, 0, 0), 1, '8BUI', 2, 0), 2, '8BUI', 20, 0) AS rast 
+        SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 3, 0, 1, -1, 0, 0, 0), 1, '8BUI', 2, 0), 2, '8BUI', 20, 0) AS rast
     )
     SELECT ST_Union(rast) AS rast FROM foo;
 WITH foo AS (SELECT ST_Tile(rast, 3, 3, TRUE) AS rast FROM raster_tile) SELECT (ST_DumpValues(rast, array[1,2,3])).* FROM foo;

Modified: trunk/raster/test/regress/rt_gdalwarp.sql
===================================================================
--- trunk/raster/test/regress/rt_gdalwarp.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_gdalwarp.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -809,7 +809,7 @@
 -- ST_Resize()
 WITH foo AS(
 SELECT
-	1 AS rid, 
+	1 AS rid,
 	ST_Resize(
 		ST_AddBand(
 			ST_MakeEmptyRaster(1000, 1000, 0, 0, 1, -1, 0, 0, 0)
@@ -819,7 +819,7 @@
 	) AS rast
 UNION ALL
 SELECT
-	2 AS rid, 
+	2 AS rid,
 	ST_Resize(
 		ST_AddBand(
 			ST_MakeEmptyRaster(1000, 1000, 0, 0, 1, -1, 0, 0, 0)
@@ -829,7 +829,7 @@
 	) AS rast
 UNION ALL
 SELECT
-	3 AS rid, 
+	3 AS rid,
 	ST_Resize(
 		ST_AddBand(
 			ST_MakeEmptyRaster(1000, 1000, 0, 0, 1, -1, 0, 0, 0)
@@ -839,7 +839,7 @@
 	) AS rast
 UNION ALL
 SELECT -- ticket #2188
-	4 AS rid, 
+	4 AS rid,
 	ST_Resize(
 		ST_AddBand(
 			ST_MakeEmptyRaster(1000, 1000, 0, 0, 1, -1, 0, 0, 0)

Modified: trunk/raster/test/regress/rt_georeference.sql
===================================================================
--- trunk/raster/test/regress/rt_georeference.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_georeference.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -32,13 +32,13 @@
     rast raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 0, '10x20, ip:0.5,0.5 scale:2,3 skew:0,0 srid:10 width:10 height:20',
         10, 10, 20, --- SRID, width, height
         2, 3, 0.5, 0.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -63,13 +63,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 1, '1x1, ip:2.5,2.5 scale:5,5 skew:0,0, srid:12, width:1, height:1',
         12, 1, 1, --- SRID, width, height
          5, 5, 2.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -94,13 +94,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 2, '1x1, ip:7.5,2.5 scale:5,5 skew:0,0, srid:0, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -125,13 +125,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 3, '1x1, ip:7.5,2.5 scale:5,5 skew:0,0, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -154,15 +154,15 @@
 ||
 '0100' -- height (uint16 1)
 )::raster
-); 
+);
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 4, '1x1, ip:7.5,2.5 scale:5,5 skew:1,1, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 1, 1, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -187,13 +187,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 5, '1x1, ip:7.5,2.5 scale:5,5 skew:3,7, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 3, 7, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -216,99 +216,99 @@
 ||
 '0100' -- height (uint16 1)
 )::raster
-); 
+);
 
 -----------------------------------------------------------------------
 -- st_georeference (default)
 -----------------------------------------------------------------------
 
-SELECT 
+SELECT
     replace(st_georeference(rast)::text, E'\n', E'EOL'),
-    replace(st_georeference(rast)::text, E'\n', E'EOL') = 
+    replace(st_georeference(rast)::text, E'\n', E'EOL') =
     '2.0000000000EOL0.0000000000EOL0.0000000000EOL3.0000000000EOL0.5000000000EOL0.5000000000EOL'
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 0;
 
-SELECT 
+SELECT
     replace(st_georeference(rast)::text, E'\n', E'EOL'),
-    replace(st_georeference(rast)::text, E'\n', E'EOL') = 
+    replace(st_georeference(rast)::text, E'\n', E'EOL') =
     '5.0000000000EOL0.0000000000EOL0.0000000000EOL5.0000000000EOL2.5000000000EOL2.5000000000EOL'
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 1;
 
-SELECT 
+SELECT
     replace(st_georeference(rast)::text, E'\n', E'EOL'),
-    replace(st_georeference(rast)::text, E'\n', E'EOL') = 
+    replace(st_georeference(rast)::text, E'\n', E'EOL') =
     '5.0000000000EOL0.0000000000EOL0.0000000000EOL5.0000000000EOL7.5000000000EOL2.5000000000EOL'
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 2;
 
 
-SELECT 
+SELECT
     replace(st_georeference(rast)::text, E'\n', E'EOL'),
-    replace(st_georeference(rast)::text, E'\n', E'EOL') = 
+    replace(st_georeference(rast)::text, E'\n', E'EOL') =
     '5.0000000000EOL0.0000000000EOL0.0000000000EOL5.0000000000EOL7.5000000000EOL2.5000000000EOL'
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 3;
 
-SELECT 
+SELECT
     replace(st_georeference(rast)::text, E'\n', E'EOL'),
-    replace(st_georeference(rast)::text, E'\n', E'EOL') = 
+    replace(st_georeference(rast)::text, E'\n', E'EOL') =
     '5.0000000000EOL1.0000000000EOL1.0000000000EOL5.0000000000EOL7.5000000000EOL2.5000000000EOL'
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 4;
 
-SELECT 
+SELECT
     replace(st_georeference(rast)::text, E'\n', E'EOL'),
-    replace(st_georeference(rast)::text, E'\n', E'EOL') = 
+    replace(st_georeference(rast)::text, E'\n', E'EOL') =
     '5.0000000000EOL7.0000000000EOL3.0000000000EOL5.0000000000EOL7.5000000000EOL2.5000000000EOL'
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 5;
 
 -----------------------------------------------------------------------
 -- st_georeference (GDAL)
 -----------------------------------------------------------------------
 
-SELECT 
+SELECT
     replace(st_georeference(rast,'GDAL')::text, E'\n', E'EOL'),
-    replace(st_georeference(rast,'GDAL')::text, E'\n', E'EOL') = 
+    replace(st_georeference(rast,'GDAL')::text, E'\n', E'EOL') =
     '2.0000000000EOL0.0000000000EOL0.0000000000EOL3.0000000000EOL0.5000000000EOL0.5000000000EOL'
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 0;
 
-SELECT 
+SELECT
     replace(st_georeference(rast,'GDAL')::text, E'\n', E'EOL'),
-    replace(st_georeference(rast,'GDAL')::text, E'\n', E'EOL') = 
+    replace(st_georeference(rast,'GDAL')::text, E'\n', E'EOL') =
     '5.0000000000EOL0.0000000000EOL0.0000000000EOL5.0000000000EOL2.5000000000EOL2.5000000000EOL'
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 1;
 
-SELECT 
+SELECT
     replace(st_georeference(rast,'GDAL')::text, E'\n', E'EOL'),
-    replace(st_georeference(rast,'GDAL')::text, E'\n', E'EOL') = 
+    replace(st_georeference(rast,'GDAL')::text, E'\n', E'EOL') =
     '5.0000000000EOL0.0000000000EOL0.0000000000EOL5.0000000000EOL7.5000000000EOL2.5000000000EOL'
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 2;
 
-SELECT 
+SELECT
     replace(st_georeference(rast,'GDAL')::text, E'\n', E'EOL'),
-    replace(st_georeference(rast,'GDAL')::text, E'\n', E'EOL') = 
+    replace(st_georeference(rast,'GDAL')::text, E'\n', E'EOL') =
     '5.0000000000EOL0.0000000000EOL0.0000000000EOL5.0000000000EOL7.5000000000EOL2.5000000000EOL'
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 3;
 
-SELECT 
+SELECT
     replace(st_georeference(rast,'GDAL')::text, E'\n', E'EOL'),
-    replace(st_georeference(rast,'GDAL')::text, E'\n', E'EOL') = 
+    replace(st_georeference(rast,'GDAL')::text, E'\n', E'EOL') =
     '5.0000000000EOL1.0000000000EOL1.0000000000EOL5.0000000000EOL7.5000000000EOL2.5000000000EOL'
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 4;
 
-SELECT 
+SELECT
     replace(st_georeference(rast,'GDAL')::text, E'\n', E'EOL'),
-    replace(st_georeference(rast,'GDAL')::text, E'\n', E'EOL') = 
+    replace(st_georeference(rast,'GDAL')::text, E'\n', E'EOL') =
     '5.0000000000EOL7.0000000000EOL3.0000000000EOL5.0000000000EOL7.5000000000EOL2.5000000000EOL'
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 5;
 
 -----------------------------------------------------------------------
@@ -317,44 +317,44 @@
 
 SELECT
 	replace(st_georeference(rast,'ESRI')::text, E'\n', E'EOL'),
-	replace(st_georeference(rast,'ESRI')::text, E'\n', E'EOL') = 
+	replace(st_georeference(rast,'ESRI')::text, E'\n', E'EOL') =
     '2.0000000000EOL0.0000000000EOL0.0000000000EOL3.0000000000EOL1.5000000000EOL2.0000000000EOL'
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 0;
 
 SELECT
 	replace(st_georeference(rast,'ESRI')::text, E'\n', E'EOL'),
-	replace(st_georeference(rast,'ESRI')::text, E'\n', E'EOL') = 
+	replace(st_georeference(rast,'ESRI')::text, E'\n', E'EOL') =
     '5.0000000000EOL0.0000000000EOL0.0000000000EOL5.0000000000EOL5.0000000000EOL5.0000000000EOL'
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 1;
 
 SELECT
 	replace(st_georeference(rast,'ESRI')::text, E'\n', E'EOL'),
-	replace(st_georeference(rast,'ESRI')::text, E'\n', E'EOL') = 
+	replace(st_georeference(rast,'ESRI')::text, E'\n', E'EOL') =
     '5.0000000000EOL0.0000000000EOL0.0000000000EOL5.0000000000EOL10.0000000000EOL5.0000000000EOL'
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 2;
 
 SELECT
 	replace(st_georeference(rast,'ESRI')::text, E'\n', E'EOL'),
-	replace(st_georeference(rast,'ESRI')::text, E'\n', E'EOL') = 
+	replace(st_georeference(rast,'ESRI')::text, E'\n', E'EOL') =
     '5.0000000000EOL0.0000000000EOL0.0000000000EOL5.0000000000EOL10.0000000000EOL5.0000000000EOL'
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 3;
 
 SELECT
 	replace(st_georeference(rast,'ESRI')::text, E'\n', E'EOL'),
-	replace(st_georeference(rast,'ESRI')::text, E'\n', E'EOL') = 
+	replace(st_georeference(rast,'ESRI')::text, E'\n', E'EOL') =
     '5.0000000000EOL1.0000000000EOL1.0000000000EOL5.0000000000EOL10.0000000000EOL5.0000000000EOL'
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 4;
 
 SELECT
 	replace(st_georeference(rast,'ESRI')::text, E'\n', E'EOL'),
-	replace(st_georeference(rast,'ESRI')::text, E'\n', E'EOL') = 
+	replace(st_georeference(rast,'ESRI')::text, E'\n', E'EOL') =
     '5.0000000000EOL7.0000000000EOL3.0000000000EOL5.0000000000EOL10.0000000000EOL5.0000000000EOL'
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 5;
 
 
@@ -365,19 +365,19 @@
 SELECT
     -- all 6 parameters must be numeric
     st_setgeoreference(rast,'4.0000000000 0.0000000000 0.0000000000 6.0000000000 1.5000000000 nodata') IS NULL
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 0;
 
 SELECT
     -- must have 6 parameters
     st_setgeoreference(rast,'2.0000000000 1.0000000000 2.0000000000 3.0000000000 1.5000000000') IS NULL
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 1;
 
 SELECT
     -- any whitespace accepted between parameters as well as ' '
     st_setgeoreference(rast,E'2.0000000000	1.0000000000\n2.0000000000\t3.0000000000	1.5000000000	2.0000000000') IS NOT NULL
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 2;
 
 -----------------------------------------------------------------------
@@ -387,7 +387,7 @@
 SELECT
     -- raster arg is null
     st_setgeoreference(null,'4.0000000000 0.0000000000 0.0000000000 6.0000000000 1.5000000000 2.0000000000') IS NULL
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 0;
 
 -----------------------------------------------------------------------
@@ -399,7 +399,7 @@
 	st_scaley(rast) = 3,
 	st_scalex(st_setgeoreference(rast,'4.0000000000 0.0000000000 0.0000000000 6.0000000000 1.5000000000 2.0000000000')) = 4,
 	st_scaley(st_setgeoreference(rast,'4.0000000000 0.0000000000 0.0000000000 6.0000000000 1.5000000000 2.0000000000')) = 6
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 0;
 
 SELECT
@@ -407,7 +407,7 @@
 	st_skewy(rast) = 0,
 	st_skewx(st_setgeoreference(rast,'2.0000000000 1.0000000000 2.0000000000 3.0000000000 1.5000000000 2.0000000000')) = 2,
 	st_skewy(st_setgeoreference(rast,'2.0000000000 1.0000000000 2.0000000000 3.0000000000 1.5000000000 2.0000000000')) = 1
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 1;
 
 SELECT
@@ -415,7 +415,7 @@
 	st_upperlefty(rast) = 2.5,
 	st_upperleftx(st_setgeoreference(rast,'2.0000000000 1.0000000000 2.0000000000 3.0000000000 1.5000000000 2.0000000000')) = 1.5,
 	st_upperlefty(st_setgeoreference(rast,'2.0000000000 1.0000000000 2.0000000000 3.0000000000 1.5000000000 2.0000000000')) = 2.0
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 2;
 
 -----------------------------------------------------------------------
@@ -427,7 +427,7 @@
 	st_scaley(rast) = 3,
 	st_scalex(st_setgeoreference(rast,'4.0000000000 0.0000000000 0.0000000000 6.0000000000 1.5000000000 2.0000000000','GDAL')) = 4,
 	st_scaley(st_setgeoreference(rast,'4.0000000000 0.0000000000 0.0000000000 6.0000000000 1.5000000000 2.0000000000','GDAL')) = 6
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 0;
 
 SELECT
@@ -435,7 +435,7 @@
 	st_skewy(rast) = 0,
 	st_skewx(st_setgeoreference(rast,'2.0000000000 1.0000000000 2.0000000000 3.0000000000 1.5000000000 2.0000000000','GDAL')) = 2,
 	st_skewy(st_setgeoreference(rast,'2.0000000000 1.0000000000 2.0000000000 3.0000000000 1.5000000000 2.0000000000','GDAL')) = 1
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 1;
 
 SELECT
@@ -443,7 +443,7 @@
 	st_upperlefty(rast) = 2.5,
 	st_upperleftx(st_setgeoreference(rast,'2.0000000000 1.0000000000 2.0000000000 3.0000000000 1.5000000000 2.0000000000','GDAL')) = 1.5,
 	st_upperlefty(st_setgeoreference(rast,'2.0000000000 1.0000000000 2.0000000000 3.0000000000 1.5000000000 2.0000000000','GDAL')) = 2.0
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 2;
 
 -----------------------------------------------------------------------
@@ -455,7 +455,7 @@
 	st_scaley(rast) = 3,
 	st_scalex(st_setgeoreference(rast,'4.0000000000 0.0000000000 0.0000000000 6.0000000000 1.5000000000 2.0000000000','ESRI')) = 4,
 	st_scaley(st_setgeoreference(rast,'4.0000000000 0.0000000000 0.0000000000 6.0000000000 1.5000000000 2.0000000000','ESRI')) = 6
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 0;
 
 SELECT
@@ -463,7 +463,7 @@
 	st_skewy(rast) = 0,
 	st_skewx(st_setgeoreference(rast,'2.0000000000 1.0000000000 2.0000000000 3.0000000000 1.5000000000 2.0000000000','ESRI')) = 2,
 	st_skewy(st_setgeoreference(rast,'2.0000000000 1.0000000000 2.0000000000 3.0000000000 1.5000000000 2.0000000000','ESRI')) = 1
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 1;
 
 SELECT
@@ -471,7 +471,7 @@
 	st_upperlefty(rast) = 2.5,
 	st_upperleftx(st_setgeoreference(rast,'2.0000000000 0.0000000000 0.0000000000 3.0000000000 1.0000000000 2.5000000000','ESRI')) = 0,
 	st_upperlefty(st_setgeoreference(rast,'2.0000000000 0.0000000000 0.0000000000 3.0000000000 1.0000000000 2.5000000000','ESRI')) = 1
-FROM rt_properties_test 
+FROM rt_properties_test
 WHERE id = 2;
 
 -----------------------------------------------------------------------

Modified: trunk/raster/test/regress/rt_gist_relationships.sql
===================================================================
--- trunk/raster/test/regress/rt_gist_relationships.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_gist_relationships.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -57,7 +57,7 @@
 '
 LANGUAGE 'plpgsql';
 
-CREATE TABLE rt_gist_grid_test AS 
+CREATE TABLE rt_gist_grid_test AS
     SELECT * FROM makegrid(10, 10, 'BOX(-100 -100, 100 100)', 1, 1);
 
 CREATE TABLE rt_gist_query_test AS

Modified: trunk/raster/test/regress/rt_io.sql
===================================================================
--- trunk/raster/test/regress/rt_io.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_io.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -11,7 +11,7 @@
 VALUES ( 0, '1x1 no bands, no transform',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -37,7 +37,7 @@
 ,
 (
 '00' -- big endian (uint8 xdr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -67,7 +67,7 @@
 VALUES ( 1, '1x1 single band (1BB) no transform',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0100' -- nBands (uint16 1)
@@ -99,7 +99,7 @@
 ,
 (
 '00' -- big endian (uint8 xdr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0001' -- nBands (uint16 1)
@@ -135,7 +135,7 @@
 VALUES ( 2, '1x1 single band (2BUI) no transform',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0100' -- nBands (uint16 1)
@@ -153,7 +153,7 @@
 '0000000000000000' -- skewY (float64 0)
 ||
 '0A000000' -- SRID (int32 10)
-|| 
+||
 '0100' -- width (uint16 1)
 ||
 '0100' -- height (uint16 1)
@@ -166,7 +166,7 @@
 ),
 (
 '00' -- big endian (uint8 xdr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0001' -- nBands (uint16 1)
@@ -201,7 +201,7 @@
 VALUES ( 3, '1x1 single band (4BUI) no transform',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0100' -- nBands (uint16 1)
@@ -219,7 +219,7 @@
 '0000000000000000' -- skewY (float64 0)
 ||
 '0A000000' -- SRID (int32 10)
-|| 
+||
 '0100' -- width (uint16 1)
 ||
 '0100' -- height (uint16 1)
@@ -232,7 +232,7 @@
 ),
 (
 '00' -- big endian (uint8 xdr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0001' -- nBands (uint16 1)
@@ -267,7 +267,7 @@
 VALUES ( 4, '1x1 single band (8BSI) no transform',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0100' -- nBands (uint16 1)
@@ -285,7 +285,7 @@
 '0000000000000000' -- skewY (float64 0)
 ||
 '0A000000' -- SRID (int32 10)
-|| 
+||
 '0100' -- width (uint16 1)
 ||
 '0100' -- height (uint16 1)
@@ -298,7 +298,7 @@
 ),
 (
 '00' -- big endian (uint8 xdr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0001' -- nBands (uint16 1)
@@ -333,7 +333,7 @@
 VALUES ( 5, '1x1 single band (8BUI) no transform',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0100' -- nBands (uint16 1)
@@ -351,7 +351,7 @@
 '0000000000000000' -- skewY (float64 0)
 ||
 '0A000000' -- SRID (int32 10)
-|| 
+||
 '0100' -- width (uint16 1)
 ||
 '0100' -- height (uint16 1)
@@ -364,7 +364,7 @@
 ),
 (
 '00' -- big endian (uint8 xdr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0001' -- nBands (uint16 1)
@@ -399,7 +399,7 @@
 VALUES ( 6, '1x1 single band (16BSI) no transform',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0100' -- nBands (uint16 1)
@@ -417,7 +417,7 @@
 '0000000000000000' -- skewY (float64 0)
 ||
 '0A000000' -- SRID (int32 10)
-|| 
+||
 '0100' -- width (uint16 1)
 ||
 '0100' -- height (uint16 1)
@@ -430,7 +430,7 @@
 ),
 (
 '00' -- big endian (uint8 xdr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0001' -- nBands (uint16 1)
@@ -465,7 +465,7 @@
 VALUES ( 7, '1x1 single band (16BUI) no transform',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0100' -- nBands (uint16 1)
@@ -483,7 +483,7 @@
 '0000000000000000' -- skewY (float64 0)
 ||
 '0A000000' -- SRID (int32 10)
-|| 
+||
 '0100' -- width (uint16 1)
 ||
 '0100' -- height (uint16 1)
@@ -496,7 +496,7 @@
 ),
 (
 '00' -- big endian (uint8 xdr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0001' -- nBands (uint16 1)
@@ -531,7 +531,7 @@
 VALUES ( 8, '1x1 single band (32BSI) no transform',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0100' -- nBands (uint16 1)
@@ -549,7 +549,7 @@
 '0000000000000000' -- skewY (float64 0)
 ||
 '0A000000' -- SRID (int32 10)
-|| 
+||
 '0100' -- width (uint16 1)
 ||
 '0100' -- height (uint16 1)
@@ -562,7 +562,7 @@
 ),
 (
 '00' -- big endian (uint8 xdr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0001' -- nBands (uint16 1)
@@ -589,7 +589,7 @@
 ||
 '00000000' -- novalue==0
 ||
-'FFFFFFFF' -- pixel(0,0)==-1 ? 
+'FFFFFFFF' -- pixel(0,0)==-1 ?
 ) );
 
 -- 1x1, single band of type 32BUI, no transform, scale 1:1
@@ -597,7 +597,7 @@
 VALUES ( 9, '1x1 single band (32BUI) no transform',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0100' -- nBands (uint16 1)
@@ -615,7 +615,7 @@
 '0000000000000000' -- skewY (float64 0)
 ||
 '0A000000' -- SRID (int32 10)
-|| 
+||
 '0100' -- width (uint16 1)
 ||
 '0100' -- height (uint16 1)
@@ -628,7 +628,7 @@
 ),
 (
 '00' -- big endian (uint8 xdr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0001' -- nBands (uint16 1)
@@ -663,7 +663,7 @@
 VALUES ( 11, '1x1 single band (32BF) no transform',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0100' -- nBands (uint16 1)
@@ -681,7 +681,7 @@
 '0000000000000000' -- skewY (float64 0)
 ||
 '0A000000' -- SRID (int32 10)
-|| 
+||
 '0100' -- width (uint16 1)
 ||
 '0100' -- height (uint16 1)
@@ -694,7 +694,7 @@
 ),
 (
 '00' -- big endian (uint8 xdr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0001' -- nBands (uint16 1)
@@ -729,7 +729,7 @@
 VALUES ( 11, '1x1 single band (64BF) no transform',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0100' -- nBands (uint16 1)
@@ -747,7 +747,7 @@
 '0000000000000000' -- skewY (float64 0)
 ||
 '0A000000' -- SRID (int32 10)
-|| 
+||
 '0100' -- width (uint16 1)
 ||
 '0100' -- height (uint16 1)
@@ -760,7 +760,7 @@
 ),
 (
 '00' -- big endian (uint8 xdr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0001' -- nBands (uint16 1)
@@ -797,7 +797,7 @@
 VALUES ( 12, '1x1 single band (64BF external) no transform',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0100' -- nBands (uint16 1)
@@ -815,7 +815,7 @@
 '0000000000000000' -- skewY (float64 0)
 ||
 '0A000000' -- SRID (int32 10)
-|| 
+||
 '0100' -- width (uint16 1)
 ||
 '0100' -- height (uint16 1)
@@ -830,7 +830,7 @@
 ),
 (
 '00' -- big endian (uint8 xdr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0001' -- nBands (uint16 1)

Modified: trunk/raster/test/regress/rt_mapalgebra.sql
===================================================================
--- trunk/raster/test/regress/rt_mapalgebra.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_mapalgebra.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -217,7 +217,7 @@
 			) AS rast
 		FROM raster_nmapalgebra_in t1
 		JOIN foo t2
-			ON t1.rid = t2.rid 
+			ON t1.rid = t2.rid
 	)
 	SELECT
 		rid,
@@ -250,7 +250,7 @@
 			) AS rast
 		FROM raster_nmapalgebra_in t1
 		JOIN foo t2
-			ON t1.rid = t2.rid 
+			ON t1.rid = t2.rid
 	)
 	SELECT
 		rid,
@@ -284,7 +284,7 @@
 			) AS rast
 		FROM raster_nmapalgebra_in t1
 		JOIN foo t2
-			ON t1.rid = t2.rid 
+			ON t1.rid = t2.rid
 	)
 	SELECT
 		rid,
@@ -697,6 +697,6 @@
 FROM raster_nmapalgebra_in
 WHERE rid IN (2);
 
-DROP FUNCTION IF EXISTS raster_nmapalgebra_test(double precision[], int[], text[]); 
-DROP FUNCTION IF EXISTS raster_nmapalgebra_test_bad_return(double precision[], int[], text[]); 
-DROP TABLE IF EXISTS raster_nmapalgebra_in; 
+DROP FUNCTION IF EXISTS raster_nmapalgebra_test(double precision[], int[], text[]);
+DROP FUNCTION IF EXISTS raster_nmapalgebra_test_bad_return(double precision[], int[], text[]);
+DROP TABLE IF EXISTS raster_nmapalgebra_in;

Modified: trunk/raster/test/regress/rt_mapalgebra_expr.sql
===================================================================
--- trunk/raster/test/regress/rt_mapalgebra_expr.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_mapalgebra_expr.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,7 +1,7 @@
 SET client_min_messages TO warning;
 
-CREATE OR REPLACE FUNCTION ST_TestRaster(ulx float8, uly float8, val float8) 
-    RETURNS raster AS 
+CREATE OR REPLACE FUNCTION ST_TestRaster(ulx float8, uly float8, val float8)
+    RETURNS raster AS
     $$
     DECLARE
     BEGIN
@@ -11,7 +11,7 @@
     LANGUAGE 'plpgsql';
 
 CREATE OR REPLACE FUNCTION raster_plus_twenty(pixel FLOAT, VARIADIC args TEXT[])
-    RETURNS FLOAT AS 
+    RETURNS FLOAT AS
     $$
     BEGIN
         IF pixel IS NULL THEN
@@ -19,11 +19,11 @@
         END IF;
         RETURN pixel + 20;
     END;
-    $$ 
+    $$
     LANGUAGE 'plpgsql' IMMUTABLE;
 
 CREATE OR REPLACE FUNCTION raster_plus_arg1(pixel FLOAT, VARIADIC args TEXT[])
-    RETURNS FLOAT AS 
+    RETURNS FLOAT AS
     $$
     DECLARE
         x float := 0;
@@ -33,7 +33,7 @@
         END IF;
         RETURN pixel + x;
     END;
-    $$ 
+    $$
     LANGUAGE 'plpgsql' IMMUTABLE;
 
 CREATE OR REPLACE FUNCTION raster_polynomial(pixel FLOAT, VARIADIC args TEXT[])
@@ -146,14 +146,14 @@
   ST_Value(rast, 3, 4) = 3
   FROM ST_MapAlgebra(
     ST_AddBand(
-      ST_MakeEmptyRaster(10, 10, 0, 0, 0.001, 0.001, 0, 0, 4269), 
-      '8BUI'::text, 
-      1, 
+      ST_MakeEmptyRaster(10, 10, 0, 0, 0.001, 0.001, 0, 0, 4269),
+      '8BUI'::text,
+      1,
       0
-    ), 
-    '32BUI', 
+    ),
+    '32BUI',
     '[rast.x]'
-  ) AS rast; 
+  ) AS rast;
 
 DROP FUNCTION ST_TestRaster(ulx float8, uly float8, val float8);
 DROP FUNCTION raster_plus_twenty(pixel FLOAT, VARIADIC args TEXT[]);

Modified: trunk/raster/test/regress/rt_mapalgebra_mask.sql
===================================================================
--- trunk/raster/test/regress/rt_mapalgebra_mask.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_mapalgebra_mask.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -43,7 +43,7 @@
 select st_mapalgebra(rast,1,'raster_nmapalgebra_test(double precision[], int[], text[])'::regprocedure,ARRAY[[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]]::double precision[],false) from raster_nmapalgebra_mask_in;
 
 SELECT *
-FROM (SELECT rid, st_dumpvalues(st_mapalgebra(rast,1,'raster_nmapalgebra_test(double precision[], int[], text[])'::regprocedure,NULL::double precision[],false)) AS dv 
+FROM (SELECT rid, st_dumpvalues(st_mapalgebra(rast,1,'raster_nmapalgebra_test(double precision[], int[], text[])'::regprocedure,NULL::double precision[],false)) AS dv
 from raster_nmapalgebra_mask_in) As f
 ORDER BY rid, (dv).nband;
 
@@ -56,7 +56,7 @@
 ORDER BY rid, (dv).nband;
 
 SELECT *
-FROM (SELECT rid, st_dumpvalues(st_mapalgebra(rast,1,'raster_nmapalgebra_test(double precision[], int[], text[])'::regprocedure,ARRAY[[NULL]]::double precision[],false)) AS dv 
+FROM (SELECT rid, st_dumpvalues(st_mapalgebra(rast,1,'raster_nmapalgebra_test(double precision[], int[], text[])'::regprocedure,ARRAY[[NULL]]::double precision[],false)) AS dv
 from raster_nmapalgebra_mask_in) AS f
 ORDER BY rid, (dv).nband;
 
@@ -93,12 +93,12 @@
 ORDER BY rid, (dv).nband;
 
 SELECT *
-FROM (SELECT rid, st_dumpvalues(st_mapalgebra(rast,1,'raster_nmapalgebra_test(double precision[], int[], text[])'::regprocedure,ARRAY[[1,1,1],[1,1,1],[1,1,1]]::double precision[],true)) As dv 
+FROM (SELECT rid, st_dumpvalues(st_mapalgebra(rast,1,'raster_nmapalgebra_test(double precision[], int[], text[])'::regprocedure,ARRAY[[1,1,1],[1,1,1],[1,1,1]]::double precision[],true)) As dv
 from raster_nmapalgebra_mask_in) As f
 ORDER BY rid, (dv).nband;
 
 SELECT *
-FROM (SELECT rid, st_dumpvalues(st_mapalgebra(rast,1,'raster_nmapalgebra_test(double precision[], int[], text[])'::regprocedure,ARRAY[[1,0,0],[0,0,0],[0,0,0]]::double precision[],true)) AS dv 
+FROM (SELECT rid, st_dumpvalues(st_mapalgebra(rast,1,'raster_nmapalgebra_test(double precision[], int[], text[])'::regprocedure,ARRAY[[1,0,0],[0,0,0],[0,0,0]]::double precision[],true)) AS dv
     from raster_nmapalgebra_mask_in) As f
 ORDER BY rid, (dv).nband;
 
@@ -114,12 +114,12 @@
 ORDER BY rid, (dv).nband;
 
 SELECT *
-FROM (SELECT rid, st_dumpvalues(st_mapalgebra(rast,1,'raster_nmapalgebra_test(double precision[], int[], text[])'::regprocedure,ARRAY[[.5,.5,.5],[.5,.5,.5],[.5,.5,.5]]::double precision[],true)) AS dv 
+FROM (SELECT rid, st_dumpvalues(st_mapalgebra(rast,1,'raster_nmapalgebra_test(double precision[], int[], text[])'::regprocedure,ARRAY[[.5,.5,.5],[.5,.5,.5],[.5,.5,.5]]::double precision[],true)) AS dv
 from raster_nmapalgebra_mask_in) AS f
 ORDER BY rid, (dv).nband;
 
 SELECT *
-FROM (SELECT rid, st_dumpvalues(st_mapalgebra(rast,1,'raster_nmapalgebra_test(double precision[], int[], text[])'::regprocedure,ARRAY[[.5,0,0],[0,0,0],[0,0,0]]::double precision[],true)) AS dv  
+FROM (SELECT rid, st_dumpvalues(st_mapalgebra(rast,1,'raster_nmapalgebra_test(double precision[], int[], text[])'::regprocedure,ARRAY[[.5,0,0],[0,0,0],[0,0,0]]::double precision[],true)) AS dv
     from raster_nmapalgebra_mask_in) AS f
 ORDER BY rid, (dv).nband;
 

Modified: trunk/raster/test/regress/rt_mapalgebraexpr.sql
===================================================================
--- trunk/raster/test/regress/rt_mapalgebraexpr.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_mapalgebraexpr.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,5 +1,5 @@
-CREATE OR REPLACE FUNCTION ST_TestRaster(ulx float8, uly float8, val float8) 
-    RETURNS raster AS 
+CREATE OR REPLACE FUNCTION ST_TestRaster(ulx float8, uly float8, val float8)
+    RETURNS raster AS
     $$
     DECLARE
     BEGIN
@@ -9,7 +9,7 @@
     LANGUAGE 'plpgsql';
 
 CREATE OR REPLACE FUNCTION raster_plus_twenty(pixel FLOAT, VARIADIC args TEXT[])
-    RETURNS FLOAT AS 
+    RETURNS FLOAT AS
     $$
     BEGIN
         IF pixel IS NULL THEN
@@ -17,11 +17,11 @@
         END IF;
         RETURN pixel + 20;
     END;
-    $$ 
+    $$
     LANGUAGE 'plpgsql' IMMUTABLE;
 
 CREATE OR REPLACE FUNCTION raster_plus_arg1(pixel FLOAT, VARIADIC args TEXT[])
-    RETURNS FLOAT AS 
+    RETURNS FLOAT AS
     $$
     DECLARE
         x float := 0;
@@ -31,7 +31,7 @@
         END IF;
         RETURN pixel + x;
     END;
-    $$ 
+    $$
     LANGUAGE 'plpgsql' IMMUTABLE;
 
 CREATE OR REPLACE FUNCTION raster_polynomial(pixel FLOAT, VARIADIC args TEXT[])
@@ -144,14 +144,14 @@
   ST_Value(rast, 3, 4) = 3
   FROM ST_MapAlgebraExpr(
     ST_AddBand(
-      ST_MakeEmptyRaster(10, 10, 0, 0, 0.001, 0.001, 0, 0, 4269), 
-      '8BUI'::text, 
-      1, 
+      ST_MakeEmptyRaster(10, 10, 0, 0, 0.001, 0.001, 0, 0, 4269),
+      '8BUI'::text,
+      1,
       0
-    ), 
-    '32BUI', 
+    ),
+    '32BUI',
     '[rast.x]'
-  ) AS rast; 
+  ) AS rast;
 
 DROP FUNCTION ST_TestRaster(ulx float8, uly float8, val float8);
 DROP FUNCTION raster_plus_twenty(pixel FLOAT, VARIADIC args TEXT[]);

Modified: trunk/raster/test/regress/rt_mapalgebrafct.sql
===================================================================
--- trunk/raster/test/regress/rt_mapalgebrafct.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_mapalgebrafct.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,5 +1,5 @@
-CREATE OR REPLACE FUNCTION ST_TestRaster(ulx float8, uly float8, val float8) 
-    RETURNS raster AS 
+CREATE OR REPLACE FUNCTION ST_TestRaster(ulx float8, uly float8, val float8)
+    RETURNS raster AS
     $$
     DECLARE
     BEGIN
@@ -9,16 +9,16 @@
     LANGUAGE 'plpgsql';
 
 CREATE OR REPLACE FUNCTION raster_plus_twenty(pixel FLOAT, VARIADIC args TEXT[])
-    RETURNS FLOAT AS 
+    RETURNS FLOAT AS
     $$
     BEGIN
         RETURN pixel + 20;
     END;
-    $$ 
+    $$
     LANGUAGE 'plpgsql' IMMUTABLE;
 
 CREATE OR REPLACE FUNCTION raster_plus_arg1(pixel FLOAT, VARIADIC args TEXT[])
-    RETURNS FLOAT AS 
+    RETURNS FLOAT AS
     $$
     DECLARE
         x float := 0;
@@ -28,7 +28,7 @@
         END IF;
         RETURN pixel + x;
     END;
-    $$ 
+    $$
     LANGUAGE 'plpgsql' IMMUTABLE;
 
 CREATE OR REPLACE FUNCTION raster_polynomial(pixel FLOAT, VARIADIC args TEXT[])

Modified: trunk/raster/test/regress/rt_mapalgebrafctngb.sql
===================================================================
--- trunk/raster/test/regress/rt_mapalgebrafctngb.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_mapalgebrafctngb.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -14,8 +14,8 @@
 --
 --Test rasters
 --
-CREATE OR REPLACE FUNCTION ST_TestRasterNgb(h integer, w integer, val float8) 
-    RETURNS raster AS 
+CREATE OR REPLACE FUNCTION ST_TestRasterNgb(h integer, w integer, val float8)
+    RETURNS raster AS
     $$
     DECLARE
     BEGIN
@@ -43,7 +43,7 @@
  FROM ST_TestRasterNgb(3, 3, 1) AS rast;
 
 -- Test negative width neighborhood. Original raster returned.
-SELECT 
+SELECT
   ST_Value(rast, 2, 2) = 1,
   ST_Value(
     ST_MapAlgebraFctNgb(
@@ -52,7 +52,7 @@
  FROM ST_TestRasterNgb(3, 3, 1) AS rast;
 
 -- Test negative height neighborhood. Original raster returned.
-SELECT 
+SELECT
   ST_Value(rast, 2, 2) = 1,
   ST_Value(
     ST_MapAlgebraFctNgb(
@@ -61,8 +61,8 @@
  FROM ST_TestRasterNgb(3, 3, 1) AS rast;
 
 -- Test has no nodata value. Should return null and 7.
-SELECT 
-  ST_Value(rast, 2, 2) IS NULL, 
+SELECT
+  ST_Value(rast, 2, 2) IS NULL,
   ST_Value(
     ST_MapAlgebraFctNgb(
       ST_SetBandNoDataValue(rast, NULL), 1, NULL, 1, 1, 'ST_Sum4ma(float[][], text, text[])'::regprocedure, 'NULL', NULL
@@ -70,80 +70,80 @@
  FROM ST_SetValue(ST_TestRasterNgb(3, 3, 1), 2, 2, NULL) AS rast;
 
 ---- Test NULL nodatamode. Should return null and null.
-SELECT 
-  ST_Value(rast, 2, 2) IS NULL, 
+SELECT
+  ST_Value(rast, 2, 2) IS NULL,
   ST_Value(
     ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'ST_Sum4ma(float[][], text, text[])'::regprocedure, 'NULL', NULL), 2, 2
   ) IS NULL
  FROM ST_SetValue(ST_TestRasterNgb(3, 3, 1), 2, 2, NULL) AS rast;
 
 ---- Test default nodatamode (ignore). Should return null and 8.
-SELECT 
-  ST_Value(rast, 2, 2) IS NULL, 
+SELECT
+  ST_Value(rast, 2, 2) IS NULL,
   ST_Value(
     ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'ST_Sum4ma(float[][], text, text[])'::regprocedure, NULL, NULL), 2, 2
   ) = 8
  FROM ST_SetValue(ST_TestRasterNgb(3, 3, 1), 2, 2, NULL) AS rast;
 
 ---- Test ignore nodatamode. Should return null and 8.
-SELECT 
-  ST_Value(rast, 2, 2) IS NULL, 
+SELECT
+  ST_Value(rast, 2, 2) IS NULL,
   ST_Value(
     ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'ST_Sum4ma(float[][], text, text[])'::regprocedure, 'ignore', NULL), 2, 2
   ) = 8
  FROM ST_SetValue(ST_TestRasterNgb(3, 3, 1), 2, 2, NULL) AS rast;
 
 ---- Test value nodatamode. Should return null and null.
-SELECT 
-  ST_Value(rast, 2, 2) IS NULL, 
+SELECT
+  ST_Value(rast, 2, 2) IS NULL,
   ST_Value(
     ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'ST_Sum4ma(float[][], text, text[])'::regprocedure, 'value', NULL), 2, 2
-  ) IS NULL 
+  ) IS NULL
  FROM ST_SetValue(ST_TestRasterNgb(3, 3, 1), 2, 2, NULL) AS rast;
 
 -- Test value nodatamode. Should return null and 9.
-SELECT 
-  ST_Value(rast, 1, 1) IS NULL, 
+SELECT
+  ST_Value(rast, 1, 1) IS NULL,
   ST_Value(
     ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'ST_Sum4ma(float[][], text, text[])'::regprocedure, 'value', NULL), 2, 2
   ) = 9
  FROM ST_SetValue(ST_TestRasterNgb(3, 3, 1), 1, 1, NULL) AS rast;
 
 -- Test value nodatamode. Should return null and 0.
-SELECT 
-  ST_Value(rast, 2, 2) IS NULL, 
+SELECT
+  ST_Value(rast, 2, 2) IS NULL,
   ST_Value(
     ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'ST_Sum4ma(float[][], text, text[])'::regprocedure, '-8', NULL), 2, 2
   ) = 0
  FROM ST_SetValue(ST_TestRasterNgb(3, 3, 1), 2, 2, NULL) AS rast;
 
 -- Test value nodatamode. Should return null and 128.
-SELECT 
-  ST_Value(rast, 2, 2) IS NULL, 
+SELECT
+  ST_Value(rast, 2, 2) IS NULL,
   ST_Value(
     ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'ST_Sum4ma(float[][], text, text[])'::regprocedure, '120', NULL), 2, 2
   ) = 128
  FROM ST_SetValue(ST_TestRasterNgb(3, 3, 1), 2, 2, NULL) AS rast;
 
 -- Test value nodatamode. Should return null and null.
-SELECT 
-  ST_Value(rast, 2, 2) IS NULL, 
+SELECT
+  ST_Value(rast, 2, 2) IS NULL,
   ST_Value(
     ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'ST_Sum4ma(float[][], text, text[])'::regprocedure, 'abcd', NULL), 2, 2
   ) IS NULL
  FROM ST_SetValue(ST_TestRasterNgb(3, 3, 1), 2, 2, NULL) AS rast;
 
 -- Test ST_Sum user function. Should be 1 and 9.
-SELECT 
-  ST_Value(rast, 2, 2) = 1, 
+SELECT
+  ST_Value(rast, 2, 2) = 1,
   ST_Value(
     ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'ST_Sum4ma(float[][], text, text[])'::regprocedure, 'NULL', NULL), 2, 2
   ) = 9
  FROM ST_TestRasterNgb(3, 3, 1) AS rast;
 
 -- Test ST_Sum user function on a no nodata value raster. Should be null and -1.
-SELECT 
-  ST_Value(rast, 2, 2) IS NULL, 
+SELECT
+  ST_Value(rast, 2, 2) IS NULL,
   ST_Value(
     ST_MapAlgebraFctNgb(ST_SetBandNoDataValue(rast, NULL), 1, NULL, 1, 1, 'ST_Sum4ma(float[][], text, text[])'::regprocedure, 'NULL', NULL), 2, 2
   ) = -1
@@ -158,16 +158,16 @@
  FROM ST_SetBandNoDataValue(ST_TestRasterNgb(3, 3, 2), 1, NULL) AS rast;
 
 -- Test pixeltype 1. No error, changed to 32BF
-SELECT 
-  ST_Value(rast, 2, 2) = 2, 
+SELECT
+  ST_Value(rast, 2, 2) = 2,
   ST_Value(
     ST_MapAlgebraFctNgb(rast, 1, '4BUId', 1, 1, 'ST_Sum4ma(float[][], text, text[])'::regprocedure, 'NULL', NULL), 2, 2
   ) = 18
  FROM ST_TestRasterNgb(3, 3, 2) AS rast;
 
 -- Test pixeltype 1. Should return 1 and 3.
-SELECT 
-  ST_Value(rast, 2, 2) = 1, 
+SELECT
+  ST_Value(rast, 2, 2) = 1,
   ST_Value(
     ST_MapAlgebraFctNgb(rast, 1, '2BUI', 1, 1, 'ST_Sum4ma(float[][], text, text[])'::regprocedure, 'NULL', NULL), 2, 2
   ) = 3
@@ -208,8 +208,8 @@
 SELECT
   ST_NRings(geom) = 2,
   ST_NumInteriorRings(geom) = 1,
-  ST_Area(geom) = 16, 
-  val = 9, 
+  ST_Area(geom) = 16,
+  val = 9,
   ST_Area(ST_BuildArea(ST_InteriorRingN(geom, 1))) = 9
  FROM (SELECT
     (ST_DumpAsPolygons(
@@ -220,7 +220,7 @@
 -- Test that the neighborhood function leaves a border of NODATA,
 -- and the center pyramids when summed twice, ignoring NODATA values
 SELECT
-  COUNT(*) = 9, SUM(ST_Area(geom)) = 9, SUM(val) = ((36+54+36) + (54+81+54) + (36+54+36)) 
+  COUNT(*) = 9, SUM(ST_Area(geom)) = 9, SUM(val) = ((36+54+36) + (54+81+54) + (36+54+36))
  FROM (SELECT
     (ST_DumpAsPolygons(
       ST_MapAlgebraFctNgb(
@@ -242,7 +242,7 @@
    FROM ST_TestRasterNgb(5, 5, 1) AS rast) AS foo;
 
 -- test a user function that nullifies everything
-SELECT 
+SELECT
   ST_Value(rast, 2, 2) = 2,
   ST_Value(
     ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'ST_Nullage(float[][], text, text[])'::regprocedure, 'NULL', NULL), 2, 2
@@ -252,7 +252,7 @@
 -- 'dog ate my homework' test
 -- raster initialized to one NODATA value, then a literal value passed in as the 'nodatamode' parameter.
 -- expect that the cells processed by the neighborhoods would be replaced by the 'nodatamode' parameter value, and not NODATA.
-SELECT 
+SELECT
   ST_Value(
     ST_MapAlgebraFctNgb(rast, 1, '8BUI', 1, 1, 'ST_Sum4ma(float[][], text, text[])'::regprocedure, '120', NULL), 2, 2
   ) = 200

Modified: trunk/raster/test/regress/rt_mapalgebrafctngb_userfunc.sql
===================================================================
--- trunk/raster/test/regress/rt_mapalgebrafctngb_userfunc.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_mapalgebrafctngb_userfunc.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -14,8 +14,8 @@
 --
 --Test rasters
 --
-CREATE OR REPLACE FUNCTION ST_TestRasterNgb(h integer, w integer, val float8) 
-    RETURNS raster AS 
+CREATE OR REPLACE FUNCTION ST_TestRasterNgb(h integer, w integer, val float8)
+    RETURNS raster AS
     $$
     DECLARE
     BEGIN
@@ -45,7 +45,7 @@
   ST_Value(rast, 2, 2) = 1,
   ST_Value(
     ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'st_max4ma(float[][], text, text[])'::regprocedure, '22', NULL), 2, 2
-  ) = 22 
+  ) = 22
   FROM ST_SetValue(ST_TestRasterNgb(3, 3, 1), 3, 3, NULL) AS rast;
 
 -- test st_min4ma, uniform values
@@ -69,7 +69,7 @@
   ST_Value(rast, 2, 2) = 22,
   ST_Value(
     ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'st_min4ma(float[][], text, text[])'::regprocedure, '2', NULL), 2, 2
-  ) = 2 
+  ) = 2
   FROM ST_SetValue(ST_TestRasterNgb(3, 3, 22), 3, 3, NULL) AS rast;
 
 -- test st_sum4ma happens in rt_mapalgebrafctngb.sql
@@ -95,7 +95,7 @@
   ST_Value(rast, 2, 2) = 10,
   ST_Value(
     ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'st_mean4ma(float[][], text, text[])'::regprocedure, '1', NULL), 2, 2
-  ) = 9 
+  ) = 9
   FROM ST_SetValue(ST_TestRasterNgb(3, 3, 10), 3, 3, NULL) AS rast;
 
 -- test st_range4ma, uniform values
@@ -119,7 +119,7 @@
   ST_Value(rast, 2, 2) = 10,
   ST_Value(
     ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'st_range4ma(float[][], text, text[])'::regprocedure, '1', NULL), 2, 2
-  ) = 9 
+  ) = 9
   FROM ST_SetValue(ST_TestRasterNgb(3, 3, 10), 3, 3, NULL) AS rast;
 
 -- test st_slope, flat plane
@@ -219,7 +219,7 @@
     ), 3, 3, 2477
   ) AS rast;
 
--- test st_hillshade, defaults on known set from: http://webhelp.esri.com/arcgiSDEsktop/9.3/index.cfm?TopicName=How%20Hillshade%20works  
+-- test st_hillshade, defaults on known set from: http://webhelp.esri.com/arcgiSDEsktop/9.3/index.cfm?TopicName=How%20Hillshade%20works
 SELECT
   round(ST_Value(
     ST_Hillshade(rast, 1, NULL, 315.0, 45.), 2, 2
@@ -249,7 +249,7 @@
   ST_Value(rast, 2, 2) = 10,
   ST_Value(
     ST_MapAlgebraFctNgb(rast, 1, NULL, 1, 1, 'st_distinct4ma(float[][], text, text[])'::regprocedure, '1', NULL), 2, 2
-  ) = 1 
+  ) = 1
   FROM ST_TestRasterNgb(3, 3, 10) AS rast;
 
 -- test st_distinct4ma, three distinct values

Modified: trunk/raster/test/regress/rt_neighborhood.sql
===================================================================
--- trunk/raster/test/regress/rt_neighborhood.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_neighborhood.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -37,53 +37,53 @@
 SELECT make_test_raster();
 DROP FUNCTION IF EXISTS make_test_raster();
 
-SELECT 
+SELECT
 	ST_Neighborhood(rast, 1, 1, 1, 1, 1)
 FROM raster_neighborhood;
-SELECT 
+SELECT
 	ST_Neighborhood(ST_SetBandNoDataValue(rast, NULL), 1, 1, 1, 1, 1)
 FROM raster_neighborhood;
-SELECT 
+SELECT
 	ST_Neighborhood(rast, 1, 2, 2, 1, 1)
 FROM raster_neighborhood;
-SELECT 
+SELECT
 	ST_Neighborhood(rast, 1, 5, 5, 1, 1)
 FROM raster_neighborhood;
-SELECT 
+SELECT
 	ST_Neighborhood(rast, 1, 5, 5, 2, 2)
 FROM raster_neighborhood;
-SELECT 
+SELECT
 	ST_Neighborhood(rast, 1, 11, 11, 1, 1)
 FROM raster_neighborhood;
-SELECT 
+SELECT
 	ST_Neighborhood(rast, 1, 12, 12, 1, 1)
 FROM raster_neighborhood;
-SELECT 
+SELECT
 	ST_Neighborhood(rast, 1, 0, 0, 1, 1)
 FROM raster_neighborhood;
-SELECT 
+SELECT
 	ST_Neighborhood(rast, 1, 0, 2, 1, 1)
 FROM raster_neighborhood;
-SELECT 
+SELECT
 	ST_Neighborhood(rast, 1, -1, 3, 1, 1)
 FROM raster_neighborhood;
-SELECT 
+SELECT
 	ST_Neighborhood(rast, 1, -9, 3, 3, 3)
 FROM raster_neighborhood;
-SELECT 
+SELECT
 	ST_Neighborhood(rast, 1, -9, 3, 3, 3, FALSE)
 FROM raster_neighborhood;
 
-SELECT 
+SELECT
 	ST_Neighborhood(rast, 1, 4, 4, 1, 1)
 FROM raster_neighborhood;
-SELECT 
+SELECT
 	ST_Neighborhood(rast, 1, 4, 4, 2, 2)
 FROM raster_neighborhood;
-SELECT 
+SELECT
 	ST_Neighborhood(rast, 1, 4, 4, 1, 2)
 FROM raster_neighborhood;
-SELECT 
+SELECT
 	ST_Neighborhood(rast, 1, 4, 4, 1, 0)
 FROM raster_neighborhood;
 

Modified: trunk/raster/test/regress/rt_pixelsize.sql
===================================================================
--- trunk/raster/test/regress/rt_pixelsize.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_pixelsize.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -32,13 +32,13 @@
     rast raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 0, '10x20, ip:0.5,0.5 scale:2,3 skew:0,0 srid:10 width:10 height:20',
         10, 10, 20, --- SRID, width, height
         2, 3, 0.5, 0.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -63,13 +63,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 1, '1x1, ip:2.5,2.5 scale:5,5 skew:0,0, srid:12, width:1, height:1',
         12, 1, 1, --- SRID, width, height
          5, 5, 2.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -94,13 +94,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 2, '1x1, ip:7.5,2.5 scale:5,5 skew:0,0, srid:0, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -125,13 +125,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 3, '1x1, ip:7.5,2.5 scale:5,5 skew:0,0, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -154,15 +154,15 @@
 ||
 '0100' -- height (uint16 1)
 )::raster
-); 
+);
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 4, '1x1, ip:7.5,2.5 scale:5,5 skew:1,1, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 1, 1, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -187,13 +187,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 5, '1x1, ip:7.5,2.5 scale:5,5 skew:3,7, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 3, 7, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -216,7 +216,7 @@
 ||
 '0100' -- height (uint16 1)
 )::raster
-); 
+);
 
 -----------------------------------------------------------------------
 -- st_pixelwidth

Modified: trunk/raster/test/regress/rt_pixelvalue.sql
===================================================================
--- trunk/raster/test/regress/rt_pixelvalue.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_pixelvalue.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -45,7 +45,7 @@
     rast raster
 );
 
-INSERT INTO rt_band_properties_test 
+INSERT INTO rt_band_properties_test
 VALUES ( 1, '1x1, nbband:2 b1pixeltype:4BUI b1hasnodatavalue:true b1nodatavalue:3 b2pixeltype:16BSI b2hasnodatavalue:false b2nodatavalue:13',
         2, --- nbband
         '4BUI', true, 3, 2,   --- b1pixeltype, b1hasnodatavalue, b1nodatavalue, b1val
@@ -53,7 +53,7 @@
         'POLYGON((782325.5 26744042.5,782330.5 26744045.5,782333.5 26744040.5,782328.5 26744037.5,782325.5 26744042.5))',
 (
 '01' -- big endian (uint8 xdr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0200' -- nBands (uint16 2)
@@ -78,7 +78,7 @@
 ||
 '4' -- hasnodatavalue set to true
 ||
-'2' -- first band type (4BUI) 
+'2' -- first band type (4BUI)
 ||
 '03' -- novalue==3
 ||
@@ -94,7 +94,7 @@
 )::raster
 );
 
-INSERT INTO rt_band_properties_test 
+INSERT INTO rt_band_properties_test
 VALUES ( 2, '1x1, nbband:2 b1pixeltype:4BUI b1hasnodatavalue:true b1nodatavalue:3 b2pixeltype:16BSI b2hasnodatavalue:false b2nodatavalue:13',
         2, --- nbband
         '4BUI', true, 3, 2,   --- b1pixeltype, b1hasnodatavalue, b1nodatavalue, b1val
@@ -102,7 +102,7 @@
         'POLYGON((-75.5533328537098 49.2824585505576,-75.5525268884758 49.2826703629415,-75.5523150760919 49.2818643977075,-75.553121041326 49.2816525853236,-75.5533328537098 49.2824585505576))',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0200' -- nBands (uint16 0)
@@ -127,7 +127,7 @@
 ||
 '4' -- hasnodatavalue set to true
 ||
-'2' -- first band type (4BUI) 
+'2' -- first band type (4BUI)
 ||
 '03' -- novalue==3
 ||
@@ -143,7 +143,7 @@
 )::raster
 );
 
-INSERT INTO rt_band_properties_test 
+INSERT INTO rt_band_properties_test
 VALUES ( 3, '1x1, nbband:2 b1pixeltype:4BUI b1hasnodatavalue:true b1nodatavalue:3 b2pixeltype:16BSI b2hasnodatavalue:false b2nodatavalue:13',
         2, --- nbband
         '4BUI', true, 3, 3,   --- b1pixeltype, b1hasnodatavalue, b1nodatavalue, b1val
@@ -151,7 +151,7 @@
         'POLYGON((-75.5533328537098 49.2824585505576,-75.5525268884758 49.2826703629415,-75.5523150760919 49.2818643977075,-75.553121041326 49.2816525853236,-75.5533328537098 49.2824585505576))',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0200' -- nBands (uint16 0)
@@ -176,7 +176,7 @@
 ||
 '6' -- hasnodatavalue and isnodata set to true
 ||
-'2' -- first band type (4BUI) 
+'2' -- first band type (4BUI)
 ||
 '03' -- novalue==3
 ||
@@ -192,7 +192,7 @@
 )::raster
 );
 
-INSERT INTO rt_band_properties_test 
+INSERT INTO rt_band_properties_test
 VALUES ( 4, '1x1, nbband:2 b1pixeltype:4BUI b1hasnodatavalue:true b1nodatavalue:3 b2pixeltype:16BSI b2hasnodatavalue:false b2nodatavalue:13',
         2, --- nbband
         '4BUI', true, 3, 3,   --- b1pixeltype, b1hasnodatavalue, b1nodatavalue, b1val
@@ -200,7 +200,7 @@
         'POLYGON((-75.5533328537098 49.2824585505576,-75.5525268884758 49.2826703629415,-75.5523150760919 49.2818643977075,-75.553121041326 49.2816525853236,-75.5533328537098 49.2824585505576))',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0200' -- nBands (uint16 0)
@@ -225,7 +225,7 @@
 ||
 '4' -- hasnodatavalue set to true and isnodata set to false (should be updated)
 ||
-'2' -- first band type (4BUI) 
+'2' -- first band type (4BUI)
 ||
 '03' -- novalue==3
 ||
@@ -242,7 +242,7 @@
 );
 
 -----------------------------------------------------------------------
--- Test 1 - st_value(rast raster, band integer, x integer, y integer) 
+-- Test 1 - st_value(rast raster, band integer, x integer, y integer)
 -----------------------------------------------------------------------
 
 SELECT 'test 1.1', id
@@ -313,7 +313,7 @@
 SELECT 'test 4.1', id
     FROM rt_band_properties_test
     WHERE st_value(st_setvalue(rast, 1, 1, 1, 5), 1, 1, 1) != 5;
-    
+
 SELECT 'test 4.2', id
     FROM rt_band_properties_test
     WHERE NOT st_value(st_setvalue(rast, 1, 1, 1, NULL), 1, 1, 1) IS NULL;

Modified: trunk/raster/test/regress/rt_rotation.sql
===================================================================
--- trunk/raster/test/regress/rt_rotation.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_rotation.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -33,13 +33,13 @@
     rast raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 0, '10x20, ip:0.5,0.5 scale:2,3 skew:0,0 srid:10 width:10 height:20',
         10, 10, 20, --- SRID, width, height
         2, 3, 0.5, 0.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -64,13 +64,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 1, '1x1, ip:2.5,2.5 scale:5,5 skew:0,0, srid:12, width:1, height:1',
         12, 1, 1, --- SRID, width, height
          5, 5, 2.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -95,13 +95,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 2, '1x1, ip:7.5,2.5 scale:5,5 skew:0,0, srid:0, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -126,13 +126,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 3, '1x1, ip:7.5,2.5 scale:5,5 skew:0,0, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -155,15 +155,15 @@
 ||
 '0100' -- height (uint16 1)
 )::raster
-); 
+);
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 4, '1x1, ip:7.5,2.5 scale:5,5 skew:1,1, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 1, 1, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -188,13 +188,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 5, '1x1, ip:7.5,2.5 scale:5,5 skew:3,7, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 3, 7, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -217,7 +217,7 @@
 ||
 '0100' -- height (uint16 1)
 )::raster
-); 
+);
 
 -----------------------------------------------------------------------
 -- st_skewx
@@ -275,7 +275,7 @@
         ipy = round(st_upperlefty(rast)*1000000000000)
     WHERE id > 100;
 
-SELECT 'T5', id, scalex, scaley, skewx, skewy, 
+SELECT 'T5', id, scalex, scaley, skewx, skewy,
     round(st_rotation(rast)*1000000000000)
     FROM rt_properties_test
     WHERE id > 100;
@@ -293,7 +293,7 @@
         ipy = round(st_upperlefty(rast)*1000000000000)
     WHERE id > 100;
 
-SELECT 'T6', id, scalex, scaley, skewx, skewy, 
+SELECT 'T6', id, scalex, scaley, skewx, skewy,
     round(st_rotation(rast)*1000000000000)
     FROM rt_properties_test
     WHERE id > 100;

Modified: trunk/raster/test/regress/rt_scale.sql
===================================================================
--- trunk/raster/test/regress/rt_scale.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_scale.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -32,13 +32,13 @@
     rast raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 0, '10x20, ip:0.5,0.5 scale:2,3 skew:0,0 srid:10 width:10 height:20',
         10, 10, 20, --- SRID, width, height
         2, 3, 0.5, 0.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -63,13 +63,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 1, '1x1, ip:2.5,2.5 scale:5,5 skew:0,0, srid:12, width:1, height:1',
         12, 1, 1, --- SRID, width, height
          5, 5, 2.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -94,13 +94,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 2, '1x1, ip:7.5,2.5 scale:5,5 skew:0,0, srid:0, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -125,13 +125,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 3, '1x1, ip:7.5,2.5 scale:5,5 skew:0,0, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -154,15 +154,15 @@
 ||
 '0100' -- height (uint16 1)
 )::raster
-); 
+);
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 4, '1x1, ip:7.5,2.5 scale:5,5 skew:1,1, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 1, 1, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -187,13 +187,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 5, '1x1, ip:7.5,2.5 scale:5,5 skew:3,7, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 3, 7, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -216,7 +216,7 @@
 ||
 '0100' -- height (uint16 1)
 )::raster
-); 
+);
 
 -----------------------------------------------------------------------
 -- st_scalex

Modified: trunk/raster/test/regress/rt_set_band_properties.sql
===================================================================
--- trunk/raster/test/regress/rt_set_band_properties.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_set_band_properties.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -37,7 +37,7 @@
     rast raster
 );
 
-INSERT INTO rt_band_properties_test 
+INSERT INTO rt_band_properties_test
 VALUES ( 1, '1x1, nbband:2 b1pixeltype:4BUI b1hasnodatavalue:true b1nodatavalue:3 b2pixeltype:16BSI b2hasnodatavalue:false b2nodatavalue:13',
         2, --- nbband
         '4BUI', true, 3, 2,   --- b1pixeltype, b1hasnodatavalue, b1nodatavalue, b1val
@@ -45,7 +45,7 @@
         'POLYGON((782325.5 26744042.5,782330.5 26744045.5,782333.5 26744040.5,782328.5 26744037.5,782325.5 26744042.5))',
 (
 '01' -- big endian (uint8 xdr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0200' -- nBands (uint16 2)
@@ -70,7 +70,7 @@
 ||
 '4' -- hasnodatavalue set to true
 ||
-'2' -- first band type (4BUI) 
+'2' -- first band type (4BUI)
 ||
 '03' -- novalue==3
 ||
@@ -86,7 +86,7 @@
 )::raster
 );
 
-INSERT INTO rt_band_properties_test 
+INSERT INTO rt_band_properties_test
 VALUES ( 2, '1x1, nbband:2 b1pixeltype:4BUI b1hasnodatavalue:true b1nodatavalue:3 b2pixeltype:16BSI b2hasnodatavalue:false b2nodatavalue:13',
         2, --- nbband
         '4BUI', true, 3, 2,   --- b1pixeltype, b1hasnodatavalue, b1nodatavalue, b1val
@@ -94,7 +94,7 @@
         'POLYGON((-75.5533328537098 49.2824585505576,-75.5525268884758 49.2826703629415,-75.5523150760919 49.2818643977075,-75.553121041326 49.2816525853236,-75.5533328537098 49.2824585505576))',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0200' -- nBands (uint16 0)
@@ -119,7 +119,7 @@
 ||
 '4' -- hasnodatavalue set to true
 ||
-'2' -- first band type (4BUI) 
+'2' -- first band type (4BUI)
 ||
 '03' -- novalue==3
 ||
@@ -135,7 +135,7 @@
 )::raster
 );
 
-INSERT INTO rt_band_properties_test 
+INSERT INTO rt_band_properties_test
 VALUES ( 3, '1x1, nbband:2 b1pixeltype:4BUI b1hasnodatavalue:true b1nodatavalue:3 b2pixeltype:16BSI b2hasnodatavalue:false b2nodatavalue:13',
         2, --- nbband
         '4BUI', true, 3, 3,   --- b1pixeltype, b1hasnodatavalue, b1nodatavalue, b1val
@@ -143,7 +143,7 @@
         'POLYGON((-75.5533328537098 49.2824585505576,-75.5525268884758 49.2826703629415,-75.5523150760919 49.2818643977075,-75.553121041326 49.2816525853236,-75.5533328537098 49.2824585505576))',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0200' -- nBands (uint16 0)
@@ -168,7 +168,7 @@
 ||
 '6' -- hasnodatavalue and isnodata set to true
 ||
-'2' -- first band type (4BUI) 
+'2' -- first band type (4BUI)
 ||
 '03' -- novalue==3
 ||
@@ -184,7 +184,7 @@
 )::raster
 );
 
-INSERT INTO rt_band_properties_test 
+INSERT INTO rt_band_properties_test
 VALUES ( 4, '1x1, nbband:2 b1pixeltype:4BUI b1hasnodatavalue:true b1nodatavalue:3 b2pixeltype:16BSI b2hasnodatavalue:false b2nodatavalue:13',
         2, --- nbband
         '4BUI', true, 3, 3,   --- b1pixeltype, b1hasnodatavalue, b1nodatavalue, b1val
@@ -192,7 +192,7 @@
         'POLYGON((-75.5533328537098 49.2824585505576,-75.5525268884758 49.2826703629415,-75.5523150760919 49.2818643977075,-75.553121041326 49.2816525853236,-75.5533328537098 49.2824585505576))',
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0200' -- nBands (uint16 0)
@@ -217,7 +217,7 @@
 ||
 '4' -- hasnodatavalue set to true and isnodata set to false (should be updated)
 ||
-'2' -- first band type (4BUI) 
+'2' -- first band type (4BUI)
 ||
 '03' -- novalue==3
 ||

Modified: trunk/raster/test/regress/rt_set_properties.sql
===================================================================
--- trunk/raster/test/regress/rt_set_properties.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_set_properties.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -32,13 +32,13 @@
     rast raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 0, '10x20, ip:0.5,0.5 scale:2,3 skew:0,0 srid:10 width:10 height:20',
         10, 10, 20, --- SRID, width, height
         2, 3, 0.5, 0.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -63,13 +63,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 1, '1x1, ip:2.5,2.5 scale:5,5 skew:0,0, srid:12, width:1, height:1',
         12, 1, 1, --- SRID, width, height
          5, 5, 2.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -94,13 +94,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 2, '1x1, ip:7.5,2.5 scale:5,5 skew:0,0, srid:0, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -125,13 +125,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 3, '1x1, ip:7.5,2.5 scale:5,5 skew:0,0, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -154,15 +154,15 @@
 ||
 '0100' -- height (uint16 1)
 )::raster
-); 
+);
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 4, '1x1, ip:7.5,2.5 scale:5,5 skew:1,1, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 1, 1, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -187,13 +187,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 5, '1x1, ip:7.5,2.5 scale:5,5 skew:3,7, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 3, 7, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -216,7 +216,7 @@
 ||
 '0100' -- height (uint16 1)
 )::raster
-); 
+);
 
 -----------------------------------------------------------------------
 --- Test of "Set" functions for properties of the raster.

Modified: trunk/raster/test/regress/rt_setvalues_array.sql
===================================================================
--- trunk/raster/test/regress/rt_setvalues_array.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_setvalues_array.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -154,7 +154,7 @@
 	SELECT ST_SetValues(
 		rast, 1,
 		1, 1,
-		5, 3, 
+		5, 3,
 		100
 	)
 	FROM raster_setvalues_rast
@@ -165,7 +165,7 @@
 	SELECT ST_SetValues(
 		rast, 1,
 		1, 1,
-		5, 3, 
+		5, 3,
 		NULL
 	)
 	FROM raster_setvalues_rast
@@ -176,7 +176,7 @@
 	SELECT ST_SetValues(
 		rast, 1,
 		1, 1,
-		5, 3, 
+		5, 3,
 		0
 	)
 	FROM raster_setvalues_rast

Modified: trunk/raster/test/regress/rt_upperleft.sql
===================================================================
--- trunk/raster/test/regress/rt_upperleft.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_upperleft.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -32,13 +32,13 @@
     rast raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 0, '10x20, ip:0.5,0.5 scale:2,3 skew:0,0 srid:10 width:10 height:20',
         10, 10, 20, --- SRID, width, height
         2, 3, 0.5, 0.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -63,13 +63,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 1, '1x1, ip:2.5,2.5 scale:5,5 skew:0,0, srid:12, width:1, height:1',
         12, 1, 1, --- SRID, width, height
          5, 5, 2.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -94,13 +94,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 2, '1x1, ip:7.5,2.5 scale:5,5 skew:0,0, srid:0, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -125,13 +125,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 3, '1x1, ip:7.5,2.5 scale:5,5 skew:0,0, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -154,15 +154,15 @@
 ||
 '0100' -- height (uint16 1)
 )::raster
-); 
+);
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 4, '1x1, ip:7.5,2.5 scale:5,5 skew:1,1, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 1, 1, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -187,13 +187,13 @@
 )::raster
 );
 
-INSERT INTO rt_properties_test 
+INSERT INTO rt_properties_test
 VALUES ( 5, '1x1, ip:7.5,2.5 scale:5,5 skew:3,7, srid:-1, width:1, height:1',
          0, 1, 1, --- SRID, width, height
          5, 5, 7.5, 2.5, 3, 7, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -216,7 +216,7 @@
 ||
 '0100' -- height (uint16 1)
 )::raster
-); 
+);
 
 -----------------------------------------------------------------------
 -- st_upperleftx

Modified: trunk/raster/test/regress/rt_utility.sql
===================================================================
--- trunk/raster/test/regress/rt_utility.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/raster/test/regress/rt_utility.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -32,13 +32,13 @@
     rast raster
 );
 
-INSERT INTO rt_utility_test 
+INSERT INTO rt_utility_test
 VALUES ( 1, '1217x1156, ip:782325.5,26744042.5 scale:5,-5 skew:0,0 srid:9102707 width:1217 height:1156',
         26919, 1217, 1156, --- SRID, width, height
         5, -5, 782325.5, 26744042.5, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -63,13 +63,13 @@
 )::raster
 );
 
-INSERT INTO rt_utility_test 
+INSERT INTO rt_utility_test
 VALUES ( 2, '1217x1156, ip:782325.5,26744042.5 scale:5,-5 skew:3,3 srid:9102707 width:1217 height:1156',
         26919, 1217, 1156, --- SRID, width, height
         5, -5, 782325.5, 26744042.5, 3, 3, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -94,13 +94,13 @@
 )::raster
 );
 
-INSERT INTO rt_utility_test 
+INSERT INTO rt_utility_test
 VALUES ( 3, '6000x6000, ip:-75,50 scale:0.000833333333333333,-0.000833333333333333 skew:0,0 srid:4326 width:6000 height:6000',
         4326, 6000, 6000, --- SRID, width, height
         0.000833333333333333, -0.000833333333333333, -75, 50, 0, 0, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -125,13 +125,13 @@
 )::raster
 );
 
-INSERT INTO rt_utility_test 
+INSERT INTO rt_utility_test
 VALUES ( 4, '6000x6000, ip:-75.5533328537098,49.2824585505576 scale:0.000805965234044584,-0.00080596523404458 skew:0.000211812383858707,0.000211812383858704 srid:4326 width:6000 height:6000',
         4326, 6000, 6000, --- SRID, width, height
         0.000805965234044584, -0.00080596523404458, -75.5533328537098, 49.2824585505576, 0.000211812383858707, 0.000211812383858704, --- georeference
 (
 '01' -- little endian (uint8 ndr)
-|| 
+||
 '0000' -- version (uint16 0)
 ||
 '0000' -- nBands (uint16 0)
@@ -157,176 +157,176 @@
 );
 
 -----------------------------------------------------------------------
--- Test 1 - ST_WorldTorastercoordx(rast raster, xw float8, yw float8) 
+-- Test 1 - ST_WorldTorastercoordx(rast raster, xw float8, yw float8)
 -----------------------------------------------------------------------
 
 SELECT 'test 1.1', id, name
     FROM rt_utility_test
-    WHERE COALESCE(ST_WorldTorastercoordx(rast, 
-                                ipx, 
+    WHERE COALESCE(ST_WorldTorastercoordx(rast,
+                                ipx,
                                 ipy
                                ), 0) != 1;
 
 SELECT 'test 1.2', id, name
     FROM rt_utility_test
-    WHERE COALESCE(ST_WorldTorastercoordx(rast, 
-                                scalex * (width - 1) + skewx * (height - 1) + ipx, 
+    WHERE COALESCE(ST_WorldTorastercoordx(rast,
+                                scalex * (width - 1) + skewx * (height - 1) + ipx,
                                 skewy * (width - 1) + scaley * (height - 1) + ipy
                                ), 0) != width;
 
 SELECT 'test 1.3', id, name
     FROM rt_utility_test
-    WHERE COALESCE(ST_WorldTorastercoordx(rast, 
-                                scalex * width + skewx * height + ipx, 
+    WHERE COALESCE(ST_WorldTorastercoordx(rast,
+                                scalex * width + skewx * height + ipx,
                                 skewy * width + scaley * height + ipy
                                ), 0) != width + 1;
 
 -----------------------------------------------------------------------
--- Test 2 - ST_WorldTorastercoordx(rast raster, xw float8) 
+-- Test 2 - ST_WorldTorastercoordx(rast raster, xw float8)
 -----------------------------------------------------------------------
 
 SELECT 'test 2.1', id, name
     FROM rt_utility_test
-    WHERE skewx = 0 and 
-          COALESCE(ST_WorldTorastercoordx(rast, 
+    WHERE skewx = 0 and
+          COALESCE(ST_WorldTorastercoordx(rast,
                                 ipx
                                ), 0) != 1;
 
 SELECT 'test 2.2', id, name
     FROM rt_utility_test
-    WHERE skewx = 0 and 
-          COALESCE(ST_WorldTorastercoordx(rast, 
+    WHERE skewx = 0 and
+          COALESCE(ST_WorldTorastercoordx(rast,
                                 scalex * (width - 1) + ipx
                                ), 0) != width;
 
 SELECT 'test 2.3', id, name
     FROM rt_utility_test
-    WHERE skewx = 0 and 
-          COALESCE(ST_WorldTorastercoordx(rast, 
+    WHERE skewx = 0 and
+          COALESCE(ST_WorldTorastercoordx(rast,
                                 scalex * width + ipx
                                ), 0) != width + 1;
 
 SELECT 'test 2.4', id, name
     FROM rt_utility_test
-    WHERE COALESCE(ST_WorldTorastercoordx(rast, 
+    WHERE COALESCE(ST_WorldTorastercoordx(rast,
                                 ipx
                                ), 0) != 1;
 
 -----------------------------------------------------------------------
--- Test 3 - ST_WorldTorastercoordx(rast raster, pt geometry) 
+-- Test 3 - ST_WorldTorastercoordx(rast raster, pt geometry)
 -----------------------------------------------------------------------
 
 SELECT 'test 3.1', id, name
     FROM rt_utility_test
-    WHERE COALESCE(ST_WorldTorastercoordx(rast, 
+    WHERE COALESCE(ST_WorldTorastercoordx(rast,
                                 st_makepoint(
-                                             ipx, 
+                                             ipx,
                                              ipy
                                             )
                                ), 0) != 1;
 
 SELECT 'test 3.2', id, name
     FROM rt_utility_test
-    WHERE COALESCE(ST_WorldTorastercoordx(rast, 
+    WHERE COALESCE(ST_WorldTorastercoordx(rast,
                                 st_makepoint(
-                                             scalex * (width - 1) + skewx * (height - 1) + ipx, 
+                                             scalex * (width - 1) + skewx * (height - 1) + ipx,
                                              skewy * (width - 1) + scaley * (height - 1) + ipy
                                             )
                                ), 0) != width;
 
 SELECT 'test 3.3', id, name
     FROM rt_utility_test
-    WHERE COALESCE(ST_WorldTorastercoordx(rast, 
+    WHERE COALESCE(ST_WorldTorastercoordx(rast,
                                 st_makepoint(
-                                             scalex * width + skewx * height + ipx, 
+                                             scalex * width + skewx * height + ipx,
                                              skewy * width + scaley * height + ipy
                                             )
                                ), 0) != width + 1;
 
 -----------------------------------------------------------------------
--- Test 4 - ST_WorldTorastercoordy(rast raster, xw float8, yw float8) 
+-- Test 4 - ST_WorldTorastercoordy(rast raster, xw float8, yw float8)
 -----------------------------------------------------------------------
 
 SELECT 'test 4.1', id, name
     FROM rt_utility_test
-    WHERE COALESCE(ST_WorldTorastercoordy(rast, 
-                                ipx, 
+    WHERE COALESCE(ST_WorldTorastercoordy(rast,
+                                ipx,
                                 ipy
                                ), 0) != 1;
 
 SELECT 'test 4.2', id, name
     FROM rt_utility_test
-    WHERE COALESCE(ST_WorldTorastercoordy(rast, 
-                                scalex * (width - 1) + skewx * (height - 1) + ipx, 
+    WHERE COALESCE(ST_WorldTorastercoordy(rast,
+                                scalex * (width - 1) + skewx * (height - 1) + ipx,
                                 skewy * (width - 1) + scaley * (height - 1) + ipy
                                ), 0) != height;
 
 SELECT 'test 4.3', id, name
     FROM rt_utility_test
-    WHERE COALESCE(ST_WorldTorastercoordy(rast, 
-                                scalex * width + skewx * height + ipx, 
+    WHERE COALESCE(ST_WorldTorastercoordy(rast,
+                                scalex * width + skewx * height + ipx,
                                 skewy * width + scaley * height + ipy
                                ), 0) != height + 1;
 
 -----------------------------------------------------------------------
--- Test 5 - ST_WorldTorastercoordy(rast raster, yw float8) 
+-- Test 5 - ST_WorldTorastercoordy(rast raster, yw float8)
 -----------------------------------------------------------------------
 
 SELECT 'test 5.1', id, name
     FROM rt_utility_test
-    WHERE skewy = 0 and 
-          COALESCE(ST_WorldTorastercoordy(rast, 
+    WHERE skewy = 0 and
+          COALESCE(ST_WorldTorastercoordy(rast,
                                 ipy
                                ), 0) != 1;
 
 SELECT 'test 5.2', id, name
     FROM rt_utility_test
-    WHERE skewy = 0 and 
-          COALESCE(ST_WorldTorastercoordy(rast, 
+    WHERE skewy = 0 and
+          COALESCE(ST_WorldTorastercoordy(rast,
                                 scaley * (height - 1) + ipy
                                ), 0) != height;
 
 SELECT 'test 5.3', id, name
     FROM rt_utility_test
-    WHERE skewy = 0 and 
-          COALESCE(ST_WorldTorastercoordy(rast, 
+    WHERE skewy = 0 and
+          COALESCE(ST_WorldTorastercoordy(rast,
                                 scaley * height + ipy
                                ), 0) != height + 1;
 
 SELECT 'test 5.4', id, name
     FROM rt_utility_test
-    WHERE COALESCE(ST_WorldTorastercoordy(rast, 
+    WHERE COALESCE(ST_WorldTorastercoordy(rast,
                                 ipy
                                ), 0) != 1;
 
 
 -----------------------------------------------------------------------
--- Test 6 - ST_WorldTorastercoordy(rast raster, pt geometry) 
+-- Test 6 - ST_WorldTorastercoordy(rast raster, pt geometry)
 -----------------------------------------------------------------------
 
 SELECT 'test 6.1', id, name
     FROM rt_utility_test
-    WHERE COALESCE(ST_WorldTorastercoordy(rast, 
+    WHERE COALESCE(ST_WorldTorastercoordy(rast,
                                 st_makepoint(
-                                             ipx, 
+                                             ipx,
                                              ipy
                                             )
                                ), 0) != 1;
 
 SELECT 'test 6.2', id, name
     FROM rt_utility_test
-    WHERE COALESCE(ST_WorldTorastercoordy(rast, 
+    WHERE COALESCE(ST_WorldTorastercoordy(rast,
                                 st_makepoint(
-                                             scalex * (width - 1) + skewx * (height - 1) + ipx, 
+                                             scalex * (width - 1) + skewx * (height - 1) + ipx,
                                              skewy * (width - 1) + scaley * (height - 1) + ipy
                                             )
                                ), 0) != height;
 
 SELECT 'test 6.3', id, name
     FROM rt_utility_test
-    WHERE COALESCE(ST_WorldTorastercoordy(rast, 
+    WHERE COALESCE(ST_WorldTorastercoordy(rast,
                                 st_makepoint(
-                                             scalex * width + skewx * height + ipx, 
+                                             scalex * width + skewx * height + ipx,
                                              skewy * width + scaley * height + ipy
                                             )
                                ), 0) != height + 1;
@@ -338,7 +338,7 @@
 SELECT 'test 7.1', id, name
     FROM rt_utility_test
     WHERE COALESCE(ST_RasterToworldcoordx(rast, 1, 1), 0)::numeric != ipx::numeric;
-    
+
 SELECT 'test 7.2', id, name
     FROM rt_utility_test
     WHERE COALESCE(ST_RasterToworldcoordx(rast, width, height), 0)::numeric != (scalex * (width - 1) + skewx * (height - 1) + ipx)::numeric;
@@ -350,7 +350,7 @@
 SELECT 'test 8.1', id, name
     FROM rt_utility_test
     WHERE skewx = 0 and COALESCE(ST_RasterToworldcoordx(rast, 1), 0)::numeric != ipx::numeric;
-    
+
 SELECT 'test 8.2', id, name
     FROM rt_utility_test
     WHERE skewx = 0 and COALESCE(ST_RasterToworldcoordx(rast, width), 0)::numeric != (scalex * (width - 1) + ipx)::numeric;
@@ -358,7 +358,7 @@
 SELECT 'test 8.3', id, name
     FROM rt_utility_test
     WHERE COALESCE(ST_RasterToworldcoordx(rast, 1), 0)::numeric != ipx::numeric;
- 
+
 -----------------------------------------------------------------------
 -- Test 9 - ST_RasterToworldcoordy(rast raster, xr int, yr int)
 -----------------------------------------------------------------------
@@ -366,19 +366,19 @@
 SELECT 'test 9.1', id, name
     FROM rt_utility_test
     WHERE COALESCE(ST_RasterToworldcoordy(rast, 1, 1), 0)::numeric != ipy::numeric;
-    
+
 SELECT 'test 9.2', id, name
     FROM rt_utility_test
     WHERE round(COALESCE(ST_RasterToworldcoordy(rast, width, height), 0)::numeric, 10) != round((skewy * (width - 1) + scaley * (height - 1) + ipy)::numeric, 10);
 
 -----------------------------------------------------------------------
--- Test 10 - ST_RasterToworldcoordy(rast raster, yr int) 
+-- Test 10 - ST_RasterToworldcoordy(rast raster, yr int)
 -----------------------------------------------------------------------
 
 SELECT 'test 10.1', id, name
     FROM rt_utility_test
     WHERE skewy = 0 and COALESCE(ST_RasterToworldcoordy(rast, 1, 1), 0)::numeric != ipy::numeric;
-    
+
 SELECT 'test 10.2', id, name
     FROM rt_utility_test
     WHERE skewy = 0 and COALESCE(ST_RasterToworldcoordy(rast, width, height), 0)::numeric != (scaley * (height - 1) + ipy)::numeric;
@@ -386,7 +386,7 @@
 SELECT 'test 10.3', id, name
     FROM rt_utility_test
     WHERE COALESCE(ST_RasterToworldcoordy(rast, 1), 0)::numeric != ipy::numeric;
-    
+
 -----------------------------------------------------------------------
 -- Test 11 - st_minpossiblevalue(pixtype text)
 -----------------------------------------------------------------------

Modified: trunk/regress/clean.sql
===================================================================
--- trunk/regress/clean.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/clean.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -39,7 +39,7 @@
 SELECT origin,caseno,
        st_equals(st_collectionextract(st_makevalid(orig),1), st_collectionextract(valid,1)) AND
        st_equals(st_collectionextract(st_makevalid(orig),2), st_collectionextract(valid,2)) AND
-       st_equals(st_collectionextract(st_makevalid(orig),3), st_collectionextract(valid,3)), 
+       st_equals(st_collectionextract(st_makevalid(orig),3), st_collectionextract(valid,3)),
        st_isvalid(st_makevalid(orig)), -- paranoia
        (st_isvaliddetail(orig)).valid
   FROM clean_cases;

Modified: trunk/regress/concave_hull.sql
===================================================================
--- trunk/regress/concave_hull.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/concave_hull.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,19 +1,19 @@
--- Tests to confirm the concave hull area is <= convex hull and 
+-- Tests to confirm the concave hull area is <= convex hull and
 -- covers the original geometry (can't use covers because always gives topo errors with 3.3
-SELECT 
+SELECT
 	'ST_ConcaveHull MultiPolygon 0.95', ST_Area(ST_Intersection(geom,ST_ConcaveHull(
-		geom, 0.95) )) = ST_Area(geom) As encloses_geom, 
-		(ST_Area(ST_ConvexHull(geom)) 
+		geom, 0.95) )) = ST_Area(geom) As encloses_geom,
+		(ST_Area(ST_ConvexHull(geom))
 		- ST_Area(ST_ConcaveHull(geom, 0.95))) < (0.95 * ST_Area(ST_ConvexHull(geom) ) ) As reached_target
-FROM ST_Union(ST_GeomFromText('POLYGON((175 150, 20 40, 
+FROM ST_Union(ST_GeomFromText('POLYGON((175 150, 20 40,
 			50 60, 125 100, 175 150))'),
 		ST_Buffer(ST_GeomFromText('POINT(110 170)'), 20)
 		) As geom;
 		
-SELECT 
+SELECT
 	'ST_ConcaveHull Lines 0.80', ST_Intersection(geom,ST_ConcaveHull(
-		geom, 0.80) ) = geom As encloses_geom, 
-		(ST_Area(ST_ConvexHull(geom)) 
+		geom, 0.80) ) = geom As encloses_geom,
+		(ST_Area(ST_ConvexHull(geom))
 		- ST_Area(ST_ConcaveHull(geom, 0.80))) < (0.80 * ST_Area(ST_ConvexHull(geom) ) ) As reached_target
 
 FROM ST_GeomFromText('MULTILINESTRING((106 164,30 112,74 70,82 112,130 94,
@@ -26,9 +26,9 @@
 132 186,92 182,56 158,36 150,62 150,76 128,88 118))') As geom;
 
 -- test holes vs. no holes - holes should still enclose but have smaller area than no holes --
-SELECT 
+SELECT
 	'ST_ConcaveHull Lines 0.80 holes', ST_Intersection(geom,ST_ConcaveHull(
-		geom, 0.80, true) ) = geom As encloses_geom, 
+		geom, 0.80, true) ) = geom As encloses_geom,
 		ST_Area(ST_ConcaveHull(geom, 0.80, true)) < ST_Area(ST_ConcaveHull(geom, 0.80)) As reached_target
 
 FROM ST_GeomFromText('MULTILINESTRING((106 164,30 112,74 70,82 112,130 94,

Modified: trunk/regress/dump.sql
===================================================================
--- trunk/regress/dump.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/dump.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,155 +1,155 @@
-SELECT 't1', path, ST_AsText(geom) 
+SELECT 't1', path, ST_AsText(geom)
 FROM (
-  SELECT (ST_Dump(g.geom)).* 
+  SELECT (ST_Dump(g.geom)).*
   FROM
-    (SELECT 
+    (SELECT
        'POINT (0 9)'::geometry AS geom
     ) AS g
   ) j;
-  
-SELECT 't2', path, ST_AsText(geom) 
+
+SELECT 't2', path, ST_AsText(geom)
 FROM (
-  SELECT (ST_Dump(g.geom)).* 
+  SELECT (ST_Dump(g.geom)).*
   FROM
-    (SELECT 
+    (SELECT
        'LINESTRING (
-                0 0, 
-                0 9, 
-                9 9, 
-                9 0, 
+                0 0,
+                0 9,
+                9 9,
+                9 0,
                 0 0
             )'::geometry AS geom
     ) AS g
   ) j;
-  
-SELECT 't3', path, ST_AsText(geom) 
+
+SELECT 't3', path, ST_AsText(geom)
 FROM (
-  SELECT (ST_Dump(g.geom)).* 
+  SELECT (ST_Dump(g.geom)).*
   FROM
-    (SELECT 
+    (SELECT
        'POLYGON ((
-                0 0, 
-                0 9, 
-                9 9, 
-                9 0, 
+                0 0,
+                0 9,
+                9 9,
+                9 0,
                 0 0
             ))'::geometry AS geom
     ) AS g
   ) j;
 
-SELECT 't4', path, ST_AsText(geom) 
+SELECT 't4', path, ST_AsText(geom)
 FROM (
-  SELECT (ST_Dump(g.geom)).* 
+  SELECT (ST_Dump(g.geom)).*
   FROM
-    (SELECT 
+    (SELECT
        'TRIANGLE ((
-                0 0, 
-                0 9, 
-                9 0, 
+                0 0,
+                0 9,
+                9 0,
                 0 0
             ))'::geometry AS geom
     ) AS g
   ) j;
 
-SELECT 't5', path, ST_AsText(geom) 
+SELECT 't5', path, ST_AsText(geom)
 FROM (
-  SELECT (ST_Dump(g.geom)).* 
+  SELECT (ST_Dump(g.geom)).*
   FROM
-    (SELECT 
+    (SELECT
        'POLYGON ((
-                0 0, 
-                0 9, 
-                9 9, 
-                9 0, 
+                0 0,
+                0 9,
+                9 9,
+                9 0,
                 0 0
             ), (
-                1 1, 
-                1 3, 
-                3 2, 
+                1 1,
+                1 3,
+                3 2,
                 1 1
             ), (
-                7 6, 
-                6 8, 
-                8 8, 
+                7 6,
+                6 8,
+                8 8,
                 7 6
             ))'::geometry AS geom
     ) AS g
   ) j;
 
-SELECT 't6', path, ST_AsText(geom) 
+SELECT 't6', path, ST_AsText(geom)
 FROM (
-  SELECT (ST_Dump(g.geom)).* 
+  SELECT (ST_Dump(g.geom)).*
   FROM
-    (SELECT 
+    (SELECT
        'MULTIPOLYGON (((
-                0 0, 
-                0 3, 
-                4 3, 
-                4 0, 
+                0 0,
+                0 3,
+                4 3,
+                4 0,
                 0 0
             )), ((
-                2 4, 
-                1 6, 
-                4 5, 
+                2 4,
+                1 6,
+                4 5,
                 2 4
             ), (
-                7 6, 
-                6 8, 
-                8 8, 
+                7 6,
+                6 8,
+                8 8,
                 7 6
             )))'::geometry AS geom
     ) AS g
   ) j;
 
-SELECT 't7', path, ST_AsEWKT(geom) 
+SELECT 't7', path, ST_AsEWKT(geom)
 FROM (
-  SELECT (ST_Dump(g.geom)).* 
+  SELECT (ST_Dump(g.geom)).*
    FROM
-     (SELECT 
+     (SELECT
        'POLYHEDRALSURFACE (((
-                0 0 0, 
-                0 0 1, 
-                0 1 1, 
-                0 1 0, 
+                0 0 0,
+                0 0 1,
+                0 1 1,
+                0 1 0,
                 0 0 0
             )), ((
-                0 0 0, 
-                0 1 0, 
-                1 1 0, 
-                1 0 0, 
+                0 0 0,
+                0 1 0,
+                1 1 0,
+                1 0 0,
                 0 0 0
             ))
             )'::geometry AS geom
    ) AS g
   ) j;
 
-SELECT 't8', path, ST_AsEWKT(geom) 
+SELECT 't8', path, ST_AsEWKT(geom)
 FROM (
-  SELECT (ST_Dump(g.geom)).* 
+  SELECT (ST_Dump(g.geom)).*
    FROM
-     (SELECT 
+     (SELECT
        'TIN (((
-                0 0 0, 
-                0 0 1, 
-                0 1 0, 
+                0 0 0,
+                0 0 1,
+                0 1 0,
                 0 0 0
             )), ((
-                0 0 0, 
-                0 1 0, 
-                1 1 0, 
+                0 0 0,
+                0 1 0,
+                1 1 0,
                 0 0 0
             ))
             )'::geometry AS geom
    ) AS g
   ) j;
 
-SELECT 't9', path, ST_AsText(geom) 
+SELECT 't9', path, ST_AsText(geom)
 FROM (
-  SELECT (ST_Dump(g.geom)).* 
+  SELECT (ST_Dump(g.geom)).*
   FROM
-    (SELECT 
+    (SELECT
        'GEOMETRYCOLLECTION(
-          POINT(99 98), 
+          POINT(99 98),
           LINESTRING(1 1, 3 3),
           POLYGON((0 0, 0 1, 1 1, 0 0)),
           POLYGON((0 0, 0 9, 9 9, 9 0, 0 0), (5 5, 5 6, 6 6, 5 5)),
@@ -158,12 +158,12 @@
     ) AS g
   ) j;
 
-SELECT 't10', count(*) 
+SELECT 't10', count(*)
 FROM ST_Dump('
 GEOMETRYCOLLECTION EMPTY
 ');
 
-SELECT 't11', count(*) 
+SELECT 't11', count(*)
 FROM ST_Dump('
 GEOMETRYCOLLECTION (
 	GEOMETRYCOLLECTION EMPTY,

Modified: trunk/regress/dumppoints.sql
===================================================================
--- trunk/regress/dumppoints.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/dumppoints.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,155 +1,155 @@
-SELECT path, ST_AsText(geom) 
+SELECT path, ST_AsText(geom)
 FROM (
-  SELECT (ST_DumpPoints(g.geom)).* 
+  SELECT (ST_DumpPoints(g.geom)).*
   FROM
-    (SELECT 
+    (SELECT
        'POINT (0 9)'::geometry AS geom
     ) AS g
   ) j;
-  
-SELECT path, ST_AsText(geom) 
+
+SELECT path, ST_AsText(geom)
 FROM (
-  SELECT (ST_DumpPoints(g.geom)).* 
+  SELECT (ST_DumpPoints(g.geom)).*
   FROM
-    (SELECT 
+    (SELECT
        'LINESTRING (
-                0 0, 
-                0 9, 
-                9 9, 
-                9 0, 
+                0 0,
+                0 9,
+                9 9,
+                9 0,
                 0 0
             )'::geometry AS geom
     ) AS g
   ) j;
-  
-SELECT path, ST_AsText(geom) 
+
+SELECT path, ST_AsText(geom)
 FROM (
-  SELECT (ST_DumpPoints(g.geom)).* 
+  SELECT (ST_DumpPoints(g.geom)).*
   FROM
-    (SELECT 
+    (SELECT
        'POLYGON ((
-                0 0, 
-                0 9, 
-                9 9, 
-                9 0, 
+                0 0,
+                0 9,
+                9 9,
+                9 0,
                 0 0
             ))'::geometry AS geom
     ) AS g
   ) j;
 
-SELECT path, ST_AsText(geom) 
+SELECT path, ST_AsText(geom)
 FROM (
-  SELECT (ST_DumpPoints(g.geom)).* 
+  SELECT (ST_DumpPoints(g.geom)).*
   FROM
-    (SELECT 
+    (SELECT
        'TRIANGLE ((
-                0 0, 
-                0 9, 
-                9 0, 
+                0 0,
+                0 9,
+                9 0,
                 0 0
             ))'::geometry AS geom
     ) AS g
   ) j;
 
-SELECT path, ST_AsText(geom) 
+SELECT path, ST_AsText(geom)
 FROM (
-  SELECT (ST_DumpPoints(g.geom)).* 
+  SELECT (ST_DumpPoints(g.geom)).*
   FROM
-    (SELECT 
+    (SELECT
        'POLYGON ((
-                0 0, 
-                0 9, 
-                9 9, 
-                9 0, 
+                0 0,
+                0 9,
+                9 9,
+                9 0,
                 0 0
             ), (
-                1 1, 
-                1 3, 
-                3 2, 
+                1 1,
+                1 3,
+                3 2,
                 1 1
             ), (
-                7 6, 
-                6 8, 
-                8 8, 
+                7 6,
+                6 8,
+                8 8,
                 7 6
             ))'::geometry AS geom
     ) AS g
   ) j;
 
-SELECT path, ST_AsText(geom) 
+SELECT path, ST_AsText(geom)
 FROM (
-  SELECT (ST_DumpPoints(g.geom)).* 
+  SELECT (ST_DumpPoints(g.geom)).*
   FROM
-    (SELECT 
+    (SELECT
        'MULTIPOLYGON (((
-                0 0, 
-                0 3, 
-                4 3, 
-                4 0, 
+                0 0,
+                0 3,
+                4 3,
+                4 0,
                 0 0
             )), ((
-                2 4, 
-                1 6, 
-                4 5, 
+                2 4,
+                1 6,
+                4 5,
                 2 4
             ), (
-                7 6, 
-                6 8, 
-                8 8, 
+                7 6,
+                6 8,
+                8 8,
                 7 6
             )))'::geometry AS geom
     ) AS g
   ) j;
 
-SELECT path, ST_AsEWKT(geom) 
+SELECT path, ST_AsEWKT(geom)
 FROM (
-  SELECT (ST_DumpPoints(g.geom)).* 
+  SELECT (ST_DumpPoints(g.geom)).*
    FROM
-     (SELECT 
+     (SELECT
        'POLYHEDRALSURFACE (((
-                0 0 0, 
-                0 0 1, 
-                0 1 1, 
-                0 1 0, 
+                0 0 0,
+                0 0 1,
+                0 1 1,
+                0 1 0,
                 0 0 0
             )), ((
-                0 0 0, 
-                0 1 0, 
-                1 1 0, 
-                1 0 0, 
+                0 0 0,
+                0 1 0,
+                1 1 0,
+                1 0 0,
                 0 0 0
             ))
             )'::geometry AS geom
    ) AS g
   ) j;
 
-SELECT path, ST_AsEWKT(geom) 
+SELECT path, ST_AsEWKT(geom)
 FROM (
-  SELECT (ST_DumpPoints(g.geom)).* 
+  SELECT (ST_DumpPoints(g.geom)).*
    FROM
-     (SELECT 
+     (SELECT
        'TIN (((
-                0 0 0, 
-                0 0 1, 
-                0 1 0, 
+                0 0 0,
+                0 0 1,
+                0 1 0,
                 0 0 0
             )), ((
-                0 0 0, 
-                0 1 0, 
-                1 1 0, 
+                0 0 0,
+                0 1 0,
+                1 1 0,
                 0 0 0
             ))
             )'::geometry AS geom
    ) AS g
   ) j;
 
-SELECT path, ST_AsText(geom) 
+SELECT path, ST_AsText(geom)
 FROM (
-  SELECT (ST_DumpPoints(g.geom)).* 
+  SELECT (ST_DumpPoints(g.geom)).*
   FROM
-    (SELECT 
+    (SELECT
        'GEOMETRYCOLLECTION(
-          POINT(99 98), 
+          POINT(99 98),
           LINESTRING(1 1, 3 3),
           POLYGON((0 0, 0 1, 1 1, 0 0)),
           POLYGON((0 0, 0 9, 9 9, 9 0, 0 0), (5 5, 5 6, 6 6, 5 5)),
@@ -158,9 +158,9 @@
     ) AS g
   ) j;
 
-SELECT path, ST_AsText(geom) 
+SELECT path, ST_AsText(geom)
 FROM (
-  SELECT (ST_DumpPoints(g.geom)).* 
+  SELECT (ST_DumpPoints(g.geom)).*
   FROM
 	(SELECT 'SRID=4326;CURVEPOLYGON(
 			CIRCULARSTRING(-71.0821 42.3036, -71.4821 42.3036,
@@ -170,9 +170,9 @@
 ) as g
 ) j;
 
-SELECT path, ST_AsText(geom) 
+SELECT path, ST_AsText(geom)
 FROM (
-  SELECT (ST_DumpPoints(g.geom)).* 
+  SELECT (ST_DumpPoints(g.geom)).*
   FROM (
 SELECT 'CURVEPOLYGON(CIRCULARSTRING(0 0, 4 0, 4 4, 0 4, 0 0),(1 1, 3 3, 3 1, 1 1))'::geometry as geom
 ) as g

Modified: trunk/regress/geography.sql
===================================================================
--- trunk/regress/geography.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/geography.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -17,7 +17,7 @@
 );
 
 -- Do cached and uncached distance agree?
-SELECT c, abs(ST_Distance(ply::geography, pt::geography) - _ST_DistanceUnCached(ply::geography, pt::geography)) < 0.01 FROM 
+SELECT c, abs(ST_Distance(ply::geography, pt::geography) - _ST_DistanceUnCached(ply::geography, pt::geography)) < 0.01 FROM
 ( VALUES
 ('geog_distance_cached_1a', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
 ('geog_distance_cached_1b', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
@@ -29,7 +29,7 @@
 ) AS u(c,ply,pt);
 
 -- Does tolerance based distance work cached? Inside tolerance
-SELECT c, ST_DWithin(ply::geography, pt::geography, 3000) from 
+SELECT c, ST_DWithin(ply::geography, pt::geography, 3000) from
 ( VALUES
 ('geog_dithin_cached_1a', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(10.01 5)'),
 ('geog_dithin_cached_1b', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(10.01 5)'),
@@ -37,7 +37,7 @@
 ) as p(c, ply, pt);
 
 -- Does tolerance based distance work cached? Outside tolerance
-SELECT c, ST_DWithin(ply::geography, pt::geography, 1000) from 
+SELECT c, ST_DWithin(ply::geography, pt::geography, 1000) from
 ( VALUES
 ('geog_dithin_cached_2a', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(10.01 5)'),
 ('geog_dithin_cached_2b', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(10.01 5)'),
@@ -45,7 +45,7 @@
 ) as p(c, ply, pt);
 
 -- Do things work when there's cache coherence on the point side but not the poly side?
-SELECT c, ST_DWithin(ply::geography, pt::geography, 3000) from 
+SELECT c, ST_DWithin(ply::geography, pt::geography, 3000) from
 ( VALUES
 ('geog_dithin_cached_3a', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
 ('geog_dithin_cached_3b', 'POLYGON((1 1, 1 10, 10 10, 10 1, 1 1))', 'POINT(5 5)'),
@@ -53,8 +53,8 @@
 ) as p(c, ply, pt);
 
 -- Test a precision case near the south pole that came up during development.
-WITH pt AS ( 
-    SELECT point::geography FROM ( VALUES 
+WITH pt AS (
+    SELECT point::geography FROM ( VALUES
     ('0101000020E61000006C5B94D920EB4CC0A0FD481119B24FC0'),
     ('0101000020E610000097A8DE1AD8524CC09C8A54185B1050C0'),
     ('0101000020E61000008FC2F5285C4F4CC0E5ED08A7050F50C0'),
@@ -68,8 +68,8 @@
 SELECT 'geog_precision_savffir', _ST_DistanceUnCached(pt.point, ply.polygon), ST_Distance(pt.point, ply.polygon) FROM pt, ply;
 
 -- Test another precision case near the north poly and over the dateline
-WITH pt AS ( 
-    SELECT point::geography FROM ( VALUES 
+WITH pt AS (
+    SELECT point::geography FROM ( VALUES
     ('0101000020E610000000000000004065400000000000804840'),
     ('0101000020E610000075C8CD70033965C02176A6D079315040') ) AS p(point)
 ),
@@ -93,15 +93,15 @@
 );
 INSERT INTO dwithgeogbug (gid, geog) VALUES (1, '0103000020E6100000010000000B0000000AA2F068F47651C0F7893DEB70B8454007ABD4C6D57651C000FB650799B84540C21AA2645A7651C011C24BA84AB8454089A9A325E87751C03314EB5453B74540AF9ED96BF57751C0BF9818F889B74540E936A498B47751C0690C87D1C5B74540F5386204DC7751C02FCA658F1AB8454077B65F7B657751C012C586EE37B845408C1862C5977751C00F17E41674B84540D4012F57357751C0AD3BC67E99B845400AA2F068F47651C0F7893DEB70B84540');
 INSERT INTO dwithgeogbug (gid, geog) VALUES (2, '0103000020E610000003000000B5000000E0D13F40187451C01A09009164BB4540771C07D8FA7351C04DBBEDB634BB45400D27D627A47351C070625C9386BB4540D691981FAD7351C02F382CCDFABA4540AA38FA85B97351C03AD3A8271CBB4540D211F0CBBE7351C027F11A8FD9BA4540839AE427EB7351C0BF97C6BBA3BA4540748967A4D47351C00C0037C970BA45408F182A0CF07351C0C050808070BA45405063F06DD27351C0681018D037BA4540E509D5C2EE7351C0B9429E0231BA4540EA39B20CCC7351C018FBB70F22BA454072DD47C8ED7351C04C992D5E0BBA4540934BDE09CE7351C04B17895ACFB94540F7AA9F1EF77351C04DE737D4DCB945400D217458DF7351C022324164B0B945408A2F53C4087451C0A7EC0972B1B9454091A02DF3FC7351C0077F0D388AB94540D9EA0152187451C02316A57280B9454023E37795F07351C09314E67D36B945408DD1866BFC7351C06A0A537214B945405F77D635DE7351C01C7B3C251EB945404785C336F27351C07D767383F1B8454043664E41C77351C0F499D9F3C2B84540DA5CD86FDC7351C0ECA943B295B845403A60B1A2AF7351C063B81C61AFB8454041469468AA7351C0B0727EE16AB845405ADF4611937351C0AA5D2634A3B84540D1BB958D917351C008
 6C6F1450B845408BBECFF4787351C008F3F4958EB845407F025FE0737351C0506C9F8057B845405A49EDDE5E7351C0AB88DA1B84B845402AAE2CB6767351C07ECC7AEB33B845406C3BCEFF557351C0D93C09506DB8454032C3D6B8577351C0CF4410B115B84540C47F5B30337351C08DCEBB6F7DB845400DC58DB4127351C0D68016845EB845409E0DC353E17251C05E161FDE94B84540D94A5CCDF87251C0D4A79022C3B745404B789041A97151C0D366245447B64540E229E50C7A7151C04864DEC059B645403CF020E75F7151C0C2341E664FB745404F6388C1807151C0BE100BDA2FB7454099DB3D97877151C0853918DE6CB74540080D2824137151C017385A8090B74540A380F14EE97051C0A517F62259B74540C9B0B8E1F47051C019014EF43DB7454075AB809D997051C023033EFC28B745401FCC6CFD3C7051C01778CC51B1B74540A5AFFD2A5E7051C08B7644232EB8454075947311FD7051C0EB4B7B9F09B8454007A084455D7151C065E676C6A7B845401CB4DA891A7151C096D19999D0B84540F9D410BC3E7151C08C3797C11CB945400CA63027017151C0640A96032BBA4540B07FB7D8897151C0B632805859BA454078D01A1FDD7151C0202711EE70B945405F3A6E8E627251C0932D32FE34BA4540B532341D277251C0DFA18E0392BA4540CD8E813B147251C0FEBBA23
 46EBA4540421F7F16F87151C0DEB93B76A3BA45403B2350A3D37151C0330AF75F99BA454077512147AC7151C0A628D5F117BB454011C9CE77507151C04CC4E1E705BB4540E6889885EE7051C0C45D89CDA8BA4540575D1B37B07051C0F883C0A0D7BA45408A0FB14B977051C01D328086A9BA454033A7D2839B7051C0EEC463DD22BA4540AFDC6C64DC7051C013983A6CE3B94540CC1E39AEE17051C076E753DD7BB94540F6E0B3BECA7051C070E459395BB94540E636719D447051C0CB5C78F2F8B845402D3B6C3AC76F51C08AFD07346AB945404080D345386F51C02EFB7C9465B94540B5BB47ED506F51C0B5742F4FC3B84540F4DAAD32326F51C03AE0604DCEB8454079D03A00286F51C0BFE416D692B84540E7EEF142456F51C026483D9219B84540556E7F645D6F51C06BA1A86620B845406BD12F44536F51C0F976E08663B84540D7BFD8077B6F51C0C500FD8E63B8454004DD9EC4816F51C0441D30FBDBB745403EE733710C6F51C05E6524F44EB74540BEEA42C14A6E51C0367C93EEDEB54540C84C8F841D6E51C0F035740AD0B54540F0B3122E316E51C09158039618B44540F5E629F8706E51C02FD3E2F726B44540533862949E6E51C015FA5534BBB34540C649D8EDEF6E51C02B5E6D6F80B345405D7B912E616F51C0DF4BA76B0EB2454072578CCFB76F51C0A22CCF6690B1
 454015A5C130647051C0F4EFF7540FB14540F1ACD1FA9D7051C0329CCCA94CB14540374504840E7151C04726DFC9B5B04540C4B031D7D97151C0FC7C331392B04540DC234455E77151C00A9F4A04B9B04540D1505DECCD7151C0D9351517EAB04540CDD86B5EF87151C004CB649085B1454099BE7DDB797151C037D42330B4B245400EA292D32C7151C0820E1DD8B4B24540ACE77E61257151C0EE15BF9BEBB245407AA945D2867151C0666E8B0F01B345404EE1C915D37151C04B6DD883B3B24540C58BDF35247251C0D3FB74C050B445403C06C143697251C0603A1C0D59B44540D2F9E6E6B07251C0BC16F1CCC7B44540E47B911C8D7251C0A95F88542AB5454047BC0FA6237251C031E8A2FB38B54540CAB1FB9FF87151C03B2BF41EF7B445404EBF18E8017251C09C164886A8B4454050CD38EBC67151C014E9B12709B54540B4C7E42DD37151C0FB5B1E864CB54540BECC9D27167251C0B37B1B12AEB545400643207D967251C048C2DBC1ACB5454039070923977251C0E6D50A2602B64540DDD41A1C2E7351C06156AFD91EB645402FAEBC26AD7251C06DB4F5FA28B64540E6498EEFD87251C06214C5327CB645400C5E024B2E7351C0CABD9E93B9B6454001F550AB447351C0FBAFC57D96B645405AE881CF3D7351C01917460EC7B64540695D4AA6607351C00D689CE284B64540C
 6299985517351C076C84855D3B645406625BA34747351C0E739BF479CB64540386A02DD607351C0D6534476E1B645400B69DB9F997351C0B8AC5ACD90B645400E3CF2EEAC7351C05979D2F9A1B645400FD99F71887351C03916C9ACFAB64540CA154DF19B7351C0CC4ECC370AB745403B8F39FFC07351C0311B27F4ACB6454008ED94DBD07351C069128CC9B9B64540BDEC1CCDAA7351C0FA1AAC0617B74540A99C51C1C07351C07759CE3A2AB7454073FCF177E67351C04A84EAA2CDB6454055CDCB6ED17351C0CB6C7B6438B74540DDD31435F87351C0D4D993891FB74540811059D30D7451C077753AD162B74540F18AF9E46B7451C0FD21E09762B74540F253FA4F547451C067E3343FACB74540F0BCC760697451C0E0AE673BDBB74540FA1616AB497451C0D50836ABF0B74540F41845176E7451C0950B89B7FCB74540A16098ED3D7451C0D4E3E2D80BB84540B9AFBD7B727451C019895C361DB84540163C14EB717451C013C465C245B845402645A98E427451C049F426523FB84540C47E7169707451C0958552ED5DB84540652934E8467451C0D6A4B9DC6EB84540762DC58E717451C0F00F358EA7B8454052BD47144E7451C0CE25A2A9B7B84540FE28AFF55E7451C0EC20702D0BB94540DC47DC52777451C0DB556D5401B945407C974EEE617451C0DF8FB3BF25B94540F486D9
 A77E7451C0C20621B41AB94540432A3030707451C08AB2EDBC39B945409B0D7D28167551C0BB2B0598F9B84540E9C3E5D1067551C0617DD7107BB94540ADD4816DC57451C052E51C9E7FB9454083A85A09D37451C04AA52729AAB94540E8B74A52A57451C0054656858DB94540C1F58C11C07451C073982E6DC8B945406639F493967451C09D31BA6A90B9454023779107AB7451C026DD7171DFB945404CC088A46D7451C00324607A78B94540B4263081827451C0AF743013AAB94540A1FEA7A25A7451C030846A958DB945403B797701697451C00240A15CE1B945405EBCC1C4497451C0AF0092E9BCB945408A96E72B6A7451C0A85FF698F9B9454048855507427451C06852C7B9F0B94540CFBB01EA5C7451C0DC68FBB715BA4540D42EA3CF3C7451C0D2A6746A0BBA4540510413EB577451C0EE883A7D2CBA4540DC8C76E73B7451C0808E628128BA4540904E729D4F7451C09335C2C358BA4540A9018BEC347451C0017C60D031BA4540508873A32E7451C03F4C9200BDBA45400FEFB0B0567451C00274F969CCBA45402E2B3AC7317451C09C029279CBBA4540C6748AB7417451C060364B9C0EBB4540E0D13F40187451C01A09009164BB4540080000006DABE362BF6F51C03B3EAB0286B84540F2EBCFEEAC6F51C008D8984EA3B84540FF2B5394BB6F51C0B2F08C42CBB84540FDF
 9E71CFC6F51C07C7C0453C8B845403ABCCFEBCF6F51C0D477C34AC2B845402D81685DC76F51C071D8F5EE94B84540FB229C95E86F51C0BD8E7FF7AEB845406DABE362BF6F51C03B3EAB0286B8454008000000DB185B503E7051C066B728BCD3B245400AC83B92357051C04BA0208DA3B34540D7FCFFA31D7051C0CF7C254CD6B345400E29CDB9907051C012EB7D78CCB34540806300429F7051C0B0D493C19CB34540786CA34E6C7051C093B0BB4060B345407D77C1F9657051C0497CC614C3B24540DB185B503E7051C066B728BCD3B24540');
-SELECT 
+SELECT
 '#2422' as ticket, gid, radius,
-_ST_DWithin(geog, tgeog, radius, true) AS dwithin_t, 
-_ST_DWithin(geog, tgeog, radius, false) AS dwithin_f, 
-round(ST_Distance(geog, tgeog, true)::numeric,3) AS distance_t, 
-round(ST_Distance(geog, tgeog, false)::numeric,3) AS distance_f, 
-round(_ST_DistanceUnCached(geog, tgeog)::numeric,3) AS distance_uncached, 
+_ST_DWithin(geog, tgeog, radius, true) AS dwithin_t,
+_ST_DWithin(geog, tgeog, radius, false) AS dwithin_f,
+round(ST_Distance(geog, tgeog, true)::numeric,3) AS distance_t,
+round(ST_Distance(geog, tgeog, false)::numeric,3) AS distance_f,
+round(_ST_DistanceUnCached(geog, tgeog)::numeric,3) AS distance_uncached,
 round(_ST_DistanceTree(geog, tgeog)::numeric,3) AS distance_tree
-FROM dwithgeogbug 
+FROM dwithgeogbug
 CROSS JOIN ST_GeogFromText('POINT(-69.83262 43.43636)') AS tgeog
 CROSS JOIN (VALUES (1609),(1600),(1068)) AS t (radius)
 ORDER BY distance_t;
@@ -116,4 +116,4 @@
 
 -- Clean up spatial_ref_sys
 DELETE FROM spatial_ref_sys WHERE srid IN (4269,4326);
-    
+

Modified: trunk/regress/hausdorff.sql
===================================================================
--- trunk/regress/hausdorff.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/hausdorff.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -14,19 +14,19 @@
 
 -- other linestrings
 SELECT 'hausdorff_ls_ls_2', st_hausdorffdistance(
-	'LINESTRING (0 0, 2 0)'::geometry, 
+	'LINESTRING (0 0, 2 0)'::geometry,
 	'LINESTRING (0 1, 1 2, 2 1)'::geometry);
 -- 2.0
 
 -- linestring and multipoint
 SELECT 'hausdorff_ls_mp', st_hausdorffdistance(
-	'LINESTRING (0 0, 2 0)'::geometry, 
+	'LINESTRING (0 0, 2 0)'::geometry,
 	'MULTIPOINT (0 1, 1 0, 2 1)'::geometry);
 -- 1.0
 
 -- another linestring and linestring
 SELECT 'hausdorff_ls_ls_3', st_hausdorffdistance(
-	'LINESTRING (130 0, 0 0, 0 150)'::geometry, 
+	'LINESTRING (130 0, 0 0, 0 150)'::geometry,
 	'LINESTRING (10 10, 10 150, 130 10)'::geometry);
 -- 14.142135623730951
 

Modified: trunk/regress/in_geojson.sql
===================================================================
--- trunk/regress/in_geojson.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/in_geojson.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -12,10 +12,10 @@
 select '#1434.2',ST_GeomFromGeoJSON('crashme');;
 select '#1434.3',ST_GeomFromGeoJSON('');
 select '#1434.4',ST_GeomFromGeoJSON('{}');
-select '#1434.5',ST_GeomFromGeoJSON('{"type":"Point","coordinates":[]}'); 
-select '#1434.6',ST_GeomFromGeoJSON('{"type":"MultiPoint","coordinates":[[]]}'); 
-select '#1434.7',ST_GeomFromGeoJSON('{"type":"MultiPoint"}'); 
-select '#1434.8',ST_GeomFromGeoJSON('{"type":"Point"}'); 
+select '#1434.5',ST_GeomFromGeoJSON('{"type":"Point","coordinates":[]}');
+select '#1434.6',ST_GeomFromGeoJSON('{"type":"MultiPoint","coordinates":[[]]}');
+select '#1434.7',ST_GeomFromGeoJSON('{"type":"MultiPoint"}');
+select '#1434.8',ST_GeomFromGeoJSON('{"type":"Point"}');
 
 -- #2130 --
 SELECT '#2130', ST_NPoints(ST_GeomFromGeoJSON('{"type":"MultiPolygon","coordinates":[[[[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,32],[-117,32],[-117,32],[-117,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-117,32],[-117,32],[-117,32],[-117,32]],[[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,32],[-117,33]]]]}'));

Modified: trunk/regress/in_gml.sql
===================================================================
--- trunk/regress/in_gml.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/in_gml.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -69,7 +69,7 @@
 -- srsName handle
 SELECT 'linestring_3', ST_AsEWKT(ST_GeomFromGML('<gml:LineString srsName="EPSG:4326"><gml:coordinates>1,2 3,4</gml:coordinates></gml:LineString>'));
 
--- ERROR: empty coordinates 
+-- ERROR: empty coordinates
 SELECT 'linestring_4', ST_AsEWKT(ST_GeomFromGML('<gml:LineString><gml:coordinates></gml:coordinates></gml:LineString>'));
 SELECT 'linestring_5', ST_AsEWKT(ST_GeomFromGML('<gml:LineString></gml:LineString>'));
 
@@ -92,16 +92,16 @@
 -- srsName handle
 SELECT 'curve_3', ST_AsEWKT(ST_GeomFromGML('<gml:Curve srsName="EPSG:4326"><gml:segments><gml:LineStringSegment><gml:posList>1 2 3 4</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve>'));
 
--- ERROR: empty coordinates 
+-- ERROR: empty coordinates
 SELECT 'curve_4', ST_AsEWKT(ST_GeomFromGML('<gml:Curve srsName="EPSG:4326"><gml:segments><gml:LineStringSegment><gml:posList></gml:posList></gml:LineStringSegment></gml:segments></gml:Curve>'));
 SELECT 'curve_5', ST_AsEWKT(ST_GeomFromGML('<gml:Curve srsName="EPSG:4326"><gml:segments><gml:LineStringSegment></gml:LineStringSegment></gml:segments></gml:Curve>'));
 SELECT 'curve_6', ST_AsEWKT(ST_GeomFromGML('<gml:Curve srsName="EPSG:4326"><gml:segments></gml:segments></gml:Curve>'));
 SELECT 'curve_7', ST_AsEWKT(ST_GeomFromGML('<gml:Curve srsName="EPSG:4326"></gml:Curve>'));
 
--- linear interpolation 
+-- linear interpolation
 SELECT 'curve_8', ST_AsEWKT(ST_GeomFromGML('<gml:Curve><gml:segments><gml:LineStringSegment interpolation="linear"><gml:posList>1 2 3 4</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve>'));
 
--- ERROR: wrong interpolation 
+-- ERROR: wrong interpolation
 SELECT 'curve_9', ST_AsEWKT(ST_GeomFromGML('<gml:Curve><gml:segments><gml:LineStringSegment interpolation="spline"><gml:posList>1 2 3 4</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve>'));
 
 -- XML not elements handle
@@ -134,7 +134,7 @@
 -- srsName handle
 SELECT 'polygon_2', ST_AsEWKT(ST_GeomFromGML('<gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,2 3,4 5,6 1,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon>'));
 
--- ERROR: In exterior ring: Last point is not the same as the first one 
+-- ERROR: In exterior ring: Last point is not the same as the first one
 SELECT 'polygon_3', ST_AsEWKT(ST_GeomFromGML('<gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,2 3,4 5,6 1,3</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon>'));
 
 -- ERROR: In exterior 3D ring: Last point is not the same as the first one in Z
@@ -143,7 +143,7 @@
 -- ERROR: Only 3 points in exterior ring
 SELECT 'polygon_5', ST_AsEWKT(ST_GeomFromGML('<gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,2 3,4 1,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon>'));
 
--- ERROR: Empty exterior ring coordinates 
+-- ERROR: Empty exterior ring coordinates
 SELECT 'polygon_6', ST_AsEWKT(ST_GeomFromGML('<gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates></gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon>'));
 SELECT 'polygon_7', ST_AsEWKT(ST_GeomFromGML('<gml:Polygon><gml:outerBoundaryIs><gml:LinearRing></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon>'));
 SELECT 'polygon_8', ST_AsEWKT(ST_GeomFromGML('<gml:Polygon><gml:outerBoundaryIs></gml:outerBoundaryIs></gml:Polygon>'));
@@ -161,7 +161,7 @@
 -- ERROR: Only 3 points in interior ring
 SELECT 'polygon_13', ST_AsEWKT(ST_GeomFromGML('<gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,2 3,4 5,6 1,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>7,8 9,10 7,8</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon>'));
 
--- ERROR: In interior ring: Last point is not the same as the first one 
+-- ERROR: In interior ring: Last point is not the same as the first one
 SELECT 'polygon_14', ST_AsEWKT(ST_GeomFromGML('<gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,2 3,4 5,6 1,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>7,8 9,10 11,12 7,9</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon>'));
 
 -- ERROR: In interior 3D ring: Last point is not the same as the first one in Z
@@ -170,7 +170,7 @@
 -- GML 2 - 3 rings
 SELECT 'polygon_16', ST_AsEWKT(ST_GeomFromGML('<gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,2 3,4 5,6 1,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>7,8 9,10 11,12 7,8</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>13,14 15,16 17,18 13,14</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon>'));
 
--- GML 3 
+-- GML 3
 SELECT 'polygon_17', ST_AsEWKT(ST_GeomFromGML('<gml:Polygon><gml:exterior><gml:LinearRing><gml:coordinates>1,2 3,4 5,6 1,2</gml:coordinates></gml:LinearRing></gml:exterior><gml:interior><gml:LinearRing><gml:coordinates>7,8 9,10 11,12 7,8</gml:coordinates></gml:LinearRing></gml:interior></gml:Polygon>'));
 
 -- Mixed dimension in rings
@@ -179,9 +179,9 @@
 
 
 
--- 
+--
 -- LinearRing
--- 
+--
 
 -- 2D LinearRing
 SELECT 'linearring_1', ST_AsEWKT(ST_GeomFromGML('<gml:LinearRing><gml:posList>1 2 3 4 5 6 1 2</gml:posList></gml:LinearRing>'));
@@ -189,7 +189,7 @@
 -- srsName handle
 SELECT 'linearring_2', ST_AsEWKT(ST_GeomFromGML('<gml:LinearRing srsName="EPSG:4326"><gml:posList>1 2 3 4 5 6 1 2</gml:posList></gml:LinearRing>'));
 
--- ERROR: Last point is not the same as the first one 
+-- ERROR: Last point is not the same as the first one
 SELECT 'linearring_3', ST_AsEWKT(ST_GeomFromGML('<gml:LinearRing><gml:posList>1 2 3 4 5 6 1 3</gml:posList></gml:LinearRing>'));
 
 -- ERROR: Last point is not the same as the first one in Z
@@ -198,7 +198,7 @@
 -- ERROR: Only 3 points
 SELECT 'linearring_5', ST_AsEWKT(ST_GeomFromGML('<gml:LinearRing><gml:posList>1 2 3 4 1 3</gml:posList></gml:LinearRing>'));
 
--- ERROR: Empty coordinates 
+-- ERROR: Empty coordinates
 SELECT 'linearring_6', ST_AsEWKT(ST_GeomFromGML('<gml:LinearRing><gml:posList></gml:posList></gml:LinearRing>'));
 SELECT 'linearring_7', ST_AsEWKT(ST_GeomFromGML('<gml:LinearRing></gml:LinearRing>'));
 
@@ -216,7 +216,7 @@
 -- srsName handle
 SELECT 'triangle_2', ST_AsEWKT(ST_GeomFromGML('<gml:Triangle srsName="EPSG:4326"><gml:exterior><gml:LinearRing><gml:coordinates>1,2 3,4 5,6 1,2</gml:coordinates></gml:LinearRing></gml:exterior></gml:Triangle>'));
 
--- ERROR: Last point is not the same as the first one 
+-- ERROR: Last point is not the same as the first one
 SELECT 'triangle_3', ST_AsEWKT(ST_GeomFromGML('<gml:Triangle><gml:exterior><gml:LinearRing><gml:coordinates>1,2 3,4 5,6 1,0</gml:coordinates></gml:LinearRing></gml:exterior></gml:PolygonPatch></gml:patches></gml:Surfacne>'));
 
 -- ERROR: Last point is not the same as the first one in Z
@@ -225,7 +225,7 @@
 -- ERROR: Only 3 points
 SELECT 'triangle_5', ST_AsEWKT(ST_GeomFromGML('<gml:Triangle><gml:exterior><gml:LinearRing><gml:coordinates>1,2 3,4 1,2</gml:coordinates></gml:LinearRing></gml:exterior></gml:Triangle>'));
 
--- ERROR: Empty exterior ring coordinates 
+-- ERROR: Empty exterior ring coordinates
 SELECT 'triangle_6', ST_AsEWKT(ST_GeomFromGML('<gml:Triangle><gml:exterior><gml:LinearRing></gml:LinearRing></gml:exterior></gml:Triangle>'));
 SELECT 'triangle_7', ST_AsEWKT(ST_GeomFromGML('<gml:Triangle><gml:exterior></gml:exterior></gml:Triangle>'));
 SELECT 'triangle_8', ST_AsEWKT(ST_GeomFromGML('<gml:Triangle></gml:Triangle>'));
@@ -251,7 +251,7 @@
 -- srsName handle
 SELECT 'surface_2', ST_AsEWKT(ST_GeomFromGML('<gml:Surface srsName="EPSG:4326"><gml:patches><gml:PolygonPatch><gml:exterior><gml:LinearRing><gml:coordinates>1,2 3,4 5,6 1,2</gml:coordinates></gml:LinearRing></gml:exterior></gml:PolygonPatch></gml:patches></gml:Surface>'));
 
--- ERROR: In exterior ring: Last point is not the same as the first one 
+-- ERROR: In exterior ring: Last point is not the same as the first one
 SELECT 'surface_3', ST_AsEWKT(ST_GeomFromGML('<gml:Surface><gml:patches><gml:PolygonPatch><gml:exterior><gml:LinearRing><gml:coordinates>1,2 3,4 5,6 1,0</gml:coordinates></gml:LinearRing></gml:exterior></gml:PolygonPatch></gml:patches></gml:Surface>'));
 
 -- ERROR: In exterior 3D ring: Last point is not the same as the first one in Z
@@ -260,7 +260,7 @@
 -- ERROR: Only 3 points in exterior ring
 SELECT 'surface_5', ST_AsEWKT(ST_GeomFromGML('<gml:Surface><gml:patches><gml:PolygonPatch><gml:exterior><gml:LinearRing><gml:coordinates>1,2 3,4 1,2</gml:coordinates></gml:LinearRing></gml:exterior></gml:PolygonPatch></gml:patches></gml:Surface>'));
 
--- ERROR: Empty exterior ring coordinates 
+-- ERROR: Empty exterior ring coordinates
 SELECT 'surface_6', ST_AsEWKT(ST_GeomFromGML('<gml:Surface><gml:patches><gml:PolygonPatch><gml:exterior><gml:LinearRing></gml:LinearRing></gml:exterior></gml:PolygonPatch></gml:patches></gml:Surface>'));
 SELECT 'surface_7', ST_AsEWKT(ST_GeomFromGML('<gml:Surface><gml:patches><gml:PolygonPatch><gml:exterior></gml:exterior></gml:PolygonPatch></gml:patches></gml:Surface>'));
 SELECT 'surface_8', ST_AsEWKT(ST_GeomFromGML('<gml:Surface><gml:patches><gml:PolygonPatch></gml:PolygonPatch></gml:patches></gml:Surface>'));
@@ -279,7 +279,7 @@
 -- ERROR: Only 3 points in interior ring
 SELECT 'surface_14', ST_AsEWKT(ST_GeomFromGML('<gml:Surface><gml:patches><gml:PolygonPatch><gml:exterior><gml:LinearRing><gml:coordinates>1,2 3,4 5,6 1,2</gml:coordinates></gml:LinearRing></gml:exterior><gml:interior><gml:LinearRing><gml:coordinates>7,8 9,10 7,8</gml:coordinates></gml:LinearRing></gml:interior></gml:PolygonPatch></gml:patches></gml:Surface>'));
 
--- ERROR: In interior ring: Last point is not the same as the first one 
+-- ERROR: In interior ring: Last point is not the same as the first one
 SELECT 'surface_15', ST_AsEWKT(ST_GeomFromGML('<gml:Surface><gml:patches><gml:PolygonPatch><gml:exterior><gml:LinearRing><gml:coordinates>1,2 3,4 5,6 1,2</gml:coordinates></gml:LinearRing></gml:exterior><gml:interior><gml:LinearRing><gml:coordinates>7,8 9,10 11,12 7,0</gml:coordinates></gml:LinearRing></gml:interior></gml:PolygonPatch></gml:patches></gml:Surface>'));
 
 -- ERROR: In interior 3D ring: Last point is not the same as the first one in Z
@@ -301,7 +301,7 @@
 -- ERROR: interpolation not planar
 SELECT 'surface_22', ST_AsEWKT(ST_GeomFromGML('<gml:Surface><gml:patches><gml:PolygonPatch interpolation="not_planar"><gml:exterior><gml:LinearRing><gml:coordinates>1,2 3,4 5,6 1,2</gml:coordinates></gml:LinearRing></gml:exterior></gml:PolygonPatch></gml:patches></gml:Surface>'));
 
--- ERROR: interior but no exterior 
+-- ERROR: interior but no exterior
 SELECT 'surface_23', ST_AsEWKT(ST_GeomFromGML('<gml:Surface><gml:patches><gml:PolygonPatch><gml:interior><gml:LinearRing><gml:coordinates>1,2 3,4 5,6 1,2</gml:coordinates></gml:LinearRing></gml:interior></gml:PolygonPatch></gml:patches></gml:Surface>'));
 
 
@@ -318,7 +318,7 @@
 -- srsName handle
 SELECT 'mpoint_3', ST_AsEWKT(ST_GeomFromGML('<gml:MultiPoint srsName="EPSG:4326"><gml:pointMember><gml:Point><gml:coordinates>1,2</gml:coordinates></gml:Point></gml:pointMember></gml:MultiPoint>'));
 
--- Empty MultiPoints 
+-- Empty MultiPoints
 SELECT 'mpoint_4', ST_AsEWKT(ST_GeomFromGML('<gml:MultiPoint><gml:pointMember></gml:pointMember></gml:MultiPoint>'));
 SELECT 'mpoint_5', ST_AsEWKT(ST_GeomFromGML('<gml:MultiPoint></gml:MultiPoint>'));
 
@@ -379,7 +379,7 @@
 -- srsName handle
 SELECT 'mcurve_3', ST_AsEWKT(ST_GeomFromGML('<gml:MultiCurve srsName="EPSG:4326"><gml:curveMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:posList>1 2 3 4</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveMember></gml:MultiCurve>'));
 
--- Empty Curve 
+-- Empty Curve
 SELECT 'mcurve_4', ST_AsEWKT(ST_GeomFromGML('<gml:MultiCurve><gml:curveMember></gml:curveMember></gml:MultiCurve>'));
 SELECT 'mcurve_5', ST_AsEWKT(ST_GeomFromGML('<gml:MultiCurve></gml:MultiCurve>'));
 
@@ -446,7 +446,7 @@
 -- srsName handle
 SELECT 'msurface_3', ST_AsEWKT(ST_GeomFromGML('<gml:MultiSurface srsName="EPSG:4326"><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>1 2 3 4 5 6 1 2</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember></gml:MultiSurface>'));
 
--- Empty MultiSurface 
+-- Empty MultiSurface
 SELECT 'msurface_4', ST_AsEWKT(ST_GeomFromGML('<gml:MultiSurface><gml:surfaceMember></gml:surfaceMember></gml:MultiSurface>'));
 SELECT 'msurface_5', ST_AsEWKT(ST_GeomFromGML('<gml:MultiSurface></gml:MultiSurface>'));
 
@@ -480,7 +480,7 @@
 -- srsName handle
 SELECT 'polyhedralsurface_2', ST_AsEWKT(ST_GeomFromGML('<gml:PolyhedralSurface srsName="EPSG:4326"><gml:polygonPatches><gml:PolygonPatch><gml:exterior><gml:LinearRing><gml:posList srsDimension="3">1 2 3 4 5 6 7 8 9 1 2 3</gml:posList></gml:LinearRing></gml:exterior></gml:PolygonPatch></gml:polygonPatches></gml:PolyhedralSurface>'));
 
--- ERROR: In exterior ring: Last point is not the same as the first one 
+-- ERROR: In exterior ring: Last point is not the same as the first one
 SELECT 'polyhedralsurface_3', ST_AsEWKT(ST_GeomFromGML('<gml:PolyhedralSurface><gml:polygonPatches><gml:PolygonPatch><gml:exterior><gml:LinearRing><gml:posList srsDimension="3">1 2 3 4 5 6 7 8 9 1 0 3</gml:posList></gml:LinearRing></gml:exterior></gml:PolygonPatch></gml:polygonPatches></gml:PolyhedralSurface>'));
 
 -- ERROR: In exterior 3D ring: Last point is not the same as the first one in Z
@@ -489,7 +489,7 @@
 -- ERROR: Only 3 points in exterior ring
 SELECT 'polyhedralsurface_5', ST_AsEWKT(ST_GeomFromGML('<gml:PolyhedralSurface><gml:polygonPatches><gml:PolygonPatch><gml:exterior><gml:LinearRing><gml:posList srsDimension="3">1 2 3 4 5 6 1 2 3</gml:posList></gml:LinearRing></gml:exterior></gml:PolygonPatch></gml:polygonPatches></gml:PolyhedralSurface>'));
 
--- ERROR: Empty exterior ring coordinates 
+-- ERROR: Empty exterior ring coordinates
 SELECT 'polyhedralsurface_6', ST_AsEWKT(ST_GeomFromGML('<gml:PolyhedralSurface><gml:polygonPatches><gml:PolygonPatch><gml:exterior><gml:LinearRing></gml:LinearRing></gml:exterior></gml:PolygonPatch></gml:polygonPatches></gml:PolyhedralSurface>'));
 SELECT 'polyhedralsurface_7', ST_AsEWKT(ST_GeomFromGML('<gml:PolyhedralSurface><gml:polygonPatches><gml:PolygonPatch><gml:exterior></gml:exterior></gml:PolygonPatch></gml:polygonPatches></gml:PolyhedralSurface>'));
 SELECT 'polyhedralsurface_8', ST_AsEWKT(ST_GeomFromGML('<gml:PolyhedralSurface><gml:polygonPatches><gml:PolygonPatch></gml:PolygonPatch></gml:polygonPatches></gml:PolyhedralSurface>'));
@@ -516,7 +516,7 @@
 -- ERROR: Only 3 points in interior ring
 SELECT 'polyhedralsurface_16', ST_AsEWKT(ST_GeomFromGML('<gml:PolyhedralSurface><gml:polygonPatches><gml:PolygonPatch><gml:exterior><gml:LinearRing><gml:posList srsDimension="3">1 2 3 4 5 6 7 8 9 1 2 3</gml:posList></gml:LinearRing></gml:exterior><gml:interior><gml:LinearRing><gml:posList srsDimension="3">10 11 12 13 14 15 16 10 11 12</gml:posList></gml:LinearRing></gml:interior></gml:PolygonPatch></gml:polygonPatches></gml:PolyhedralSurface>'));
 
--- ERROR: In interior ring: Last point is not the same as the first one 
+-- ERROR: In interior ring: Last point is not the same as the first one
 SELECT 'polyhedralsurface_17', ST_AsEWKT(ST_GeomFromGML('<gml:PolyhedralSurface><gml:polygonPatches><gml:PolygonPatch><gml:exterior><gml:LinearRing><gml:posList srsDimension="3">1 2 3 4 5 6 7 8 9 1 2 3</gml:posList></gml:LinearRing></gml:exterior><gml:interior><gml:LinearRing><gml:posList srsDimension="3">10 11 12 13 14 15 16 17 18 10 0 12</gml:posList></gml:LinearRing></gml:interior></gml:PolygonPatch></gml:polygonPatches></gml:PolyhedralSurface>'));
 
 -- ERROR: In interior 3D ring: Last point is not the same as the first one in Z
@@ -552,7 +552,7 @@
 -- srsName handle
 SELECT 'tin_2', ST_AsEWKT(ST_GeomFromGML('<gml:Tin srsName="EPSG:4326"><gml:patches><gml:Triangle><gml:exterior><gml:LinearRing><gml:posList srsDimension="3">1 2 3 4 5 6 7 8 9 1 2 3</gml:posList></gml:LinearRing></gml:exterior></gml:Triangle></gml:patches></gml:Tin>'));
 
--- ERROR: Last point is not the same as the first one 
+-- ERROR: Last point is not the same as the first one
 SELECT 'tin_3', ST_AsEWKT(ST_GeomFromGML('<gml:Tin><gml:patches><gml:Triangle><gml:exterior><gml:LinearRing><gml:posList srsDimension="3">1 2 3 4 5 6 7 8 9 1 0 3</gml:posList></gml:LinearRing></gml:exterior></gml:Triangle></gml:patches></gml:Tin>'));
 
 -- ERROR: Last point is not the same as the first one in Z
@@ -561,7 +561,7 @@
 -- ERROR: Only 3 points in exterior ring
 SELECT 'tin_5', ST_AsEWKT(ST_GeomFromGML('<gml:Tin><gml:patches><gml:Triangle><gml:exterior><gml:LinearRing><gml:posList srsDimension="3">1 2 3 4 5 6 1 2 3</gml:posList></gml:LinearRing></gml:exterior></gml:Triangle></gml:patches></gml:Tin>'));
 
--- ERROR: Empty exterior ring coordinates 
+-- ERROR: Empty exterior ring coordinates
 SELECT 'tin_6', ST_AsEWKT(ST_GeomFromGML('<gml:Tin><gml:patches><gml:Triangle><gml:exterior><gml:LinearRing></gml:LinearRing></gml:exterior></gml:Triangle></gml:patches></gml:Tin>'));
 SELECT 'tin_7', ST_AsEWKT(ST_GeomFromGML('<gml:Tin><gml:patches><gml:Triangle><gml:exterior></gml:exterior></gml:Triangle></gml:patches></gml:Tin>'));
 
@@ -598,16 +598,16 @@
 -- GeometryCollection
 --
 
--- 1 simple geom 
+-- 1 simple geom
 SELECT 'collection_1', ST_AsEWKT(ST_GeomFromGML('<gml:MultiGeometry><gml:geometryMember><gml:Point><gml:coordinates>1,2</gml:coordinates></gml:Point></gml:geometryMember></gml:MultiGeometry>'));
 
 -- 2 simples geom
 SELECT 'collection_2', ST_AsEWKT(ST_GeomFromGML('<gml:MultiGeometry><gml:geometryMember><gml:Point><gml:pos>1 2</gml:pos></gml:Point></gml:geometryMember><gml:geometryMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:posList>3 4 5 6</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:geometryMember></gml:MultiGeometry>'));
 
--- 1 multi geom 
+-- 1 multi geom
 SELECT 'collection_3', ST_AsEWKT(ST_GeomFromGML('<gml:MultiGeometry><gml:geometryMember><gml:MultiPoint><gml:pointMember><gml:Point><gml:pos>1 2</gml:pos></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:pos>3 4</gml:pos></gml:Point></gml:pointMember></gml:MultiPoint></gml:geometryMember></gml:MultiGeometry>'));
 
--- 2 multi geom 
+-- 2 multi geom
 SELECT 'collection_4', ST_AsEWKT(ST_GeomFromGML('<gml:MultiGeometry><gml:geometryMember><gml:MultiPoint><gml:pointMember><gml:Point><gml:pos>1 2</gml:pos></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:pos>3 4</gml:pos></gml:Point></gml:pointMember></gml:MultiPoint></gml:geometryMember><gml:geometryMember><gml:MultiCurve><gml:curveMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:posList>5 6 7 8</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveMember><gml:curveMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:posList>9 10 11 12</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveMember></gml:MultiCurve></gml:geometryMember></gml:MultiGeometry>'));
 
 -- 2 multi geom and 2 simples
@@ -675,22 +675,22 @@
 -- ERROR: srsName is defined as -1
 SELECT 'srs_16', ST_AsEWKT(ST_GeomFromGML('<gml:Point srsName="EPSG:-1"><gml:pos>1 2</gml:pos></gml:Point>'));
 
--- Reverse axis with all kind of simples geometry types 
+-- Reverse axis with all kind of simples geometry types
 SELECT 'srs_17', ST_AsEWKT(ST_GeomFromGML('<gml:MultiGeometry srsName="urn:ogc:def:crs:EPSG::4326"><gml:geometryMember><gml:Point><gml:pos srsDimension="2">1 2</gml:pos></gml:Point></gml:geometryMember><gml:geometryMember><gml:LineString><gml:posList srsDimension="2">3 4 5 6</gml:posList></gml:LineString></gml:geometryMember><gml:geometryMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:posList srsDimension="2">7 8 9 10</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:geometryMember><gml:geometryMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList srsDimension="2">11 12 13 14 15 16 11 12</gml:posList></gml:LinearRing></gml:exterior><gml:interior><gml:LinearRing><gml:posList srsDimension="2">17 18 19 20 21 22 17 18</gml:posList></gml:LinearRing></gml:interior></gml:Polygon></gml:geometryMember><gml:geometryMember><gml:Surface><gml:patches><gml:PolygonPatch><gml:exterior><gml:LinearRing><gml:posList srsDimension="2">23 24 25 26 27 28 23 24</gml
 :posList></gml:LinearRing></gml:exterior><gml:interior><gml:LinearRing><gml:posList srsDimension="2">25 26 27 28 29 30 25 26</gml:posList></gml:LinearRing></gml:interior></gml:PolygonPatch></gml:patches></gml:Surface></gml:geometryMember></gml:MultiGeometry>'));
 
--- Reverse axis with severals multi geometry types 
+-- Reverse axis with severals multi geometry types
 -- TODO
 
 
 
 --
 -- GML Namespace
--- 
+--
 
 -- GML namespace
 SELECT 'ns_1', ST_AsEWKT(ST_GeomFromGML('<gml:Point xmlns:gml="http://www.opengis.net/gml"><gml:coordinates>1,2</gml:coordinates></gml:Point>'));
 
--- GML namespace without explicit prefix 
+-- GML namespace without explicit prefix
 SELECT 'ns_2', ST_AsEWKT(ST_GeomFromGML('<gml:Point xmlns="http://www.opengis.net/gml"><gml:coordinates>1,2</gml:coordinates></gml:Point>'));
 
 -- GML 3.2 namespace
@@ -758,16 +758,16 @@
 -- ERROR: Begin on comma
 SELECT 'coordinates_11', ST_AsEWKT(ST_GeomFromGML('<gml:LineString><gml:coordinates>,1 2,3</gml:coordinates></gml:LineString>'));
 
--- Whitespaces before and after 
+-- Whitespaces before and after
 SELECT 'coordinates_12', ST_AsEWKT(ST_GeomFromGML('<gml:LineString><gml:coordinates> 1,2 3,4 </gml:coordinates></gml:LineString>'));
-SELECT 'coordinates_13', ST_AsEWKT(ST_GeomFromGML('<gml:LineString><gml:coordinates> 
-								1,2 3,4  
+SELECT 'coordinates_13', ST_AsEWKT(ST_GeomFromGML('<gml:LineString><gml:coordinates>
+								1,2 3,4
 						   </gml:coordinates></gml:LineString>'));
 
 -- Mixed dimension
 SELECT 'coordinates_14', ST_AsEWKT(ST_GeomFromGML('<gml:LineString><gml:coordinates>1,2,3 4,5</gml:coordinates></gml:LineString>'));
 
--- ERROR: Spaces insides 
+-- ERROR: Spaces insides
 SELECT 'coordinates_15', ST_AsEWKT(ST_GeomFromGML('<gml:LineString><gml:coordinates>1, 2 3, 4</gml:coordinates></gml:LineString>'));
 SELECT 'coordinates_16', ST_AsEWKT(ST_GeomFromGML('<gml:LineString><gml:coordinates>1,2  3,4</gml:coordinates></gml:LineString>'));
 
@@ -783,7 +783,7 @@
 -- Specify default CS separator
 SELECT 'coordinates_cs_1', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:coordinates cs="," >1,2</gml:coordinates></gml:Point>'));
 
--- ERROR: wrong CS separator 
+-- ERROR: wrong CS separator
 SELECT 'coordinates_cs_2', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:coordinates cs=";" >1,2</gml:coordinates></gml:Point>'));
 
 -- Specify a CS separator
@@ -792,13 +792,13 @@
 -- ERROR: CS separator is a number
 SELECT 'coordinates_cs_4', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:coordinates cs="0" >102</gml:coordinates></gml:Point>'));
 
--- ERROR: CS separator is multichar 
+-- ERROR: CS separator is multichar
 SELECT 'coordinates_cs_5', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:coordinates cs="||" >1||2</gml:coordinates></gml:Point>'));
 
 -- Specify default TS separator
 SELECT 'coordinates_cs_6', ST_AsEWKT(ST_GeomFromGML('<gml:LineString><gml:coordinates ts=" ">1,2 3,4</gml:coordinates></gml:LineString>'));
 
--- ERROR: wrong TS separator 
+-- ERROR: wrong TS separator
 SELECT 'coordinates_cs_7', ST_AsEWKT(ST_GeomFromGML('<gml:LineString><gml:coordinates ts=" ">1,2;3,4</gml:coordinates></gml:LineString>'));
 
 -- Specify a TS separator
@@ -807,19 +807,19 @@
 -- ERROR: TS separator is a number
 SELECT 'coordinates_cs_9', ST_AsEWKT(ST_GeomFromGML('<gml:LineString><gml:coordinates ts="0">1,203,4</gml:coordinates></gml:LineString>'));
 
--- ERROR: TS separator is multichar 
+-- ERROR: TS separator is multichar
 SELECT 'coordinates_cs_10', ST_AsEWKT(ST_GeomFromGML('<gml:LineString><gml:coordinates ts="||">1,2||3,4</gml:coordinates></gml:LineString>'));
 
 -- Specify default Decimal separator
 SELECT 'coordinates_cs_11', ST_AsEWKT(ST_GeomFromGML('<gml:LineString><gml:coordinates decimal=".">1.1,2.2 3.3,4.4</gml:coordinates></gml:LineString>'));
 
--- ERROR: wrong Decimal separator 
+-- ERROR: wrong Decimal separator
 SELECT 'coordinates_cs_12', ST_AsEWKT(ST_GeomFromGML('<gml:LineString><gml:coordinates decimal=";">1;1,2;2 3;3,4;4</gml:coordinates></gml:LineString>'));
 
 -- ERROR: Decimal separator is a number
 SELECT 'coordinates_cs_13', ST_AsEWKT(ST_GeomFromGML('<gml:LineString><gml:coordinates decimal="0">101,202 303,404</gml:coordinates></gml:LineString>'));
 
--- ERROR: Decimal separator is multichar 
+-- ERROR: Decimal separator is multichar
 SELECT 'coordinates_cs_14', ST_AsEWKT(ST_GeomFromGML('<gml:LineString><gml:coordinates decimal="||">1||1,2||2 3||3,4||4</gml:coordinates></gml:LineString>'));
 
 -- CS and TS and Decimal together
@@ -858,13 +858,13 @@
 SELECT 'pos_6', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos> </gml:pos></gml:Point>'));
 SELECT 'pos_7', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos>  </gml:pos></gml:Point>'));
 
--- Whitespaces before and after 
+-- Whitespaces before and after
 SELECT 'pos_8', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos> 1 2 </gml:pos></gml:Point>'));
 SELECT 'pos_9', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos>  1 2  </gml:pos></gml:Point>'));
-SELECT 'pos_10', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos> 
+SELECT 'pos_10', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos>
 		 			         1 2
 				           </gml:pos></gml:Point>'));
--- Several Spaces insides 
+-- Several Spaces insides
 SELECT 'pos_11', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos>1  2</gml:pos></gml:Point>'));
 
 -- ERROR: Junk
@@ -896,7 +896,7 @@
 SELECT 'poslist_2', ST_AsEWKT(ST_GeomFromGML('<gml:LineString><gml:posList> 1 2 3 4 </gml:posList></gml:LineString>'));
 SELECT 'poslist_3', ST_AsEWKT(ST_GeomFromGML('<gml:LineString><gml:posList>  1 2 3 4  </gml:posList></gml:LineString>'));
 SELECT 'poslist_4', ST_AsEWKT(ST_GeomFromGML('<gml:LineString><gml:posList>
-	      						1 2 3 4  
+	      						1 2 3 4
 						</gml:posList></gml:LineString>'));
 
 -- explicit 2 dimension
@@ -955,10 +955,10 @@
 -- ERROR: xlink:href destination is not defined
 SELECT 'xlink_2', ST_AsEWKT(ST_GeomFromGML('<gml:LineString xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"><gml:pointProperty><gml:Point gml:id="p1"><gml:pos>1 2</gml:pos></gml:Point></gml:pointProperty><gml:pointProperty><gml:Point xlink:type="simple" xlink:href="#p2"/></gml:pointProperty><gml:pos>3 4</gml:pos></gml:LineString>'));
 
--- ERROR: no href 
+-- ERROR: no href
 SELECT 'xlink_3', ST_AsEWKT(ST_GeomFromGML('<gml:LineString xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"><gml:pointProperty><gml:Point gml:id="p1"><gml:pos>1 2</gml:pos></gml:Point></gml:pointProperty><gml:pointProperty><gml:Point xlink:type="simple" /></gml:pointProperty><gml:pos>3 4</gml:pos></gml:LineString>'));
 
--- ERROR: empty href 
+-- ERROR: empty href
 SELECT 'xlink_4', ST_AsEWKT(ST_GeomFromGML('<gml:LineString xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"><gml:pointProperty><gml:Point gml:id="p1"><gml:pos>1 2</gml:pos></gml:Point></gml:pointProperty><gml:pointProperty><gml:Point xlink:type="simple" xlink:href=""/></gml:pointProperty><gml:pos>3 4</gml:pos></gml:LineString>'));
 
 -- ERROR: no sharp char in href
@@ -970,7 +970,7 @@
 -- ERROR: wrong xlink namespace
 SELECT 'xlink_7', ST_AsEWKT(ST_GeomFromGML('<gml:LineString xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://foo.net"><gml:pointProperty><gml:Point gml:id="p1"><gml:pos>1 2</gml:pos></gml:Point></gml:pointProperty><gml:pointProperty><gml:Point xlink:type="simple" xlink:href="#p1"/></gml:pointProperty><gml:pos>3 4</gml:pos></gml:LineString>'));
 
--- ERROR: no xlink:type 
+-- ERROR: no xlink:type
 SELECT 'xlink_8', ST_AsEWKT(ST_GeomFromGML('<gml:LineString xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"><gml:pointProperty><gml:Point gml:id="p1"><gml:pos>1 2</gml:pos></gml:Point></gml:pointProperty><gml:pointProperty><gml:Point xlink:href="#p1"/></gml:pointProperty><gml:pos>3 4</gml:pos></gml:LineString>'));
 
 -- ERROR: xlink:type not simple
@@ -982,37 +982,37 @@
 -- xlink with pointRep
 SELECT 'xlink_11', ST_AsEWKT(ST_GeomFromGML('<gml:LineString xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"><gml:pointRep><gml:Point gml:id="p1"><gml:pos>1 2</gml:pos></gml:Point></gml:pointRep><gml:pointRep><gml:Point xlink:type="simple" xlink:href="#p1"/></gml:pointRep><gml:pos>3 4</gml:pos></gml:LineString>'));
 
--- xlink on a point 
+-- xlink on a point
 SELECT 'xlink_12', ST_AsEWKT(ST_GeomFromGML('<gml:MultiGeometry xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"><gml:geometryMember><gml:Point gml:id="p1"><gml:pos>1 2</gml:pos></gml:Point></gml:geometryMember><gml:geometryMember><gml:Point xlink:type="simple" xlink:href="#p1"/></gml:geometryMember></gml:MultiGeometry>'));
 
 -- xlink on a linestring
 SELECT 'xlink_13', ST_AsEWKT(ST_GeomFromGML('<gml:MultiGeometry xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"><gml:geometryMember><gml:LineString gml:id="l1"><gml:posList>1 2 3 4</gml:posList></gml:LineString></gml:geometryMember><gml:geometryMember><gml:LineString xlink:type="simple" xlink:href="#l1"/></gml:geometryMember></gml:MultiGeometry>'));
 
--- xlink on a curve 
+-- xlink on a curve
 SELECT 'xlink_14', ST_AsEWKT(ST_GeomFromGML('<gml:MultiGeometry xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"><gml:geometryMember><gml:Curve gml:id="c1"><gml:segments><gml:LineStringSegment><gml:posList>1 2 3 4</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:geometryMember><gml:geometryMember><gml:Curve xlink:type="simple" xlink:href="#c1"/></gml:geometryMember></gml:MultiGeometry>'));
 
--- xlink on a polygon 
+-- xlink on a polygon
 SELECT 'xlink_15', ST_AsEWKT(ST_GeomFromGML('<gml:MultiGeometry xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"><gml:geometryMember><gml:Polygon gml:id="p1"><gml:exterior><gml:LinearRing><gml:posList>1 2 3 4 5 6 1 2</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:geometryMember><gml:geometryMember><gml:Polygon xlink:type="simple" xlink:href="#p1"/></gml:geometryMember></gml:MultiGeometry>'));
 
--- xlink on a surface 
+-- xlink on a surface
 SELECT 'xlink_16', ST_AsEWKT(ST_GeomFromGML('<gml:MultiGeometry xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"><gml:geometryMember><gml:Surface gml:id="s1"><gml:patches><gml:PolygonPatch><gml:exterior><gml:LinearRing><gml:posList>1 2 3 4 5 6 1 2</gml:posList></gml:LinearRing></gml:exterior></gml:PolygonPatch></gml:patches></gml:Surface></gml:geometryMember><gml:geometryMember><gml:Surface xlink:type="simple" xlink:href="#s1"/></gml:geometryMember></gml:MultiGeometry>'));
 
--- xlink on a multipoint 
+-- xlink on a multipoint
 SELECT 'xlink_17', ST_AsEWKT(ST_GeomFromGML('<gml:MultiGeometry xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"><gml:geometryMember><gml:MultiPoint gml:id="mp1"><gml:pointMember><gml:Point><gml:pos>1 2</gml:pos></gml:Point></gml:pointMember></gml:MultiPoint></gml:geometryMember><gml:geometryMember><gml:MultiPoint xlink:type="simple" xlink:href="#mp1"/></gml:geometryMember></gml:MultiGeometry>'));
 
--- xlink on a multiline 
+-- xlink on a multiline
 SELECT 'xlink_18', ST_AsEWKT(ST_GeomFromGML('<gml:MultiGeometry xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"><gml:geometryMember><gml:MultiLineString gml:id="ml1"><gml:lineStringMember><gml:LineString><gml:posList>1 2 3 4</gml:posList></gml:LineString></gml:lineStringMember></gml:MultiLineString></gml:geometryMember><gml:geometryMember><gml:MultiLineString xlink:type="simple" xlink:href="#ml1"/></gml:geometryMember></gml:MultiGeometry>'));
 
--- xlink on a multicurve 
+-- xlink on a multicurve
 SELECT 'xlink_19', ST_AsEWKT(ST_GeomFromGML('<gml:MultiGeometry xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"><gml:geometryMember><gml:MultiCurve gml:id="mc1"><gml:curveMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:posList>1 2 3 4</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveMember></gml:MultiCurve></gml:geometryMember><gml:geometryMember><gml:MultiCurve xlink:type="simple" xlink:href="#mc1"/></gml:geometryMember></gml:MultiGeometry>'));
 
--- xlink on a multipolygon 
+-- xlink on a multipolygon
 SELECT 'xlink_20', ST_AsEWKT(ST_GeomFromGML('<gml:MultiGeometry xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"><gml:geometryMember><gml:MultiPolygon gml:id="mp1"><gml:polygonMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>1 2 3 4 5 6 1 2</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:polygonMember></gml:MultiPolygon></gml:geometryMember><gml:geometryMember><gml:MultiPolygon xlink:type="simple" xlink:href="#mp1"/></gml:geometryMember></gml:MultiGeometry>'));
 
--- xlink on a multisurface 
+-- xlink on a multisurface
 SELECT 'xlink_21', ST_AsEWKT(ST_GeomFromGML('<gml:MultiGeometry xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"><gml:geometryMember><gml:MultiSurface gml:id="ms1"><gml:surfaceMember><gml:Surface><gml:patches><gml:PolygonPatch><gml:exterior><gml:LinearRing><gml:posList>1 2 3 4 5 6 1 2</gml:posList></gml:LinearRing></gml:exterior></gml:PolygonPatch></gml:patches></gml:Surface></gml:surfaceMember></gml:MultiSurface></gml:geometryMember><gml:geometryMember><gml:MultiSurface xlink:type="simple" xlink:href="#ms1"/></gml:geometryMember></gml:MultiGeometry>'));
 
--- xlink on a multigeometry 
+-- xlink on a multigeometry
 SELECT 'xlink_22', ST_AsEWKT(ST_GeomFromGML('<gml:MultiGeometry xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"><gml:geometryMember><gml:MultiGeometry gml:id="mg1"><gml:geometryMember><gml:Point><gml:pos>1 2</gml:pos></gml:Point></gml:geometryMember></gml:MultiGeometry></gml:geometryMember><gml:geometryMember><gml:MultiGeometry xlink:type="simple" xlink:href="#mg1"/></gml:geometryMember></gml:MultiGeometry>'));
 
 -- ERROR circular ref
@@ -1230,15 +1230,15 @@
 SELECT 'coord_6', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:coord><gml:X></gml:X><gml:Y></gml:Y></gml:coord></gml:Point>'));
 SELECT 'coord_7', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:coord></gml:coord></gml:Point>'));
 
--- ERROR space in coord 
+-- ERROR space in coord
 SELECT 'coord_8', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:coord><gml:X>1</gml:X><gml:Y> </gml:Y></gml:coord></gml:Point>'));
 SELECT 'coord_9', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:coord><gml:X>1</gml:X><gml:Y>   </gml:Y></gml:coord></gml:Point>'));
 
 -- Spaces before and after coord
 SELECT 'coord_10', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:coord><gml:X>1</gml:X><gml:Y> 2 </gml:Y></gml:coord></gml:Point>'));
 SELECT 'coord_11', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:coord><gml:X>1</gml:X><gml:Y>  2  </gml:Y></gml:coord></gml:Point>'));
-SELECT 'coord_12', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:coord><gml:X>1</gml:X><gml:Y>  
-	                  				2   
+SELECT 'coord_12', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:coord><gml:X>1</gml:X><gml:Y>
+	                  				2
 					     </gml:Y></gml:coord></gml:Point>'));
 
 -- Several coords
@@ -1259,7 +1259,7 @@
 -- Several digits
 SELECT 'double_1', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos>1 1234567890</gml:pos></gml:Point>'));
 
--- Sign +/- 
+-- Sign +/-
 SELECT 'double_2', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos>1 -1</gml:pos></gml:Point>'));
 SELECT 'double_3', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos>1 +1</gml:pos></gml:Point>'));
 
@@ -1288,7 +1288,7 @@
 SELECT 'double_13', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos>1 1a</gml:pos></gml:Point>'));
 SELECT 'double_14', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos>1 1a2</gml:pos></gml:Point>'));
 
--- Exp 
+-- Exp
 SELECT 'double_15', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos>1 1e2</gml:pos></gml:Point>'));
 SELECT 'double_16', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos>1 1E+2</gml:pos></gml:Point>'));
 SELECT 'double_17', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos>1 1e-2</gml:pos></gml:Point>'));
@@ -1307,14 +1307,14 @@
 SELECT 'double_24', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos>1 1e2.3</gml:pos></gml:Point>'));
 SELECT 'double_25', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos>1 1E2.3</gml:pos></gml:Point>'));
 
--- ERROR: spaces inside 
+-- ERROR: spaces inside
 SELECT 'double_26', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos>1 - 1.23</gml:pos></gml:Point>'));
 SELECT 'double_27', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos>1 -1 .23</gml:pos></gml:Point>'));
 SELECT 'double_28', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos>1 -1. 23</gml:pos></gml:Point>'));
 SELECT 'double_29', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos>1 -1.23 E2</gml:pos></gml:Point>'));
 SELECT 'double_30', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos>1 -1.23E 2</gml:pos></gml:Point>'));
 
--- ERROR: Junk 
+-- ERROR: Junk
 SELECT 'double_31', ST_AsEWKT(ST_GeomFromGML('<gml:Point><gml:pos>1 $0%@#$^%#</gml:pos></gml:Point>'));
 
 

Modified: trunk/regress/in_kml.sql
===================================================================
--- trunk/regress/in_kml.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/in_kml.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -61,7 +61,7 @@
 -- ERROR 1 Point
 SELECT 'linestring_2', ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates>1,2</kml:coordinates></kml:LineString>'));
 
--- ERROR: empty coordinates 
+-- ERROR: empty coordinates
 SELECT 'linestring_3', ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates></kml:coordinates></kml:LineString>'));
 SELECT 'linestring_4', ST_AsEWKT(ST_GeomFromKML('<kml:LineString></kml:LineString>'));
 
@@ -78,7 +78,7 @@
 -- 1 ring
 SELECT 'polygon_1', ST_AsEWKT(ST_GeomFromKML('<kml:Polygon><kml:outerBoundaryIs><kml:LinearRing><kml:coordinates>1,2 3,4 5,6 1,2</kml:coordinates></kml:LinearRing></kml:outerBoundaryIs></kml:Polygon>'));
 
--- ERROR: In exterior ring: Last point is not the same as the first one 
+-- ERROR: In exterior ring: Last point is not the same as the first one
 SELECT 'polygon_2', ST_AsEWKT(ST_GeomFromKML('<kml:Polygon><kml:outerBoundaryIs><kml:LinearRing><kml:coordinates>1,2 3,4 5,6 1,3</kml:coordinates></kml:LinearRing></kml:outerBoundaryIs></kml:Polygon>'));
 
 -- FORCE CLOSE: In exterior 3D ring: Last point is not the same as the first one in Z
@@ -87,7 +87,7 @@
 -- FORCE CLOSE: Only 3 points in exterior ring
 SELECT 'polygon_4', ST_AsEWKT(ST_GeomFromKML('<kml:Polygon><kml:outerBoundaryIs><kml:LinearRing><kml:coordinates>1,2 3,4 1,2</kml:coordinates></kml:LinearRing></kml:outerBoundaryIs></kml:Polygon>'));
 
--- ERROR: Empty exterior ring coordinates 
+-- ERROR: Empty exterior ring coordinates
 SELECT 'polygon_5', ST_AsEWKT(ST_GeomFromKML('<kml:Polygon><kml:outerBoundaryIs><kml:LinearRing><kml:coordinates></kml:coordinates></kml:LinearRing></kml:outerBoundaryIs></kml:Polygon>'));
 SELECT 'polygon_6', ST_AsEWKT(ST_GeomFromKML('<kml:Polygon><kml:outerBoundaryIs><kml:LinearRing></kml:LinearRing></kml:outerBoundaryIs></kml:Polygon>'));
 SELECT 'polygon_7', ST_AsEWKT(ST_GeomFromKML('<kml:Polygon><kml:outerBoundaryIs></kml:outerBoundaryIs></kml:Polygon>'));
@@ -105,7 +105,7 @@
 -- ERROR: Only 3 points in interior ring
 SELECT 'polygon_12', ST_AsEWKT(ST_GeomFromKML('<kml:Polygon><kml:outerBoundaryIs><kml:LinearRing><kml:coordinates>1,2 3,4 5,6 1,2</kml:coordinates></kml:LinearRing></kml:outerBoundaryIs><kml:innerBoundaryIs><kml:LinearRing><kml:coordinates>7,8 9,10 7,8</kml:coordinates></kml:LinearRing></kml:innerBoundaryIs></kml:Polygon>'));
 
--- FORCE CLOSE: In interior ring: Last point is not the same as the first one 
+-- FORCE CLOSE: In interior ring: Last point is not the same as the first one
 SELECT 'polygon_13', ST_AsEWKT(ST_GeomFromKML('<kml:Polygon><kml:outerBoundaryIs><kml:LinearRing><kml:coordinates>1,2 3,4 5,6 1,2</kml:coordinates></kml:LinearRing></kml:outerBoundaryIs><kml:innerBoundaryIs><kml:LinearRing><kml:coordinates>7,8 9,10 11,12 7,9</kml:coordinates></kml:LinearRing></kml:innerBoundaryIs></kml:Polygon>'));
 
 -- FORCE CLOSE: In interior 3D ring: Last point is not the same as the first one in Z
@@ -121,19 +121,19 @@
 -- MultiGeometry
 --
 
--- 1 point 
+-- 1 point
 --SELECT 'multi_1', ST_AsEWKT(ST_GeomFromKML('<kml:MultiGeometry><kml:Point><kml:coordinates>1,2</kml:coordinates></kml:Point></kml:MultiGeometry>'));
 
 -- 2 points
 --SELECT 'multi_2', ST_AsEWKT(ST_GeomFromKML('<kml:MultiGeometry><kml:Point><kml:coordinates>1,2</kml:coordinates></kml:Point><kml:Point><kml:coordinates>1,2</kml:coordinates></kml:Point></kml:MultiGeometry>'));
 
--- 1 line 
+-- 1 line
 --SELECT 'multi_3', ST_AsEWKT(ST_GeomFromKML('<kml:MultiGeometry><kml:LineString><kml:coordinates>1,2 3,4</kml:coordinates></kml:LineString></kml:MultiGeometry>'));
 
 -- 2 lines
 --SELECT 'multi_4', ST_AsEWKT(ST_GeomFromKML('<kml:MultiGeometry><kml:LineString><kml:coordinates>1,2 3,4</kml:coordinates></kml:LineString><kml:LineString><kml:coordinates>5,6 7,8</kml:coordinates></kml:LineString></kml:MultiGeometry>'));
 
--- 1 polygon 
+-- 1 polygon
 --SELECT 'multi_5', ST_AsEWKT(ST_GeomFromKML('<kml:MultiGeometry><kml:Polygon><kml:outerBoundaryIs><kml:LinearRing><kml:coordinates>1,2 3,4 5,6 1,2</kml:coordinates></kml:LinearRing></kml:outerBoundaryIs></kml:Polygon></kml:MultiGeometry>'));
 
 -- 2 polygons
@@ -156,12 +156,12 @@
 
 --
 -- KML Namespace
--- 
+--
 
 -- KML namespace
 SELECT 'ns_1', ST_AsEWKT(ST_GeomFromKML('<kml:Point xmlns:kml="http://www.opengis.net/kml/2.2"><kml:coordinates>1,2</kml:coordinates></kml:Point>'));
 
--- KML namespace without explicit prefix 
+-- KML namespace without explicit prefix
 SELECT 'ns_2', ST_AsEWKT(ST_GeomFromKML('<kml:Point xmlns="http://www.opengis.net/kml/2.2"><kml:coordinates>1,2</kml:coordinates></kml:Point>'));
 
 -- ERROR wrong namespace
@@ -219,13 +219,13 @@
 -- ERROR: Begin on comma
 SELECT 'coordinates_11', ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates>,1 2,3</kml:coordinates></kml:LineString>'));
 
--- Whitespaces before and after 
+-- Whitespaces before and after
 SELECT 'coordinates_12', ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates> 1,2 3,4 </kml:coordinates></kml:LineString>'));
-SELECT 'coordinates_13', ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates> 
-								1,2 3,4  
+SELECT 'coordinates_13', ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates>
+								1,2 3,4
 						   </kml:coordinates></kml:LineString>'));
 
--- ERROR: Spaces insides 
+-- ERROR: Spaces insides
 SELECT 'coordinates_14', ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates>1, 2 3, 4</kml:coordinates></kml:LineString>'));
 
 -- Several spaces as tuples separator
@@ -255,7 +255,7 @@
 -- Point - 3D
 SELECT 'kml_2', ST_AsEWKT(ST_GeomFromKML(ST_AsKML(ST_AsEWKT('SRID=4326;POINT(1 2 3)'))));
 
--- Linestring  
+-- Linestring
 SELECT 'kml_3', ST_AsEWKT(ST_GeomFromKML(ST_AsKML(ST_AsEWKT('SRID=4326;LINESTRING(1 2,3 4)'))));
 
 -- Linestring - 3D
@@ -279,7 +279,7 @@
 -- Multilinestring - 3D
 SELECT 'kml_10', ST_AsEWKT(ST_GeomFromKML(ST_AsKML(ST_AsEWKT('SRID=4326;MULTILINESTRING((1 2 3,4 5 6),(7 8 9,10 11 12))'))));
 
--- Multipolygon 
+-- Multipolygon
 SELECT 'kml_11', ST_AsEWKT(ST_GeomFromKML(ST_AsKML(ST_AsEWKT('SRID=4326;MULTIPOLYGON(((1 2,3 4,5 6,1 2)),((7 8,9 10,11 12,7 8)))'))));
 
 -- Multipolygon - 3D
@@ -293,7 +293,7 @@
 -- Several digits
 SELECT 'double_1', ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,1234567890</kml:coordinates></kml:Point>'));
 
--- Sign +/- 
+-- Sign +/-
 SELECT 'double_2', ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,-1</kml:coordinates></kml:Point>'));
 SELECT 'double_3', ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,+1</kml:coordinates></kml:Point>'));
 
@@ -322,7 +322,7 @@
 SELECT 'double_13', ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,1a</kml:coordinates></kml:Point>'));
 SELECT 'double_14', ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,1a2</kml:coordinates></kml:Point>'));
 
--- Exp 
+-- Exp
 SELECT 'double_15', ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,1e2</kml:coordinates></kml:Point>'));
 SELECT 'double_16', ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,1E+2</kml:coordinates></kml:Point>'));
 SELECT 'double_17', ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,1e-2</kml:coordinates></kml:Point>'));
@@ -341,14 +341,14 @@
 SELECT 'double_24', ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,1e2.3</kml:coordinates></kml:Point>'));
 SELECT 'double_25', ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,1E2.3</kml:coordinates></kml:Point>'));
 
--- ERROR: spaces inside 
+-- ERROR: spaces inside
 SELECT 'double_26', ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,- 1.23</kml:coordinates></kml:Point>'));
 SELECT 'double_27', ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,-1 .23</kml:coordinates></kml:Point>'));
 SELECT 'double_28', ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,-1. 23</kml:coordinates></kml:Point>'));
 SELECT 'double_29', ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,-1.23 E2</kml:coordinates></kml:Point>'));
 SELECT 'double_30', ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,-1.23E 2</kml:coordinates></kml:Point>'));
 
--- ERROR: Junk 
+-- ERROR: Junk
 SELECT 'double_31', ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,$0%@#$^%#</kml:coordinates></kml:Point>'));
 
 -- ERROR: mixed coordinate dimension

Modified: trunk/regress/interrupt_relate.sql
===================================================================
--- trunk/regress/interrupt_relate.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/interrupt_relate.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -15,10 +15,10 @@
 END;
 $$ LANGUAGE 'plpgsql' VOLATILE;
 
-CREATE TEMP TABLE _inputs AS 
+CREATE TEMP TABLE _inputs AS
 SELECT 1::int as id, ST_Collect(g) g FROM (
  SELECT ST_MakeLine(
-   ST_Point(cos(radians(x)),sin(radians(270-x))), 
+   ST_Point(cos(radians(x)),sin(radians(270-x))),
    ST_Point(sin(radians(x)),cos(radians(60-x)))
    ) g
  FROM generate_series(1,720) x

Modified: trunk/regress/isvaliddetail.sql
===================================================================
--- trunk/regress/isvaliddetail.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/isvaliddetail.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -6,7 +6,7 @@
   SELECT (ST_IsValidDetail('LINESTRING (70 250, 70 250)')).*
 ) foo;
 
--- Twisted polygon 
+-- Twisted polygon
 select 3, valid, reason, st_astext(location) FROM (
   SELECT (ST_IsValidDetail(
 'POLYGON ((70 250, 70 500, 80 400, 40 400, 70 250))'

Modified: trunk/regress/legacy.sql
===================================================================
--- trunk/regress/legacy.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/legacy.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,5 +1,5 @@
 --
--- These tests serve the purpose of ensuring compatibility with 
+-- These tests serve the purpose of ensuring compatibility with
 -- old versions of postgis users.
 --
 -- Their use rely on loading the legacy.sql script.

Modified: trunk/regress/loader/ReprojectPts-pre.sql
===================================================================
--- trunk/regress/loader/ReprojectPts-pre.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/loader/ReprojectPts-pre.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,5 +1,5 @@
 --- In case this test is running in an extension context
-TRUNCATE spatial_ref_sys; 
+TRUNCATE spatial_ref_sys;
 ---
 --- EPSG 4326 : WGS 84
 ---

Modified: trunk/regress/lwgeom_regress.sql
===================================================================
--- trunk/regress/lwgeom_regress.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/lwgeom_regress.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -86,7 +86,7 @@
 --
 SELECT id,wkt FROM test_data WHERE
        ST_asEWKT(geometry(wkt)) != wkt  OR
-       ST_asEWKT(geometry(wkb_xdr)) != wkt OR 
+       ST_asEWKT(geometry(wkb_xdr)) != wkt OR
        ST_asEWKT(geometry(wkb_ndr)) != wkt OR
        ST_asBinary(geometry(wkb_ndr)) != ST_asBinary(geometry(wkb_xdr)) OR
        ST_asBinary(geometry(wkt)) != ST_asBinary(geometry(wkb_xdr));

Modified: trunk/regress/measures.sql
===================================================================
--- trunk/regress/measures.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/measures.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -24,7 +24,7 @@
 	) as foo;
 
 --#1502
-SELECT '#1502', ST_Dwithin(a,b,0.0)  from 
+SELECT '#1502', ST_Dwithin(a,b,0.0)  from
 (SELECT 'LINESTRING(-97364 -97364, 9736.4 9736.4)'::geometry a, 'POINT(0 0)'::geometry b ) foo;
 
 --st_shortestline
@@ -79,7 +79,7 @@
 	st_astext(st_shortestline(b,a)),
 	st_astext(st_longestline(a,b)),
 	st_astext(st_longestline(b,a)) from (
-select 
+select
 	ST_GeomFromText('MULTILINESTRING((17 16, 16 17, 17 18, 17 17, 17 16), (28 35,29 39, 30 35))') as a,
 	ST_GeomFromText('MULTIPOLYGON(((-1 -1, -1 25, 25 25, 25 -1, -1 -1), (14 14,14 19,19 19,19 14,14 14)),((33 35,33 40, 35 40, 35 35, 33 35)))') as b
 ) as foo;
@@ -93,7 +93,7 @@
 	round(st_y(st_endpoint(st_shortestline(a,b)))::numeric, 10),	
 	st_astext(st_longestline(a,b)),
 	st_astext(st_longestline(b,a)) from (
-select 
+select
 	ST_GeomFromText('LINESTRING(-40 -20 , 4 2)') as a,
 	ST_GeomFromText('LINESTRING(-10 20, 1 -2)') as b
 ) as foo;
@@ -105,7 +105,7 @@
 	st_astext(st_shortestline(b,a)),
 	st_astext(st_longestline(a,b)),
 	st_astext(st_longestline(b,a)) from (
-select 
+select
 	ST_GeomFromText('MULTIPOLYGON(((17 16, 16 17, 17 18, 17 17, 17 16)), ((28 35,29 39, 30 35, 28 35)))') as a,
 	ST_GeomFromText('MULTIPOLYGON(((-1 -1, -1 25, 25 25, 25 -1, -1 -1), (14 14,14 19,19 19,19 14,14 14)),((33 35,33 40, 35 40, 35 35, 33 35)))') as b
 ) as foo;
@@ -283,7 +283,7 @@
 -- Area of an empty collection
 select 'emptyCollectionArea', st_area('GEOMETRYCOLLECTION EMPTY');
 
--- 
+--
 select 'spheroidLength1_deprecated', round(ST_LengthSpheroid('MULTILINESTRING((-118.584 38.374,-118.583 38.5),(-71.05957 42.3589 , -71.061 43))'::geometry,'SPHEROID["GRS_1980",6378137,298.257222101]'::spheroid)::numeric,5);
 select 'spheroidLength1', round(ST_LengthSpheroid('MULTILINESTRING((-118.584 38.374,-118.583 38.5),(-71.05957 42.3589 , -71.061 43))'::geometry,'SPHEROID["GRS_1980",6378137,298.257222101]'::spheroid)::numeric,5);
 

Modified: trunk/regress/operators.sql
===================================================================
--- trunk/regress/operators.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/operators.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -37,14 +37,14 @@
 select '96','MULTIPOINT(0 0, 1 1)'::GEOMETRY && 'MULTIPOINT(0 1, 1 2)'::GEOMETRY as bool;
 select '97','MULTIPOINT(0 0, 1 1)'::GEOMETRY && 'MULTIPOINT(0 1.0001, 1 2)'::GEOMETRY as bool;
 
---- contains 
+--- contains
 
 select '98','MULTIPOINT(0 0, 10 10)'::GEOMETRY ~ 'MULTIPOINT(5 5, 7 7)'::GEOMETRY as bool;
 select '99','MULTIPOINT(5 5, 7 7)'::GEOMETRY ~ 'MULTIPOINT(0 0, 10 10)'::GEOMETRY as bool;
 select '100','MULTIPOINT(0 0, 7 7)'::GEOMETRY ~ 'MULTIPOINT(0 0, 10 10)'::GEOMETRY as bool;
 select '101','MULTIPOINT(-0.0001 0, 7 7)'::GEOMETRY ~ 'MULTIPOINT(0 0, 10 10)'::GEOMETRY as bool;
 
---- contained by 
+--- contained by
 
 select '102','MULTIPOINT(0 0, 10 10)'::GEOMETRY @ 'MULTIPOINT(5 5, 7 7)'::GEOMETRY as bool;
 select '103','MULTIPOINT(5 5, 7 7)'::GEOMETRY @ 'MULTIPOINT(0 0, 10 10)'::GEOMETRY as bool;

Modified: trunk/regress/out_geography.sql
===================================================================
--- trunk/regress/out_geography.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/out_geography.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -66,7 +66,7 @@
 SELECT 'kml_prefix_01', ST_AsKML(2, geography(GeomFromEWKT('SRID=4326;POINT(1 2)')), 0, '');
 SELECT 'kml_prefix_02', ST_AsKML(2, geography(GeomFromEWKT('SRID=4326;POINT(1 2)')), 0, 'kml');
 
--- Projected 
+-- Projected
 -- National Astronomical Observatory of Colombia - Bogota, Colombia (Placemark)
 SELECT 'kml_projection_01', ST_AsKML(geography(GeomFromEWKT('SRID=102189;POINT(1000000 1000000)')), 3);
 

Modified: trunk/regress/out_geometry.sql
===================================================================
--- trunk/regress/out_geometry.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/out_geometry.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -81,7 +81,7 @@
 SELECT 'kml_prefix_01', ST_AsKML(2, GeomFromEWKT('SRID=4326;POINT(1 2)'), 0, '');
 SELECT 'kml_prefix_02', ST_AsKML(2, GeomFromEWKT('SRID=4326;POINT(1 2)'), 0, 'kml');
 
--- Projected 
+-- Projected
 -- National Astronomical Observatory of Colombia - Bogota, Colombia (Placemark)
 SELECT 'kml_projection_01', ST_AsKML(ST_GeomFromEWKT('SRID=102189;POINT(1000000 1000000)'), 3);
 
@@ -160,11 +160,11 @@
 SELECT 'geojson_options_16', ST_AsGeoJson(GeomFromEWKT('SRID=4326;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 7);
 
 -- Out and in to PostgreSQL native geometric types
-WITH p AS ( SELECT '((0,0),(0,1),(1,1),(1,0),(0,0))'::text AS p ) 
+WITH p AS ( SELECT '((0,0),(0,1),(1,1),(1,0),(0,0))'::text AS p )
   SELECT 'pgcast_01', p = p::polygon::geometry::polygon::text FROM p;
-WITH p AS ( SELECT '[(0,0),(1,1)]'::text AS p ) 
+WITH p AS ( SELECT '[(0,0),(1,1)]'::text AS p )
   SELECT 'pgcast_02', p = p::path::geometry::path::text FROM p;
-WITH p AS ( SELECT '(1,1)'::text AS p ) 
+WITH p AS ( SELECT '(1,1)'::text AS p )
   SELECT 'pgcast_03', p = p::point::geometry::point::text FROM p;
 SELECT 'pgcast_03','POLYGON EMPTY'::geometry::polygon IS NULL;
 SELECT 'pgcast_04','LINESTRING EMPTY'::geometry::path IS NULL;

Modified: trunk/regress/polyhedralsurface.sql
===================================================================
--- trunk/regress/polyhedralsurface.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/polyhedralsurface.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,8 +1,8 @@
--- ST_Dimension on 2D: not closed 
+-- ST_Dimension on 2D: not closed
 SELECT 'dimension_01', ST_Dimension('POLYHEDRALSURFACE(((0 0,0 0,0 1,0 0)))'::geometry);
 SELECT 'dimension_02', ST_Dimension('GEOMETRYCOLLECTION(POLYHEDRALSURFACE(((0 0,0 0,0 1,0 0))))'::geometry);
 
--- ST_Dimension on 3D: closed 
+-- ST_Dimension on 3D: closed
 SELECT 'dimension_03', ST_Dimension('POLYHEDRALSURFACE(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))'::geometry);
 SELECT 'dimension_04', ST_Dimension('GEOMETRYCOLLECTION(POLYHEDRALSURFACE(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0))))'::geometry);
 

Modified: trunk/regress/regress.sql
===================================================================
--- trunk/regress/regress.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/regress.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -159,7 +159,7 @@
 \i regress_biginsert.sql
 
 
----test basic ops on this 
+---test basic ops on this
 
 select '121',box3d(a) as box3d_a, box3d(b) as box3d_b from TEST;
 
@@ -170,7 +170,7 @@
 
 select '126',a ~= b from TEST;
 select '127',a @ b from TEST;
-select '128',a ~ b from TEST; 
+select '128',a ~ b from TEST;
 
 -- ST_Mem_Size was deprecated in favor of ST_MemSize in 2.2.0
 --  ST_Mem_Size will be removed in 2.4.0

Modified: trunk/regress/regress_bdpoly.sql
===================================================================
--- trunk/regress/regress_bdpoly.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/regress_bdpoly.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -24,8 +24,8 @@
 select ST_BdPolyFromText('POINT(0 0)', 3);
 select ST_BdMPolyFromText('POINT(0 0)', 3);
 
--- MultiPolygon forming input to BdPolyFromText 
+-- MultiPolygon forming input to BdPolyFromText
 select ST_BdPolyFromText('MULTILINESTRING( (0 0, 10 0, 10 10, 0 10, 0 0), (2 2, 2 4, 4 4, 4 2, 2 2), (5 5, 5 7, 7 7, 7 5, 5 5), (20 0,30 0,30 10,20 10,20 0), (22 2,22 4,24 4,24 2,22 2), (25 5,25 7,27 7,27 5,25 5))', 3);
 
--- SinglePolygon forming input to BdMPolyFromText 
+-- SinglePolygon forming input to BdMPolyFromText
 select 'BdMPolyFromText', ST_asewkt(ST_BdMPolyFromText('MULTILINESTRING((0 0, 10 0, 10 10, 0 10, 0 0),(2 2, 2 4, 4 4, 4 2, 2 2),(5 5, 5 7, 7 7, 7 5, 5 5))', 3));

Modified: trunk/regress/regress_index.sql
===================================================================
--- trunk/regress/regress_index.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/regress_index.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -60,7 +60,7 @@
 
   est := mat[1];
   act := mat[2];
-    
+
   err = abs(est-act);
 
   RETURN act || '+=' || tol || ':' || coalesce(
@@ -83,7 +83,7 @@
 SELECT 4, 600, 'ST_MakeEnvelope(0,0,1000,1000)'
 ;
 
--- We raise the statistics target to the limit 
+-- We raise the statistics target to the limit
 ALTER TABLE test ALTER COLUMN the_geom SET STATISTICS 10000;
 
 ANALYZE test;

Modified: trunk/regress/regress_ogc.sql
===================================================================
--- trunk/regress/regress_ogc.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/regress_ogc.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -26,9 +26,9 @@
 SELECT 'within103', ST_within('POINT(0 5)'::geometry, 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry);
 -- PIP - point in line with polygon edge
 SELECT 'within104', ST_within('POINT(0 12)'::geometry, 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry);
--- PIP - point vertically aligned with polygon vertex 
+-- PIP - point vertically aligned with polygon vertex
 SELECT 'within105', ST_within(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
--- PIP - repeated vertex 
+-- PIP - repeated vertex
 SELECT 'within106', ST_within(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
 -- PIP - multipoint within polygon
 SELECT 'within107', ST_within('MULTIPOINT(5 5)'::geometry, 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry);
@@ -49,9 +49,9 @@
 SELECT 'disjoint103', ST_disjoint('POINT(0 5)'::geometry, 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry);
 -- PIP - point in line with polygon edge
 SELECT 'disjoint104', ST_disjoint('POINT(0 12)'::geometry, 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry);
--- PIP - point vertically aligned with polygon vertex 
+-- PIP - point vertically aligned with polygon vertex
 SELECT 'disjoint105', ST_disjoint(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
--- PIP - repeated vertex 
+-- PIP - repeated vertex
 SELECT 'disjoint106', ST_disjoint(ST_GeomFromText('POINT(521543 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
 -- PIP - point within polygon
 SELECT 'disjoint150', ST_disjoint('POINT(5 5)'::geometry, 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry);
@@ -63,7 +63,7 @@
 SELECT 'disjoint153', ST_disjoint('POINT(0 5)'::geometry, 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry);
 -- PIP - point in line with polygon edge
 SELECT 'disjoint154', ST_disjoint('POINT(0 12)'::geometry, 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry);
--- PIP - point vertically aligned with polygon vertex 
+-- PIP - point vertically aligned with polygon vertex
 SELECT 'disjoint155', ST_disjoint(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
 -- PIP - repeated vertex
 SELECT 'disjoint156', ST_disjoint(ST_GeomFromText('POINT(521543 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
@@ -77,7 +77,7 @@
 SELECT 'intersects103', ST_intersects('POINT(0 5)'::geometry, 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry);
 -- PIP - point in line with polygon edge
 SELECT 'intersects104', ST_intersects('POINT(0 12)'::geometry, 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry);
--- PIP - point vertically aligned with polygon vertex 
+-- PIP - point vertically aligned with polygon vertex
 SELECT 'intersects105', ST_intersects(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
 -- PIP - repeated vertex
 SELECT 'intersects106', ST_intersects(ST_GeomFromText('POINT(521543 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
@@ -90,7 +90,7 @@
 SELECT 'intersects114', ST_intersects('MULTIPOINT ((0 5), (0 8))'::geometry, 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry);
 -- PIP - multipoint in line with polygon edge
 SELECT 'intersects115', ST_intersects('MULTIPOINT ((0 12))'::geometry, 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry);
--- PIP - multipoint vertically aligned with polygon vertex 
+-- PIP - multipoint vertically aligned with polygon vertex
 SELECT 'intersects116', ST_intersects(ST_GeomFromText('MULTIPOINT ((521513 5377804))', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
 -- PIP - repeated vertex
 SELECT 'intersects117', ST_intersects(ST_GeomFromText('MULTIPOINT ((521543 5377804))', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
@@ -110,7 +110,7 @@
 SELECT 'intersects153', ST_intersects('POINT(0 5)'::geometry, 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry);
 -- PIP - point in line with polygon edge
 SELECT 'intersects154', ST_intersects('POINT(0 12)'::geometry, 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry);
--- PIP - point vertically aligned with polygon vertex 
+-- PIP - point vertically aligned with polygon vertex
 SELECT 'intersects155', ST_intersects(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
 -- PIP - repeated vertex
 SELECT 'intersects156', ST_intersects(ST_GeomFromText('POINT(521543 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
@@ -124,9 +124,9 @@
 SELECT 'contains103', ST_contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'POINT(0 5)'::geometry);
 -- PIP - point in line with polygon edge
 SELECT 'contains104', ST_contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'POINT(0 12)'::geometry);
--- PIP - point vertically aligned with polygon vertex 
+-- PIP - point vertically aligned with polygon vertex
 SELECT 'contains105', ST_contains(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631));
--- PIP - repeated vertex 
+-- PIP - repeated vertex
 SELECT 'contains106', ST_contains(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631));
 -- PIP - multipoint within polygon
 SELECT 'contains110', ST_contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'MULTIPOINT ((5 5))'::geometry);

Modified: trunk/regress/regress_ogc_cover.sql
===================================================================
--- trunk/regress/regress_ogc_cover.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/regress_ogc_cover.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -15,9 +15,9 @@
 SELECT 'covers105', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 5)');
 -- PIP - point in line with polygon edge
 SELECT 'covers106', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 12)');
--- PIP - point vertically aligned with polygon vertex 
+-- PIP - point vertically aligned with polygon vertex
 SELECT 'covers107', ST_Covers(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631));
--- PIP - repeated vertex 
+-- PIP - repeated vertex
 SELECT 'covers108', ST_Covers(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631));
 -- CoveredBy cases
 SELECT 'coveredby100', ST_CoveredBy('LINESTRING(1 10, 9 10, 9 8)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
@@ -32,8 +32,8 @@
 SELECT 'coveredby105', ST_CoveredBy('POINT(0 5)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
 -- PIP - point in line with polygon edge
 SELECT 'coveredby106', ST_CoveredBy('POINT(0 12)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
--- PIP - point vertically aligned with polygon vertex 
+-- PIP - point vertically aligned with polygon vertex
 SELECT 'coveredby107', ST_CoveredBy(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
--- PIP - repeated vertex 
+-- PIP - repeated vertex
 SELECT 'coveredby108', ST_CoveredBy(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
 

Modified: trunk/regress/regress_ogc_prep.sql
===================================================================
--- trunk/regress/regress_ogc_prep.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/regress_ogc_prep.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -3,14 +3,14 @@
 ---
 ---
 
-SELECT c, ST_Intersects(ply, pt) FROM 
-( VALUES 
+SELECT c, ST_Intersects(ply, pt) FROM
+( VALUES
 -- PIP - point within polygon (no cache)
-('intersects099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
+('intersects099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
 -- PIP - point within polygon
-('intersects100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
+('intersects100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
 -- PIP - point on polygon vertex
-('intersects101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'), 
+('intersects101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'),
 -- PIP - point outside polygon
 ('intersects102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(-1 0)'),
 -- PIP - point on polygon edge
@@ -19,14 +19,14 @@
 ('intersects104', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 12)')
 ) AS v(c,ply,pt);
 
-SELECT c, ST_Contains(ply, pt) FROM 
-( VALUES 
+SELECT c, ST_Contains(ply, pt) FROM
+( VALUES
 -- PIP - point within polygon (no cache)
-('contains099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
+('contains099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
 -- PIP - point within polygon
-('contains100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
+('contains100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
 -- PIP - point on polygon vertex
-('contains101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'), 
+('contains101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'),
 -- PIP - point outside polygon
 ('contains102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(-1 0)'),
 -- PIP - point on polygon edge
@@ -35,14 +35,14 @@
 ('contains104', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 12)')
 ) AS v(c,ply,pt);
 
-SELECT c, ST_Covers(ply, pt) FROM 
-( VALUES 
+SELECT c, ST_Covers(ply, pt) FROM
+( VALUES
 -- PIP - point within polygon (no cache)
-('covers099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
+('covers099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
 -- PIP - point within polygon
-('covers100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
+('covers100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
 -- PIP - point on polygon vertex
-('covers101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'), 
+('covers101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'),
 -- PIP - point outside polygon
 ('covers102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(-1 0)'),
 -- PIP - point on polygon edge
@@ -51,14 +51,14 @@
 ('covers104', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 12)')
 ) AS v(c,ply,pt);
 
-SELECT c, ST_ContainsProperly(ply, pt) FROM 
-( VALUES 
+SELECT c, ST_ContainsProperly(ply, pt) FROM
+( VALUES
 -- PIP - point within polygon (no cache)
-('containsproperly099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
+('containsproperly099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
 -- PIP - point within polygon
-('containsproperly100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
+('containsproperly100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
 -- PIP - point on polygon vertex
-('containsproperly101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'), 
+('containsproperly101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'),
 -- PIP - point outside polygon
 ('containsproperly102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(-1 0)'),
 -- PIP - point on polygon edge
@@ -69,29 +69,29 @@
 
 
 -- PIP - point vertically aligned with polygon vertex, poly first
-SELECT 'intersects105', ST_Intersects(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM 
-( VALUES 
+SELECT 'intersects105', ST_Intersects(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
-	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
+	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - point vertically aligned with polygon vertex, point first
-SELECT 'intersects106', ST_Intersects(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM 
-( VALUES 
+SELECT 'intersects106', ST_Intersects(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
-	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
+	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - repeated vertex, poly first
-SELECT 'intersects107', ST_Intersects(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM 
-( VALUES 
+SELECT 'intersects107', ST_Intersects(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - repeated vertex, point first
-SELECT 'intersects108', ST_Intersects(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM 
-( VALUES 
+SELECT 'intersects108', ST_Intersects(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
@@ -99,87 +99,87 @@
 
 
 -- PIP - point vertically aligned with polygon vertex, poly first
-SELECT 'contains105', ST_Contains(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM 
-( VALUES 
+SELECT 'contains105', ST_Contains(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
-	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
+	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - point vertically aligned with polygon vertex, point first
-SELECT 'contains106', ST_Contains(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM 
-( VALUES 
+SELECT 'contains106', ST_Contains(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
-	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
+	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - repeated vertex, poly first
-SELECT 'contains107', ST_Contains(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM 
-( VALUES 
+SELECT 'contains107', ST_Contains(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - repeated vertex, point first
-SELECT 'contains108', ST_Contains(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM 
-( VALUES 
+SELECT 'contains108', ST_Contains(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 
 -- PIP - point vertically aligned with polygon vertex, poly first
-SELECT 'containsproperly105', ST_ContainsProperly(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM 
-( VALUES 
+SELECT 'containsproperly105', ST_ContainsProperly(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
-	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
+	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - point vertically aligned with polygon vertex, point first
-SELECT 'containsproperly106', ST_ContainsProperly(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM 
-( VALUES 
+SELECT 'containsproperly106', ST_ContainsProperly(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
-	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
+	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - repeated vertex, poly first
-SELECT 'containsproperly107', ST_ContainsProperly(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM 
-( VALUES 
+SELECT 'containsproperly107', ST_ContainsProperly(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - repeated vertex, point first
-SELECT 'containsproperly108', ST_ContainsProperly(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM 
-( VALUES 
+SELECT 'containsproperly108', ST_ContainsProperly(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 
 -- PIP - point vertically aligned with polygon vertex, poly first
-SELECT 'covers105', ST_Covers(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM 
-( VALUES 
+SELECT 'covers105', ST_Covers(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
-	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
+	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - point vertically aligned with polygon vertex, point first
-SELECT 'covers106', ST_Covers(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM 
-( VALUES 
+SELECT 'covers106', ST_Covers(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
-	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
+	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - repeated vertex, poly first
-SELECT 'covers107', ST_Covers(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM 
-( VALUES 
+SELECT 'covers107', ST_Covers(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - repeated vertex, point first
-SELECT 'covers108', ST_Covers(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM 
-( VALUES 
+SELECT 'covers108', ST_Covers(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
@@ -188,111 +188,111 @@
 
 SELECT c, ST_Intersects(p1, p2) AS intersects_p1p2, ST_Intersects(p2, p1) AS intersects_p2p1 FROM
 ( VALUES
-('intersects200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
-('intersects201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
+('intersects200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
+('intersects201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
 ('intersects202', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
-('intersects203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
+('intersects203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'),
 ('intersects204', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))'),
-('intersects205', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
-('intersects206', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
+('intersects205', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
+('intersects206', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
 ('intersects207', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
-('intersects208', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
+('intersects208', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'),
 ('intersects209', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))')
 ) AS v(c,p1,p2);
 
 SELECT c, ST_Contains(p1, p2) AS contains_p1p2, ST_Contains(p2, p1) AS contains_p2p1 FROM
 ( VALUES
-('contains200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
-('contains201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
+('contains200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
+('contains201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
 ('contains202', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
-('contains203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
+('contains203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'),
 ('contains204', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))'),
-('contains205', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
-('contains206', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
+('contains205', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
+('contains206', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
 ('contains207', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
-('contains208', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
+('contains208', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'),
 ('contains209', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))')
 ) AS v(c,p1,p2);
 
 SELECT c, ST_ContainsProperly(p1, p2) AS containsproperly_p1p2, ST_ContainsProperly(p2, p1) AS containsproperly_p2p1 FROM
 ( VALUES
-('containsproperly200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
-('containsproperly201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
+('containsproperly200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
+('containsproperly201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
 ('containsproperly202', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
-('containsproperly203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
+('containsproperly203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'),
 ('containsproperly204', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))'),
-('containsproperly205', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
-('containsproperly206', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
+('containsproperly205', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
+('containsproperly206', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
 ('containsproperly207', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
-('containsproperly208', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
+('containsproperly208', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'),
 ('containsproperly209', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))')
 ) AS v(c,p1,p2);
 
 SELECT c, ST_Covers(p1, p2) AS covers_p1p2, ST_Covers(p2, p1) AS covers_p2p1 FROM
 ( VALUES
-('covers200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
-('covers201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
+('covers200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
+('covers201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
 ('covers202', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
-('covers203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
+('covers203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'),
 ('covers204', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))'),
-('covers205', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
-('covers206', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
+('covers205', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
+('covers206', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
 ('covers207', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
-('covers208', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
+('covers208', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'),
 ('covers209', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))')
 ) AS v(c,p1,p2);
 
 -- UNEXPECTED GEOMETRY TYPES --
 
-SELECT c, ST_Contains(p1, p2) AS contains_p1p2, ST_Contains(p2, p1) AS contains_p2p1, 
+SELECT c, ST_Contains(p1, p2) AS contains_p1p2, ST_Contains(p2, p1) AS contains_p2p1,
           ST_Covers(p1, p2) AS covers_p1p2, ST_Covers(p2, p1) AS covers_p2p1,
           ST_Intersects(p1, p2) AS intersects_p1p2, ST_Intersects(p2, p1) AS intersects_p2p1,
-          ST_ContainsProperly(p1, p2) AS containsproper_p1p2, ST_ContainsProperly(p2, p1) AS containsproper_p2p1 
+          ST_ContainsProperly(p1, p2) AS containsproper_p1p2, ST_ContainsProperly(p2, p1) AS containsproper_p2p1
           FROM
 ( VALUES
-('types100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
-('types101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
-('types102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
-('types103', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'), 
-('types104', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'), 
-('types105', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'), 
-('types106', 'POINT(5 5)', 'POINT(5 5)'), 
-('types107', 'POINT(5 5)', 'POINT(5 5)'), 
-('types108', 'POINT(5 5)', 'POINT(5 5)'), 
-('types109', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), 
-('types110', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), 
-('types111', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), 
-('types112', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)'), 
-('types113', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)'), 
-('types114', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)') 
+('types100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
+('types101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
+('types102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
+('types103', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'),
+('types104', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'),
+('types105', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'),
+('types106', 'POINT(5 5)', 'POINT(5 5)'),
+('types107', 'POINT(5 5)', 'POINT(5 5)'),
+('types108', 'POINT(5 5)', 'POINT(5 5)'),
+('types109', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'),
+('types110', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'),
+('types111', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'),
+('types112', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)'),
+('types113', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)'),
+('types114', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)')
 ) AS v(c,p1,p2);
 
 
-SELECT 'intersects310', ST_intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
+SELECT 'intersects310', ST_intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES
 ('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)')
 ) AS v(p);
-SELECT 'intersects311', ST_intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
+SELECT 'intersects311', ST_intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES
 ('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)')
 ) AS v(p);
 
-SELECT 'contains310', ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
+SELECT 'contains310', ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES
 ('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)')
 ) AS v(p);
-SELECT 'contains311', ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
+SELECT 'contains311', ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES
 ('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)')
 ) AS v(p);
 
-SELECT 'containsproperly310', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
+SELECT 'containsproperly310', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES
 ('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)')
 ) AS v(p);
-SELECT 'containsproperly311', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
+SELECT 'containsproperly311', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES
 ('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)')
 ) AS v(p);
 
-SELECT 'covers310', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
+SELECT 'covers310', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES
 ('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)')
 ) AS v(p);
-SELECT 'covers311', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
+SELECT 'covers311', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES
 ('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)')
 ) AS v(p);
 

Modified: trunk/regress/regress_selectivity.sql
===================================================================
--- trunk/regress/regress_selectivity.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/regress_selectivity.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -13,7 +13,7 @@
 
 -- Table with uniformly variable density, highest at 1,1, lowest at 10,10
 create table regular_overdots as
-with 
+with
 ij as ( select i, j from generate_series(1, 10) i, generate_series(1, 10) j),
 iijj as (select generate_series(1, i) as a, generate_series(1, j) b from ij)
 select st_makepoint(a, b) as g from iijj;

Modified: trunk/regress/regress_sfcgal.sql
===================================================================
--- trunk/regress/regress_sfcgal.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/regress_sfcgal.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -12,14 +12,14 @@
 SELECT 'ST_Extrude_line', ST_AsText(ST_Extrude(ST_Extrude('POINT(0 0)', 1, 0, 0), 0, 1, 0));
 -- In the first SFCGAL versions, the extruded face was wrongly oriented
 -- we change the extrusion result to match the original
-SELECT 'ST_Extrude_surface', 
-CASE WHEN postgis_sfcgal_version() = '1.0' 
+SELECT 'ST_Extrude_surface',
+CASE WHEN postgis_sfcgal_version() = '1.0'
 THEN
     ST_AsText(ST_Extrude(ST_Extrude(ST_Extrude('POINT(0 0)', 1, 0, 0), 0, 1, 0), 0, 0, 1))
 ELSE
     regexp_replace(
     regexp_replace(
-    ST_AsText(ST_Extrude(ST_Extrude(ST_Extrude('POINT(0 0)', 1, 0, 0), 0, 1, 0), 0, 0, 1)) , 
+    ST_AsText(ST_Extrude(ST_Extrude(ST_Extrude('POINT(0 0)', 1, 0, 0), 0, 1, 0), 0, 0, 1)) ,
     '\(\(0 1 0,1 1 0,1 0 0,0 1 0\)\)', '((1 1 0,1 0 0,0 1 0,1 1 0))'),
     '\(\(0 1 0,1 0 0,0 0 0,0 1 0\)\)', '((1 0 0,0 0 0,0 1 0,1 0 0))')
 END;

Modified: trunk/regress/relate.sql
===================================================================
--- trunk/regress/relate.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/relate.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,555 +1,555 @@
-SELECT '1', ST_Relate('POLYGON((0 0,80 0,80 80,0 80,0 0))','POLYGON((100 200,100 140,180 140,180 200,100 200))'); 
-SELECT '2', ST_Relate('POLYGON((0 0,140 0,140 140,0 140,0 0))','POLYGON((140 0,0 0,0 140,140 140,140 0))'); 
-SELECT '3', ST_Relate('POLYGON((40 60,360 60,360 300,40 300,40 60))','POLYGON((120 100,280 100,280 240,120 240,120 100))'); 
-SELECT '4', ST_Relate('POLYGON((40 60,420 60,420 320,40 320,40 60),(200 140,160 220,260 200,200 140))','POLYGON((80 100,360 100,360 280,80 280,80 100))'); 
-SELECT '5', ST_Relate('POLYGON((0 280,0 0,260 0,260 280,0 280),(220 240,40 240,40 40,220 40,220 240))','POLYGON((20 260,240 260,240 20,20 20,20 260),(160 180,80 180,120 120,160 180))'); 
-SELECT '6', ST_Relate('POLYGON((60 80,200 80,200 220,60 220,60 80))','POLYGON((120 140,260 140,260 260,120 260,120 140))'); 
-SELECT '7', ST_Relate('POLYGON((60 220,220 220,140 140,60 220))','POLYGON((100 180,180 180,180 100,100 100,100 180))'); 
-SELECT '8', ST_Relate('POLYGON((40 40,180 40,180 180,40 180,40 40))','POLYGON((180 40,40 180,160 280,300 140,180 40))'); 
-SELECT '9', ST_Relate('POLYGON((100 60,140 100,100 140,60 100,100 60))','MULTIPOLYGON(((80 40,120 40,120 80,80 80,80 40)),((120 80,160 80,160 120,120 120,120 80)),((80 120,120 120,120 160,80 160,80 120)),((40 80,80 80,80 120,40 120,40 80)))'); 
-SELECT '10', ST_Relate('POLYGON((40 280,200 280,200 100,40 100,40 280),(100 220,120 220,120 200,100 180,100 220))','POLYGON((40 280,180 260,180 120,60 120,40 280))'); 
-SELECT '11', ST_Relate('POLYGON((0 200,0 0,200 0,200 200,0 200),(20 180,130 180,130 30,20 30,20 180))','POLYGON((60 90,130 90,130 30,60 30,60 90))'); 
-SELECT '12', ST_Relate('POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))','POLYGON((270 90,200 50,150 80,210 120,270 90))'); 
-SELECT '13', ST_Relate('POLYGON((100 60,140 100,100 140,60 100,100 60))','MULTIPOLYGON(((80 40,120 40,120 80,80 80,80 40)),((120 80,160 80,160 120,120 120,120 80)),((80 120,120 120,120 160,80 160,80 120)),((40 80,80 80,80 120,40 120,40 80)))'); 
-SELECT '14', ST_Relate('LINESTRING(100 120,100 240)','POLYGON((40 60,160 60,160 180,40 180,40 60))'); 
-SELECT '15', ST_Relate('LINESTRING(80 80,140 140,200 200)','POLYGON((40 40,140 40,140 140,40 140,40 40))'); 
-SELECT '16', ST_Relate('LINESTRING(70 50,70 150)','MULTIPOLYGON(((0 0,0 100,140 100,140 0,0 0)),((20 170,70 100,130 170,20 170)))'); 
-SELECT '17', ST_Relate('LINESTRING(60 160,150 70)','POLYGON((190 190,360 20,20 20,190 190),(110 110,250 100,140 30,110 110))'); 
-SELECT '18', ST_Relate('LINESTRING(60 160,150 70)','POLYGON((190 190,360 20,20 20,190 190),(111 110,250 100,140 30,111 110))'); 
-SELECT '19', ST_Relate('LINESTRING(80 110,170 110)','POLYGON((20 200,20 20,240 20,240 200,20 200),(130 110,60 40,60 180,130 110),(130 180,130 40,200 110,130 180))'); 
-SELECT '20', ST_Relate('LINESTRING(80 110,170 110)','POLYGON((20 200,20 20,240 20,240 200,20 200),(130 110,60 40,60 180,130 110),(130 180,131 40,200 110,130 180))'); 
-SELECT '21', ST_Relate('LINESTRING(160 70,320 230)','MULTIPOLYGON(((140 110,260 110,170 20,50 20,140 110)),((300 270,420 270,340 190,220 190,300 270)))'); 
-SELECT '22', ST_Relate('LINESTRING(100 140,100 40)','MULTIPOLYGON(((20 80,180 79,100 0,20 80)),((20 160,180 160,100 80,20 160)))'); 
-SELECT '23', ST_Relate('LINESTRING(100 140,100 40)','MULTIPOLYGON(((20 80,180 80,100 0,20 80)),((20 160,180 160,100 80,20 160)))'); 
-SELECT '24', ST_Relate('LINESTRING(110 60,20 150,200 150,110 60)','POLYGON((20 20,200 20,110 110,20 20))'); 
-SELECT '25', ST_Relate('LINESTRING(0 0,0 50,50 50,50 0,0 0)','MULTILINESTRING((0 0,0 50),(0 50,50 50),(50 50,50 0),(50 0,0 0))'); 
-SELECT '26', ST_Relate('LINESTRING(40 180,140 180)','MULTIPOLYGON(((20 320,180 320,180 180,20 180,20 320)),((20 180,20 80,180 80,180 180,20 180)))'); 
-SELECT '27', ST_Relate('LINESTRING(40 180,140 180)','MULTIPOLYGON(((20 320,180 320,180 180,20 180,20 320)),((60 180,60 80,180 80,180 180,60 180)))'); 
-SELECT '28', ST_Relate('LINESTRING(0 0,60 0,60 60,60 0,120 0)','MULTILINESTRING((0 0,60 0),(60 0,120 0),(60 0,60 60))'); 
-SELECT '29', ST_Relate('LINESTRING(60 0,20 80,100 80,80 120,40 140)','LINESTRING(140 300,220 160,260 200,240 260)'); 
-SELECT '30', ST_Relate('LINESTRING(60 0,20 80,100 80,80 120,40 140)','LINESTRING(60 40,140 40,140 160,0 160)'); 
-SELECT '31', ST_Relate('LINESTRING(60 0,20 80,100 80,80 120,40 140)','LINESTRING(140 280,240 280,240 180,140 180,140 280)'); 
-SELECT '32', ST_Relate('LINESTRING(140 0,0 0,40 60,0 120,60 200,220 160,220 40)','LINESTRING(80 140,180 100,160 40,100 40,60 100,80 140)'); 
-SELECT '33', ST_Relate('LINESTRING(20 20,80 80)','LINESTRING(20 20,80 80)'); 
-SELECT '34', ST_Relate('LINESTRING(40 40,160 160,200 60,60 140)','LINESTRING(40 40,160 160,200 60,60 140)'); 
-SELECT '35', ST_Relate('LINESTRING(40 40,200 40)','LINESTRING(200 40,140 40,40 40)'); 
-SELECT '36', ST_Relate('LINESTRING(0 0,110 0,60 0)','LINESTRING(0 0,110 0)'); 
-SELECT '37', ST_Relate('LINESTRING(0 0,0 50,50 50,50 0,0 0)','MULTILINESTRING((0 0,0 50),(0 50,50 50),(50 50,50 0),(50 0,0 0))'); 
-SELECT '38', ST_Relate('LINESTRING(0 0,80 0,80 60,80 0,170 0)','MULTILINESTRING((0 0,170 0),(80 0,80 60))'); 
-SELECT '39', ST_Relate('LINESTRING(80 100,180 200)','LINESTRING(80 180,180 120)'); 
-SELECT '40', ST_Relate('LINESTRING(40 40,100 100,160 160)','LINESTRING(160 60,100 100,60 140)'); 
-SELECT '41', ST_Relate('LINESTRING(40 40,100 100,180 100,180 180,100 180,100 100)','LINESTRING(140 60,60 140)'); 
-SELECT '42', ST_Relate('LINESTRING(40 40,180 180,100 180,100 100)','LINESTRING(140 60,60 140)'); 
-SELECT '43', ST_Relate('LINESTRING(20 110,200 110)','LINESTRING(200 200,20 20,200 20,110 110,20 200,110 200,110 110)'); 
-SELECT '44', ST_Relate('LINESTRING(80 90,50 50,0 0)','LINESTRING(0 0,100 100)'); 
-SELECT '45', ST_Relate('LINESTRING(40 140,240 140)','LINESTRING(40 140,100 140,80 80,120 60,100 140,160 140,160 100,200 100,160 140,240 140)'); 
-SELECT '46', ST_Relate('LINESTRING(20 20,100 20,20 20)','LINESTRING(60 20,200 20)'); 
-SELECT '47', ST_Relate('LINESTRING(40 60,180 60,180 140,100 140,100 60,220 60,220 180,80 180,80 60,280 60)','LINESTRING(140 60,180 60,220 60,260 60)'); 
-SELECT '48', ST_Relate('POINT(20 20)','POLYGON((60 120,60 40,160 40,160 120,60 120))'); 
-SELECT '49', ST_Relate('MULTIPOINT(0 20,40 20)','POLYGON((20 40,20 0,60 0,60 40,20 40))'); 
-SELECT '50', ST_Relate('MULTIPOINT(0 20,20 20)','POLYGON((20 40,20 0,60 0,60 40,20 40))'); 
-SELECT '51', ST_Relate('MULTIPOINT(20 20,40 20)','POLYGON((20 40,20 0,60 0,60 40,20 40))'); 
-SELECT '52', ST_Relate('MULTIPOINT(80 260,140 260,180 260)','POLYGON((40 320,140 320,140 200,40 200,40 320))'); 
-SELECT '53', ST_Relate('POINT(40 40)','MULTIPOLYGON(((0 40,0 0,40 0,40 40,0 40)),((40 80,40 40,80 40,80 80,40 80)))'); 
-SELECT '54', ST_Relate('POINT(60 120)','LINESTRING(40 40,120 120,200 120)'); 
-SELECT '55', ST_Relate('POINT(40 40)','LINESTRING(40 40,100 100,160 100)'); 
-SELECT '56', ST_Relate('POINT(60 60)','LINESTRING(40 40,100 100)'); 
-SELECT '57', ST_Relate('MULTIPOINT(40 40,100 40)','LINESTRING(40 40,80 80)'); 
-SELECT '58', ST_Relate('MULTIPOINT(40 40,60 60)','LINESTRING(40 40,80 80)'); 
-SELECT '59', ST_Relate('MULTIPOINT(60 60,100 100)','LINESTRING(40 40,80 80)'); 
-SELECT '60', ST_Relate('MULTIPOINT(60 60,100 100)','LINESTRING(40 40,80 80)'); 
-SELECT '61', ST_Relate('MULTIPOINT(60 60,100 100)','LINESTRING(40 40,60 60,80 80)'); 
-SELECT '62', ST_Relate('POINT(20 20)','POINT(20 20)'); 
-SELECT '63', ST_Relate('POINT(20 20)','POINT(20 30)'); 
-SELECT '64', ST_Relate('MULTIPOINT(40 40,80 60,40 100)','MULTIPOINT(40 40,80 60,120 100)'); 
-SELECT '65', ST_Relate('MULTIPOINT(40 40,80 60,120 100)','MULTIPOINT(40 40,80 60,120 100)'); 
-SELECT '66', ST_Relate('POLYGON((100 100,100 200,200 200,200 100,100 100))','POLYGON((100 100,1e+15 110,1e+15 100,100 100))'); 
-SELECT '67', ST_Relate('POLYGON((120 100,120 200,200 200,200 100,120 100))','POLYGON((100 100,1e+15 110,1e+15 100,100 100))'); 
-SELECT '68', ST_Relate('POLYGON((20 20,20 100,120 100,140 20,20 20))','POLYGON((20 20,20 100,120 100,140 20,20 20))'); 
-SELECT '69', ST_Relate('POLYGON((20 20,20 100,120 100,140 20,20 20))','POLYGON((20 20,140 20,120 100,20 100,20 20))'); 
-SELECT '70', ST_Relate('POLYGON((20 20,20 100,120 100,140 20,20 20))','POLYGON((120 100,140 20,20 20,20 100,120 100))'); 
-SELECT '71', ST_Relate('POLYGON((20 20,20 100,120 100,140 20,20 20))','POLYGON((20 100,60 100,120 100,140 20,80 20,20 20,20 100))'); 
-SELECT '72', ST_Relate('POLYGON((0 0,80 0,80 80,0 80,0 0))','POLYGON((100 200,100 140,180 140,180 200,100 200))'); 
-SELECT '73', ST_Relate('POLYGON((140 120,160 20,20 20,20 120,140 120))','POLYGON((140 120,140 200,240 200,240 120,140 120))'); 
-SELECT '74', ST_Relate('POLYGON((140 120,160 20,20 20,20 120,140 120))','POLYGON((80 180,140 260,260 200,200 60,80 180))'); 
-SELECT '75', ST_Relate('POLYGON((140 120,160 20,20 20,20 120,140 120))','POLYGON((240 80,140 120,180 240,280 200,240 80))'); 
-SELECT '76', ST_Relate('POLYGON((140 160,20 20,270 20,150 160,230 40,60 40,140 160))','POLYGON((140 40,180 80,120 100,140 40))'); 
-SELECT '77', ST_Relate('POLYGON((140 160,20 20,270 20,150 160,230 40,60 40,140 160))','POLYGON((120 100,180 80,130 40,120 100))'); 
-SELECT '78', ST_Relate('POLYGON((20 20,180 20,140 140,20 140,20 20))','POLYGON((180 100,80 200,180 280,260 200,180 100))'); 
-SELECT '79', ST_Relate('POLYGON((140 120,160 20,20 20,20 120,140 120))','POLYGON((140 140,20 120,0 220,120 240,140 140))'); 
-SELECT '80', ST_Relate('POLYGON((160 200,210 70,120 70,160 200))','POLYGON((160 200,260 40,70 40,160 200,20 20,310 20,160 200))'); 
-SELECT '81', ST_Relate('POLYGON((110 140,200 70,200 160,110 140))','POLYGON((110 140,110 50,60 50,60 90,160 190,20 110,20 20,200 20,110 140))'); 
-SELECT '82', ST_Relate('POLYGON((20 120,20 20,260 20,260 120,200 40,140 120,80 40,20 120))','POLYGON((20 120,20 240,260 240,260 120,200 200,140 120,80 200,20 120))'); 
-SELECT '83', ST_Relate('POLYGON((20 120,20 20,260 20,260 120,180 40,140 120,100 40,20 120))','POLYGON((20 120,300 120,140 240,20 120))'); 
-SELECT '84', ST_Relate('POLYGON((20 20,20 300,280 300,280 260,220 260,60 100,60 60,280 60,280 20,20 20))','POLYGON((100 140,160 80,280 180,200 240,220 160,160 200,180 120,100 140))'); 
-SELECT '85', ST_Relate('POLYGON((20 20,20 300,280 300,280 260,220 260,60 100,60 60,280 60,280 20,20 20))','POLYGON((260 200,180 80,120 160,200 160,180 220,260 200))'); 
-SELECT '86', ST_Relate('POLYGON((20 20,280 20,280 140,220 60,140 140,80 60,20 140,20 20))','POLYGON((0 140,300 140,140 240,0 140))'); 
-SELECT '87', ST_Relate('POLYGON((20 20,280 20,280 140,220 60,140 140,80 60,20 140,20 20))','POLYGON((20 240,20 140,320 140,180 240,20 240))'); 
-SELECT '88', ST_Relate('POLYGON((20 20,280 20,280 140,220 60,140 140,80 60,20 140,20 20))','POLYGON((20 240,20 140,80 180,140 140,220 180,280 140,280 240,20 240))'); 
-SELECT '89', ST_Relate('POLYGON((120 120,180 60,20 20,20 120,120 120))','POLYGON((120 120,220 20,280 20,240 160,120 120))'); 
-SELECT '90', ST_Relate('POLYGON((140 120,160 20,20 20,20 120,140 120))','POLYGON((140 120,160 20,260 120,220 200,140 120))'); 
-SELECT '91', ST_Relate('POLYGON((20 140,120 40,20 40,20 140))','POLYGON((190 140,190 20,140 20,20 140,190 140))'); 
-SELECT '92', ST_Relate('POLYGON((120 120,180 60,20 20,20 120,120 120))','POLYGON((300 20,220 20,120 120,260 160,300 20))'); 
-SELECT '93', ST_Relate('POLYGON((140 120,160 20,20 20,20 120,140 120))','POLYGON((140 120,240 160,280 60,160 20,140 120))'); 
-SELECT '94', ST_Relate('POLYGON((120 120,180 60,20 20,20 120,120 120))','POLYGON((280 60,180 60,120 120,260 180,280 60))'); 
-SELECT '95', ST_Relate('POLYGON((140 120,160 20,20 20,20 120,140 120))','POLYGON((120 200,120 120,40 120,40 200,120 200))'); 
-SELECT '96', ST_Relate('POLYGON((140 120,160 20,20 20,20 120,140 120))','POLYGON((160 220,140 120,60 120,40 220,160 220))'); 
-SELECT '97', ST_Relate('POLYGON((140 120,160 20,20 20,20 120,140 120))','POLYGON((140 120,20 120,20 220,140 220,140 120))'); 
-SELECT '98', ST_Relate('POLYGON((120 120,180 60,20 20,20 120,120 120))','POLYGON((320 20,220 20,80 160,240 140,320 20))'); 
-SELECT '99', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((60 40,60 140,180 140,180 40,60 40))'); 
-SELECT '100', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 20,80 140,160 60,20 20))'); 
-SELECT '101', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((160 60,20 20,100 140,160 60))'); 
-SELECT '102', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 100,140 160,160 40,20 100))'); 
-SELECT '103', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((160 40,20 100,160 160,160 40))'); 
-SELECT '104', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 180,180 120,80 40,20 180))'); 
-SELECT '105', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((180 120,100 40,20 180,180 120))'); 
-SELECT '106', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 20,140 40,140 120,20 160,80 80,20 20))'); 
-SELECT '107', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 20,140 40,140 140,20 180,80 100,20 20))'); 
-SELECT '108', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((40 180,60 100,180 100,200 180,120 120,40 180))'); 
-SELECT '109', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 180,60 80,180 80,220 180,120 120,20 180))'); 
-SELECT '110', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((40 60,20 180,100 100,140 180,160 120,220 100,140 40,40 60))'); 
-SELECT '111', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((60 100,180 100,220 180,120 140,20 180,60 100))'); 
-SELECT '112', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 20,20 140,120 120,120 40,20 20))'); 
-SELECT '113', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 20,20 180,140 140,140 60,20 20))'); 
-SELECT '114', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 20,120 40,120 120,20 140,20 20))'); 
-SELECT '115', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((120 40,20 20,20 140,120 120,120 40))'); 
-SELECT '116', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 20,140 60,140 140,20 180,20 20))'); 
-SELECT '117', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((140 60,20 20,20 180,140 140,140 60))'); 
-SELECT '118', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 20,60 120,140 120,180 20,20 20))'); 
-SELECT '119', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 40,120 40,120 120,20 140,20 40))'); 
-SELECT '120', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 20,20 180,60 120,100 180,140 120,220 180,200 120,140 60,20 20))'); 
-SELECT '121', ST_Relate('POLYGON((150 150,330 150,250 70,70 70,150 150))','POLYGON((150 150,270 150,140 20,20 20,150 150))'); 
-SELECT '122', ST_Relate('POLYGON((150 150,270 150,330 150,250 70,190 70,70 70,150 150))','POLYGON((150 150,270 150,190 70,140 20,20 20,70 70,150 150))'); 
-SELECT '123', ST_Relate('POLYGON((20 20,60 50,20 40,60 70,20 60,60 90,20 90,70 110,20 130,80 130,20 150,80 160,20 170,80 180,20 200,80 200,30 240,80 220,50 260,100 220,100 260,120 220,130 260,140 220,150 280,150 190,160 280,170 190,180 280,190 190,200 280,210 190,220 280,230 190,240 260,250 230,260 260,260 220,290 270,290 220,330 260,300 210,340 240,290 180,340 210,290 170,350 170,240 150,350 150,240 140,350 130,240 120,350 120,240 110,350 110,240 100,350 100,240 90,350 90,240 80,350 80,300 70,340 60,290 60,340 40,300 50,340 20,270 60,310 20,250 60,270 20,230 60,240 20,210 60,210 20,190 70,190 20,180 90,170 20,160 90,150 20,140 90,130 20,120 90,110 20,100 90,100 20,90 60,80 20,70 40,20 20))','POLYGON((190 140,140 130,200 160,130 150,210 170,130 170,210 180,120 190,220 200,120 200,250 210,120 210,250 220,120 220,250 230,120 240,230 240,120 250,240 260,120 260,240 270,120 270,270 290,120 290,230 300,150 310,250 310,180 320,250 320,200 360,260 330,240 360,280 320,290 370,290 320,320 36
 0,310 320,360 360,310 310,380 340,310 290,390 330,310 280,410 310,310 270,420 280,310 260,430 250,300 250,440 240,300 240,450 230,280 220,440 220,280 210,440 210,300 200,430 190,300 190,440 180,330 180,430 150,320 180,420 130,300 180,410 120,280 180,400 110,280 170,390 90,280 160,400 70,270 160,450 30,260 160,420 30,250 160,390 30,240 160,370 30,230 160,360 30,230 150,330 50,240 130,330 30,230 130,310 30,220 130,280 30,230 100,270 40,220 110,250 30,210 130,240 30,210 100,220 40,200 90,200 20,190 100,180 30,20 20,180 40,20 30,180 50,20 50,180 60,30 60,180 70,20 70,170 80,80 80,170 90,20 80,180 100,40 100,200 110,60 110,200 120,120 120,190 140))'); 
-SELECT '124', ST_Relate('POLYGON((70 150,20 160,110 160,20 180,100 200,20 200,190 210,20 210,160 220,20 220,150 230,60 240,180 250,20 260,170 260,60 270,160 270,100 310,170 280,200 260,180 230,210 260,130 330,230 250,210 290,240 250,230 210,260 300,250 230,270 300,270 240,300 340,280 250,320 330,290 250,340 350,290 240,350 360,270 190,350 340,290 200,350 330,300 190,360 320,310 190,360 300,320 200,360 280,330 200,360 260,340 200,370 260,340 180,390 290,340 170,400 260,350 170,400 250,350 160,410 240,350 150,400 170,350 140,310 170,340 140,270 180,330 140,260 170,310 140,240 170,290 140,200 190,270 140,180 190,260 140,170 190,260 130,170 180,250 130,170 170,240 120,170 160,210 120,170 150,210 110,340 130,230 110,420 140,220 100,410 130,220 90,400 120,220 80,390 110,220 70,420 110,240 70,420 100,260 70,420 90,280 70,430 80,230 60,430 60,270 50,450 40,210 50,370 40,260 40,460 30,160 40,210 60,200 110,190 60,190 120,170 50,180 130,150 30,170 130,140 20,160 120,130 20,160 150,120 20,160 
 170,110 20,160 190,100 20,150 190,90 20,140 180,80 20,120 140,70 20,120 150,60 20,110 150,50 20,100 140,50 30,90 130,40 30,80 120,30 30,80 130,30 40,80 140,20 40,70 140,40 90,60 130,20 90,60 140,20 130,70 150))','POLYGON((190 140,140 130,200 160,130 150,210 170,130 170,210 180,120 190,220 200,120 200,250 210,120 210,250 220,120 220,250 230,120 240,230 240,120 250,240 260,120 260,240 270,120 270,270 290,120 290,230 300,150 310,250 310,180 320,250 320,200 360,260 330,240 360,280 320,290 370,290 320,320 360,310 320,360 360,310 310,380 340,310 290,390 330,310 280,410 310,310 270,420 280,310 260,430 250,300 250,440 240,300 240,450 230,280 220,440 220,280 210,440 210,300 200,430 190,300 190,440 180,330 180,430 150,320 180,420 130,300 180,410 120,280 180,400 110,280 170,390 90,280 160,400 70,270 160,450 30,260 160,420 30,250 160,390 30,240 160,370 30,230 160,360 30,230 150,330 50,240 130,330 30,230 130,310 30,220 130,280 30,230 100,270 40,220 110,250 30,210 130,240 30,210 100,220 40,200 90
 ,200 20,190 100,180 30,20 20,180 40,20 30,180 50,20 50,180 60,30 60,180 70,20 70,170 80,80 80,170 90,20 80,180 100,40 100,200 110,60 110,200 120,120 120,190 140))'); 
-SELECT '125', ST_Relate('POLYGON((60 160,220 160,220 20,60 20,60 160))','POLYGON((60 160,20 200,260 200,220 160,140 80,60 160))'); 
-SELECT '126', ST_Relate('POLYGON((60 160,220 160,220 20,60 20,60 160))','POLYGON((60 160,20 200,260 200,140 80,60 160))'); 
-SELECT '127', ST_Relate('POLYGON((60 160,220 160,220 20,60 20,60 160))','POLYGON((20 200,140 80,260 200,20 200))'); 
-SELECT '128', ST_Relate('POLYGON((60 160,220 160,220 20,60 20,60 160))','POLYGON((20 200,60 160,140 80,220 160,260 200,20 200))'); 
-SELECT '129', ST_Relate('POLYGON((60 160,220 160,220 20,60 20,60 160))','POLYGON((20 200,60 160,140 80,260 200,20 200))'); 
-SELECT '130', ST_Relate('POLYGON((0 0,0 200,200 200,200 0,0 0))','POLYGON((100 100,1000000 110,10000000 100,100 100))'); 
-SELECT '131', ST_Relate('POLYGON((100 0,100 200,200 200,200 0,100 0))','POLYGON((100 100,1000000 110,10000000 100,100 100))'); 
-SELECT '132', ST_Relate('POLYGON((120 0,120 200,200 200,200 0,120 0))','POLYGON((100 100,1000000 110,10000000 100,100 100))'); 
-SELECT '133', ST_Relate('POLYGON((0 0,0 200,110 200,110 0,0 0))','POLYGON((100 100,1000000 110,10000000 100,100 100))'); 
-SELECT '134', ST_Relate('POLYGON((100 100,100 200,200 200,200 100,100 100))','POLYGON((100 100,2100 110,2100 100,100 100))'); 
-SELECT '135', ST_Relate('POLYGON((100 100,100 200,200 200,200 100,100 100))','POLYGON((100 100,2101 110,2101 100,100 100))'); 
-SELECT '136', ST_Relate('POLYGON((100 100,200 200,200 100,100 100))','POLYGON((100 100,2101 110,2101 100,100 100))'); 
-SELECT '137', ST_Relate('POLYGON((100 100,100 200,200 200,200 100,100 100))','POLYGON((100 100,1000000 110,1000000 100,100 100))'); 
-SELECT '138', ST_Relate('POLYGON((120 100,120 200,200 200,200 100,120 100))','POLYGON((100 100,500 110,500 100,100 100))'); 
-SELECT '139', ST_Relate('POLYGON((120 100,120 200,200 200,200 100,120 100))','POLYGON((100 100,501 110,501 100,100 100))'); 
-SELECT '140', ST_Relate('POLYGON((120 100,130 200,200 200,200 100,120 100))','POLYGON((100 100,501 110,501 100,100 100))'); 
-SELECT '141', ST_Relate('POLYGON((120 100,17 200,200 200,200 100,120 100))','POLYGON((100 100,501 110,501 100,100 100))'); 
-SELECT '142', ST_Relate('POLYGON((120 100,120 200,200 200,200 100,120 100))','POLYGON((100 100,1000000 110,1000000 100,100 100))'); 
-SELECT '143', ST_Relate('POLYGON((101 99,101 1000000,102 1000000,101 99))','POLYGON((100 100,1000000 110,1000000 100,100 100))'); 
-SELECT '144', ST_Relate('POLYGON((100 100,200 101,200 100,100 100))','POLYGON((100 100,2101 110,2101 100,100 100))'); 
-SELECT '145', ST_Relate('POLYGON((16 319,150 39,25 302,160 20,265 20,127 317,16 319))','POLYGON((10 307,22 307,153 34,22 34,10 307))'); 
-SELECT '146', ST_Relate('POLYGON((160 200,210 70,120 70,160 200))','POLYGON((160 200,310 20,20 20,160 200),(160 200,260 40,70 40,160 200))'); 
-SELECT '147', ST_Relate('POLYGON((170 120,240 100,260 50,190 70,170 120))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))'); 
-SELECT '148', ST_Relate('POLYGON((270 90,200 50,150 80,210 120,270 90))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))'); 
-SELECT '149', ST_Relate('POLYGON((170 120,260 100,240 60,150 80,170 120))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))'); 
-SELECT '150', ST_Relate('POLYGON((220 120,270 80,200 60,160 100,220 120))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))'); 
-SELECT '151', ST_Relate('POLYGON((260 50,180 70,180 110,260 90,260 50))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))'); 
-SELECT '152', ST_Relate('POLYGON((230 110,290 80,190 60,140 90,230 110))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))'); 
-SELECT '153', ST_Relate('POLYGON((170 120,330 120,260 50,100 50,170 120))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))'); 
-SELECT '154', ST_Relate('POLYGON((170 120,330 120,280 70,120 70,170 120))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))'); 
-SELECT '155', ST_Relate('POLYGON((170 120,300 120,250 70,120 70,170 120))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))'); 
-SELECT '156', ST_Relate('POLYGON((190 100,310 100,260 50,140 50,190 100))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))'); 
-SELECT '157', ST_Relate('POLYGON((280 130,360 130,270 40,190 40,280 130))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,250 120,180 50,100 50,170 120))'); 
-SELECT '158', ST_Relate('POLYGON((220 80,180 40,80 40,170 130,270 130,230 90,300 90,250 30,280 30,390 140,150 140,40 30,230 30,280 80,220 80))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,250 120,180 50,100 50,170 120))'); 
-SELECT '159', ST_Relate('POLYGON((260 130,360 130,280 40,170 40,260 130))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,250 120,180 50,100 50,170 120))'); 
-SELECT '160', ST_Relate('POLYGON((240 110,340 110,290 60,190 60,240 110))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,250 120,180 50,100 50,170 120))'); 
-SELECT '161', ST_Relate('POLYGON((250 120,350 120,280 50,180 50,250 120))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,250 120,180 50,100 50,170 120))'); 
-SELECT '162', ST_Relate('POLYGON((230 210,230 20,20 20,20 210,230 210),(120 180,50 50,200 50,120 180))','POLYGON((230 210,230 20,20 20,20 210,230 210),(120 180,50 50,200 50,120 180))'); 
-SELECT '163', ST_Relate('POLYGON((230 210,230 20,20 20,20 210,230 210),(140 40,40 40,40 170,140 40),(110 190,210 190,210 50,110 190))','POLYGON((230 210,230 20,20 20,20 210,230 210),(140 40,40 40,40 170,140 40),(110 190,210 190,210 50,110 190))'); 
-SELECT '164', ST_Relate('POLYGON((280 190,330 150,200 110,150 150,280 190))','MULTIPOLYGON(((140 110,260 110,170 20,50 20,140 110)),((300 270,420 270,340 190,220 190,300 270)))'); 
-SELECT '165', ST_Relate('POLYGON((80 190,220 190,140 110,0 110,80 190))','MULTIPOLYGON(((140 110,260 110,170 20,50 20,140 110)),((300 270,420 270,340 190,220 190,300 270)))'); 
-SELECT '166', ST_Relate('POLYGON((330 150,200 110,150 150,280 190,330 150))','MULTIPOLYGON(((140 110,260 110,170 20,50 20,140 110)),((300 270,420 270,340 190,220 190,300 270)))'); 
-SELECT '167', ST_Relate('POLYGON((290 190,340 150,220 120,170 170,290 190))','MULTIPOLYGON(((140 110,260 110,170 20,50 20,140 110)),((300 270,420 270,340 190,220 190,300 270)))'); 
-SELECT '168', ST_Relate('POLYGON((220 190,340 190,260 110,140 110,220 190))','MULTIPOLYGON(((140 110,260 110,170 20,50 20,140 110)),((300 270,420 270,340 190,220 190,300 270)))'); 
-SELECT '169', ST_Relate('POLYGON((140 190,220 190,100 70,20 70,140 190))','MULTIPOLYGON(((140 110,260 110,170 20,50 20,140 110)),((300 270,420 270,340 190,220 190,300 270)))'); 
-SELECT '170', ST_Relate('POLYGON((140 220,60 140,140 60,220 140,140 220))','MULTIPOLYGON(((100 20,180 20,180 100,100 100,100 20)),((20 100,100 100,100 180,20 180,20 100)),((100 180,180 180,180 260,100 260,100 180)),((180 100,260 100,260 180,180 180,180 100)))'); 
-SELECT '171', ST_Relate('MULTIPOLYGON(((110 110,70 200,150 200,110 110)),((110 110,150 20,70 20,110 110)))','MULTIPOLYGON(((110 110,160 160,210 110,160 60,110 110)),((110 110,60 60,10 110,60 160,110 110)))'); 
-SELECT '172', ST_Relate('MULTIPOLYGON(((110 110,70 200,150 200,110 110),(110 110,100 180,120 180,110 110)),((110 110,150 20,70 20,110 110),(110 110,120 40,100 40,110 110)))','MULTIPOLYGON(((110 110,160 160,210 110,160 60,110 110),(110 110,160 130,160 90,110 110)),((110 110,60 60,10 110,60 160,110 110),(110 110,60 90,60 130,110 110)))'); 
-SELECT '173', ST_Relate('MULTIPOLYGON(((110 110,70 200,200 200,110 110),(110 110,100 180,120 180,110 110)),((110 110,200 20,70 20,110 110),(110 110,120 40,100 40,110 110)))','MULTIPOLYGON(((110 110,160 160,210 110,160 60,110 110),(110 110,160 130,160 90,110 110)),((110 110,60 60,10 110,60 160,110 110),(110 110,60 90,60 130,110 110)))'); 
-SELECT '174', ST_Relate('MULTIPOLYGON(((110 110,20 200,200 200,110 110),(110 110,100 180,120 180,110 110)),((110 110,200 20,20 20,110 110),(110 110,120 40,100 40,110 110)))','MULTIPOLYGON(((110 110,160 160,210 110,160 60,110 110),(110 110,160 130,160 90,110 110)),((110 110,60 60,10 110,60 160,110 110),(110 110,60 90,60 130,110 110)))'); 
-SELECT '175', ST_Relate('MULTIPOLYGON(((110 110,70 200,200 200,110 110),(110 110,100 180,120 180,110 110)),((110 110,200 20,70 20,110 110),(110 110,120 40,100 40,110 110)))','MULTIPOLYGON(((110 110,160 160,210 110,160 60,110 110),(110 110,160 130,160 90,110 110)),((110 110,60 60,10 110,60 160,110 110),(110 110,60 90,60 130,110 110)))'); 
-SELECT '176', ST_Relate('MULTIPOLYGON(((110 110,70 200,200 200,110 110),(110 110,100 180,120 180,110 110)),((110 110,200 20,70 20,110 110),(110 110,120 40,100 40,110 110)))','MULTIPOLYGON(((110 110,70 200,210 110,70 20,110 110),(110 110,110 140,150 110,110 80,110 110)),((110 110,60 60,10 110,60 160,110 110),(110 110,60 90,60 130,110 110)))'); 
-SELECT '177', ST_Relate('POLYGON((100 60,140 100,100 140,60 100,100 60))','MULTIPOLYGON(((80 40,120 40,120 80,80 80,80 40)),((120 80,160 80,160 120,120 120,120 80)),((80 120,120 120,120 160,80 160,80 120)),((40 80,80 80,80 120,40 120,40 80)))'); 
-SELECT '178', ST_Relate('LINESTRING(150 150,40 230)','POLYGON((150 150,410 150,280 20,20 20,150 150))'); 
-SELECT '179', ST_Relate('LINESTRING(40 40,50 130,130 130)','POLYGON((150 150,410 150,280 20,20 20,150 150))'); 
-SELECT '180', ST_Relate('LINESTRING(40 230,150 150)','POLYGON((150 150,410 150,280 20,20 20,150 150))'); 
-SELECT '181', ST_Relate('LINESTRING(210 150,330 150)','POLYGON((150 150,410 150,280 20,20 20,150 150))'); 
-SELECT '182', ST_Relate('LINESTRING(200 150,310 150,360 220)','POLYGON((150 150,410 150,280 20,20 20,150 150))'); 
-SELECT '183', ST_Relate('LINESTRING(180 150,250 150,230 250,370 250,410 150)','POLYGON((150 150,410 150,280 20,20 20,150 150))'); 
-SELECT '184', ST_Relate('LINESTRING(210 210,220 150,320 150,370 210)','POLYGON((150 150,410 150,280 20,20 20,150 150))'); 
-SELECT '185', ST_Relate('LINESTRING(20 60,150 60)','POLYGON((150 150,410 150,280 20,20 20,150 150))'); 
-SELECT '186', ST_Relate('LINESTRING(60 90,310 180)','POLYGON((150 150,410 150,280 20,20 20,150 150))'); 
-SELECT '187', ST_Relate('LINESTRING(90 210,210 90)','POLYGON((150 150,410 150,280 20,20 20,150 150))'); 
-SELECT '188', ST_Relate('LINESTRING(290 10,130 170)','POLYGON((150 150,410 150,280 20,20 20,150 150))'); 
-SELECT '189', ST_Relate('LINESTRING(30 100,100 100,180 100)','POLYGON((150 150,410 150,280 20,20 20,150 150))'); 
-SELECT '190', ST_Relate('LINESTRING(20 100,100 100,360 100,410 100)','POLYGON((150 150,410 150,280 20,20 20,150 150))'); 
-SELECT '191', ST_Relate('LINESTRING(90 210,150 150,210 90)','POLYGON((150 150,410 150,280 20,20 20,150 150))'); 
-SELECT '192', ST_Relate('LINESTRING(180 90,280 120)','POLYGON((150 150,410 150,280 20,20 20,150 150))'); 
-SELECT '193', ST_Relate('LINESTRING(70 70,80 20)','POLYGON((150 150,410 150,280 20,20 20,150 150))'); 
-SELECT '194', ST_Relate('LINESTRING(130 20,150 60)','POLYGON((150 150,410 150,280 20,20 20,150 150))'); 
-SELECT '195', ST_Relate('LINESTRING(70 70,80 20,140 20,150 60)','POLYGON((150 150,410 150,280 20,20 20,150 150))'); 
-SELECT '196', ST_Relate('LINESTRING(170 50,170 20,240 20,260 60)','POLYGON((150 150,410 150,280 20,20 20,150 150))'); 
-SELECT '197', ST_Relate('LINESTRING(50 100,140 190,280 190)','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))'); 
-SELECT '198', ST_Relate('LINESTRING(140 60,180 100,290 100)','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))'); 
-SELECT '199', ST_Relate('LINESTRING(170 120,210 80,270 80)','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))'); 
-SELECT '200', ST_Relate('LINESTRING(170 120,260 50)','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))'); 
-SELECT '201', ST_Relate('LINESTRING(190 90,190 270)','POLYGON((190 190,360 20,20 20,190 190),(190 190,280 50,100 50,190 190))'); 
-SELECT '202', ST_Relate('LINESTRING(60 160,150 70)','POLYGON((190 190,360 20,20 20,190 190),(110 110,250 100,140 30,110 110))'); 
-SELECT '203', ST_Relate('LINESTRING(60 160,150 70)','POLYGON((190 190,20 20,360 20,190 190),(250 100,110 110,140 30,250 100))'); 
-SELECT '204', ST_Relate('LINESTRING(60 160,150 70)','POLYGON((190 190,20 20,360 20,190 190),(250 100,110 110,140 30,250 100))'); 
-SELECT '205', ST_Relate('LINESTRING(190 90,190 190,190 270)','POLYGON((190 190,360 20,20 20,190 190),(190 190,280 50,100 50,190 190))'); 
-SELECT '206', ST_Relate('LINESTRING(60 160,110 110,150 70)','POLYGON((190 190,360 20,20 20,190 190),(110 110,250 100,140 30,110 110))'); 
-SELECT '207', ST_Relate('LINESTRING(60 160,110 110,150 70)','POLYGON((190 190,20 20,360 20,190 190),(250 100,110 110,140 30,250 100))'); 
-SELECT '208', ST_Relate('LINESTRING(60 160,110 110,150 70)','POLYGON((190 190,110 110,20 20,360 20,190 190),(250 100,110 110,140 30,250 100))'); 
-SELECT '209', ST_Relate('LINESTRING(130 110,180 110,190 60)','POLYGON((20 200,240 200,240 20,20 20,20 200),(130 110,60 180,60 40,130 110),(130 110,200 40,200 180,130 110))'); 
-SELECT '210', ST_Relate('LINESTRING(80 110,180 110)','POLYGON((20 200,240 200,240 20,20 20,20 200),(130 110,60 180,60 40,130 110),(130 110,200 40,200 180,130 110))'); 
-SELECT '211', ST_Relate('LINESTRING(80 110,180 110)','POLYGON((20 200,20 20,240 20,240 200,20 200),(60 180,130 110,60 40,60 180),(130 110,200 40,200 180,130 110))'); 
-SELECT '212', ST_Relate('LINESTRING(80 110,170 110)','POLYGON((20 200,20 20,240 20,240 200,20 200),(130 110,60 40,60 180,130 110),(130 180,130 40,200 110,130 180))'); 
-SELECT '213', ST_Relate('LINESTRING(80 110,130 110,170 110)','POLYGON((20 200,20 20,240 20,240 200,20 200),(130 110,60 40,60 180,130 110),(130 180,130 40,200 110,130 180))'); 
-SELECT '214', ST_Relate('LINESTRING(80 110,130 110,180 110)','POLYGON((20 200,240 200,240 20,20 20,20 200),(130 110,60 180,60 40,130 110),(130 110,200 40,200 180,130 110))'); 
-SELECT '215', ST_Relate('LINESTRING(80 110,130 110,180 110)','POLYGON((20 200,20 20,240 20,240 200,20 200),(60 180,130 110,60 40,60 180),(130 110,200 40,200 180,130 110))'); 
-SELECT '216', ST_Relate('LINESTRING(80 110,130 110,170 110)','POLYGON((20 200,20 20,240 20,240 200,20 200),(130 110,60 40,60 180,130 110),(130 180,130 40,200 110,130 180))'); 
-SELECT '217', ST_Relate('LINESTRING(160 70,320 230)','MULTIPOLYGON(((140 110,260 110,170 20,50 20,140 110)),((300 270,420 270,340 190,220 190,300 270)))'); 
-SELECT '218', ST_Relate('LINESTRING(160 70,200 110,280 190,320 230)','MULTIPOLYGON(((140 110,260 110,170 20,50 20,140 110)),((300 270,420 270,340 190,220 190,300 270)))'); 
-SELECT '219', ST_Relate('LINESTRING(70 50,70 150)','MULTIPOLYGON(((0 0,0 100,140 100,140 0,0 0)),((20 170,70 100,130 170,20 170)))'); 
-SELECT '220', ST_Relate('LINESTRING(110 110,20 200,200 200,110 110)','POLYGON((20 20,200 20,110 110,20 20))'); 
-SELECT '221', ST_Relate('LINESTRING(150 70,160 110,200 60,150 70)','POLYGON((20 20,200 20,110 110,20 20))'); 
-SELECT '222', ST_Relate('LINESTRING(80 60,120 40,120 70,80 60)','POLYGON((110 110,200 20,20 20,110 110),(110 90,50 30,170 30,110 90))'); 
-SELECT '223', ST_Relate('LINESTRING(20 20,200 20,110 110,20 20)','POLYGON((20 20,200 20,110 110,20 20))'); 
-SELECT '224', ST_Relate('LINESTRING(110 90,170 30,50 30,110 90)','POLYGON((110 110,200 20,20 20,110 110),(110 90,50 30,170 30,110 90))'); 
-SELECT '225', ST_Relate('LINESTRING(110 110,170 50,170 110,110 110)','POLYGON((110 110,200 20,20 20,110 110),(110 90,50 30,170 30,110 90))'); 
-SELECT '226', ST_Relate('LINESTRING(110 90,70 50,130 50,110 90)','POLYGON((110 110,200 20,20 20,110 110),(110 90,50 30,170 30,110 90))'); 
-SELECT '227', ST_Relate('LINESTRING(110 60,20 150,200 150,110 60)','POLYGON((20 20,200 20,110 110,20 20))'); 
-SELECT '228', ST_Relate('LINESTRING(110 130,110 70,200 100,110 130)','POLYGON((110 110,200 20,20 20,110 110),(110 90,50 30,170 30,110 90))'); 
-SELECT '229', ST_Relate('LINESTRING(110 90,160 40,60 40,110 90)','POLYGON((20 20,200 20,110 110,20 20))'); 
-SELECT '230', ST_Relate('LINESTRING(110 100,40 30,180 30,110 100)','POLYGON((110 110,200 20,20 20,110 110),(110 90,60 40,160 40,110 90))'); 
-SELECT '231', ST_Relate('LINESTRING(110 110,180 30,40 30,110 110)','POLYGON((110 110,200 20,20 20,110 110),(110 90,60 40,160 40,110 90))'); 
-SELECT '232', ST_Relate('LINESTRING(110 90,180 30,40 30,110 90)','POLYGON((110 110,200 20,20 20,110 110),(110 90,60 40,160 40,110 90))'); 
-SELECT '233', ST_Relate('LINESTRING(110 90,50 30,180 30,110 90)','POLYGON((110 110,200 20,20 20,110 110),(110 90,60 40,160 40,110 90))'); 
-SELECT '234', ST_Relate('LINESTRING(110 110,200 200,200 110,110 200)','POLYGON((110 110,200 20,20 20,110 110))'); 
-SELECT '235', ST_Relate('LINESTRING(110 110,200 200,110 110,20 200,20 110,200 110)','POLYGON((110 110,200 20,20 20,110 110))'); 
-SELECT '236', ST_Relate('LINESTRING(110 110,20 110,200 110,50 110,110 170)','POLYGON((110 110,200 20,20 20,110 110))'); 
-SELECT '237', ST_Relate('LINESTRING(110 110,20 200,110 200,110 110,200 200)','POLYGON((110 110,200 20,20 20,110 110))'); 
-SELECT '238', ST_Relate('LINESTRING(110 110,170 50,20 200,20 110,200 110)','POLYGON((110 110,200 20,20 20,110 110))'); 
-SELECT '239', ST_Relate('LINESTRING(110 110,180 40,110 40,110 180)','POLYGON((110 110,200 20,20 20,110 110))'); 
-SELECT '240', ST_Relate('LINESTRING(110 60,50 30,170 30,90 70)','POLYGON((110 110,200 20,20 20,110 110))'); 
-SELECT '241', ST_Relate('LINESTRING(110 110,180 40,110 40,110 110,70 40)','POLYGON((110 110,200 20,20 20,110 110))'); 
-SELECT '242', ST_Relate('LINESTRING(230 70,170 120,190 60,140 60,170 120,270 90)','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))'); 
-SELECT '243', ST_Relate('MULTILINESTRING((20 110,200 110),(200 200,110 110,20 210,110 110))','POLYGON((110 110,200 20,20 20,110 110))'); 
-SELECT '244', ST_Relate('MULTILINESTRING((20 110,200 110),(60 180,60 110,160 110,110 110))','POLYGON((110 110,200 20,20 20,110 110))'); 
-SELECT '245', ST_Relate('MULTILINESTRING((20 110,200 110),(200 200,110 110,20 200,110 200,110 110))','POLYGON((110 110,200 20,20 20,110 110))'); 
-SELECT '246', ST_Relate('MULTILINESTRING((20 110,200 110),(110 50,110 170,110 70,110 150,200 150))','POLYGON((110 110,200 20,20 20,110 110))'); 
-SELECT '247', ST_Relate('MULTILINESTRING((20 110,200 110),(50 110,170 110,110 170,110 50,110 170,110 50))','POLYGON((110 110,200 20,20 20,110 110))'); 
-SELECT '248', ST_Relate('MULTILINESTRING((20 110,200 110),(110 60,110 160,200 160))','POLYGON((110 110,200 20,20 20,110 110))'); 
-SELECT '249', ST_Relate('MULTILINESTRING((20 110,200 110),(110 60,110 160,200 160))','POLYGON((110 110,200 20,20 20,110 110))'); 
-SELECT '250', ST_Relate('MULTILINESTRING((110 100,40 30,180 30),(170 30,110 90,50 30))','POLYGON((110 110,200 20,20 20,110 110))'); 
-SELECT '251', ST_Relate('MULTILINESTRING((110 110,60 40,70 20,150 20,170 40),(180 30,40 30,110 80))','POLYGON((110 110,200 20,20 20,110 110))'); 
-SELECT '252', ST_Relate('MULTILINESTRING((20 110,200 110,200 160),(110 110,200 110,200 70,20 150))','MULTIPOLYGON(((110 110,20 20,200 20,110 110)),((110 110,20 200,200 200,110 110)))'); 
-SELECT '253', ST_Relate('MULTILINESTRING((20 160,70 110,150 110,200 160),(110 110,20 110,50 80,70 110,200 110))','MULTIPOLYGON(((110 110,20 20,200 20,110 110)),((110 110,20 200,200 200,110 110)))'); 
-SELECT '254', ST_Relate('MULTILINESTRING((20 110,200 110),(110 110,20 170,20 130,200 90))','MULTIPOLYGON(((110 110,20 20,200 20,110 110)),((110 110,20 200,200 200,110 110)))'); 
-SELECT '255', ST_Relate('LINESTRING(0 0,0 50,50 50,50 0,0 0)','MULTILINESTRING((0 0,0 50),(0 50,50 50),(50 50,50 0),(50 0,0 0))'); 
-SELECT '256', ST_Relate('LINESTRING(40 180,140 180)','MULTIPOLYGON(((20 320,180 320,180 180,20 180,20 320)),((20 180,20 80,180 80,180 180,20 180)))'); 
-SELECT '257', ST_Relate('LINESTRING(40 180,140 180)','MULTIPOLYGON(((20 320,180 320,180 180,20 180,20 320)),((60 180,60 80,180 80,180 180,60 180)))'); 
-SELECT '258', ST_Relate('LINESTRING(0 0,60 0,60 60,60 0,120 0)','MULTILINESTRING((0 0,60 0),(60 0,120 0),(60 0,60 60))'); 
-SELECT '259', ST_Relate('LINESTRING(40 40,120 120)','LINESTRING(40 40,60 120)'); 
-SELECT '260', ST_Relate('LINESTRING(40 40,120 120)','LINESTRING(60 240,40 40)'); 
-SELECT '261', ST_Relate('LINESTRING(40 40,180 180)','LINESTRING(120 120,20 200)'); 
-SELECT '262', ST_Relate('LINESTRING(40 40,120 120)','LINESTRING(60 240,120 120)'); 
-SELECT '263', ST_Relate('LINESTRING(40 40,180 180)','LINESTRING(20 180,140 140)'); 
-SELECT '264', ST_Relate('LINESTRING(40 40,120 120)','LINESTRING(40 120,120 40)'); 
-SELECT '265', ST_Relate('LINESTRING(40 40,100 100)','LINESTRING(40 40,100 100)'); 
-SELECT '266', ST_Relate('LINESTRING(40 40,100 100)','LINESTRING(100 100,40 40)'); 
-SELECT '267', ST_Relate('LINESTRING(40 40,120 120)','LINESTRING(40 120,120 160)'); 
-SELECT '268', ST_Relate('LINESTRING(20 20,180 180)','LINESTRING(20 20,180 180)'); 
-SELECT '269', ST_Relate('LINESTRING(20 20,180 180)','LINESTRING(20 20,110 110)'); 
-SELECT '270', ST_Relate('LINESTRING(20 20,180 180)','LINESTRING(50 50,140 140)'); 
-SELECT '271', ST_Relate('LINESTRING(180 180,40 40)','LINESTRING(120 120,260 260)'); 
-SELECT '272', ST_Relate('LINESTRING(40 40,180 180)','LINESTRING(260 260,120 120)'); 
-SELECT '273', ST_Relate('LINESTRING(40 40,180 180)','LINESTRING(120 120,260 260)'); 
-SELECT '274', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(40 40,20 100,40 160,20 200)'); 
-SELECT '275', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(20 200,40 160,20 100,40 40)'); 
-SELECT '276', ST_Relate('LINESTRING(80 240,200 120,100 100,40 40)','LINESTRING(20 200,40 160,20 100,40 40)'); 
-SELECT '277', ST_Relate('LINESTRING(60 60,60 230,140 230,250 160)','LINESTRING(20 20,60 60,250 160,310 230)'); 
-SELECT '278', ST_Relate('LINESTRING(60 60,60 230,140 230,250 160)','LINESTRING(20 20,110 110,200 110,320 230)'); 
-SELECT '279', ST_Relate('LINESTRING(60 110,60 250,360 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)'); 
-SELECT '280', ST_Relate('LINESTRING(60 110,60 250,360 210)','LINESTRING(360 210,310 160,110 160,60 110)'); 
-SELECT '281', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(160 160,240 240)'); 
-SELECT '282', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(240 240,160 160)'); 
-SELECT '283', ST_Relate('LINESTRING(60 60,60 230,140 230,250 160)','LINESTRING(60 150,110 100,170 100,110 230)'); 
-SELECT '284', ST_Relate('LINESTRING(60 60,60 230,140 230,250 160)','LINESTRING(60 110,110 160,250 160,310 160,360 210)'); 
-SELECT '285', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(200 120,200 190,150 240,200 240)'); 
-SELECT '286', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(200 240,150 240,200 200,200 120)'); 
-SELECT '287', ST_Relate('LINESTRING(60 60,60 230,140 230,250 160)','LINESTRING(60 230,80 140,120 140,140 230)'); 
-SELECT '288', ST_Relate('LINESTRING(60 110,200 110,250 160,300 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)'); 
-SELECT '289', ST_Relate('LINESTRING(60 110,200 110,250 160,300 210,360 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)'); 
-SELECT '290', ST_Relate('LINESTRING(60 110,220 110,250 160,280 110)','LINESTRING(60 110,110 160,250 160,310 160,360 210)'); 
-SELECT '291', ST_Relate('LINESTRING(60 110,150 110,200 160,250 110,360 110,360 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)'); 
-SELECT '292', ST_Relate('LINESTRING(130 160,160 110,220 110,250 160,250 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)'); 
-SELECT '293', ST_Relate('LINESTRING(130 160,160 110,190 110,230 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)'); 
-SELECT '294', ST_Relate('LINESTRING(130 160,160 110,200 110,230 160,260 210,360 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)'); 
-SELECT '295', ST_Relate('LINESTRING(130 160,160 110,200 110,230 160,260 210,360 210,380 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)'); 
-SELECT '296', ST_Relate('LINESTRING(130 160,160 110,200 110,230 160,260 210,380 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)'); 
-SELECT '297', ST_Relate('LINESTRING(110 160,160 110,200 110,250 160,250 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)'); 
-SELECT '298', ST_Relate('LINESTRING(110 160,180 110,250 160,320 110)','LINESTRING(60 110,110 160,250 160,310 160,360 210)'); 
-SELECT '299', ST_Relate('LINESTRING(140 160,180 80,220 160,250 80)','LINESTRING(60 110,110 160,250 160,310 160,360 210)'); 
-SELECT '300', ST_Relate('LINESTRING(40 40,100 100,200 120,130 190)','LINESTRING(20 130,70 130,160 40)'); 
-SELECT '301', ST_Relate('LINESTRING(40 40,100 100,200 120,130 190)','LINESTRING(40 160,40 100,110 40,170 40)'); 
-SELECT '302', ST_Relate('LINESTRING(130 110,180 160,230 110,280 160,330 110)','LINESTRING(60 110,110 160,250 160,310 160,360 210)'); 
-SELECT '303', ST_Relate('LINESTRING(40 40,100 100,200 120,130 190)','LINESTRING(30 140,80 140,100 100,200 30)'); 
-SELECT '304', ST_Relate('LINESTRING(110 110,110 160,180 110,250 160,250 110)','LINESTRING(60 110,110 160,250 160,310 160,360 210)'); 
-SELECT '305', ST_Relate('LINESTRING(20 20,80 80,160 80,240 80,300 140)','LINESTRING(20 60,60 60,60 140,80 80,100 20,140 140,180 20,200 80,220 20,240 80,300 80,270 110,200 110)'); 
-SELECT '306', ST_Relate('LINESTRING(20 20,230 20,20 30,170 30,20 40,230 40,20 50,230 60,60 60,230 70,20 70,180 80,60 80,230 90,20 90,230 100,30 100,210 110,20 110,80 120,20 130,170 130,90 120,230 130,170 140,230 140,80 150,160 140,20 140,70 150,20 150,230 160,80 160,230 170,20 160,180 170,20 170,230 180,20 180,40 190,230 190,20 200,230 200)','LINESTRING(30 210,30 60,40 210,40 30,50 190,50 20,60 160,60 50,70 220,70 50,80 20,80 210,90 50,90 150,100 30,100 210,110 20,110 190,120 50,120 180,130 210,120 20,140 210,130 50,150 210,130 20,160 210,140 30,170 210,150 20,180 210,160 20,190 210,180 80,170 50,170 20,180 70,180 20,190 190,190 30,200 210,200 30,210 210,210 20,220 150,220 20)'); 
-SELECT '307', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(40 40,100 100,200 120,80 240)'); 
-SELECT '308', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(80 240,200 120,100 100,40 40)'); 
-SELECT '309', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(80 240,120 200,200 120,100 100,80 80,40 40)'); 
-SELECT '310', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(260 210,240 130,280 120,260 40)'); 
-SELECT '311', ST_Relate('LINESTRING(100 20,20 20,20 160,210 160,210 20,110 20,50 120,120 150,200 150)','LINESTRING(140 130,100 110,120 60,170 60)'); 
-SELECT '312', ST_Relate('LINESTRING(60 110,110 160,250 160,310 160,360 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)'); 
-SELECT '313', ST_Relate('LINESTRING(60 110,110 160,310 160,360 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)'); 
-SELECT '314', ST_Relate('LINESTRING(60 110,110 160,250 160,310 160,360 210)','LINESTRING(60 110,110 160,250 160)'); 
-SELECT '315', ST_Relate('LINESTRING(60 110,110 160,250 160,310 160,360 210)','LINESTRING(110 160,310 160,340 190)'); 
-SELECT '316', ST_Relate('LINESTRING(60 110,110 160,250 160,310 160,360 210)','LINESTRING(140 160,250 160,310 160,340 190)'); 
-SELECT '317', ST_Relate('LINESTRING(60 110,110 160,250 160,310 160,360 210)','LINESTRING(110 160,250 160,310 160)'); 
-SELECT '318', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(200 120,100 100,40 40,140 80,200 40)'); 
-SELECT '319', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(280 240,240 140,200 120,100 100,40 40)'); 
-SELECT '320', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(80 190,140 140,40 40)'); 
-SELECT '321', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(240 200,200 260,80 240,140 180)'); 
-SELECT '322', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(140 180,80 240,200 260,240 200)'); 
-SELECT '323', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(280 240,240 140,200 120,80 240)'); 
-SELECT '324', ST_Relate('LINESTRING(20 20,80 80,160 80,240 80,300 140)','LINESTRING(20 80,120 80,200 80,260 20)'); 
-SELECT '325', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(100 100,200 120,240 140,280 240)'); 
-SELECT '326', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(280 240,240 140,200 120,100 100)'); 
-SELECT '327', ST_Relate('LINESTRING(20 20,80 80,160 80,240 80,300 140)','LINESTRING(80 20,80 80,240 80,300 20)'); 
-SELECT '328', ST_Relate('LINESTRING(20 20,80 80,160 80,240 80,300 140)','LINESTRING(20 80,80 80,120 80,140 140,160 80,200 80,220 20,240 80,270 110,300 80)'); 
-SELECT '329', ST_Relate('LINESTRING(100 100,20 180,180 180)','LINESTRING(100 100,180 20,20 20,100 100)'); 
-SELECT '330', ST_Relate('LINESTRING(20 100,180 100,100 180)','LINESTRING(100 100,180 20,20 20,100 100)'); 
-SELECT '331', ST_Relate('LINESTRING(100 40,100 160,180 160)','LINESTRING(100 100,180 20,20 20,100 100)'); 
-SELECT '332', ST_Relate('LINESTRING(20 100,100 100,180 100,100 180)','LINESTRING(100 100,180 20,20 20,100 100)'); 
-SELECT '333', ST_Relate('LINESTRING(100 100,160 40)','LINESTRING(100 100,180 20,20 20,100 100)'); 
-SELECT '334', ST_Relate('LINESTRING(100 100,180 20)','LINESTRING(100 100,180 20,20 20,100 100)'); 
-SELECT '335', ST_Relate('LINESTRING(60 60,100 100,140 60)','LINESTRING(100 100,180 20,20 20,100 100)'); 
-SELECT '336', ST_Relate('LINESTRING(100 100,190 10,190 100)','LINESTRING(100 100,180 20,20 20,100 100)'); 
-SELECT '337', ST_Relate('LINESTRING(100 100,160 40,160 100)','LINESTRING(100 100,180 20,20 20,100 100)'); 
-SELECT '338', ST_Relate('LINESTRING(60 140,160 40,160 140)','LINESTRING(100 100,180 20,20 20,100 100)'); 
-SELECT '339', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(80 80,20 80,140 80,80 20,80 140)'); 
-SELECT '340', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(80 80,20 80,140 80)'); 
-SELECT '341', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(80 80,140 80,80 20,80 140)'); 
-SELECT '342', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(80 80,20 80,140 80,80 20,80 80)'); 
-SELECT '343', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(80 80,20 80,140 80,80 80)'); 
-SELECT '344', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(80 80,20 80,20 140,140 20,80 20,80 80)'); 
-SELECT '345', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(20 140,140 20,100 20,100 80)'); 
-SELECT '346', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(140 80,20 80,120 80,80 20,80 140)'); 
-SELECT '347', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(140 80,20 80,140 80)'); 
-SELECT '348', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(140 80,20 80,80 140,80 20)'); 
-SELECT '349', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(140 80,80 80,20 80,50 140,50 60)'); 
-SELECT '350', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(140 80,20 80,120 80,80 20,80 80,80 140)'); 
-SELECT '351', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(140 80,20 80,80 80,140 80)'); 
-SELECT '352', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(140 80,20 80,80 140,80 80,80 20)'); 
-SELECT '353', ST_Relate('LINESTRING(130 150,220 150,220 240)','LINESTRING(130 240,130 150,220 20,50 20,130 150)'); 
-SELECT '354', ST_Relate('LINESTRING(30 150,130 150,250 150)','LINESTRING(130 240,130 150,220 20,50 20,130 150)'); 
-SELECT '355', ST_Relate('LINESTRING(30 150,250 150)','LINESTRING(130 240,130 150,220 20,50 20,130 150)'); 
-SELECT '356', ST_Relate('LINESTRING(30 150,130 150,250 150)','LINESTRING(130 240,130 20,30 20,130 150)'); 
-SELECT '357', ST_Relate('LINESTRING(30 150,250 150)','LINESTRING(120 240,120 20,20 20,120 170)'); 
-SELECT '358', ST_Relate('LINESTRING(200 200,20 20,200 20,110 110,20 200,110 200,110 110)','LINESTRING(110 110,200 110)'); 
-SELECT '359', ST_Relate('LINESTRING(110 110,200 110)','LINESTRING(200 200,20 20,200 20,110 110,20 200,110 200,110 110)'); 
-SELECT '360', ST_Relate('LINESTRING(20 110,200 110)','LINESTRING(200 200,20 20,200 20,110 110,20 200,110 200,110 110)'); 
-SELECT '361', ST_Relate('LINESTRING(200 200,20 20,200 20,110 110,20 200,110 200,110 110)','LINESTRING(20 110,200 110)'); 
-SELECT '362', ST_Relate('LINESTRING(90 200,90 130,110 110,150 200)','LINESTRING(200 200,20 20,200 20,20 200,20 130,90 130)'); 
-SELECT '363', ST_Relate('LINESTRING(200 110,110 110,90 130,90 200)','LINESTRING(200 200,20 20,200 20,20 200,20 130,90 130)'); 
-SELECT '364', ST_Relate('LINESTRING(80 80,150 80,210 80)','MULTILINESTRING((20 20,140 140),(20 140,140 20))'); 
-SELECT '365', ST_Relate('LINESTRING(40 80,160 200,260 20,40 80)','LINESTRING(40 80,160 200,260 20,40 80)'); 
-SELECT '366', ST_Relate('LINESTRING(40 80,160 200,260 20,40 80)','LINESTRING(40 80,260 20,160 200,40 80)'); 
-SELECT '367', ST_Relate('LINESTRING(40 80,160 200,260 20,40 80)','LINESTRING(260 20,40 80,160 200,260 20)'); 
-SELECT '368', ST_Relate('LINESTRING(40 80,160 200,260 20,40 80)','LINESTRING(100 140,160 200,260 20,40 80,100 140)'); 
-SELECT '369', ST_Relate('LINESTRING(100 100,180 20,20 20,100 100)','LINESTRING(100 100,180 180,20 180,100 100)'); 
-SELECT '370', ST_Relate('LINESTRING(40 150,40 40,150 40,150 150,40 150)','LINESTRING(40 150,150 40,170 20,170 190,40 150)'); 
-SELECT '371', ST_Relate('LINESTRING(100 100,180 20,20 20,100 100)','LINESTRING(180 100,20 100,100 180,180 100)'); 
-SELECT '372', ST_Relate('LINESTRING(100 100,180 20,20 20,100 100)','LINESTRING(180 180,100 100,20 180,180 180)'); 
-SELECT '373', ST_Relate('LINESTRING(20 180,100 100,20 20,20 180)','LINESTRING(100 20,100 180,180 100,100 20)'); 
-SELECT '374', ST_Relate('LINESTRING(40 150,40 40,150 40,150 150,40 150)','LINESTRING(170 20,20 170,170 170,170 20)'); 
-SELECT '375', ST_Relate('LINESTRING(40 150,40 40,150 40,150 150,40 150)','LINESTRING(40 150,150 150,90 210,40 150)'); 
-SELECT '376', ST_Relate('LINESTRING(40 150,40 40,150 40,150 150,40 150)','LINESTRING(20 150,170 150,90 230,20 150)'); 
-SELECT '377', ST_Relate('LINESTRING(40 150,40 40,150 40,150 150,40 150)','LINESTRING(40 150,150 150,150 40,20 40,20 150,40 150)'); 
-SELECT '378', ST_Relate('LINESTRING(110 110,200 20,20 20,110 110)','LINESTRING(110 110,200 200,110 110,20 200,20 110,200 110)'); 
-SELECT '379', ST_Relate('LINESTRING(110 110,200 20,20 20,110 110)','LINESTRING(110 110,20 110,200 110,50 110,110 170)'); 
-SELECT '380', ST_Relate('LINESTRING(110 110,200 20,20 20,110 110)','LINESTRING(110 110,20 200,110 200,110 110,200 200)'); 
-SELECT '381', ST_Relate('LINESTRING(110 110,200 20,20 20,110 110)','LINESTRING(200 20,20 200,200 200,110 110,110 40)'); 
-SELECT '382', ST_Relate('LINESTRING(110 110,200 20,20 20,110 110)','LINESTRING(200 20,20 200,200 200,20 20)'); 
-SELECT '383', ST_Relate('LINESTRING(110 110,20 110,110 20,20 20,110 110)','LINESTRING(110 110,200 200,110 200,200 110,110 110)'); 
-SELECT '384', ST_Relate('LINESTRING(20 120,120 120,20 20,120 20,20 120)','LINESTRING(170 100,70 100,170 170,70 170,170 100)'); 
-SELECT '385', ST_Relate('LINESTRING(20 110,110 110,20 20,110 20,20 110)','LINESTRING(110 160,70 110,60 160,20 130,110 160)'); 
-SELECT '386', ST_Relate('LINESTRING(20 200,200 200,20 20,200 20,20 200)','LINESTRING(20 110,200 110,200 160,20 60,20 110)'); 
-SELECT '387', ST_Relate('LINESTRING(20 110,110 110,20 20,110 20,20 110)','LINESTRING(200 200,110 110,200 110,110 200,200 200)'); 
-SELECT '388', ST_Relate('LINESTRING(20 120,120 120,20 20,120 20,20 120)','LINESTRING(220 120,120 20,220 20,120 120,220 120)'); 
-SELECT '389', ST_Relate('MULTILINESTRING((70 20,20 90,70 170),(70 170,120 90,70 20))','MULTILINESTRING((70 20,20 90,70 170),(70 170,120 90,70 20))'); 
-SELECT '390', ST_Relate('MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))','MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))'); 
-SELECT '391', ST_Relate('MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))','MULTILINESTRING((90 140,90 60,90 20),(170 20,130 20,20 20))'); 
-SELECT '392', ST_Relate('MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))','MULTILINESTRING((90 20,170 100,170 140),(170 60,90 20,20 60),(130 100,130 60,90 20,50 90))'); 
-SELECT '393', ST_Relate('MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))','MULTILINESTRING((90 20,170 100,170 140),(130 140,130 60,90 20,20 90,90 20,130 60,170 60))'); 
-SELECT '394', ST_Relate('MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))','MULTILINESTRING((90 20,170 100,170 140),(170 60,90 20,20 60))'); 
-SELECT '395', ST_Relate('MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))','MULTILINESTRING((90 20,170 100,170 140),(170 60,90 20,20 60),(130 100,90 20))'); 
-SELECT '396', ST_Relate('MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))','MULTILINESTRING((90 20,170 100,170 140),(170 60,90 20,20 60),(120 100,170 100,90 20))'); 
-SELECT '397', ST_Relate('MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))','MULTILINESTRING((90 20,170 100,170 140),(170 60,90 20,20 60),(120 100,170 100,90 20))'); 
-SELECT '398', ST_Relate('MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))','MULTILINESTRING((90 20,170 100,170 140),(130 140,130 60,90 20,20 90,90 20))'); 
-SELECT '399', ST_Relate('MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))','MULTILINESTRING((90 20,170 100,170 140),(170 60,90 20,20 60,20 140,90 20))'); 
-SELECT '400', ST_Relate('MULTILINESTRING((20 20,90 90,20 160),(90 160,90 20))','MULTILINESTRING((160 160,90 90,160 20),(160 120,120 120,90 90,160 60))'); 
-SELECT '401', ST_Relate('MULTILINESTRING((20 20,90 90,20 160),(90 160,90 20))','MULTILINESTRING((160 160,90 90,160 20),(160 120,120 120,90 90,120 60,160 60))'); 
-SELECT '402', ST_Relate('MULTILINESTRING((20 20,90 90,20 160),(90 160,90 20))','MULTILINESTRING((160 160,90 90,160 20),(160 120,90 90,160 60))'); 
-SELECT '403', ST_Relate('POINT(20 20)','POLYGON((60 120,60 40,160 40,160 120,60 120))'); 
-SELECT '404', ST_Relate('POINT(70 170)','POLYGON((110 230,80 160,20 160,20 20,200 20,200 160,140 160,110 230))'); 
-SELECT '405', ST_Relate('POINT(110 130)','POLYGON((20 160,80 160,110 100,140 160,200 160,200 20,20 20,20 160))'); 
-SELECT '406', ST_Relate('POINT(100 70)','POLYGON((20 150,100 150,40 50,170 50,110 150,190 150,190 20,20 20,20 150))'); 
-SELECT '407', ST_Relate('POINT(100 70)','POLYGON((20 150,100 150,40 50,160 50,100 150,180 150,180 20,20 20,20 150))'); 
-SELECT '408', ST_Relate('POINT(60 120)','POLYGON((60 120,60 40,160 40,160 120,60 120))'); 
-SELECT '409', ST_Relate('POINT(110 120)','POLYGON((60 120,60 40,160 40,160 120,60 120))'); 
-SELECT '410', ST_Relate('POINT(160 120)','POLYGON((60 120,60 40,160 40,160 120,60 120))'); 
-SELECT '411', ST_Relate('POINT(100 150)','POLYGON((20 150,100 150,40 50,160 50,100 150,180 150,180 20,20 20,20 150))'); 
-SELECT '412', ST_Relate('POINT(100 80)','POLYGON((60 120,60 40,160 40,160 120,60 120))'); 
-SELECT '413', ST_Relate('POINT(60 160)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))'); 
-SELECT '414', ST_Relate('POINT(190 90)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))'); 
-SELECT '415', ST_Relate('POINT(190 190)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))'); 
-SELECT '416', ST_Relate('POINT(360 20)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))'); 
-SELECT '417', ST_Relate('POINT(130 130)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))'); 
-SELECT '418', ST_Relate('POINT(280 50)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))'); 
-SELECT '419', ST_Relate('POINT(150 100)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))'); 
-SELECT '420', ST_Relate('POINT(100 50)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))'); 
-SELECT '421', ST_Relate('POINT(140 120)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))'); 
-SELECT '422', ST_Relate('POINT(190 50)','POLYGON((190 190,360 20,20 20,190 190),(90 50,150 110,190 50,90 50),(190 50,230 110,290 50,190 50))'); 
-SELECT '423', ST_Relate('POINT(180 90)','POLYGON((190 190,360 20,20 20,190 190),(180 140,180 40,80 40,180 140),(180 90,210 140,310 40,230 40,180 90))'); 
-SELECT '424', ST_Relate('MULTIPOINT(20 80,110 160,20 160)','POLYGON((60 120,60 40,160 40,160 120,60 120))'); 
-SELECT '425', ST_Relate('MULTIPOINT(20 80,60 120,20 160)','POLYGON((60 120,60 40,160 40,160 120,60 120))'); 
-SELECT '426', ST_Relate('MULTIPOINT(10 80,110 170,110 120)','POLYGON((60 120,60 40,160 40,160 120,60 120))'); 
-SELECT '427', ST_Relate('MULTIPOINT(10 80,110 170,160 120)','POLYGON((60 120,60 40,160 40,160 120,60 120))'); 
-SELECT '428', ST_Relate('MULTIPOINT(20 120,60 120,110 120,160 120,200 120)','POLYGON((60 120,60 40,160 40,160 120,60 120))'); 
-SELECT '429', ST_Relate('MULTIPOINT(60 120,110 120,160 120)','POLYGON((60 120,60 40,160 40,160 120,60 120))'); 
-SELECT '430', ST_Relate('MULTIPOINT(60 120,160 120,160 40,60 40)','POLYGON((60 120,60 40,160 40,160 120,60 120))'); 
-SELECT '431', ST_Relate('MULTIPOINT(20 150,60 120,110 80)','POLYGON((60 120,60 40,160 40,160 120,60 120))'); 
-SELECT '432', ST_Relate('MULTIPOINT(110 80,160 120,200 160)','POLYGON((60 120,60 40,160 40,160 120,60 120))'); 
-SELECT '433', ST_Relate('MULTIPOINT(110 80,110 120,110 160)','POLYGON((60 120,60 40,160 40,160 120,60 120))'); 
-SELECT '434', ST_Relate('MULTIPOINT(110 170,110 80)','POLYGON((60 120,60 40,160 40,160 120,60 120))'); 
-SELECT '435', ST_Relate('MULTIPOINT(60 120,160 120,110 80,110 170)','POLYGON((60 120,60 40,160 40,160 120,60 120))'); 
-SELECT '436', ST_Relate('MULTIPOINT(90 80,130 80)','POLYGON((60 120,60 40,160 40,160 120,60 120))'); 
-SELECT '437', ST_Relate('MULTIPOINT(60 120,160 120,110 80)','POLYGON((60 120,60 40,160 40,160 120,60 120))'); 
-SELECT '438', ST_Relate('MULTIPOINT(40 170,40 90,130 170)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))'); 
-SELECT '439', ST_Relate('MULTIPOINT(90 170,280 170,190 90)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))'); 
-SELECT '440', ST_Relate('MULTIPOINT(190 110,150 70,230 70)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))'); 
-SELECT '441', ST_Relate('POINT(100 100)','MULTIPOLYGON(((20 100,20 20,100 20,100 100,20 100)),((100 180,100 100,180 100,180 180,100 180)))'); 
-SELECT '442', ST_Relate('POINT(20 100)','MULTIPOLYGON(((20 100,20 20,100 20,100 100,20 100)),((100 180,100 100,180 100,180 180,100 180)))'); 
-SELECT '443', ST_Relate('POINT(60 100)','MULTIPOLYGON(((20 100,20 20,100 20,100 100,20 100)),((100 180,100 100,180 100,180 180,100 180)))'); 
-SELECT '444', ST_Relate('POINT(110 110)','MULTIPOLYGON(((110 110,20 200,200 200,110 110),(110 110,80 180,140 180,110 110)),((110 110,20 20,200 20,110 110),(110 110,80 40,140 40,110 110)))'); 
-SELECT '445', ST_Relate('POINT(110 200)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '446', ST_Relate('POINT(90 80)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '447', ST_Relate('POINT(340 240)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '448', ST_Relate('POINT(230 150)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '449', ST_Relate('POINT(160 150)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '450', ST_Relate('POINT(90 150)','LINESTRING(150 150,20 20,280 20,150 150)'); 
-SELECT '451', ST_Relate('POINT(150 80)','LINESTRING(150 150,20 20,280 20,150 150)'); 
-SELECT '452', ST_Relate('POINT(150 150)','LINESTRING(150 150,20 20,280 20,150 150)'); 
-SELECT '453', ST_Relate('POINT(100 20)','LINESTRING(150 150,20 20,280 20,150 150)'); 
-SELECT '454', ST_Relate('POINT(20 20)','LINESTRING(150 150,20 20,280 20,150 150)'); 
-SELECT '455', ST_Relate('POINT(220 220)','LINESTRING(110 110,220 20,20 20,110 110,220 220)'); 
-SELECT '456', ST_Relate('POINT(110 110)','LINESTRING(110 110,220 20,20 20,110 110,220 220)'); 
-SELECT '457', ST_Relate('POINT(110 110)','LINESTRING(110 110,220 20,20 20,220 220)'); 
-SELECT '458', ST_Relate('POINT(110 20)','LINESTRING(110 110,220 20,20 20,220 220)'); 
-SELECT '459', ST_Relate('POINT(220 20)','LINESTRING(110 110,220 20,20 20,220 220)'); 
-SELECT '460', ST_Relate('POINT(110 20)','LINESTRING(220 220,20 20,220 20,110 110)'); 
-SELECT '461', ST_Relate('POINT(20 20)','LINESTRING(220 220,20 20,220 20,110 110)'); 
-SELECT '462', ST_Relate('POINT(20 110)','LINESTRING(20 200,20 20,110 20,20 110,110 200)'); 
-SELECT '463', ST_Relate('POINT(20 200)','LINESTRING(20 200,200 20,20 20,200 200)'); 
-SELECT '464', ST_Relate('POINT(110 110)','LINESTRING(20 200,200 20,140 20,140 80,80 140,20 140)'); 
-SELECT '465', ST_Relate('POINT(110 110)','LINESTRING(20 200,200 20,20 20,200 200)'); 
-SELECT '466', ST_Relate('POINT(80 140)','LINESTRING(20 200,110 110,200 20,140 20,140 80,110 110,80 140,20 140)'); 
-SELECT '467', ST_Relate('POINT(110 110)','LINESTRING(20 200,110 110,200 20,140 20,140 80,110 110,80 140,20 140)'); 
-SELECT '468', ST_Relate('POINT(110 110)','LINESTRING(20 200,200 20,140 20,140 80,110 110,80 140,20 140)'); 
-SELECT '469', ST_Relate('POINT(110 110)','LINESTRING(20 200,110 110,200 20,20 20,110 110,200 200)'); 
-SELECT '470', ST_Relate('POINT(110 110)','LINESTRING(20 200,200 20,20 20,110 110,200 200)'); 
-SELECT '471', ST_Relate('POINT(110 110)','LINESTRING(20 200,110 110,20 20,200 20,110 110,200 200)'); 
-SELECT '472', ST_Relate('POINT(110 110)','LINESTRING(110 110,110 200,20 200,110 110,200 20,140 20,140 80,110 110,80 140,20 140)'); 
-SELECT '473', ST_Relate('POINT(110 110)','LINESTRING(110 110,110 200,20 200,200 20,140 20,140 80,110 110,80 140,20 140)'); 
-SELECT '474', ST_Relate('POINT(110 110)','LINESTRING(110 110,110 200,20 200,200 20,140 20,140 80,80 140,20 140)'); 
-SELECT '475', ST_Relate('POINT(110 110)','LINESTRING(110 110,110 200,20 200,110 110,200 20,20 20,110 110,200 200)'); 
-SELECT '476', ST_Relate('POINT(110 110)','LINESTRING(110 110,110 200,20 200,200 20,20 20,110 110,200 200)'); 
-SELECT '477', ST_Relate('POINT(110 110)','LINESTRING(110 110,110 200,20 200,200 20,20 20,200 200)'); 
-SELECT '478', ST_Relate('POINT(110 110)','LINESTRING(110 110,110 200,20 200,110 110,20 20,200 20,110 110,200 200)'); 
-SELECT '479', ST_Relate('POINT(110 110)','LINESTRING(110 110,110 200,20 200,200 20,200 110,110 110,200 200)'); 
-SELECT '480', ST_Relate('POINT(110 110)','LINESTRING(200 200,110 110,20 20,200 20,110 110,20 200,110 200,110 110)'); 
-SELECT '481', ST_Relate('POINT(110 110)','LINESTRING(200 200,20 20,200 20,110 110,20 200,110 200,110 110)'); 
-SELECT '482', ST_Relate('POINT(110 110)','LINESTRING(200 200,20 20,200 20,20 200,110 200,110 110)'); 
-SELECT '483', ST_Relate('POINT(110 110)','LINESTRING(200 200,110 110,200 20,20 20,110 110,20 200,110 200,110 110)'); 
-SELECT '484', ST_Relate('POINT(110 110)','LINESTRING(200 200,20 20,20 110,110 110,20 200,110 200,110 110)'); 
-SELECT '485', ST_Relate('POINT(110 160)','LINESTRING(110 160,200 250,110 250,110 160,110 110,110 20,20 20,110 110)'); 
-SELECT '486', ST_Relate('POINT(110 160)','LINESTRING(110 160,200 250,110 250,110 110,110 20,20 20,110 110)'); 
-SELECT '487', ST_Relate('POINT(110 110)','LINESTRING(110 160,200 250,110 250,110 160,110 110,110 20,20 20,110 110)'); 
-SELECT '488', ST_Relate('POINT(110 110)','LINESTRING(110 160,200 250,110 250,110 160,110 20,20 20,110 110)'); 
-SELECT '489', ST_Relate('POINT(110 110)','LINESTRING(110 110,200 200,110 200,110 110,110 20,20 20,110 110)'); 
-SELECT '490', ST_Relate('POINT(110 110)','LINESTRING(110 110,200 200,110 200,110 20,20 20,110 110)'); 
-SELECT '491', ST_Relate('POINT(140 200)','LINESTRING(110 110,200 200,110 200,110 110,110 20,20 20,110 110)'); 
-SELECT '492', ST_Relate('POINT(110 200)','LINESTRING(110 110,200 200,110 200,110 110,110 20,20 20,110 110)'); 
-SELECT '493', ST_Relate('POINT(110 110)','LINESTRING(110 110,200 200,110 200,110 110,110 20,200 20,110 110)'); 
-SELECT '494', ST_Relate('POINT(140 200)','LINESTRING(110 110,200 200,110 200,110 110,110 20,200 20,110 110)'); 
-SELECT '495', ST_Relate('POINT(110 200)','LINESTRING(110 110,200 200,110 200,110 110,110 20,200 20,110 110)'); 
-SELECT '496', ST_Relate('POINT(90 130)','LINESTRING(90 130,20 130,20 200,90 130,200 20,20 20,200 200)'); 
-SELECT '497', ST_Relate('POINT(110 110)','LINESTRING(90 130,20 130,20 200,90 130,200 20,20 20,200 200)'); 
-SELECT '498', ST_Relate('POINT(90 130)','LINESTRING(90 130,20 130,20 200,200 20,20 20,200 200)'); 
-SELECT '499', ST_Relate('POINT(110 110)','LINESTRING(90 130,20 130,20 200,200 20,20 20,200 200)'); 
-SELECT '500', ST_Relate('POINT(90 130)','LINESTRING(200 200,20 20,200 20,90 130,20 200,20 130,90 130)'); 
-SELECT '501', ST_Relate('POINT(110 110)','LINESTRING(200 200,20 20,200 20,90 130,20 200,20 130,90 130)'); 
-SELECT '502', ST_Relate('POINT(90 130)','LINESTRING(200 200,20 20,200 20,20 200,20 130,90 130)'); 
-SELECT '503', ST_Relate('POINT(110 110)','LINESTRING(200 200,20 20,200 20,20 200,20 130,90 130)'); 
-SELECT '504', ST_Relate('POINT(110 110)','LINESTRING(110 110,20 130,20 200,110 110,200 20,20 20,110 110,200 200,200 130,110 110)'); 
-SELECT '505', ST_Relate('POINT(110 110)','LINESTRING(110 110,20 130,20 200,200 20,20 20,200 200,200 130,110 110)'); 
-SELECT '506', ST_Relate('POINT(110 110)','LINESTRING(110 110,80 200,20 200,110 110,200 20,20 20,110 110,200 200,140 200,110 110)'); 
-SELECT '507', ST_Relate('POINT(110 110)','LINESTRING(110 110,80 200,20 200,200 20,20 20,200 200,140 200,110 110)'); 
-SELECT '508', ST_Relate('POINT(110 110)','LINESTRING(200 200,20 20,200 20,20 200,200 200)'); 
-SELECT '509', ST_Relate('POINT(110 110)','LINESTRING(200 200,110 110,20 20,200 20,110 110,20 200,200 200)'); 
-SELECT '510', ST_Relate('POINT(110 110)','LINESTRING(200 200,110 110,200 20,20 20,110 110,20 200,200 200)'); 
-SELECT '511', ST_Relate('POINT(90 130)','LINESTRING(90 130,20 130,20 200,90 130,110 110,200 20,20 20,110 110,200 200,90 130)'); 
-SELECT '512', ST_Relate('POINT(90 130)','LINESTRING(90 130,20 130,20 200,110 110,200 20,20 20,110 110,200 200,90 130)'); 
-SELECT '513', ST_Relate('POINT(90 130)','LINESTRING(90 130,90 200,20 200,90 130,110 110,200 20,20 20,110 110,200 200,90 130)'); 
-SELECT '514', ST_Relate('POINT(90 130)','LINESTRING(90 130,90 200,20 200,200 20,20 20,200 200,90 130)'); 
-SELECT '515', ST_Relate('POINT(90 130)','LINESTRING(90 130,90 200,20 200,110 110,200 20,20 20,110 110,200 200,90 130)'); 
-SELECT '516', ST_Relate('POINT(90 130)','LINESTRING(90 130,90 200,20 200,200 20,20 20,200 200,90 130)'); 
-SELECT '517', ST_Relate('POINT(110 110)','LINESTRING(90 130,90 200,20 200,200 20,20 20,200 200,90 130)'); 
-SELECT '518', ST_Relate('POINT(110 200)','LINESTRING(110 200,110 110,20 20,200 20,110 110,110 200,200 200)'); 
-SELECT '519', ST_Relate('POINT(110 150)','LINESTRING(110 200,110 110,20 20,200 20,110 110,110 200,200 200)'); 
-SELECT '520', ST_Relate('POINT(110 110)','LINESTRING(110 200,110 110,20 20,200 20,110 110,110 200,200 200)'); 
-SELECT '521', ST_Relate('POINT(110 200)','LINESTRING(110 200,110 110,20 20,200 20,110 110,110 200)'); 
-SELECT '522', ST_Relate('POINT(110 150)','LINESTRING(110 200,110 110,20 20,200 20,110 110,110 200)'); 
-SELECT '523', ST_Relate('POINT(110 110)','LINESTRING(110 200,110 110,20 20,200 20,110 110,110 200)'); 
-SELECT '524', ST_Relate('POINT(110 150)','LINESTRING(20 200,110 200,110 110,20 20,200 20,110 110,110 200,200 200)'); 
-SELECT '525', ST_Relate('POINT(110 110)','LINESTRING(20 200,110 200,110 110,20 20,200 20,110 110,110 200,200 200)'); 
-SELECT '526', ST_Relate('POINT(110 200)','LINESTRING(20 200,110 200,110 110,20 20,200 20,110 110,110 200,200 200)'); 
-SELECT '527', ST_Relate('MULTIPOINT(50 250,90 220,130 190)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '528', ST_Relate('MULTIPOINT(180 180,230 130,280 80)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '529', ST_Relate('MULTIPOINT(50 120,90 80,130 40)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '530', ST_Relate('MULTIPOINT(300 280,340 240,380 200)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '531', ST_Relate('MULTIPOINT(230 150,260 120,290 90)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '532', ST_Relate('MULTIPOINT(200 190,240 150,270 110)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '533', ST_Relate('MULTIPOINT(160 150,190 120,220 90)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '534', ST_Relate('MULTIPOINT(120 190,160 150,200 110)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '535', ST_Relate('MULTIPOINT(90 80,160 150,340 240)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '536', ST_Relate('MULTIPOINT(90 80,160 150,300 150)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '537', ST_Relate('MULTIPOINT(90 80,160 150,240 150)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '538', ST_Relate('MULTIPOINT(90 80,130 120,210 150)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '539', ST_Relate('MULTIPOINT(130 120,210 150,340 200)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '540', ST_Relate('MULTIPOINT(160 150,240 150,340 210)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '541', ST_Relate('MULTIPOINT(160 150,300 150,340 150)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '542', ST_Relate('MULTIPOINT(160 150,240 150,340 240)','LINESTRING(90 80,160 150,300 150,340 150,340 240)'); 
-SELECT '543', ST_Relate('POINT(20 20)','POINT(20 20)'); 
-SELECT '544', ST_Relate('POINT(20 20)','POINT(40 60)'); 
-SELECT '545', ST_Relate('POINT(40 40)','MULTIPOINT(20 20,80 80,20 120)'); 
-SELECT '546', ST_Relate('POINT(20 20)','MULTIPOINT(20 20,80 80,20 120)'); 
-SELECT '547', ST_Relate('MULTIPOINT(40 40,80 60,120 100)','MULTIPOINT(40 40,80 60,120 100)'); 
-SELECT '548', ST_Relate('MULTIPOINT(40 40,80 60,120 100)','MULTIPOINT(40 40,120 100,80 60)'); 
-SELECT '549', ST_Relate('MULTIPOINT(40 40,60 100,100 60,120 120)','MULTIPOINT(20 120,60 60,100 100,140 40)'); 
-SELECT '550', ST_Relate('MULTIPOINT(20 20,80 70,140 120,200 170)','MULTIPOINT(20 20,80 70,140 120,200 170)'); 
-SELECT '551', ST_Relate('MULTIPOINT(20 20,140 120,80 70,200 170)','MULTIPOINT(80 70,20 20,200 170,140 120)'); 
-SELECT '552', ST_Relate('MULTIPOINT(20 20,80 70,140 120,200 170)','MULTIPOINT(80 70,140 120)'); 
-SELECT '553', ST_Relate('MULTIPOINT(80 70,20 20,200 170,140 120)','MULTIPOINT(140 120,80 70)'); 
-SELECT '554', ST_Relate('MULTIPOINT(80 70,20 20,200 170,140 120)','MULTIPOINT(80 170,140 120,200 80)'); 
-SELECT '555', ST_Relate('MULTIPOINT(80 70,20 20,200 170,140 120)','MULTIPOINT(80 170,140 120,200 80,80 70)'); 
+SELECT '1', ST_Relate('POLYGON((0 0,80 0,80 80,0 80,0 0))','POLYGON((100 200,100 140,180 140,180 200,100 200))');
+SELECT '2', ST_Relate('POLYGON((0 0,140 0,140 140,0 140,0 0))','POLYGON((140 0,0 0,0 140,140 140,140 0))');
+SELECT '3', ST_Relate('POLYGON((40 60,360 60,360 300,40 300,40 60))','POLYGON((120 100,280 100,280 240,120 240,120 100))');
+SELECT '4', ST_Relate('POLYGON((40 60,420 60,420 320,40 320,40 60),(200 140,160 220,260 200,200 140))','POLYGON((80 100,360 100,360 280,80 280,80 100))');
+SELECT '5', ST_Relate('POLYGON((0 280,0 0,260 0,260 280,0 280),(220 240,40 240,40 40,220 40,220 240))','POLYGON((20 260,240 260,240 20,20 20,20 260),(160 180,80 180,120 120,160 180))');
+SELECT '6', ST_Relate('POLYGON((60 80,200 80,200 220,60 220,60 80))','POLYGON((120 140,260 140,260 260,120 260,120 140))');
+SELECT '7', ST_Relate('POLYGON((60 220,220 220,140 140,60 220))','POLYGON((100 180,180 180,180 100,100 100,100 180))');
+SELECT '8', ST_Relate('POLYGON((40 40,180 40,180 180,40 180,40 40))','POLYGON((180 40,40 180,160 280,300 140,180 40))');
+SELECT '9', ST_Relate('POLYGON((100 60,140 100,100 140,60 100,100 60))','MULTIPOLYGON(((80 40,120 40,120 80,80 80,80 40)),((120 80,160 80,160 120,120 120,120 80)),((80 120,120 120,120 160,80 160,80 120)),((40 80,80 80,80 120,40 120,40 80)))');
+SELECT '10', ST_Relate('POLYGON((40 280,200 280,200 100,40 100,40 280),(100 220,120 220,120 200,100 180,100 220))','POLYGON((40 280,180 260,180 120,60 120,40 280))');
+SELECT '11', ST_Relate('POLYGON((0 200,0 0,200 0,200 200,0 200),(20 180,130 180,130 30,20 30,20 180))','POLYGON((60 90,130 90,130 30,60 30,60 90))');
+SELECT '12', ST_Relate('POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))','POLYGON((270 90,200 50,150 80,210 120,270 90))');
+SELECT '13', ST_Relate('POLYGON((100 60,140 100,100 140,60 100,100 60))','MULTIPOLYGON(((80 40,120 40,120 80,80 80,80 40)),((120 80,160 80,160 120,120 120,120 80)),((80 120,120 120,120 160,80 160,80 120)),((40 80,80 80,80 120,40 120,40 80)))');
+SELECT '14', ST_Relate('LINESTRING(100 120,100 240)','POLYGON((40 60,160 60,160 180,40 180,40 60))');
+SELECT '15', ST_Relate('LINESTRING(80 80,140 140,200 200)','POLYGON((40 40,140 40,140 140,40 140,40 40))');
+SELECT '16', ST_Relate('LINESTRING(70 50,70 150)','MULTIPOLYGON(((0 0,0 100,140 100,140 0,0 0)),((20 170,70 100,130 170,20 170)))');
+SELECT '17', ST_Relate('LINESTRING(60 160,150 70)','POLYGON((190 190,360 20,20 20,190 190),(110 110,250 100,140 30,110 110))');
+SELECT '18', ST_Relate('LINESTRING(60 160,150 70)','POLYGON((190 190,360 20,20 20,190 190),(111 110,250 100,140 30,111 110))');
+SELECT '19', ST_Relate('LINESTRING(80 110,170 110)','POLYGON((20 200,20 20,240 20,240 200,20 200),(130 110,60 40,60 180,130 110),(130 180,130 40,200 110,130 180))');
+SELECT '20', ST_Relate('LINESTRING(80 110,170 110)','POLYGON((20 200,20 20,240 20,240 200,20 200),(130 110,60 40,60 180,130 110),(130 180,131 40,200 110,130 180))');
+SELECT '21', ST_Relate('LINESTRING(160 70,320 230)','MULTIPOLYGON(((140 110,260 110,170 20,50 20,140 110)),((300 270,420 270,340 190,220 190,300 270)))');
+SELECT '22', ST_Relate('LINESTRING(100 140,100 40)','MULTIPOLYGON(((20 80,180 79,100 0,20 80)),((20 160,180 160,100 80,20 160)))');
+SELECT '23', ST_Relate('LINESTRING(100 140,100 40)','MULTIPOLYGON(((20 80,180 80,100 0,20 80)),((20 160,180 160,100 80,20 160)))');
+SELECT '24', ST_Relate('LINESTRING(110 60,20 150,200 150,110 60)','POLYGON((20 20,200 20,110 110,20 20))');
+SELECT '25', ST_Relate('LINESTRING(0 0,0 50,50 50,50 0,0 0)','MULTILINESTRING((0 0,0 50),(0 50,50 50),(50 50,50 0),(50 0,0 0))');
+SELECT '26', ST_Relate('LINESTRING(40 180,140 180)','MULTIPOLYGON(((20 320,180 320,180 180,20 180,20 320)),((20 180,20 80,180 80,180 180,20 180)))');
+SELECT '27', ST_Relate('LINESTRING(40 180,140 180)','MULTIPOLYGON(((20 320,180 320,180 180,20 180,20 320)),((60 180,60 80,180 80,180 180,60 180)))');
+SELECT '28', ST_Relate('LINESTRING(0 0,60 0,60 60,60 0,120 0)','MULTILINESTRING((0 0,60 0),(60 0,120 0),(60 0,60 60))');
+SELECT '29', ST_Relate('LINESTRING(60 0,20 80,100 80,80 120,40 140)','LINESTRING(140 300,220 160,260 200,240 260)');
+SELECT '30', ST_Relate('LINESTRING(60 0,20 80,100 80,80 120,40 140)','LINESTRING(60 40,140 40,140 160,0 160)');
+SELECT '31', ST_Relate('LINESTRING(60 0,20 80,100 80,80 120,40 140)','LINESTRING(140 280,240 280,240 180,140 180,140 280)');
+SELECT '32', ST_Relate('LINESTRING(140 0,0 0,40 60,0 120,60 200,220 160,220 40)','LINESTRING(80 140,180 100,160 40,100 40,60 100,80 140)');
+SELECT '33', ST_Relate('LINESTRING(20 20,80 80)','LINESTRING(20 20,80 80)');
+SELECT '34', ST_Relate('LINESTRING(40 40,160 160,200 60,60 140)','LINESTRING(40 40,160 160,200 60,60 140)');
+SELECT '35', ST_Relate('LINESTRING(40 40,200 40)','LINESTRING(200 40,140 40,40 40)');
+SELECT '36', ST_Relate('LINESTRING(0 0,110 0,60 0)','LINESTRING(0 0,110 0)');
+SELECT '37', ST_Relate('LINESTRING(0 0,0 50,50 50,50 0,0 0)','MULTILINESTRING((0 0,0 50),(0 50,50 50),(50 50,50 0),(50 0,0 0))');
+SELECT '38', ST_Relate('LINESTRING(0 0,80 0,80 60,80 0,170 0)','MULTILINESTRING((0 0,170 0),(80 0,80 60))');
+SELECT '39', ST_Relate('LINESTRING(80 100,180 200)','LINESTRING(80 180,180 120)');
+SELECT '40', ST_Relate('LINESTRING(40 40,100 100,160 160)','LINESTRING(160 60,100 100,60 140)');
+SELECT '41', ST_Relate('LINESTRING(40 40,100 100,180 100,180 180,100 180,100 100)','LINESTRING(140 60,60 140)');
+SELECT '42', ST_Relate('LINESTRING(40 40,180 180,100 180,100 100)','LINESTRING(140 60,60 140)');
+SELECT '43', ST_Relate('LINESTRING(20 110,200 110)','LINESTRING(200 200,20 20,200 20,110 110,20 200,110 200,110 110)');
+SELECT '44', ST_Relate('LINESTRING(80 90,50 50,0 0)','LINESTRING(0 0,100 100)');
+SELECT '45', ST_Relate('LINESTRING(40 140,240 140)','LINESTRING(40 140,100 140,80 80,120 60,100 140,160 140,160 100,200 100,160 140,240 140)');
+SELECT '46', ST_Relate('LINESTRING(20 20,100 20,20 20)','LINESTRING(60 20,200 20)');
+SELECT '47', ST_Relate('LINESTRING(40 60,180 60,180 140,100 140,100 60,220 60,220 180,80 180,80 60,280 60)','LINESTRING(140 60,180 60,220 60,260 60)');
+SELECT '48', ST_Relate('POINT(20 20)','POLYGON((60 120,60 40,160 40,160 120,60 120))');
+SELECT '49', ST_Relate('MULTIPOINT(0 20,40 20)','POLYGON((20 40,20 0,60 0,60 40,20 40))');
+SELECT '50', ST_Relate('MULTIPOINT(0 20,20 20)','POLYGON((20 40,20 0,60 0,60 40,20 40))');
+SELECT '51', ST_Relate('MULTIPOINT(20 20,40 20)','POLYGON((20 40,20 0,60 0,60 40,20 40))');
+SELECT '52', ST_Relate('MULTIPOINT(80 260,140 260,180 260)','POLYGON((40 320,140 320,140 200,40 200,40 320))');
+SELECT '53', ST_Relate('POINT(40 40)','MULTIPOLYGON(((0 40,0 0,40 0,40 40,0 40)),((40 80,40 40,80 40,80 80,40 80)))');
+SELECT '54', ST_Relate('POINT(60 120)','LINESTRING(40 40,120 120,200 120)');
+SELECT '55', ST_Relate('POINT(40 40)','LINESTRING(40 40,100 100,160 100)');
+SELECT '56', ST_Relate('POINT(60 60)','LINESTRING(40 40,100 100)');
+SELECT '57', ST_Relate('MULTIPOINT(40 40,100 40)','LINESTRING(40 40,80 80)');
+SELECT '58', ST_Relate('MULTIPOINT(40 40,60 60)','LINESTRING(40 40,80 80)');
+SELECT '59', ST_Relate('MULTIPOINT(60 60,100 100)','LINESTRING(40 40,80 80)');
+SELECT '60', ST_Relate('MULTIPOINT(60 60,100 100)','LINESTRING(40 40,80 80)');
+SELECT '61', ST_Relate('MULTIPOINT(60 60,100 100)','LINESTRING(40 40,60 60,80 80)');
+SELECT '62', ST_Relate('POINT(20 20)','POINT(20 20)');
+SELECT '63', ST_Relate('POINT(20 20)','POINT(20 30)');
+SELECT '64', ST_Relate('MULTIPOINT(40 40,80 60,40 100)','MULTIPOINT(40 40,80 60,120 100)');
+SELECT '65', ST_Relate('MULTIPOINT(40 40,80 60,120 100)','MULTIPOINT(40 40,80 60,120 100)');
+SELECT '66', ST_Relate('POLYGON((100 100,100 200,200 200,200 100,100 100))','POLYGON((100 100,1e+15 110,1e+15 100,100 100))');
+SELECT '67', ST_Relate('POLYGON((120 100,120 200,200 200,200 100,120 100))','POLYGON((100 100,1e+15 110,1e+15 100,100 100))');
+SELECT '68', ST_Relate('POLYGON((20 20,20 100,120 100,140 20,20 20))','POLYGON((20 20,20 100,120 100,140 20,20 20))');
+SELECT '69', ST_Relate('POLYGON((20 20,20 100,120 100,140 20,20 20))','POLYGON((20 20,140 20,120 100,20 100,20 20))');
+SELECT '70', ST_Relate('POLYGON((20 20,20 100,120 100,140 20,20 20))','POLYGON((120 100,140 20,20 20,20 100,120 100))');
+SELECT '71', ST_Relate('POLYGON((20 20,20 100,120 100,140 20,20 20))','POLYGON((20 100,60 100,120 100,140 20,80 20,20 20,20 100))');
+SELECT '72', ST_Relate('POLYGON((0 0,80 0,80 80,0 80,0 0))','POLYGON((100 200,100 140,180 140,180 200,100 200))');
+SELECT '73', ST_Relate('POLYGON((140 120,160 20,20 20,20 120,140 120))','POLYGON((140 120,140 200,240 200,240 120,140 120))');
+SELECT '74', ST_Relate('POLYGON((140 120,160 20,20 20,20 120,140 120))','POLYGON((80 180,140 260,260 200,200 60,80 180))');
+SELECT '75', ST_Relate('POLYGON((140 120,160 20,20 20,20 120,140 120))','POLYGON((240 80,140 120,180 240,280 200,240 80))');
+SELECT '76', ST_Relate('POLYGON((140 160,20 20,270 20,150 160,230 40,60 40,140 160))','POLYGON((140 40,180 80,120 100,140 40))');
+SELECT '77', ST_Relate('POLYGON((140 160,20 20,270 20,150 160,230 40,60 40,140 160))','POLYGON((120 100,180 80,130 40,120 100))');
+SELECT '78', ST_Relate('POLYGON((20 20,180 20,140 140,20 140,20 20))','POLYGON((180 100,80 200,180 280,260 200,180 100))');
+SELECT '79', ST_Relate('POLYGON((140 120,160 20,20 20,20 120,140 120))','POLYGON((140 140,20 120,0 220,120 240,140 140))');
+SELECT '80', ST_Relate('POLYGON((160 200,210 70,120 70,160 200))','POLYGON((160 200,260 40,70 40,160 200,20 20,310 20,160 200))');
+SELECT '81', ST_Relate('POLYGON((110 140,200 70,200 160,110 140))','POLYGON((110 140,110 50,60 50,60 90,160 190,20 110,20 20,200 20,110 140))');
+SELECT '82', ST_Relate('POLYGON((20 120,20 20,260 20,260 120,200 40,140 120,80 40,20 120))','POLYGON((20 120,20 240,260 240,260 120,200 200,140 120,80 200,20 120))');
+SELECT '83', ST_Relate('POLYGON((20 120,20 20,260 20,260 120,180 40,140 120,100 40,20 120))','POLYGON((20 120,300 120,140 240,20 120))');
+SELECT '84', ST_Relate('POLYGON((20 20,20 300,280 300,280 260,220 260,60 100,60 60,280 60,280 20,20 20))','POLYGON((100 140,160 80,280 180,200 240,220 160,160 200,180 120,100 140))');
+SELECT '85', ST_Relate('POLYGON((20 20,20 300,280 300,280 260,220 260,60 100,60 60,280 60,280 20,20 20))','POLYGON((260 200,180 80,120 160,200 160,180 220,260 200))');
+SELECT '86', ST_Relate('POLYGON((20 20,280 20,280 140,220 60,140 140,80 60,20 140,20 20))','POLYGON((0 140,300 140,140 240,0 140))');
+SELECT '87', ST_Relate('POLYGON((20 20,280 20,280 140,220 60,140 140,80 60,20 140,20 20))','POLYGON((20 240,20 140,320 140,180 240,20 240))');
+SELECT '88', ST_Relate('POLYGON((20 20,280 20,280 140,220 60,140 140,80 60,20 140,20 20))','POLYGON((20 240,20 140,80 180,140 140,220 180,280 140,280 240,20 240))');
+SELECT '89', ST_Relate('POLYGON((120 120,180 60,20 20,20 120,120 120))','POLYGON((120 120,220 20,280 20,240 160,120 120))');
+SELECT '90', ST_Relate('POLYGON((140 120,160 20,20 20,20 120,140 120))','POLYGON((140 120,160 20,260 120,220 200,140 120))');
+SELECT '91', ST_Relate('POLYGON((20 140,120 40,20 40,20 140))','POLYGON((190 140,190 20,140 20,20 140,190 140))');
+SELECT '92', ST_Relate('POLYGON((120 120,180 60,20 20,20 120,120 120))','POLYGON((300 20,220 20,120 120,260 160,300 20))');
+SELECT '93', ST_Relate('POLYGON((140 120,160 20,20 20,20 120,140 120))','POLYGON((140 120,240 160,280 60,160 20,140 120))');
+SELECT '94', ST_Relate('POLYGON((120 120,180 60,20 20,20 120,120 120))','POLYGON((280 60,180 60,120 120,260 180,280 60))');
+SELECT '95', ST_Relate('POLYGON((140 120,160 20,20 20,20 120,140 120))','POLYGON((120 200,120 120,40 120,40 200,120 200))');
+SELECT '96', ST_Relate('POLYGON((140 120,160 20,20 20,20 120,140 120))','POLYGON((160 220,140 120,60 120,40 220,160 220))');
+SELECT '97', ST_Relate('POLYGON((140 120,160 20,20 20,20 120,140 120))','POLYGON((140 120,20 120,20 220,140 220,140 120))');
+SELECT '98', ST_Relate('POLYGON((120 120,180 60,20 20,20 120,120 120))','POLYGON((320 20,220 20,80 160,240 140,320 20))');
+SELECT '99', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((60 40,60 140,180 140,180 40,60 40))');
+SELECT '100', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 20,80 140,160 60,20 20))');
+SELECT '101', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((160 60,20 20,100 140,160 60))');
+SELECT '102', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 100,140 160,160 40,20 100))');
+SELECT '103', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((160 40,20 100,160 160,160 40))');
+SELECT '104', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 180,180 120,80 40,20 180))');
+SELECT '105', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((180 120,100 40,20 180,180 120))');
+SELECT '106', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 20,140 40,140 120,20 160,80 80,20 20))');
+SELECT '107', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 20,140 40,140 140,20 180,80 100,20 20))');
+SELECT '108', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((40 180,60 100,180 100,200 180,120 120,40 180))');
+SELECT '109', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 180,60 80,180 80,220 180,120 120,20 180))');
+SELECT '110', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((40 60,20 180,100 100,140 180,160 120,220 100,140 40,40 60))');
+SELECT '111', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((60 100,180 100,220 180,120 140,20 180,60 100))');
+SELECT '112', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 20,20 140,120 120,120 40,20 20))');
+SELECT '113', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 20,20 180,140 140,140 60,20 20))');
+SELECT '114', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 20,120 40,120 120,20 140,20 20))');
+SELECT '115', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((120 40,20 20,20 140,120 120,120 40))');
+SELECT '116', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 20,140 60,140 140,20 180,20 20))');
+SELECT '117', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((140 60,20 20,20 180,140 140,140 60))');
+SELECT '118', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 20,60 120,140 120,180 20,20 20))');
+SELECT '119', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 40,120 40,120 120,20 140,20 40))');
+SELECT '120', ST_Relate('POLYGON((20 20,20 180,220 180,220 20,20 20))','POLYGON((20 20,20 180,60 120,100 180,140 120,220 180,200 120,140 60,20 20))');
+SELECT '121', ST_Relate('POLYGON((150 150,330 150,250 70,70 70,150 150))','POLYGON((150 150,270 150,140 20,20 20,150 150))');
+SELECT '122', ST_Relate('POLYGON((150 150,270 150,330 150,250 70,190 70,70 70,150 150))','POLYGON((150 150,270 150,190 70,140 20,20 20,70 70,150 150))');
+SELECT '123', ST_Relate('POLYGON((20 20,60 50,20 40,60 70,20 60,60 90,20 90,70 110,20 130,80 130,20 150,80 160,20 170,80 180,20 200,80 200,30 240,80 220,50 260,100 220,100 260,120 220,130 260,140 220,150 280,150 190,160 280,170 190,180 280,190 190,200 280,210 190,220 280,230 190,240 260,250 230,260 260,260 220,290 270,290 220,330 260,300 210,340 240,290 180,340 210,290 170,350 170,240 150,350 150,240 140,350 130,240 120,350 120,240 110,350 110,240 100,350 100,240 90,350 90,240 80,350 80,300 70,340 60,290 60,340 40,300 50,340 20,270 60,310 20,250 60,270 20,230 60,240 20,210 60,210 20,190 70,190 20,180 90,170 20,160 90,150 20,140 90,130 20,120 90,110 20,100 90,100 20,90 60,80 20,70 40,20 20))','POLYGON((190 140,140 130,200 160,130 150,210 170,130 170,210 180,120 190,220 200,120 200,250 210,120 210,250 220,120 220,250 230,120 240,230 240,120 250,240 260,120 260,240 270,120 270,270 290,120 290,230 300,150 310,250 310,180 320,250 320,200 360,260 330,240 360,280 320,290 370,290 320,320 36
 0,310 320,360 360,310 310,380 340,310 290,390 330,310 280,410 310,310 270,420 280,310 260,430 250,300 250,440 240,300 240,450 230,280 220,440 220,280 210,440 210,300 200,430 190,300 190,440 180,330 180,430 150,320 180,420 130,300 180,410 120,280 180,400 110,280 170,390 90,280 160,400 70,270 160,450 30,260 160,420 30,250 160,390 30,240 160,370 30,230 160,360 30,230 150,330 50,240 130,330 30,230 130,310 30,220 130,280 30,230 100,270 40,220 110,250 30,210 130,240 30,210 100,220 40,200 90,200 20,190 100,180 30,20 20,180 40,20 30,180 50,20 50,180 60,30 60,180 70,20 70,170 80,80 80,170 90,20 80,180 100,40 100,200 110,60 110,200 120,120 120,190 140))');
+SELECT '124', ST_Relate('POLYGON((70 150,20 160,110 160,20 180,100 200,20 200,190 210,20 210,160 220,20 220,150 230,60 240,180 250,20 260,170 260,60 270,160 270,100 310,170 280,200 260,180 230,210 260,130 330,230 250,210 290,240 250,230 210,260 300,250 230,270 300,270 240,300 340,280 250,320 330,290 250,340 350,290 240,350 360,270 190,350 340,290 200,350 330,300 190,360 320,310 190,360 300,320 200,360 280,330 200,360 260,340 200,370 260,340 180,390 290,340 170,400 260,350 170,400 250,350 160,410 240,350 150,400 170,350 140,310 170,340 140,270 180,330 140,260 170,310 140,240 170,290 140,200 190,270 140,180 190,260 140,170 190,260 130,170 180,250 130,170 170,240 120,170 160,210 120,170 150,210 110,340 130,230 110,420 140,220 100,410 130,220 90,400 120,220 80,390 110,220 70,420 110,240 70,420 100,260 70,420 90,280 70,430 80,230 60,430 60,270 50,450 40,210 50,370 40,260 40,460 30,160 40,210 60,200 110,190 60,190 120,170 50,180 130,150 30,170 130,140 20,160 120,130 20,160 150,120 20,160 
 170,110 20,160 190,100 20,150 190,90 20,140 180,80 20,120 140,70 20,120 150,60 20,110 150,50 20,100 140,50 30,90 130,40 30,80 120,30 30,80 130,30 40,80 140,20 40,70 140,40 90,60 130,20 90,60 140,20 130,70 150))','POLYGON((190 140,140 130,200 160,130 150,210 170,130 170,210 180,120 190,220 200,120 200,250 210,120 210,250 220,120 220,250 230,120 240,230 240,120 250,240 260,120 260,240 270,120 270,270 290,120 290,230 300,150 310,250 310,180 320,250 320,200 360,260 330,240 360,280 320,290 370,290 320,320 360,310 320,360 360,310 310,380 340,310 290,390 330,310 280,410 310,310 270,420 280,310 260,430 250,300 250,440 240,300 240,450 230,280 220,440 220,280 210,440 210,300 200,430 190,300 190,440 180,330 180,430 150,320 180,420 130,300 180,410 120,280 180,400 110,280 170,390 90,280 160,400 70,270 160,450 30,260 160,420 30,250 160,390 30,240 160,370 30,230 160,360 30,230 150,330 50,240 130,330 30,230 130,310 30,220 130,280 30,230 100,270 40,220 110,250 30,210 130,240 30,210 100,220 40,200 90
 ,200 20,190 100,180 30,20 20,180 40,20 30,180 50,20 50,180 60,30 60,180 70,20 70,170 80,80 80,170 90,20 80,180 100,40 100,200 110,60 110,200 120,120 120,190 140))');
+SELECT '125', ST_Relate('POLYGON((60 160,220 160,220 20,60 20,60 160))','POLYGON((60 160,20 200,260 200,220 160,140 80,60 160))');
+SELECT '126', ST_Relate('POLYGON((60 160,220 160,220 20,60 20,60 160))','POLYGON((60 160,20 200,260 200,140 80,60 160))');
+SELECT '127', ST_Relate('POLYGON((60 160,220 160,220 20,60 20,60 160))','POLYGON((20 200,140 80,260 200,20 200))');
+SELECT '128', ST_Relate('POLYGON((60 160,220 160,220 20,60 20,60 160))','POLYGON((20 200,60 160,140 80,220 160,260 200,20 200))');
+SELECT '129', ST_Relate('POLYGON((60 160,220 160,220 20,60 20,60 160))','POLYGON((20 200,60 160,140 80,260 200,20 200))');
+SELECT '130', ST_Relate('POLYGON((0 0,0 200,200 200,200 0,0 0))','POLYGON((100 100,1000000 110,10000000 100,100 100))');
+SELECT '131', ST_Relate('POLYGON((100 0,100 200,200 200,200 0,100 0))','POLYGON((100 100,1000000 110,10000000 100,100 100))');
+SELECT '132', ST_Relate('POLYGON((120 0,120 200,200 200,200 0,120 0))','POLYGON((100 100,1000000 110,10000000 100,100 100))');
+SELECT '133', ST_Relate('POLYGON((0 0,0 200,110 200,110 0,0 0))','POLYGON((100 100,1000000 110,10000000 100,100 100))');
+SELECT '134', ST_Relate('POLYGON((100 100,100 200,200 200,200 100,100 100))','POLYGON((100 100,2100 110,2100 100,100 100))');
+SELECT '135', ST_Relate('POLYGON((100 100,100 200,200 200,200 100,100 100))','POLYGON((100 100,2101 110,2101 100,100 100))');
+SELECT '136', ST_Relate('POLYGON((100 100,200 200,200 100,100 100))','POLYGON((100 100,2101 110,2101 100,100 100))');
+SELECT '137', ST_Relate('POLYGON((100 100,100 200,200 200,200 100,100 100))','POLYGON((100 100,1000000 110,1000000 100,100 100))');
+SELECT '138', ST_Relate('POLYGON((120 100,120 200,200 200,200 100,120 100))','POLYGON((100 100,500 110,500 100,100 100))');
+SELECT '139', ST_Relate('POLYGON((120 100,120 200,200 200,200 100,120 100))','POLYGON((100 100,501 110,501 100,100 100))');
+SELECT '140', ST_Relate('POLYGON((120 100,130 200,200 200,200 100,120 100))','POLYGON((100 100,501 110,501 100,100 100))');
+SELECT '141', ST_Relate('POLYGON((120 100,17 200,200 200,200 100,120 100))','POLYGON((100 100,501 110,501 100,100 100))');
+SELECT '142', ST_Relate('POLYGON((120 100,120 200,200 200,200 100,120 100))','POLYGON((100 100,1000000 110,1000000 100,100 100))');
+SELECT '143', ST_Relate('POLYGON((101 99,101 1000000,102 1000000,101 99))','POLYGON((100 100,1000000 110,1000000 100,100 100))');
+SELECT '144', ST_Relate('POLYGON((100 100,200 101,200 100,100 100))','POLYGON((100 100,2101 110,2101 100,100 100))');
+SELECT '145', ST_Relate('POLYGON((16 319,150 39,25 302,160 20,265 20,127 317,16 319))','POLYGON((10 307,22 307,153 34,22 34,10 307))');
+SELECT '146', ST_Relate('POLYGON((160 200,210 70,120 70,160 200))','POLYGON((160 200,310 20,20 20,160 200),(160 200,260 40,70 40,160 200))');
+SELECT '147', ST_Relate('POLYGON((170 120,240 100,260 50,190 70,170 120))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))');
+SELECT '148', ST_Relate('POLYGON((270 90,200 50,150 80,210 120,270 90))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))');
+SELECT '149', ST_Relate('POLYGON((170 120,260 100,240 60,150 80,170 120))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))');
+SELECT '150', ST_Relate('POLYGON((220 120,270 80,200 60,160 100,220 120))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))');
+SELECT '151', ST_Relate('POLYGON((260 50,180 70,180 110,260 90,260 50))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))');
+SELECT '152', ST_Relate('POLYGON((230 110,290 80,190 60,140 90,230 110))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))');
+SELECT '153', ST_Relate('POLYGON((170 120,330 120,260 50,100 50,170 120))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))');
+SELECT '154', ST_Relate('POLYGON((170 120,330 120,280 70,120 70,170 120))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))');
+SELECT '155', ST_Relate('POLYGON((170 120,300 120,250 70,120 70,170 120))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))');
+SELECT '156', ST_Relate('POLYGON((190 100,310 100,260 50,140 50,190 100))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))');
+SELECT '157', ST_Relate('POLYGON((280 130,360 130,270 40,190 40,280 130))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,250 120,180 50,100 50,170 120))');
+SELECT '158', ST_Relate('POLYGON((220 80,180 40,80 40,170 130,270 130,230 90,300 90,250 30,280 30,390 140,150 140,40 30,230 30,280 80,220 80))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,250 120,180 50,100 50,170 120))');
+SELECT '159', ST_Relate('POLYGON((260 130,360 130,280 40,170 40,260 130))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,250 120,180 50,100 50,170 120))');
+SELECT '160', ST_Relate('POLYGON((240 110,340 110,290 60,190 60,240 110))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,250 120,180 50,100 50,170 120))');
+SELECT '161', ST_Relate('POLYGON((250 120,350 120,280 50,180 50,250 120))','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,250 120,180 50,100 50,170 120))');
+SELECT '162', ST_Relate('POLYGON((230 210,230 20,20 20,20 210,230 210),(120 180,50 50,200 50,120 180))','POLYGON((230 210,230 20,20 20,20 210,230 210),(120 180,50 50,200 50,120 180))');
+SELECT '163', ST_Relate('POLYGON((230 210,230 20,20 20,20 210,230 210),(140 40,40 40,40 170,140 40),(110 190,210 190,210 50,110 190))','POLYGON((230 210,230 20,20 20,20 210,230 210),(140 40,40 40,40 170,140 40),(110 190,210 190,210 50,110 190))');
+SELECT '164', ST_Relate('POLYGON((280 190,330 150,200 110,150 150,280 190))','MULTIPOLYGON(((140 110,260 110,170 20,50 20,140 110)),((300 270,420 270,340 190,220 190,300 270)))');
+SELECT '165', ST_Relate('POLYGON((80 190,220 190,140 110,0 110,80 190))','MULTIPOLYGON(((140 110,260 110,170 20,50 20,140 110)),((300 270,420 270,340 190,220 190,300 270)))');
+SELECT '166', ST_Relate('POLYGON((330 150,200 110,150 150,280 190,330 150))','MULTIPOLYGON(((140 110,260 110,170 20,50 20,140 110)),((300 270,420 270,340 190,220 190,300 270)))');
+SELECT '167', ST_Relate('POLYGON((290 190,340 150,220 120,170 170,290 190))','MULTIPOLYGON(((140 110,260 110,170 20,50 20,140 110)),((300 270,420 270,340 190,220 190,300 270)))');
+SELECT '168', ST_Relate('POLYGON((220 190,340 190,260 110,140 110,220 190))','MULTIPOLYGON(((140 110,260 110,170 20,50 20,140 110)),((300 270,420 270,340 190,220 190,300 270)))');
+SELECT '169', ST_Relate('POLYGON((140 190,220 190,100 70,20 70,140 190))','MULTIPOLYGON(((140 110,260 110,170 20,50 20,140 110)),((300 270,420 270,340 190,220 190,300 270)))');
+SELECT '170', ST_Relate('POLYGON((140 220,60 140,140 60,220 140,140 220))','MULTIPOLYGON(((100 20,180 20,180 100,100 100,100 20)),((20 100,100 100,100 180,20 180,20 100)),((100 180,180 180,180 260,100 260,100 180)),((180 100,260 100,260 180,180 180,180 100)))');
+SELECT '171', ST_Relate('MULTIPOLYGON(((110 110,70 200,150 200,110 110)),((110 110,150 20,70 20,110 110)))','MULTIPOLYGON(((110 110,160 160,210 110,160 60,110 110)),((110 110,60 60,10 110,60 160,110 110)))');
+SELECT '172', ST_Relate('MULTIPOLYGON(((110 110,70 200,150 200,110 110),(110 110,100 180,120 180,110 110)),((110 110,150 20,70 20,110 110),(110 110,120 40,100 40,110 110)))','MULTIPOLYGON(((110 110,160 160,210 110,160 60,110 110),(110 110,160 130,160 90,110 110)),((110 110,60 60,10 110,60 160,110 110),(110 110,60 90,60 130,110 110)))');
+SELECT '173', ST_Relate('MULTIPOLYGON(((110 110,70 200,200 200,110 110),(110 110,100 180,120 180,110 110)),((110 110,200 20,70 20,110 110),(110 110,120 40,100 40,110 110)))','MULTIPOLYGON(((110 110,160 160,210 110,160 60,110 110),(110 110,160 130,160 90,110 110)),((110 110,60 60,10 110,60 160,110 110),(110 110,60 90,60 130,110 110)))');
+SELECT '174', ST_Relate('MULTIPOLYGON(((110 110,20 200,200 200,110 110),(110 110,100 180,120 180,110 110)),((110 110,200 20,20 20,110 110),(110 110,120 40,100 40,110 110)))','MULTIPOLYGON(((110 110,160 160,210 110,160 60,110 110),(110 110,160 130,160 90,110 110)),((110 110,60 60,10 110,60 160,110 110),(110 110,60 90,60 130,110 110)))');
+SELECT '175', ST_Relate('MULTIPOLYGON(((110 110,70 200,200 200,110 110),(110 110,100 180,120 180,110 110)),((110 110,200 20,70 20,110 110),(110 110,120 40,100 40,110 110)))','MULTIPOLYGON(((110 110,160 160,210 110,160 60,110 110),(110 110,160 130,160 90,110 110)),((110 110,60 60,10 110,60 160,110 110),(110 110,60 90,60 130,110 110)))');
+SELECT '176', ST_Relate('MULTIPOLYGON(((110 110,70 200,200 200,110 110),(110 110,100 180,120 180,110 110)),((110 110,200 20,70 20,110 110),(110 110,120 40,100 40,110 110)))','MULTIPOLYGON(((110 110,70 200,210 110,70 20,110 110),(110 110,110 140,150 110,110 80,110 110)),((110 110,60 60,10 110,60 160,110 110),(110 110,60 90,60 130,110 110)))');
+SELECT '177', ST_Relate('POLYGON((100 60,140 100,100 140,60 100,100 60))','MULTIPOLYGON(((80 40,120 40,120 80,80 80,80 40)),((120 80,160 80,160 120,120 120,120 80)),((80 120,120 120,120 160,80 160,80 120)),((40 80,80 80,80 120,40 120,40 80)))');
+SELECT '178', ST_Relate('LINESTRING(150 150,40 230)','POLYGON((150 150,410 150,280 20,20 20,150 150))');
+SELECT '179', ST_Relate('LINESTRING(40 40,50 130,130 130)','POLYGON((150 150,410 150,280 20,20 20,150 150))');
+SELECT '180', ST_Relate('LINESTRING(40 230,150 150)','POLYGON((150 150,410 150,280 20,20 20,150 150))');
+SELECT '181', ST_Relate('LINESTRING(210 150,330 150)','POLYGON((150 150,410 150,280 20,20 20,150 150))');
+SELECT '182', ST_Relate('LINESTRING(200 150,310 150,360 220)','POLYGON((150 150,410 150,280 20,20 20,150 150))');
+SELECT '183', ST_Relate('LINESTRING(180 150,250 150,230 250,370 250,410 150)','POLYGON((150 150,410 150,280 20,20 20,150 150))');
+SELECT '184', ST_Relate('LINESTRING(210 210,220 150,320 150,370 210)','POLYGON((150 150,410 150,280 20,20 20,150 150))');
+SELECT '185', ST_Relate('LINESTRING(20 60,150 60)','POLYGON((150 150,410 150,280 20,20 20,150 150))');
+SELECT '186', ST_Relate('LINESTRING(60 90,310 180)','POLYGON((150 150,410 150,280 20,20 20,150 150))');
+SELECT '187', ST_Relate('LINESTRING(90 210,210 90)','POLYGON((150 150,410 150,280 20,20 20,150 150))');
+SELECT '188', ST_Relate('LINESTRING(290 10,130 170)','POLYGON((150 150,410 150,280 20,20 20,150 150))');
+SELECT '189', ST_Relate('LINESTRING(30 100,100 100,180 100)','POLYGON((150 150,410 150,280 20,20 20,150 150))');
+SELECT '190', ST_Relate('LINESTRING(20 100,100 100,360 100,410 100)','POLYGON((150 150,410 150,280 20,20 20,150 150))');
+SELECT '191', ST_Relate('LINESTRING(90 210,150 150,210 90)','POLYGON((150 150,410 150,280 20,20 20,150 150))');
+SELECT '192', ST_Relate('LINESTRING(180 90,280 120)','POLYGON((150 150,410 150,280 20,20 20,150 150))');
+SELECT '193', ST_Relate('LINESTRING(70 70,80 20)','POLYGON((150 150,410 150,280 20,20 20,150 150))');
+SELECT '194', ST_Relate('LINESTRING(130 20,150 60)','POLYGON((150 150,410 150,280 20,20 20,150 150))');
+SELECT '195', ST_Relate('LINESTRING(70 70,80 20,140 20,150 60)','POLYGON((150 150,410 150,280 20,20 20,150 150))');
+SELECT '196', ST_Relate('LINESTRING(170 50,170 20,240 20,260 60)','POLYGON((150 150,410 150,280 20,20 20,150 150))');
+SELECT '197', ST_Relate('LINESTRING(50 100,140 190,280 190)','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))');
+SELECT '198', ST_Relate('LINESTRING(140 60,180 100,290 100)','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))');
+SELECT '199', ST_Relate('LINESTRING(170 120,210 80,270 80)','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))');
+SELECT '200', ST_Relate('LINESTRING(170 120,260 50)','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))');
+SELECT '201', ST_Relate('LINESTRING(190 90,190 270)','POLYGON((190 190,360 20,20 20,190 190),(190 190,280 50,100 50,190 190))');
+SELECT '202', ST_Relate('LINESTRING(60 160,150 70)','POLYGON((190 190,360 20,20 20,190 190),(110 110,250 100,140 30,110 110))');
+SELECT '203', ST_Relate('LINESTRING(60 160,150 70)','POLYGON((190 190,20 20,360 20,190 190),(250 100,110 110,140 30,250 100))');
+SELECT '204', ST_Relate('LINESTRING(60 160,150 70)','POLYGON((190 190,20 20,360 20,190 190),(250 100,110 110,140 30,250 100))');
+SELECT '205', ST_Relate('LINESTRING(190 90,190 190,190 270)','POLYGON((190 190,360 20,20 20,190 190),(190 190,280 50,100 50,190 190))');
+SELECT '206', ST_Relate('LINESTRING(60 160,110 110,150 70)','POLYGON((190 190,360 20,20 20,190 190),(110 110,250 100,140 30,110 110))');
+SELECT '207', ST_Relate('LINESTRING(60 160,110 110,150 70)','POLYGON((190 190,20 20,360 20,190 190),(250 100,110 110,140 30,250 100))');
+SELECT '208', ST_Relate('LINESTRING(60 160,110 110,150 70)','POLYGON((190 190,110 110,20 20,360 20,190 190),(250 100,110 110,140 30,250 100))');
+SELECT '209', ST_Relate('LINESTRING(130 110,180 110,190 60)','POLYGON((20 200,240 200,240 20,20 20,20 200),(130 110,60 180,60 40,130 110),(130 110,200 40,200 180,130 110))');
+SELECT '210', ST_Relate('LINESTRING(80 110,180 110)','POLYGON((20 200,240 200,240 20,20 20,20 200),(130 110,60 180,60 40,130 110),(130 110,200 40,200 180,130 110))');
+SELECT '211', ST_Relate('LINESTRING(80 110,180 110)','POLYGON((20 200,20 20,240 20,240 200,20 200),(60 180,130 110,60 40,60 180),(130 110,200 40,200 180,130 110))');
+SELECT '212', ST_Relate('LINESTRING(80 110,170 110)','POLYGON((20 200,20 20,240 20,240 200,20 200),(130 110,60 40,60 180,130 110),(130 180,130 40,200 110,130 180))');
+SELECT '213', ST_Relate('LINESTRING(80 110,130 110,170 110)','POLYGON((20 200,20 20,240 20,240 200,20 200),(130 110,60 40,60 180,130 110),(130 180,130 40,200 110,130 180))');
+SELECT '214', ST_Relate('LINESTRING(80 110,130 110,180 110)','POLYGON((20 200,240 200,240 20,20 20,20 200),(130 110,60 180,60 40,130 110),(130 110,200 40,200 180,130 110))');
+SELECT '215', ST_Relate('LINESTRING(80 110,130 110,180 110)','POLYGON((20 200,20 20,240 20,240 200,20 200),(60 180,130 110,60 40,60 180),(130 110,200 40,200 180,130 110))');
+SELECT '216', ST_Relate('LINESTRING(80 110,130 110,170 110)','POLYGON((20 200,20 20,240 20,240 200,20 200),(130 110,60 40,60 180,130 110),(130 180,130 40,200 110,130 180))');
+SELECT '217', ST_Relate('LINESTRING(160 70,320 230)','MULTIPOLYGON(((140 110,260 110,170 20,50 20,140 110)),((300 270,420 270,340 190,220 190,300 270)))');
+SELECT '218', ST_Relate('LINESTRING(160 70,200 110,280 190,320 230)','MULTIPOLYGON(((140 110,260 110,170 20,50 20,140 110)),((300 270,420 270,340 190,220 190,300 270)))');
+SELECT '219', ST_Relate('LINESTRING(70 50,70 150)','MULTIPOLYGON(((0 0,0 100,140 100,140 0,0 0)),((20 170,70 100,130 170,20 170)))');
+SELECT '220', ST_Relate('LINESTRING(110 110,20 200,200 200,110 110)','POLYGON((20 20,200 20,110 110,20 20))');
+SELECT '221', ST_Relate('LINESTRING(150 70,160 110,200 60,150 70)','POLYGON((20 20,200 20,110 110,20 20))');
+SELECT '222', ST_Relate('LINESTRING(80 60,120 40,120 70,80 60)','POLYGON((110 110,200 20,20 20,110 110),(110 90,50 30,170 30,110 90))');
+SELECT '223', ST_Relate('LINESTRING(20 20,200 20,110 110,20 20)','POLYGON((20 20,200 20,110 110,20 20))');
+SELECT '224', ST_Relate('LINESTRING(110 90,170 30,50 30,110 90)','POLYGON((110 110,200 20,20 20,110 110),(110 90,50 30,170 30,110 90))');
+SELECT '225', ST_Relate('LINESTRING(110 110,170 50,170 110,110 110)','POLYGON((110 110,200 20,20 20,110 110),(110 90,50 30,170 30,110 90))');
+SELECT '226', ST_Relate('LINESTRING(110 90,70 50,130 50,110 90)','POLYGON((110 110,200 20,20 20,110 110),(110 90,50 30,170 30,110 90))');
+SELECT '227', ST_Relate('LINESTRING(110 60,20 150,200 150,110 60)','POLYGON((20 20,200 20,110 110,20 20))');
+SELECT '228', ST_Relate('LINESTRING(110 130,110 70,200 100,110 130)','POLYGON((110 110,200 20,20 20,110 110),(110 90,50 30,170 30,110 90))');
+SELECT '229', ST_Relate('LINESTRING(110 90,160 40,60 40,110 90)','POLYGON((20 20,200 20,110 110,20 20))');
+SELECT '230', ST_Relate('LINESTRING(110 100,40 30,180 30,110 100)','POLYGON((110 110,200 20,20 20,110 110),(110 90,60 40,160 40,110 90))');
+SELECT '231', ST_Relate('LINESTRING(110 110,180 30,40 30,110 110)','POLYGON((110 110,200 20,20 20,110 110),(110 90,60 40,160 40,110 90))');
+SELECT '232', ST_Relate('LINESTRING(110 90,180 30,40 30,110 90)','POLYGON((110 110,200 20,20 20,110 110),(110 90,60 40,160 40,110 90))');
+SELECT '233', ST_Relate('LINESTRING(110 90,50 30,180 30,110 90)','POLYGON((110 110,200 20,20 20,110 110),(110 90,60 40,160 40,110 90))');
+SELECT '234', ST_Relate('LINESTRING(110 110,200 200,200 110,110 200)','POLYGON((110 110,200 20,20 20,110 110))');
+SELECT '235', ST_Relate('LINESTRING(110 110,200 200,110 110,20 200,20 110,200 110)','POLYGON((110 110,200 20,20 20,110 110))');
+SELECT '236', ST_Relate('LINESTRING(110 110,20 110,200 110,50 110,110 170)','POLYGON((110 110,200 20,20 20,110 110))');
+SELECT '237', ST_Relate('LINESTRING(110 110,20 200,110 200,110 110,200 200)','POLYGON((110 110,200 20,20 20,110 110))');
+SELECT '238', ST_Relate('LINESTRING(110 110,170 50,20 200,20 110,200 110)','POLYGON((110 110,200 20,20 20,110 110))');
+SELECT '239', ST_Relate('LINESTRING(110 110,180 40,110 40,110 180)','POLYGON((110 110,200 20,20 20,110 110))');
+SELECT '240', ST_Relate('LINESTRING(110 60,50 30,170 30,90 70)','POLYGON((110 110,200 20,20 20,110 110))');
+SELECT '241', ST_Relate('LINESTRING(110 110,180 40,110 40,110 110,70 40)','POLYGON((110 110,200 20,20 20,110 110))');
+SELECT '242', ST_Relate('LINESTRING(230 70,170 120,190 60,140 60,170 120,270 90)','POLYGON((150 150,410 150,280 20,20 20,150 150),(170 120,330 120,260 50,100 50,170 120))');
+SELECT '243', ST_Relate('MULTILINESTRING((20 110,200 110),(200 200,110 110,20 210,110 110))','POLYGON((110 110,200 20,20 20,110 110))');
+SELECT '244', ST_Relate('MULTILINESTRING((20 110,200 110),(60 180,60 110,160 110,110 110))','POLYGON((110 110,200 20,20 20,110 110))');
+SELECT '245', ST_Relate('MULTILINESTRING((20 110,200 110),(200 200,110 110,20 200,110 200,110 110))','POLYGON((110 110,200 20,20 20,110 110))');
+SELECT '246', ST_Relate('MULTILINESTRING((20 110,200 110),(110 50,110 170,110 70,110 150,200 150))','POLYGON((110 110,200 20,20 20,110 110))');
+SELECT '247', ST_Relate('MULTILINESTRING((20 110,200 110),(50 110,170 110,110 170,110 50,110 170,110 50))','POLYGON((110 110,200 20,20 20,110 110))');
+SELECT '248', ST_Relate('MULTILINESTRING((20 110,200 110),(110 60,110 160,200 160))','POLYGON((110 110,200 20,20 20,110 110))');
+SELECT '249', ST_Relate('MULTILINESTRING((20 110,200 110),(110 60,110 160,200 160))','POLYGON((110 110,200 20,20 20,110 110))');
+SELECT '250', ST_Relate('MULTILINESTRING((110 100,40 30,180 30),(170 30,110 90,50 30))','POLYGON((110 110,200 20,20 20,110 110))');
+SELECT '251', ST_Relate('MULTILINESTRING((110 110,60 40,70 20,150 20,170 40),(180 30,40 30,110 80))','POLYGON((110 110,200 20,20 20,110 110))');
+SELECT '252', ST_Relate('MULTILINESTRING((20 110,200 110,200 160),(110 110,200 110,200 70,20 150))','MULTIPOLYGON(((110 110,20 20,200 20,110 110)),((110 110,20 200,200 200,110 110)))');
+SELECT '253', ST_Relate('MULTILINESTRING((20 160,70 110,150 110,200 160),(110 110,20 110,50 80,70 110,200 110))','MULTIPOLYGON(((110 110,20 20,200 20,110 110)),((110 110,20 200,200 200,110 110)))');
+SELECT '254', ST_Relate('MULTILINESTRING((20 110,200 110),(110 110,20 170,20 130,200 90))','MULTIPOLYGON(((110 110,20 20,200 20,110 110)),((110 110,20 200,200 200,110 110)))');
+SELECT '255', ST_Relate('LINESTRING(0 0,0 50,50 50,50 0,0 0)','MULTILINESTRING((0 0,0 50),(0 50,50 50),(50 50,50 0),(50 0,0 0))');
+SELECT '256', ST_Relate('LINESTRING(40 180,140 180)','MULTIPOLYGON(((20 320,180 320,180 180,20 180,20 320)),((20 180,20 80,180 80,180 180,20 180)))');
+SELECT '257', ST_Relate('LINESTRING(40 180,140 180)','MULTIPOLYGON(((20 320,180 320,180 180,20 180,20 320)),((60 180,60 80,180 80,180 180,60 180)))');
+SELECT '258', ST_Relate('LINESTRING(0 0,60 0,60 60,60 0,120 0)','MULTILINESTRING((0 0,60 0),(60 0,120 0),(60 0,60 60))');
+SELECT '259', ST_Relate('LINESTRING(40 40,120 120)','LINESTRING(40 40,60 120)');
+SELECT '260', ST_Relate('LINESTRING(40 40,120 120)','LINESTRING(60 240,40 40)');
+SELECT '261', ST_Relate('LINESTRING(40 40,180 180)','LINESTRING(120 120,20 200)');
+SELECT '262', ST_Relate('LINESTRING(40 40,120 120)','LINESTRING(60 240,120 120)');
+SELECT '263', ST_Relate('LINESTRING(40 40,180 180)','LINESTRING(20 180,140 140)');
+SELECT '264', ST_Relate('LINESTRING(40 40,120 120)','LINESTRING(40 120,120 40)');
+SELECT '265', ST_Relate('LINESTRING(40 40,100 100)','LINESTRING(40 40,100 100)');
+SELECT '266', ST_Relate('LINESTRING(40 40,100 100)','LINESTRING(100 100,40 40)');
+SELECT '267', ST_Relate('LINESTRING(40 40,120 120)','LINESTRING(40 120,120 160)');
+SELECT '268', ST_Relate('LINESTRING(20 20,180 180)','LINESTRING(20 20,180 180)');
+SELECT '269', ST_Relate('LINESTRING(20 20,180 180)','LINESTRING(20 20,110 110)');
+SELECT '270', ST_Relate('LINESTRING(20 20,180 180)','LINESTRING(50 50,140 140)');
+SELECT '271', ST_Relate('LINESTRING(180 180,40 40)','LINESTRING(120 120,260 260)');
+SELECT '272', ST_Relate('LINESTRING(40 40,180 180)','LINESTRING(260 260,120 120)');
+SELECT '273', ST_Relate('LINESTRING(40 40,180 180)','LINESTRING(120 120,260 260)');
+SELECT '274', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(40 40,20 100,40 160,20 200)');
+SELECT '275', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(20 200,40 160,20 100,40 40)');
+SELECT '276', ST_Relate('LINESTRING(80 240,200 120,100 100,40 40)','LINESTRING(20 200,40 160,20 100,40 40)');
+SELECT '277', ST_Relate('LINESTRING(60 60,60 230,140 230,250 160)','LINESTRING(20 20,60 60,250 160,310 230)');
+SELECT '278', ST_Relate('LINESTRING(60 60,60 230,140 230,250 160)','LINESTRING(20 20,110 110,200 110,320 230)');
+SELECT '279', ST_Relate('LINESTRING(60 110,60 250,360 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)');
+SELECT '280', ST_Relate('LINESTRING(60 110,60 250,360 210)','LINESTRING(360 210,310 160,110 160,60 110)');
+SELECT '281', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(160 160,240 240)');
+SELECT '282', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(240 240,160 160)');
+SELECT '283', ST_Relate('LINESTRING(60 60,60 230,140 230,250 160)','LINESTRING(60 150,110 100,170 100,110 230)');
+SELECT '284', ST_Relate('LINESTRING(60 60,60 230,140 230,250 160)','LINESTRING(60 110,110 160,250 160,310 160,360 210)');
+SELECT '285', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(200 120,200 190,150 240,200 240)');
+SELECT '286', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(200 240,150 240,200 200,200 120)');
+SELECT '287', ST_Relate('LINESTRING(60 60,60 230,140 230,250 160)','LINESTRING(60 230,80 140,120 140,140 230)');
+SELECT '288', ST_Relate('LINESTRING(60 110,200 110,250 160,300 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)');
+SELECT '289', ST_Relate('LINESTRING(60 110,200 110,250 160,300 210,360 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)');
+SELECT '290', ST_Relate('LINESTRING(60 110,220 110,250 160,280 110)','LINESTRING(60 110,110 160,250 160,310 160,360 210)');
+SELECT '291', ST_Relate('LINESTRING(60 110,150 110,200 160,250 110,360 110,360 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)');
+SELECT '292', ST_Relate('LINESTRING(130 160,160 110,220 110,250 160,250 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)');
+SELECT '293', ST_Relate('LINESTRING(130 160,160 110,190 110,230 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)');
+SELECT '294', ST_Relate('LINESTRING(130 160,160 110,200 110,230 160,260 210,360 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)');
+SELECT '295', ST_Relate('LINESTRING(130 160,160 110,200 110,230 160,260 210,360 210,380 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)');
+SELECT '296', ST_Relate('LINESTRING(130 160,160 110,200 110,230 160,260 210,380 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)');
+SELECT '297', ST_Relate('LINESTRING(110 160,160 110,200 110,250 160,250 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)');
+SELECT '298', ST_Relate('LINESTRING(110 160,180 110,250 160,320 110)','LINESTRING(60 110,110 160,250 160,310 160,360 210)');
+SELECT '299', ST_Relate('LINESTRING(140 160,180 80,220 160,250 80)','LINESTRING(60 110,110 160,250 160,310 160,360 210)');
+SELECT '300', ST_Relate('LINESTRING(40 40,100 100,200 120,130 190)','LINESTRING(20 130,70 130,160 40)');
+SELECT '301', ST_Relate('LINESTRING(40 40,100 100,200 120,130 190)','LINESTRING(40 160,40 100,110 40,170 40)');
+SELECT '302', ST_Relate('LINESTRING(130 110,180 160,230 110,280 160,330 110)','LINESTRING(60 110,110 160,250 160,310 160,360 210)');
+SELECT '303', ST_Relate('LINESTRING(40 40,100 100,200 120,130 190)','LINESTRING(30 140,80 140,100 100,200 30)');
+SELECT '304', ST_Relate('LINESTRING(110 110,110 160,180 110,250 160,250 110)','LINESTRING(60 110,110 160,250 160,310 160,360 210)');
+SELECT '305', ST_Relate('LINESTRING(20 20,80 80,160 80,240 80,300 140)','LINESTRING(20 60,60 60,60 140,80 80,100 20,140 140,180 20,200 80,220 20,240 80,300 80,270 110,200 110)');
+SELECT '306', ST_Relate('LINESTRING(20 20,230 20,20 30,170 30,20 40,230 40,20 50,230 60,60 60,230 70,20 70,180 80,60 80,230 90,20 90,230 100,30 100,210 110,20 110,80 120,20 130,170 130,90 120,230 130,170 140,230 140,80 150,160 140,20 140,70 150,20 150,230 160,80 160,230 170,20 160,180 170,20 170,230 180,20 180,40 190,230 190,20 200,230 200)','LINESTRING(30 210,30 60,40 210,40 30,50 190,50 20,60 160,60 50,70 220,70 50,80 20,80 210,90 50,90 150,100 30,100 210,110 20,110 190,120 50,120 180,130 210,120 20,140 210,130 50,150 210,130 20,160 210,140 30,170 210,150 20,180 210,160 20,190 210,180 80,170 50,170 20,180 70,180 20,190 190,190 30,200 210,200 30,210 210,210 20,220 150,220 20)');
+SELECT '307', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(40 40,100 100,200 120,80 240)');
+SELECT '308', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(80 240,200 120,100 100,40 40)');
+SELECT '309', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(80 240,120 200,200 120,100 100,80 80,40 40)');
+SELECT '310', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(260 210,240 130,280 120,260 40)');
+SELECT '311', ST_Relate('LINESTRING(100 20,20 20,20 160,210 160,210 20,110 20,50 120,120 150,200 150)','LINESTRING(140 130,100 110,120 60,170 60)');
+SELECT '312', ST_Relate('LINESTRING(60 110,110 160,250 160,310 160,360 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)');
+SELECT '313', ST_Relate('LINESTRING(60 110,110 160,310 160,360 210)','LINESTRING(60 110,110 160,250 160,310 160,360 210)');
+SELECT '314', ST_Relate('LINESTRING(60 110,110 160,250 160,310 160,360 210)','LINESTRING(60 110,110 160,250 160)');
+SELECT '315', ST_Relate('LINESTRING(60 110,110 160,250 160,310 160,360 210)','LINESTRING(110 160,310 160,340 190)');
+SELECT '316', ST_Relate('LINESTRING(60 110,110 160,250 160,310 160,360 210)','LINESTRING(140 160,250 160,310 160,340 190)');
+SELECT '317', ST_Relate('LINESTRING(60 110,110 160,250 160,310 160,360 210)','LINESTRING(110 160,250 160,310 160)');
+SELECT '318', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(200 120,100 100,40 40,140 80,200 40)');
+SELECT '319', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(280 240,240 140,200 120,100 100,40 40)');
+SELECT '320', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(80 190,140 140,40 40)');
+SELECT '321', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(240 200,200 260,80 240,140 180)');
+SELECT '322', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(140 180,80 240,200 260,240 200)');
+SELECT '323', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(280 240,240 140,200 120,80 240)');
+SELECT '324', ST_Relate('LINESTRING(20 20,80 80,160 80,240 80,300 140)','LINESTRING(20 80,120 80,200 80,260 20)');
+SELECT '325', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(100 100,200 120,240 140,280 240)');
+SELECT '326', ST_Relate('LINESTRING(40 40,100 100,200 120,80 240)','LINESTRING(280 240,240 140,200 120,100 100)');
+SELECT '327', ST_Relate('LINESTRING(20 20,80 80,160 80,240 80,300 140)','LINESTRING(80 20,80 80,240 80,300 20)');
+SELECT '328', ST_Relate('LINESTRING(20 20,80 80,160 80,240 80,300 140)','LINESTRING(20 80,80 80,120 80,140 140,160 80,200 80,220 20,240 80,270 110,300 80)');
+SELECT '329', ST_Relate('LINESTRING(100 100,20 180,180 180)','LINESTRING(100 100,180 20,20 20,100 100)');
+SELECT '330', ST_Relate('LINESTRING(20 100,180 100,100 180)','LINESTRING(100 100,180 20,20 20,100 100)');
+SELECT '331', ST_Relate('LINESTRING(100 40,100 160,180 160)','LINESTRING(100 100,180 20,20 20,100 100)');
+SELECT '332', ST_Relate('LINESTRING(20 100,100 100,180 100,100 180)','LINESTRING(100 100,180 20,20 20,100 100)');
+SELECT '333', ST_Relate('LINESTRING(100 100,160 40)','LINESTRING(100 100,180 20,20 20,100 100)');
+SELECT '334', ST_Relate('LINESTRING(100 100,180 20)','LINESTRING(100 100,180 20,20 20,100 100)');
+SELECT '335', ST_Relate('LINESTRING(60 60,100 100,140 60)','LINESTRING(100 100,180 20,20 20,100 100)');
+SELECT '336', ST_Relate('LINESTRING(100 100,190 10,190 100)','LINESTRING(100 100,180 20,20 20,100 100)');
+SELECT '337', ST_Relate('LINESTRING(100 100,160 40,160 100)','LINESTRING(100 100,180 20,20 20,100 100)');
+SELECT '338', ST_Relate('LINESTRING(60 140,160 40,160 140)','LINESTRING(100 100,180 20,20 20,100 100)');
+SELECT '339', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(80 80,20 80,140 80,80 20,80 140)');
+SELECT '340', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(80 80,20 80,140 80)');
+SELECT '341', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(80 80,140 80,80 20,80 140)');
+SELECT '342', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(80 80,20 80,140 80,80 20,80 80)');
+SELECT '343', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(80 80,20 80,140 80,80 80)');
+SELECT '344', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(80 80,20 80,20 140,140 20,80 20,80 80)');
+SELECT '345', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(20 140,140 20,100 20,100 80)');
+SELECT '346', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(140 80,20 80,120 80,80 20,80 140)');
+SELECT '347', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(140 80,20 80,140 80)');
+SELECT '348', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(140 80,20 80,80 140,80 20)');
+SELECT '349', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(140 80,80 80,20 80,50 140,50 60)');
+SELECT '350', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(140 80,20 80,120 80,80 20,80 80,80 140)');
+SELECT '351', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(140 80,20 80,80 80,140 80)');
+SELECT '352', ST_Relate('LINESTRING(20 20,140 140)','LINESTRING(140 80,20 80,80 140,80 80,80 20)');
+SELECT '353', ST_Relate('LINESTRING(130 150,220 150,220 240)','LINESTRING(130 240,130 150,220 20,50 20,130 150)');
+SELECT '354', ST_Relate('LINESTRING(30 150,130 150,250 150)','LINESTRING(130 240,130 150,220 20,50 20,130 150)');
+SELECT '355', ST_Relate('LINESTRING(30 150,250 150)','LINESTRING(130 240,130 150,220 20,50 20,130 150)');
+SELECT '356', ST_Relate('LINESTRING(30 150,130 150,250 150)','LINESTRING(130 240,130 20,30 20,130 150)');
+SELECT '357', ST_Relate('LINESTRING(30 150,250 150)','LINESTRING(120 240,120 20,20 20,120 170)');
+SELECT '358', ST_Relate('LINESTRING(200 200,20 20,200 20,110 110,20 200,110 200,110 110)','LINESTRING(110 110,200 110)');
+SELECT '359', ST_Relate('LINESTRING(110 110,200 110)','LINESTRING(200 200,20 20,200 20,110 110,20 200,110 200,110 110)');
+SELECT '360', ST_Relate('LINESTRING(20 110,200 110)','LINESTRING(200 200,20 20,200 20,110 110,20 200,110 200,110 110)');
+SELECT '361', ST_Relate('LINESTRING(200 200,20 20,200 20,110 110,20 200,110 200,110 110)','LINESTRING(20 110,200 110)');
+SELECT '362', ST_Relate('LINESTRING(90 200,90 130,110 110,150 200)','LINESTRING(200 200,20 20,200 20,20 200,20 130,90 130)');
+SELECT '363', ST_Relate('LINESTRING(200 110,110 110,90 130,90 200)','LINESTRING(200 200,20 20,200 20,20 200,20 130,90 130)');
+SELECT '364', ST_Relate('LINESTRING(80 80,150 80,210 80)','MULTILINESTRING((20 20,140 140),(20 140,140 20))');
+SELECT '365', ST_Relate('LINESTRING(40 80,160 200,260 20,40 80)','LINESTRING(40 80,160 200,260 20,40 80)');
+SELECT '366', ST_Relate('LINESTRING(40 80,160 200,260 20,40 80)','LINESTRING(40 80,260 20,160 200,40 80)');
+SELECT '367', ST_Relate('LINESTRING(40 80,160 200,260 20,40 80)','LINESTRING(260 20,40 80,160 200,260 20)');
+SELECT '368', ST_Relate('LINESTRING(40 80,160 200,260 20,40 80)','LINESTRING(100 140,160 200,260 20,40 80,100 140)');
+SELECT '369', ST_Relate('LINESTRING(100 100,180 20,20 20,100 100)','LINESTRING(100 100,180 180,20 180,100 100)');
+SELECT '370', ST_Relate('LINESTRING(40 150,40 40,150 40,150 150,40 150)','LINESTRING(40 150,150 40,170 20,170 190,40 150)');
+SELECT '371', ST_Relate('LINESTRING(100 100,180 20,20 20,100 100)','LINESTRING(180 100,20 100,100 180,180 100)');
+SELECT '372', ST_Relate('LINESTRING(100 100,180 20,20 20,100 100)','LINESTRING(180 180,100 100,20 180,180 180)');
+SELECT '373', ST_Relate('LINESTRING(20 180,100 100,20 20,20 180)','LINESTRING(100 20,100 180,180 100,100 20)');
+SELECT '374', ST_Relate('LINESTRING(40 150,40 40,150 40,150 150,40 150)','LINESTRING(170 20,20 170,170 170,170 20)');
+SELECT '375', ST_Relate('LINESTRING(40 150,40 40,150 40,150 150,40 150)','LINESTRING(40 150,150 150,90 210,40 150)');
+SELECT '376', ST_Relate('LINESTRING(40 150,40 40,150 40,150 150,40 150)','LINESTRING(20 150,170 150,90 230,20 150)');
+SELECT '377', ST_Relate('LINESTRING(40 150,40 40,150 40,150 150,40 150)','LINESTRING(40 150,150 150,150 40,20 40,20 150,40 150)');
+SELECT '378', ST_Relate('LINESTRING(110 110,200 20,20 20,110 110)','LINESTRING(110 110,200 200,110 110,20 200,20 110,200 110)');
+SELECT '379', ST_Relate('LINESTRING(110 110,200 20,20 20,110 110)','LINESTRING(110 110,20 110,200 110,50 110,110 170)');
+SELECT '380', ST_Relate('LINESTRING(110 110,200 20,20 20,110 110)','LINESTRING(110 110,20 200,110 200,110 110,200 200)');
+SELECT '381', ST_Relate('LINESTRING(110 110,200 20,20 20,110 110)','LINESTRING(200 20,20 200,200 200,110 110,110 40)');
+SELECT '382', ST_Relate('LINESTRING(110 110,200 20,20 20,110 110)','LINESTRING(200 20,20 200,200 200,20 20)');
+SELECT '383', ST_Relate('LINESTRING(110 110,20 110,110 20,20 20,110 110)','LINESTRING(110 110,200 200,110 200,200 110,110 110)');
+SELECT '384', ST_Relate('LINESTRING(20 120,120 120,20 20,120 20,20 120)','LINESTRING(170 100,70 100,170 170,70 170,170 100)');
+SELECT '385', ST_Relate('LINESTRING(20 110,110 110,20 20,110 20,20 110)','LINESTRING(110 160,70 110,60 160,20 130,110 160)');
+SELECT '386', ST_Relate('LINESTRING(20 200,200 200,20 20,200 20,20 200)','LINESTRING(20 110,200 110,200 160,20 60,20 110)');
+SELECT '387', ST_Relate('LINESTRING(20 110,110 110,20 20,110 20,20 110)','LINESTRING(200 200,110 110,200 110,110 200,200 200)');
+SELECT '388', ST_Relate('LINESTRING(20 120,120 120,20 20,120 20,20 120)','LINESTRING(220 120,120 20,220 20,120 120,220 120)');
+SELECT '389', ST_Relate('MULTILINESTRING((70 20,20 90,70 170),(70 170,120 90,70 20))','MULTILINESTRING((70 20,20 90,70 170),(70 170,120 90,70 20))');
+SELECT '390', ST_Relate('MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))','MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))');
+SELECT '391', ST_Relate('MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))','MULTILINESTRING((90 140,90 60,90 20),(170 20,130 20,20 20))');
+SELECT '392', ST_Relate('MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))','MULTILINESTRING((90 20,170 100,170 140),(170 60,90 20,20 60),(130 100,130 60,90 20,50 90))');
+SELECT '393', ST_Relate('MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))','MULTILINESTRING((90 20,170 100,170 140),(130 140,130 60,90 20,20 90,90 20,130 60,170 60))');
+SELECT '394', ST_Relate('MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))','MULTILINESTRING((90 20,170 100,170 140),(170 60,90 20,20 60))');
+SELECT '395', ST_Relate('MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))','MULTILINESTRING((90 20,170 100,170 140),(170 60,90 20,20 60),(130 100,90 20))');
+SELECT '396', ST_Relate('MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))','MULTILINESTRING((90 20,170 100,170 140),(170 60,90 20,20 60),(120 100,170 100,90 20))');
+SELECT '397', ST_Relate('MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))','MULTILINESTRING((90 20,170 100,170 140),(170 60,90 20,20 60),(120 100,170 100,90 20))');
+SELECT '398', ST_Relate('MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))','MULTILINESTRING((90 20,170 100,170 140),(130 140,130 60,90 20,20 90,90 20))');
+SELECT '399', ST_Relate('MULTILINESTRING((20 20,90 20,170 20),(90 20,90 80,90 140))','MULTILINESTRING((90 20,170 100,170 140),(170 60,90 20,20 60,20 140,90 20))');
+SELECT '400', ST_Relate('MULTILINESTRING((20 20,90 90,20 160),(90 160,90 20))','MULTILINESTRING((160 160,90 90,160 20),(160 120,120 120,90 90,160 60))');
+SELECT '401', ST_Relate('MULTILINESTRING((20 20,90 90,20 160),(90 160,90 20))','MULTILINESTRING((160 160,90 90,160 20),(160 120,120 120,90 90,120 60,160 60))');
+SELECT '402', ST_Relate('MULTILINESTRING((20 20,90 90,20 160),(90 160,90 20))','MULTILINESTRING((160 160,90 90,160 20),(160 120,90 90,160 60))');
+SELECT '403', ST_Relate('POINT(20 20)','POLYGON((60 120,60 40,160 40,160 120,60 120))');
+SELECT '404', ST_Relate('POINT(70 170)','POLYGON((110 230,80 160,20 160,20 20,200 20,200 160,140 160,110 230))');
+SELECT '405', ST_Relate('POINT(110 130)','POLYGON((20 160,80 160,110 100,140 160,200 160,200 20,20 20,20 160))');
+SELECT '406', ST_Relate('POINT(100 70)','POLYGON((20 150,100 150,40 50,170 50,110 150,190 150,190 20,20 20,20 150))');
+SELECT '407', ST_Relate('POINT(100 70)','POLYGON((20 150,100 150,40 50,160 50,100 150,180 150,180 20,20 20,20 150))');
+SELECT '408', ST_Relate('POINT(60 120)','POLYGON((60 120,60 40,160 40,160 120,60 120))');
+SELECT '409', ST_Relate('POINT(110 120)','POLYGON((60 120,60 40,160 40,160 120,60 120))');
+SELECT '410', ST_Relate('POINT(160 120)','POLYGON((60 120,60 40,160 40,160 120,60 120))');
+SELECT '411', ST_Relate('POINT(100 150)','POLYGON((20 150,100 150,40 50,160 50,100 150,180 150,180 20,20 20,20 150))');
+SELECT '412', ST_Relate('POINT(100 80)','POLYGON((60 120,60 40,160 40,160 120,60 120))');
+SELECT '413', ST_Relate('POINT(60 160)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))');
+SELECT '414', ST_Relate('POINT(190 90)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))');
+SELECT '415', ST_Relate('POINT(190 190)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))');
+SELECT '416', ST_Relate('POINT(360 20)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))');
+SELECT '417', ST_Relate('POINT(130 130)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))');
+SELECT '418', ST_Relate('POINT(280 50)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))');
+SELECT '419', ST_Relate('POINT(150 100)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))');
+SELECT '420', ST_Relate('POINT(100 50)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))');
+SELECT '421', ST_Relate('POINT(140 120)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))');
+SELECT '422', ST_Relate('POINT(190 50)','POLYGON((190 190,360 20,20 20,190 190),(90 50,150 110,190 50,90 50),(190 50,230 110,290 50,190 50))');
+SELECT '423', ST_Relate('POINT(180 90)','POLYGON((190 190,360 20,20 20,190 190),(180 140,180 40,80 40,180 140),(180 90,210 140,310 40,230 40,180 90))');
+SELECT '424', ST_Relate('MULTIPOINT(20 80,110 160,20 160)','POLYGON((60 120,60 40,160 40,160 120,60 120))');
+SELECT '425', ST_Relate('MULTIPOINT(20 80,60 120,20 160)','POLYGON((60 120,60 40,160 40,160 120,60 120))');
+SELECT '426', ST_Relate('MULTIPOINT(10 80,110 170,110 120)','POLYGON((60 120,60 40,160 40,160 120,60 120))');
+SELECT '427', ST_Relate('MULTIPOINT(10 80,110 170,160 120)','POLYGON((60 120,60 40,160 40,160 120,60 120))');
+SELECT '428', ST_Relate('MULTIPOINT(20 120,60 120,110 120,160 120,200 120)','POLYGON((60 120,60 40,160 40,160 120,60 120))');
+SELECT '429', ST_Relate('MULTIPOINT(60 120,110 120,160 120)','POLYGON((60 120,60 40,160 40,160 120,60 120))');
+SELECT '430', ST_Relate('MULTIPOINT(60 120,160 120,160 40,60 40)','POLYGON((60 120,60 40,160 40,160 120,60 120))');
+SELECT '431', ST_Relate('MULTIPOINT(20 150,60 120,110 80)','POLYGON((60 120,60 40,160 40,160 120,60 120))');
+SELECT '432', ST_Relate('MULTIPOINT(110 80,160 120,200 160)','POLYGON((60 120,60 40,160 40,160 120,60 120))');
+SELECT '433', ST_Relate('MULTIPOINT(110 80,110 120,110 160)','POLYGON((60 120,60 40,160 40,160 120,60 120))');
+SELECT '434', ST_Relate('MULTIPOINT(110 170,110 80)','POLYGON((60 120,60 40,160 40,160 120,60 120))');
+SELECT '435', ST_Relate('MULTIPOINT(60 120,160 120,110 80,110 170)','POLYGON((60 120,60 40,160 40,160 120,60 120))');
+SELECT '436', ST_Relate('MULTIPOINT(90 80,130 80)','POLYGON((60 120,60 40,160 40,160 120,60 120))');
+SELECT '437', ST_Relate('MULTIPOINT(60 120,160 120,110 80)','POLYGON((60 120,60 40,160 40,160 120,60 120))');
+SELECT '438', ST_Relate('MULTIPOINT(40 170,40 90,130 170)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))');
+SELECT '439', ST_Relate('MULTIPOINT(90 170,280 170,190 90)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))');
+SELECT '440', ST_Relate('MULTIPOINT(190 110,150 70,230 70)','POLYGON((190 190,360 20,20 20,190 190),(280 50,100 50,190 140,280 50))');
+SELECT '441', ST_Relate('POINT(100 100)','MULTIPOLYGON(((20 100,20 20,100 20,100 100,20 100)),((100 180,100 100,180 100,180 180,100 180)))');
+SELECT '442', ST_Relate('POINT(20 100)','MULTIPOLYGON(((20 100,20 20,100 20,100 100,20 100)),((100 180,100 100,180 100,180 180,100 180)))');
+SELECT '443', ST_Relate('POINT(60 100)','MULTIPOLYGON(((20 100,20 20,100 20,100 100,20 100)),((100 180,100 100,180 100,180 180,100 180)))');
+SELECT '444', ST_Relate('POINT(110 110)','MULTIPOLYGON(((110 110,20 200,200 200,110 110),(110 110,80 180,140 180,110 110)),((110 110,20 20,200 20,110 110),(110 110,80 40,140 40,110 110)))');
+SELECT '445', ST_Relate('POINT(110 200)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '446', ST_Relate('POINT(90 80)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '447', ST_Relate('POINT(340 240)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '448', ST_Relate('POINT(230 150)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '449', ST_Relate('POINT(160 150)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '450', ST_Relate('POINT(90 150)','LINESTRING(150 150,20 20,280 20,150 150)');
+SELECT '451', ST_Relate('POINT(150 80)','LINESTRING(150 150,20 20,280 20,150 150)');
+SELECT '452', ST_Relate('POINT(150 150)','LINESTRING(150 150,20 20,280 20,150 150)');
+SELECT '453', ST_Relate('POINT(100 20)','LINESTRING(150 150,20 20,280 20,150 150)');
+SELECT '454', ST_Relate('POINT(20 20)','LINESTRING(150 150,20 20,280 20,150 150)');
+SELECT '455', ST_Relate('POINT(220 220)','LINESTRING(110 110,220 20,20 20,110 110,220 220)');
+SELECT '456', ST_Relate('POINT(110 110)','LINESTRING(110 110,220 20,20 20,110 110,220 220)');
+SELECT '457', ST_Relate('POINT(110 110)','LINESTRING(110 110,220 20,20 20,220 220)');
+SELECT '458', ST_Relate('POINT(110 20)','LINESTRING(110 110,220 20,20 20,220 220)');
+SELECT '459', ST_Relate('POINT(220 20)','LINESTRING(110 110,220 20,20 20,220 220)');
+SELECT '460', ST_Relate('POINT(110 20)','LINESTRING(220 220,20 20,220 20,110 110)');
+SELECT '461', ST_Relate('POINT(20 20)','LINESTRING(220 220,20 20,220 20,110 110)');
+SELECT '462', ST_Relate('POINT(20 110)','LINESTRING(20 200,20 20,110 20,20 110,110 200)');
+SELECT '463', ST_Relate('POINT(20 200)','LINESTRING(20 200,200 20,20 20,200 200)');
+SELECT '464', ST_Relate('POINT(110 110)','LINESTRING(20 200,200 20,140 20,140 80,80 140,20 140)');
+SELECT '465', ST_Relate('POINT(110 110)','LINESTRING(20 200,200 20,20 20,200 200)');
+SELECT '466', ST_Relate('POINT(80 140)','LINESTRING(20 200,110 110,200 20,140 20,140 80,110 110,80 140,20 140)');
+SELECT '467', ST_Relate('POINT(110 110)','LINESTRING(20 200,110 110,200 20,140 20,140 80,110 110,80 140,20 140)');
+SELECT '468', ST_Relate('POINT(110 110)','LINESTRING(20 200,200 20,140 20,140 80,110 110,80 140,20 140)');
+SELECT '469', ST_Relate('POINT(110 110)','LINESTRING(20 200,110 110,200 20,20 20,110 110,200 200)');
+SELECT '470', ST_Relate('POINT(110 110)','LINESTRING(20 200,200 20,20 20,110 110,200 200)');
+SELECT '471', ST_Relate('POINT(110 110)','LINESTRING(20 200,110 110,20 20,200 20,110 110,200 200)');
+SELECT '472', ST_Relate('POINT(110 110)','LINESTRING(110 110,110 200,20 200,110 110,200 20,140 20,140 80,110 110,80 140,20 140)');
+SELECT '473', ST_Relate('POINT(110 110)','LINESTRING(110 110,110 200,20 200,200 20,140 20,140 80,110 110,80 140,20 140)');
+SELECT '474', ST_Relate('POINT(110 110)','LINESTRING(110 110,110 200,20 200,200 20,140 20,140 80,80 140,20 140)');
+SELECT '475', ST_Relate('POINT(110 110)','LINESTRING(110 110,110 200,20 200,110 110,200 20,20 20,110 110,200 200)');
+SELECT '476', ST_Relate('POINT(110 110)','LINESTRING(110 110,110 200,20 200,200 20,20 20,110 110,200 200)');
+SELECT '477', ST_Relate('POINT(110 110)','LINESTRING(110 110,110 200,20 200,200 20,20 20,200 200)');
+SELECT '478', ST_Relate('POINT(110 110)','LINESTRING(110 110,110 200,20 200,110 110,20 20,200 20,110 110,200 200)');
+SELECT '479', ST_Relate('POINT(110 110)','LINESTRING(110 110,110 200,20 200,200 20,200 110,110 110,200 200)');
+SELECT '480', ST_Relate('POINT(110 110)','LINESTRING(200 200,110 110,20 20,200 20,110 110,20 200,110 200,110 110)');
+SELECT '481', ST_Relate('POINT(110 110)','LINESTRING(200 200,20 20,200 20,110 110,20 200,110 200,110 110)');
+SELECT '482', ST_Relate('POINT(110 110)','LINESTRING(200 200,20 20,200 20,20 200,110 200,110 110)');
+SELECT '483', ST_Relate('POINT(110 110)','LINESTRING(200 200,110 110,200 20,20 20,110 110,20 200,110 200,110 110)');
+SELECT '484', ST_Relate('POINT(110 110)','LINESTRING(200 200,20 20,20 110,110 110,20 200,110 200,110 110)');
+SELECT '485', ST_Relate('POINT(110 160)','LINESTRING(110 160,200 250,110 250,110 160,110 110,110 20,20 20,110 110)');
+SELECT '486', ST_Relate('POINT(110 160)','LINESTRING(110 160,200 250,110 250,110 110,110 20,20 20,110 110)');
+SELECT '487', ST_Relate('POINT(110 110)','LINESTRING(110 160,200 250,110 250,110 160,110 110,110 20,20 20,110 110)');
+SELECT '488', ST_Relate('POINT(110 110)','LINESTRING(110 160,200 250,110 250,110 160,110 20,20 20,110 110)');
+SELECT '489', ST_Relate('POINT(110 110)','LINESTRING(110 110,200 200,110 200,110 110,110 20,20 20,110 110)');
+SELECT '490', ST_Relate('POINT(110 110)','LINESTRING(110 110,200 200,110 200,110 20,20 20,110 110)');
+SELECT '491', ST_Relate('POINT(140 200)','LINESTRING(110 110,200 200,110 200,110 110,110 20,20 20,110 110)');
+SELECT '492', ST_Relate('POINT(110 200)','LINESTRING(110 110,200 200,110 200,110 110,110 20,20 20,110 110)');
+SELECT '493', ST_Relate('POINT(110 110)','LINESTRING(110 110,200 200,110 200,110 110,110 20,200 20,110 110)');
+SELECT '494', ST_Relate('POINT(140 200)','LINESTRING(110 110,200 200,110 200,110 110,110 20,200 20,110 110)');
+SELECT '495', ST_Relate('POINT(110 200)','LINESTRING(110 110,200 200,110 200,110 110,110 20,200 20,110 110)');
+SELECT '496', ST_Relate('POINT(90 130)','LINESTRING(90 130,20 130,20 200,90 130,200 20,20 20,200 200)');
+SELECT '497', ST_Relate('POINT(110 110)','LINESTRING(90 130,20 130,20 200,90 130,200 20,20 20,200 200)');
+SELECT '498', ST_Relate('POINT(90 130)','LINESTRING(90 130,20 130,20 200,200 20,20 20,200 200)');
+SELECT '499', ST_Relate('POINT(110 110)','LINESTRING(90 130,20 130,20 200,200 20,20 20,200 200)');
+SELECT '500', ST_Relate('POINT(90 130)','LINESTRING(200 200,20 20,200 20,90 130,20 200,20 130,90 130)');
+SELECT '501', ST_Relate('POINT(110 110)','LINESTRING(200 200,20 20,200 20,90 130,20 200,20 130,90 130)');
+SELECT '502', ST_Relate('POINT(90 130)','LINESTRING(200 200,20 20,200 20,20 200,20 130,90 130)');
+SELECT '503', ST_Relate('POINT(110 110)','LINESTRING(200 200,20 20,200 20,20 200,20 130,90 130)');
+SELECT '504', ST_Relate('POINT(110 110)','LINESTRING(110 110,20 130,20 200,110 110,200 20,20 20,110 110,200 200,200 130,110 110)');
+SELECT '505', ST_Relate('POINT(110 110)','LINESTRING(110 110,20 130,20 200,200 20,20 20,200 200,200 130,110 110)');
+SELECT '506', ST_Relate('POINT(110 110)','LINESTRING(110 110,80 200,20 200,110 110,200 20,20 20,110 110,200 200,140 200,110 110)');
+SELECT '507', ST_Relate('POINT(110 110)','LINESTRING(110 110,80 200,20 200,200 20,20 20,200 200,140 200,110 110)');
+SELECT '508', ST_Relate('POINT(110 110)','LINESTRING(200 200,20 20,200 20,20 200,200 200)');
+SELECT '509', ST_Relate('POINT(110 110)','LINESTRING(200 200,110 110,20 20,200 20,110 110,20 200,200 200)');
+SELECT '510', ST_Relate('POINT(110 110)','LINESTRING(200 200,110 110,200 20,20 20,110 110,20 200,200 200)');
+SELECT '511', ST_Relate('POINT(90 130)','LINESTRING(90 130,20 130,20 200,90 130,110 110,200 20,20 20,110 110,200 200,90 130)');
+SELECT '512', ST_Relate('POINT(90 130)','LINESTRING(90 130,20 130,20 200,110 110,200 20,20 20,110 110,200 200,90 130)');
+SELECT '513', ST_Relate('POINT(90 130)','LINESTRING(90 130,90 200,20 200,90 130,110 110,200 20,20 20,110 110,200 200,90 130)');
+SELECT '514', ST_Relate('POINT(90 130)','LINESTRING(90 130,90 200,20 200,200 20,20 20,200 200,90 130)');
+SELECT '515', ST_Relate('POINT(90 130)','LINESTRING(90 130,90 200,20 200,110 110,200 20,20 20,110 110,200 200,90 130)');
+SELECT '516', ST_Relate('POINT(90 130)','LINESTRING(90 130,90 200,20 200,200 20,20 20,200 200,90 130)');
+SELECT '517', ST_Relate('POINT(110 110)','LINESTRING(90 130,90 200,20 200,200 20,20 20,200 200,90 130)');
+SELECT '518', ST_Relate('POINT(110 200)','LINESTRING(110 200,110 110,20 20,200 20,110 110,110 200,200 200)');
+SELECT '519', ST_Relate('POINT(110 150)','LINESTRING(110 200,110 110,20 20,200 20,110 110,110 200,200 200)');
+SELECT '520', ST_Relate('POINT(110 110)','LINESTRING(110 200,110 110,20 20,200 20,110 110,110 200,200 200)');
+SELECT '521', ST_Relate('POINT(110 200)','LINESTRING(110 200,110 110,20 20,200 20,110 110,110 200)');
+SELECT '522', ST_Relate('POINT(110 150)','LINESTRING(110 200,110 110,20 20,200 20,110 110,110 200)');
+SELECT '523', ST_Relate('POINT(110 110)','LINESTRING(110 200,110 110,20 20,200 20,110 110,110 200)');
+SELECT '524', ST_Relate('POINT(110 150)','LINESTRING(20 200,110 200,110 110,20 20,200 20,110 110,110 200,200 200)');
+SELECT '525', ST_Relate('POINT(110 110)','LINESTRING(20 200,110 200,110 110,20 20,200 20,110 110,110 200,200 200)');
+SELECT '526', ST_Relate('POINT(110 200)','LINESTRING(20 200,110 200,110 110,20 20,200 20,110 110,110 200,200 200)');
+SELECT '527', ST_Relate('MULTIPOINT(50 250,90 220,130 190)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '528', ST_Relate('MULTIPOINT(180 180,230 130,280 80)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '529', ST_Relate('MULTIPOINT(50 120,90 80,130 40)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '530', ST_Relate('MULTIPOINT(300 280,340 240,380 200)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '531', ST_Relate('MULTIPOINT(230 150,260 120,290 90)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '532', ST_Relate('MULTIPOINT(200 190,240 150,270 110)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '533', ST_Relate('MULTIPOINT(160 150,190 120,220 90)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '534', ST_Relate('MULTIPOINT(120 190,160 150,200 110)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '535', ST_Relate('MULTIPOINT(90 80,160 150,340 240)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '536', ST_Relate('MULTIPOINT(90 80,160 150,300 150)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '537', ST_Relate('MULTIPOINT(90 80,160 150,240 150)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '538', ST_Relate('MULTIPOINT(90 80,130 120,210 150)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '539', ST_Relate('MULTIPOINT(130 120,210 150,340 200)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '540', ST_Relate('MULTIPOINT(160 150,240 150,340 210)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '541', ST_Relate('MULTIPOINT(160 150,300 150,340 150)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '542', ST_Relate('MULTIPOINT(160 150,240 150,340 240)','LINESTRING(90 80,160 150,300 150,340 150,340 240)');
+SELECT '543', ST_Relate('POINT(20 20)','POINT(20 20)');
+SELECT '544', ST_Relate('POINT(20 20)','POINT(40 60)');
+SELECT '545', ST_Relate('POINT(40 40)','MULTIPOINT(20 20,80 80,20 120)');
+SELECT '546', ST_Relate('POINT(20 20)','MULTIPOINT(20 20,80 80,20 120)');
+SELECT '547', ST_Relate('MULTIPOINT(40 40,80 60,120 100)','MULTIPOINT(40 40,80 60,120 100)');
+SELECT '548', ST_Relate('MULTIPOINT(40 40,80 60,120 100)','MULTIPOINT(40 40,120 100,80 60)');
+SELECT '549', ST_Relate('MULTIPOINT(40 40,60 100,100 60,120 120)','MULTIPOINT(20 120,60 60,100 100,140 40)');
+SELECT '550', ST_Relate('MULTIPOINT(20 20,80 70,140 120,200 170)','MULTIPOINT(20 20,80 70,140 120,200 170)');
+SELECT '551', ST_Relate('MULTIPOINT(20 20,140 120,80 70,200 170)','MULTIPOINT(80 70,20 20,200 170,140 120)');
+SELECT '552', ST_Relate('MULTIPOINT(20 20,80 70,140 120,200 170)','MULTIPOINT(80 70,140 120)');
+SELECT '553', ST_Relate('MULTIPOINT(80 70,20 20,200 170,140 120)','MULTIPOINT(140 120,80 70)');
+SELECT '554', ST_Relate('MULTIPOINT(80 70,20 20,200 170,140 120)','MULTIPOINT(80 170,140 120,200 80)');
+SELECT '555', ST_Relate('MULTIPOINT(80 70,20 20,200 170,140 120)','MULTIPOINT(80 170,140 120,200 80,80 70)');

Modified: trunk/regress/remove_repeated_points.sql
===================================================================
--- trunk/regress/remove_repeated_points.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/remove_repeated_points.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -16,7 +16,7 @@
                 0 2 2 4,
                 -2 0 0 0),
                 (-1 0 1 2,                                                                      0 0.5 2 4,
-                1 0 3 6,                                                                        0 1 3 4,                                                                        -1 0 1 2))'));        
+                1 0 3 6,                                                                        0 1 3 4,                                                                        -1 0 1 2))'));
 SELECT 10, ST_AsText(ST_RemoveRepeatedPoints('LINESTRING(0 0, 0 0)'));
 SELECT 11, ST_AsText(ST_RemoveRepeatedPoints('LINESTRING(0 0, 0 0, 0 0, 0 0, 0 0)'));
 SELECT 12, ST_SRID(ST_RemoveRepeatedPoints('SRID=3;LINESTRING(0 0, 0 0, 0 0, 0 0, 0 0)'));

Modified: trunk/regress/setpoint.sql
===================================================================
--- trunk/regress/setpoint.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/setpoint.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -8,19 +8,19 @@
 SELECT ST_SetPoint('MULTIPOINT(0 0, 1 1, 2 2)', 3, 'POINT(9 9)');
 SELECT ST_SetPoint('LINESTRING(0 0, 1 1, 2 2)', -1, 'MULTIPOINT(9 9, 0 0)');
 
--- Replacing 3dz line with 3dm point 
+-- Replacing 3dz line with 3dm point
 SELECT ST_asewkt(ST_SetPoint('LINESTRING(-1 -1 -1, 1 1 1, 2 2 2)', 0, 'POINT(90 91 92)'));
 
--- Replacing 3dm line with 3dz point 
+-- Replacing 3dm line with 3dz point
 SELECT ST_asewkt(ST_SetPoint('LINESTRINGM(0 0 0, 1 1 1, 2 2 2)', 1, 'POINTM(90 91 92)'));
 
--- Replacing 3dm line with 4d point 
+-- Replacing 3dm line with 4d point
 SELECT ST_asewkt(ST_SetPoint('LINESTRINGM(0 0 0, 1 1 1, 2 2 2)', 2, 'POINT(90 91 92 93)'));
 
--- Replacing 3dz line with 4d point 
+-- Replacing 3dz line with 4d point
 SELECT ST_asewkt(ST_SetPoint('LINESTRING(0 0 0, 1 1 1, 2 2 2)', 1, 'POINT(90 91 92 93)'));
 
--- Replacing 4d line with 2d/3dm/3dz/4d point 
+-- Replacing 4d line with 2d/3dm/3dz/4d point
 SELECT ST_asewkt(ST_SetPoint('LINESTRING(0 0 0 0, 1 1 1 1, 2 2 2 2, 4 4 4 4)', 3, 'POINT(90 91)'));
 SELECT ST_asewkt(ST_SetPoint('LINESTRING(0 0 0 0, 1 1 1 1, 2 2 2 2, 4 4 4 4)', 2, 'POINT(90 91 92)'));
 SELECT ST_asewkt(ST_SetPoint('LINESTRING(0 0 0 0, 1 1 1 1, 2 2 2 2, 4 4 4 4)', 1, 'POINTM(90 91 92)'));

Modified: trunk/regress/sfcgal/concave_hull.sql
===================================================================
--- trunk/regress/sfcgal/concave_hull.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/sfcgal/concave_hull.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,23 +1,23 @@
 SET postgis.backend = 'sfcgal';
 
--- Tests to confirm the concave hull area is <= convex hull and 
+-- Tests to confirm the concave hull area is <= convex hull and
 -- covers the original geometry (can't use covers because always gives topo errors with 3.3
 -- vmora: the small tolerance for area comes from the reordering of the geometry that
 --        cause small errors on area to cummulate (difference of 5e-13 on 2224 in this case)
-SELECT 
+SELECT
 	'ST_ConcaveHull MultiPolygon 0.95', ST_Area(ST_Intersection(geom,ST_ConcaveHull(
-		geom, 0.95) )) - ST_Area(geom) < 1e-9 As encloses_geom, 
-		(ST_Area(ST_ConvexHull(geom)) 
+		geom, 0.95) )) - ST_Area(geom) < 1e-9 As encloses_geom,
+		(ST_Area(ST_ConvexHull(geom))
 		- ST_Area(ST_ConcaveHull(geom, 0.95))) < (0.95 * ST_Area(ST_ConvexHull(geom) ) ) As reached_target
-FROM ST_Union(ST_GeomFromText('POLYGON((175 150, 20 40, 
+FROM ST_Union(ST_GeomFromText('POLYGON((175 150, 20 40,
 			50 60, 125 100, 175 150))'),
 		ST_Buffer(ST_GeomFromText('POINT(110 170)'), 20)
 		) As geom;
 		
-SELECT 
+SELECT
 	'ST_ConcaveHull Lines 0.80', ST_Intersection(geom,ST_ConcaveHull(
-		geom, 0.80) ) = geom As encloses_geom, 
-		(ST_Area(ST_ConvexHull(geom)) 
+		geom, 0.80) ) = geom As encloses_geom,
+		(ST_Area(ST_ConvexHull(geom))
 		- ST_Area(ST_ConcaveHull(geom, 0.80))) < (0.80 * ST_Area(ST_ConvexHull(geom) ) ) As reached_target
 
 FROM ST_GeomFromText('MULTILINESTRING((106 164,30 112,74 70,82 112,130 94,
@@ -30,9 +30,9 @@
 132 186,92 182,56 158,36 150,62 150,76 128,88 118))') As geom;
 
 -- test holes vs. no holes - holes should still enclose but have smaller area than no holes --
-SELECT 
+SELECT
 	'ST_ConcaveHull Lines 0.80 holes', ST_Intersection(geom,ST_ConcaveHull(
-		geom, 0.80, true) ) = geom As encloses_geom, 
+		geom, 0.80, true) ) = geom As encloses_geom,
 		ST_Area(ST_ConcaveHull(geom, 0.80, true)) < ST_Area(ST_ConcaveHull(geom, 0.80)) As reached_target
 
 FROM ST_GeomFromText('MULTILINESTRING((106 164,30 112,74 70,82 112,130 94,

Modified: trunk/regress/sfcgal/geography.sql
===================================================================
--- trunk/regress/sfcgal/geography.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/sfcgal/geography.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -10,7 +10,7 @@
 );
 
 -- Do cached and uncached distance agree?
-SELECT c, abs(ST_Distance(ply::geography, pt::geography) - _ST_DistanceUnCached(ply::geography, pt::geography)) < 0.01 FROM 
+SELECT c, abs(ST_Distance(ply::geography, pt::geography) - _ST_DistanceUnCached(ply::geography, pt::geography)) < 0.01 FROM
 ( VALUES
 ('geog_distance_cached_1a', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
 ('geog_distance_cached_1b', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
@@ -22,7 +22,7 @@
 ) AS u(c,ply,pt);
 
 -- Does tolerance based distance work cached? Inside tolerance
-SELECT c, ST_DWithin(ply::geography, pt::geography, 3000) from 
+SELECT c, ST_DWithin(ply::geography, pt::geography, 3000) from
 ( VALUES
 ('geog_dithin_cached_1a', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(10.01 5)'),
 ('geog_dithin_cached_1b', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(10.01 5)'),
@@ -30,7 +30,7 @@
 ) as p(c, ply, pt);
 
 -- Does tolerance based distance work cached? Outside tolerance
-SELECT c, ST_DWithin(ply::geography, pt::geography, 1000) from 
+SELECT c, ST_DWithin(ply::geography, pt::geography, 1000) from
 ( VALUES
 ('geog_dithin_cached_2a', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(10.01 5)'),
 ('geog_dithin_cached_2b', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(10.01 5)'),
@@ -38,7 +38,7 @@
 ) as p(c, ply, pt);
 
 -- Do things work when there's cache coherence on the point side but not the poly side?
-SELECT c, ST_DWithin(ply::geography, pt::geography, 3000) from 
+SELECT c, ST_DWithin(ply::geography, pt::geography, 3000) from
 ( VALUES
 ('geog_dithin_cached_3a', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
 ('geog_dithin_cached_3b', 'POLYGON((1 1, 1 10, 10 10, 10 1, 1 1))', 'POINT(5 5)'),
@@ -46,8 +46,8 @@
 ) as p(c, ply, pt);
 
 -- Test a precision case near the south pole that came up during development.
-WITH pt AS ( 
-    SELECT point::geography FROM ( VALUES 
+WITH pt AS (
+    SELECT point::geography FROM ( VALUES
     ('0101000020E61000006C5B94D920EB4CC0A0FD481119B24FC0'),
     ('0101000020E610000097A8DE1AD8524CC09C8A54185B1050C0'),
     ('0101000020E61000008FC2F5285C4F4CC0E5ED08A7050F50C0'),
@@ -61,8 +61,8 @@
 SELECT 'geog_precision_savffir', _ST_DistanceUnCached(pt.point, ply.polygon), ST_Distance(pt.point, ply.polygon) FROM pt, ply;
 
 -- Test another precision case near the north poly and over the dateline
-WITH pt AS ( 
-    SELECT point::geography FROM ( VALUES 
+WITH pt AS (
+    SELECT point::geography FROM ( VALUES
     ('0101000020E610000000000000004065400000000000804840'),
     ('0101000020E610000075C8CD70033965C02176A6D079315040') ) AS p(point)
 ),
@@ -76,4 +76,4 @@
 
 -- Clean up spatial_ref_sys
 DELETE FROM spatial_ref_sys WHERE srid = 4326;
-    
+

Modified: trunk/regress/sfcgal/legacy.sql
===================================================================
--- trunk/regress/sfcgal/legacy.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/sfcgal/legacy.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,5 +1,5 @@
 --
--- These tests serve the purpose of ensuring compatibility with 
+-- These tests serve the purpose of ensuring compatibility with
 -- old versions of postgis users.
 --
 -- Their use rely on loading the legacy.sql script.

Modified: trunk/regress/sfcgal/measures.sql
===================================================================
--- trunk/regress/sfcgal/measures.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/sfcgal/measures.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -25,7 +25,7 @@
 	) as foo;
 
 --#1502
-SELECT '#1502', ST_Dwithin(a,b,0.0)  from 
+SELECT '#1502', ST_Dwithin(a,b,0.0)  from
 (SELECT 'LINESTRING(-97364 -97364, 9736.4 9736.4)'::geometry a, 'POINT(0 0)'::geometry b ) foo;
 
 --st_shortestline
@@ -80,7 +80,7 @@
 	st_astext(st_shortestline(b,a)),
 	st_astext(st_longestline(a,b)),
 	st_astext(st_longestline(b,a)) from (
-select 
+select
 	ST_GeomFromText('MULTILINESTRING((17 16, 16 17, 17 18, 17 17, 17 16), (28 35,29 39, 30 35))') as a,
 	ST_GeomFromText('MULTIPOLYGON(((-1 -1, -1 25, 25 25, 25 -1, -1 -1), (14 14,19 14,19 19,14 19,14 14)),((33 35,35 35,35 40,33 40,33 35)))') as b
 ) as foo;
@@ -94,7 +94,7 @@
 	round(st_y(st_endpoint(st_shortestline(a,b)))::numeric, 10),	
 	st_astext(st_longestline(a,b)),
 	st_astext(st_longestline(b,a)) from (
-select 
+select
 	ST_GeomFromText('LINESTRING(-40 -20 , 4 2)') as a,
 	ST_GeomFromText('LINESTRING(-10 20, 1 -2)') as b
 ) as foo;
@@ -106,7 +106,7 @@
 	st_astext(st_shortestline(b,a)),
 	st_astext(st_longestline(a,b)),
 	st_astext(st_longestline(b,a)) from (
-select 
+select
 	ST_GeomFromText('MULTIPOLYGON(((17 16,16 17,17 18,17 17,17 16)), ((28 35,30 35,29 39,28 35)))') as a,
 	ST_GeomFromText('MULTIPOLYGON(((-1 -1, -1 25, 25 25, 25 -1, -1 -1), (14 14,19 14,19 19,14 19,14 14)),((33 35,33 40, 35 40, 35 35, 33 35)))') as b
 ) as foo;
@@ -260,5 +260,5 @@
 -- Area of an empty collection
 select 'emptyCollectionArea', st_area('GEOMETRYCOLLECTION EMPTY');
 
--- 
+--
 select 'spheroidLength1', round(ST_LengthSpheroid('MULTILINESTRING((-118.584 38.374,-118.583 38.5),(-71.05957 42.3589 , -71.061 43))'::geometry,'SPHEROID["GRS_1980",6378137,298.257222101]'::spheroid)::numeric,5);

Modified: trunk/regress/sfcgal/regress.sql
===================================================================
--- trunk/regress/sfcgal/regress.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/sfcgal/regress.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -156,14 +156,14 @@
 select '96','MULTIPOINT(0 0, 1 1)'::GEOMETRY && 'MULTIPOINT(0 1, 1 2)'::GEOMETRY as bool;
 select '97','MULTIPOINT(0 0, 1 1)'::GEOMETRY && 'MULTIPOINT(0 1.0001, 1 2)'::GEOMETRY as bool;
 
---- contains 
+--- contains
 
 select '98','MULTIPOINT(0 0, 10 10)'::GEOMETRY ~ 'MULTIPOINT(5 5, 7 7)'::GEOMETRY as bool;
 select '99','MULTIPOINT(5 5, 7 7)'::GEOMETRY ~ 'MULTIPOINT(0 0, 10 10)'::GEOMETRY as bool;
 select '100','MULTIPOINT(0 0, 7 7)'::GEOMETRY ~ 'MULTIPOINT(0 0, 10 10)'::GEOMETRY as bool;
 select '101','MULTIPOINT(-0.0001 0, 7 7)'::GEOMETRY ~ 'MULTIPOINT(0 0, 10 10)'::GEOMETRY as bool;
 
---- contained by 
+--- contained by
 
 select '102','MULTIPOINT(0 0, 10 10)'::GEOMETRY @ 'MULTIPOINT(5 5, 7 7)'::GEOMETRY as bool;
 select '103','MULTIPOINT(5 5, 7 7)'::GEOMETRY @ 'MULTIPOINT(0 0, 10 10)'::GEOMETRY as bool;
@@ -207,7 +207,7 @@
 \i regress_biginsert.sql
 
 
----test basic ops on this 
+---test basic ops on this
 
 select '121',box3d(a) as box3d_a, box3d(b) as box3d_b from TEST;
 
@@ -218,7 +218,7 @@
 
 select '126',a ~= b from TEST;
 select '127',a @ b from TEST;
-select '128',a ~ b from TEST; 
+select '128',a ~ b from TEST;
 
 select '129', ST_MemSize(PostGIS_DropBBOX(a)), ST_MemSize(PostGIS_DropBBOX(b)) from TEST;
 

Modified: trunk/regress/sfcgal/regress_ogc_prep.sql
===================================================================
--- trunk/regress/sfcgal/regress_ogc_prep.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/sfcgal/regress_ogc_prep.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -5,14 +5,14 @@
 
 SET postgis.backend = 'sfcgal';
 
-SELECT c, ST_Intersects(ply, pt) FROM 
-( VALUES 
+SELECT c, ST_Intersects(ply, pt) FROM
+( VALUES
 -- PIP - point within polygon (no cache)
-('intersects099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
+('intersects099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
 -- PIP - point within polygon
-('intersects100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
+('intersects100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
 -- PIP - point on polygon vertex
-('intersects101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'), 
+('intersects101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'),
 -- PIP - point outside polygon
 ('intersects102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(-1 0)'),
 -- PIP - point on polygon edge
@@ -21,14 +21,14 @@
 ('intersects104', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 12)')
 ) AS v(c,ply,pt);
 
-SELECT c, ST_Contains(ply, pt) FROM 
-( VALUES 
+SELECT c, ST_Contains(ply, pt) FROM
+( VALUES
 -- PIP - point within polygon (no cache)
-('contains099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
+('contains099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
 -- PIP - point within polygon
-('contains100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
+('contains100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
 -- PIP - point on polygon vertex
-('contains101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'), 
+('contains101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'),
 -- PIP - point outside polygon
 ('contains102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(-1 0)'),
 -- PIP - point on polygon edge
@@ -37,14 +37,14 @@
 ('contains104', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 12)')
 ) AS v(c,ply,pt);
 
-SELECT c, ST_Covers(ply, pt) FROM 
-( VALUES 
+SELECT c, ST_Covers(ply, pt) FROM
+( VALUES
 -- PIP - point within polygon (no cache)
-('covers099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
+('covers099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
 -- PIP - point within polygon
-('covers100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
+('covers100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
 -- PIP - point on polygon vertex
-('covers101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'), 
+('covers101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'),
 -- PIP - point outside polygon
 ('covers102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(-1 0)'),
 -- PIP - point on polygon edge
@@ -53,14 +53,14 @@
 ('covers104', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 12)')
 ) AS v(c,ply,pt);
 
-SELECT c, ST_ContainsProperly(ply, pt) FROM 
-( VALUES 
+SELECT c, ST_ContainsProperly(ply, pt) FROM
+( VALUES
 -- PIP - point within polygon (no cache)
-('containsproperly099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
+('containsproperly099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
 -- PIP - point within polygon
-('containsproperly100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
+('containsproperly100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
 -- PIP - point on polygon vertex
-('containsproperly101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'), 
+('containsproperly101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'),
 -- PIP - point outside polygon
 ('containsproperly102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(-1 0)'),
 -- PIP - point on polygon edge
@@ -71,29 +71,29 @@
 
 
 -- PIP - point vertically aligned with polygon vertex, poly first
-SELECT 'intersects105', ST_Intersects(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM 
-( VALUES 
+SELECT 'intersects105', ST_Intersects(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
-	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
+	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - point vertically aligned with polygon vertex, point first
-SELECT 'intersects106', ST_Intersects(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM 
-( VALUES 
+SELECT 'intersects106', ST_Intersects(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
-	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
+	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - repeated vertex, poly first
-SELECT 'intersects107', ST_Intersects(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM 
-( VALUES 
+SELECT 'intersects107', ST_Intersects(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - repeated vertex, point first
-SELECT 'intersects108', ST_Intersects(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM 
-( VALUES 
+SELECT 'intersects108', ST_Intersects(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
@@ -101,87 +101,87 @@
 
 
 -- PIP - point vertically aligned with polygon vertex, poly first
-SELECT 'contains105', ST_Contains(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM 
-( VALUES 
+SELECT 'contains105', ST_Contains(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
-	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
+	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - point vertically aligned with polygon vertex, point first
-SELECT 'contains106', ST_Contains(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM 
-( VALUES 
+SELECT 'contains106', ST_Contains(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
-	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
+	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - repeated vertex, poly first
-SELECT 'contains107', ST_Contains(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM 
-( VALUES 
+SELECT 'contains107', ST_Contains(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - repeated vertex, point first
-SELECT 'contains108', ST_Contains(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM 
-( VALUES 
+SELECT 'contains108', ST_Contains(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 
 -- PIP - point vertically aligned with polygon vertex, poly first
-SELECT 'containsproperly105', ST_ContainsProperly(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM 
-( VALUES 
+SELECT 'containsproperly105', ST_ContainsProperly(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
-	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
+	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - point vertically aligned with polygon vertex, point first
-SELECT 'containsproperly106', ST_ContainsProperly(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM 
-( VALUES 
+SELECT 'containsproperly106', ST_ContainsProperly(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
-	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
+	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - repeated vertex, poly first
-SELECT 'containsproperly107', ST_ContainsProperly(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM 
-( VALUES 
+SELECT 'containsproperly107', ST_ContainsProperly(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - repeated vertex, point first
-SELECT 'containsproperly108', ST_ContainsProperly(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM 
-( VALUES 
+SELECT 'containsproperly108', ST_ContainsProperly(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 
 -- PIP - point vertically aligned with polygon vertex, poly first
-SELECT 'covers105', ST_Covers(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM 
-( VALUES 
+SELECT 'covers105', ST_Covers(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
-	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
+	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - point vertically aligned with polygon vertex, point first
-SELECT 'covers106', ST_Covers(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM 
-( VALUES 
+SELECT 'covers106', ST_Covers(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
-	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
+	(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - repeated vertex, poly first
-SELECT 'covers107', ST_Covers(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM 
-( VALUES 
+SELECT 'covers107', ST_Covers(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 ) AS v(p);
 -- PIP - repeated vertex, point first
-SELECT 'covers108', ST_Covers(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM 
-( VALUES 
+SELECT 'covers108', ST_Covers(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM
+( VALUES
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 	(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
@@ -190,111 +190,111 @@
 
 SELECT c, ST_Intersects(p1, p2) AS intersects_p1p2, ST_Intersects(p2, p1) AS intersects_p2p1 FROM
 ( VALUES
-('intersects200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
-('intersects201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
+('intersects200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
+('intersects201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
 ('intersects202', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
-('intersects203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
+('intersects203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'),
 ('intersects204', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))'),
-('intersects205', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
-('intersects206', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
+('intersects205', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
+('intersects206', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
 ('intersects207', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
-('intersects208', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
+('intersects208', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'),
 ('intersects209', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))')
 ) AS v(c,p1,p2);
 
 SELECT c, ST_Contains(p1, p2) AS contains_p1p2, ST_Contains(p2, p1) AS contains_p2p1 FROM
 ( VALUES
-('contains200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
-('contains201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
+('contains200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
+('contains201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
 ('contains202', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
-('contains203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
+('contains203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'),
 ('contains204', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))'),
-('contains205', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
-('contains206', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
+('contains205', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
+('contains206', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
 ('contains207', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
-('contains208', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
+('contains208', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'),
 ('contains209', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))')
 ) AS v(c,p1,p2);
 
 SELECT c, ST_ContainsProperly(p1, p2) AS containsproperly_p1p2, ST_ContainsProperly(p2, p1) AS containsproperly_p2p1 FROM
 ( VALUES
-('containsproperly200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
-('containsproperly201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
+('containsproperly200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
+('containsproperly201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
 ('containsproperly202', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
-('containsproperly203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
+('containsproperly203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'),
 ('containsproperly204', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))'),
-('containsproperly205', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
-('containsproperly206', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
+('containsproperly205', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
+('containsproperly206', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
 ('containsproperly207', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
-('containsproperly208', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
+('containsproperly208', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'),
 ('containsproperly209', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))')
 ) AS v(c,p1,p2);
 
 SELECT c, ST_Covers(p1, p2) AS covers_p1p2, ST_Covers(p2, p1) AS covers_p2p1 FROM
 ( VALUES
-('covers200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
-('covers201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
+('covers200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
+('covers201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
 ('covers202', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
-('covers203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
+('covers203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'),
 ('covers204', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))'),
-('covers205', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
-('covers206', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
+('covers205', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
+('covers206', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'),
 ('covers207', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
-('covers208', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
+('covers208', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'),
 ('covers209', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))')
 ) AS v(c,p1,p2);
 
 -- UNEXPECTED GEOMETRY TYPES --
 
-SELECT c, ST_Contains(p1, p2) AS contains_p1p2, ST_Contains(p2, p1) AS contains_p2p1, 
+SELECT c, ST_Contains(p1, p2) AS contains_p1p2, ST_Contains(p2, p1) AS contains_p2p1,
           ST_Covers(p1, p2) AS covers_p1p2, ST_Covers(p2, p1) AS covers_p2p1,
           ST_Intersects(p1, p2) AS intersects_p1p2, ST_Intersects(p2, p1) AS intersects_p2p1,
-          ST_ContainsProperly(p1, p2) AS containsproper_p1p2, ST_ContainsProperly(p2, p1) AS containsproper_p2p1 
+          ST_ContainsProperly(p1, p2) AS containsproper_p1p2, ST_ContainsProperly(p2, p1) AS containsproper_p2p1
           FROM
 ( VALUES
-('types100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
-('types101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
-('types102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
-('types103', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'), 
-('types104', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'), 
-('types105', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'), 
-('types106', 'POINT(5 5)', 'POINT(5 5)'), 
-('types107', 'POINT(5 5)', 'POINT(5 5)'), 
-('types108', 'POINT(5 5)', 'POINT(5 5)'), 
-('types109', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), 
-('types110', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), 
-('types111', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), 
-('types112', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)'), 
-('types113', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)'), 
-('types114', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)') 
+('types100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
+('types101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
+('types102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'),
+('types103', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'),
+('types104', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'),
+('types105', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'),
+('types106', 'POINT(5 5)', 'POINT(5 5)'),
+('types107', 'POINT(5 5)', 'POINT(5 5)'),
+('types108', 'POINT(5 5)', 'POINT(5 5)'),
+('types109', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'),
+('types110', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'),
+('types111', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'),
+('types112', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)'),
+('types113', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)'),
+('types114', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)')
 ) AS v(c,p1,p2);
 
 
-SELECT 'intersects310', ST_intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
+SELECT 'intersects310', ST_intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES
 ('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)')
 ) AS v(p);
-SELECT 'intersects311', ST_intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
+SELECT 'intersects311', ST_intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES
 ('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)')
 ) AS v(p);
 
-SELECT 'contains310', ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
+SELECT 'contains310', ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES
 ('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)')
 ) AS v(p);
-SELECT 'contains311', ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
+SELECT 'contains311', ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES
 ('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)')
 ) AS v(p);
 
-SELECT 'containsproperly310', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
+SELECT 'containsproperly310', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES
 ('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)')
 ) AS v(p);
-SELECT 'containsproperly311', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
+SELECT 'containsproperly311', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES
 ('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)')
 ) AS v(p);
 
-SELECT 'covers310', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
+SELECT 'covers310', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES
 ('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)')
 ) AS v(p);
-SELECT 'covers311', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
+SELECT 'covers311', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES
 ('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)')
 ) AS v(p);
 

Modified: trunk/regress/sfcgal/tickets.sql
===================================================================
--- trunk/regress/sfcgal/tickets.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/sfcgal/tickets.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -20,25 +20,25 @@
 
 -- #2 --
 SELECT '#2', ST_AsText(ST_Union(g)) FROM
-( VALUES 
-('SRID=4326;MULTIPOLYGON(((1 1,1 2,2 2,2 1,1 1)))'), 
+( VALUES
+('SRID=4326;MULTIPOLYGON(((1 1,1 2,2 2,2 1,1 1)))'),
 ('SRID=4326;MULTIPOLYGON(((2 1,3 1,3 2,2 2,2 1)))')
 ) AS v(g);
 
 -- #11 --
-SELECT '#11', round(ST_Distance (a.g, ST_Intersection(b.g, a.g))) AS distance 
-FROM (SELECT '01020000000200000050E8303FC2E85141B017CFC05A825541000000E0C0E85141000000205C825541'::geometry AS g) a, 
+SELECT '#11', round(ST_Distance (a.g, ST_Intersection(b.g, a.g))) AS distance
+FROM (SELECT '01020000000200000050E8303FC2E85141B017CFC05A825541000000E0C0E85141000000205C825541'::geometry AS g) a,
 	 (SELECT 'LINESTRING(4694792.35840419 5638508.89950758,4694793.20840419 5638506.34950758)'::geometry AS g) b;
 	
 -- #21 --
 SELECT '#21', ST_AsEWKT(ST_Locate_Along_Measure(g, 4566)) FROM
-( VALUES 
+( VALUES
 (ST_GeomFromEWKT('SRID=31293;LINESTRINGM( 6193.76 5337404.95 4519, 6220.13 5337367.145 4566, 6240.889 5337337.383 4603 )'))
 ) AS v(g);
 
 -- #22 --
-SELECT ST_Within(g, 'POLYGON((0 0,10 0,20 10,10 20,0 20,-10 10,0 0))') FROM 
-(VALUES 
+SELECT ST_Within(g, 'POLYGON((0 0,10 0,20 10,10 20,0 20,-10 10,0 0))') FROM
+(VALUES
 ('POLYGON((4 9,6 9,6 11,4 11,4 9))')
 ) AS v(g);
 
@@ -47,9 +47,9 @@
 SELECT '#33', AddGeometryColumn( '', 'public', 'road_pg','roads_geom', 330000, 'POINT', 2 );
 DROP TABLE road_pg;
 
--- #44 -- 
-SELECT '#44', ST_Relate(g1, g2, 'T12101212'), ST_Relate(g1, g2, 't12101212') FROM 
-(VALUES 
+-- #44 --
+SELECT '#44', ST_Relate(g1, g2, 'T12101212'), ST_Relate(g1, g2, 't12101212') FROM
+(VALUES
 ('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))', 'POLYGON((1 1, 3 1, 3 3, 1 3, 1 1))')
 ) AS v(g1, g2);
 
@@ -111,15 +111,15 @@
 SELECT '#156', ST_AsEWKT('0106000000010000000103000000010000000700000024213D12AA7BFD40945FF42576511941676A32F9017BFD40B1D67BEA7E511941C3E3C640DB7DFD4026CE38F4EE531941C91289C5A7EFD40017B8518E3531941646F1599AB7DFD409627F1F0AE521941355EBA49547CFD407B14AEC74652194123213D12AA7BFD40945FF42576511941');
 
 -- #157 --
-SELECT 
+SELECT
 	'#157',
-	ST_GeometryType(g) As newname, 
-	GeometryType(g) as oldname 
-FROM ( VALUES 
+	ST_GeometryType(g) As newname,
+	GeometryType(g) as oldname
+FROM ( VALUES
 	(ST_GeomFromText('POLYGON((-0.25 -1.25,-0.25 1.25,2.5 1.25,2.5 -1.25,-0.25 -1.25), (2.25 0,1.25 1,1.25 -1,2.25 0),(1 -1,1 1,0 0,1 -1))') ),
-	( ST_Point(1,2) ), 
-	( ST_Buffer(ST_Point(1,2), 3) ), 
-	( ST_LineToCurve(ST_Buffer(ST_Point(1,2), 3)) ) , 
+	( ST_Point(1,2) ),
+	( ST_Buffer(ST_Point(1,2), 3) ),
+	( ST_LineToCurve(ST_Buffer(ST_Point(1,2), 3)) ) ,
 	( ST_LineToCurve(ST_Boundary(ST_Buffer(ST_Point(1,2), 3))) )
 	) AS v(g);
 
@@ -179,15 +179,15 @@
 -- #262 --
 SELECT '#262', ST_AsText(pt.the_geog) As wkt_pt, ST_Covers(poly.the_geog, pt.the_geog) As geog,
 	ST_Covers(
-		ST_Transform(CAST(poly.the_geog As geometry),32611), 
+		ST_Transform(CAST(poly.the_geog As geometry),32611),
 		ST_Transform(CAST(pt.the_geog As geometry),32611)) As utm,
 	ST_Covers(
-		CAST(poly.the_geog As geometry), 
+		CAST(poly.the_geog As geometry),
 		CAST(pt.the_geog As geometry)
 	) As pca
-FROM (SELECT ST_GeographyFromText('SRID=4326;POLYGON((-119.5434 34.9438,-119.5437 34.9445,-119.5452 34.9442,-119.5434 34.9438))') As the_geog) 
+FROM (SELECT ST_GeographyFromText('SRID=4326;POLYGON((-119.5434 34.9438,-119.5437 34.9445,-119.5452 34.9442,-119.5434 34.9438))') As the_geog)
 	As poly
-    CROSS JOIN 
+    CROSS JOIN
 	(VALUES
 		( ST_GeographyFromText('SRID=4326;POINT(-119.5434 34.9438)') ) ,
 		( ST_GeographyFromText('SRID=4326;POINT(-119.5452 34.9442)') ) ,
@@ -199,18 +199,18 @@
 -- #263 --
 SELECT '#263', ST_AsEWKT(geometry(geography(pt.the_geom))) As wkt,
 	ST_Covers(
-		ST_Transform(poly.the_geom,32611), 
+		ST_Transform(poly.the_geom,32611),
 		ST_Transform(pt.the_geom,32611)) As utm,
 	ST_Covers(
-		poly.the_geom, 
+		poly.the_geom,
 		pt.the_geom)
 	 As pca,
 	ST_Covers(geometry(geography(poly.the_geom)),
 		geometry(geography(pt.the_geom))) As gm_to_gg_gm_pca
 	
-FROM (SELECT ST_GeomFromEWKT('SRID=4326;POLYGON((-119.5434 34.9438,-119.5437 34.9445,-119.5452 34.9442,-119.5434 34.9438))') As the_geom) 
+FROM (SELECT ST_GeomFromEWKT('SRID=4326;POLYGON((-119.5434 34.9438,-119.5437 34.9445,-119.5452 34.9442,-119.5434 34.9438))') As the_geom)
 	As poly
-    CROSS JOIN 
+    CROSS JOIN
 	(VALUES
 		( ST_GeomFromEWKT('SRID=4326;POINT(-119.5434 34.9438)') ) ,
 		( ST_GeomFromEWKT('SRID=4326;POINT(-119.5452 34.9442)') ) ,
@@ -235,7 +235,7 @@
 SELECT '#277', ST_AsGML(2, ST_GeomFromText('POINT(1 1e308)'));
 
 -- #299 --
-SELECT '#299', round(ST_Y(geometry(ST_Intersection(ST_GeographyFromText('POINT(1.2456 2)'), ST_GeographyFromText('POINT(1.2456 2)'))))); 
+SELECT '#299', round(ST_Y(geometry(ST_Intersection(ST_GeographyFromText('POINT(1.2456 2)'), ST_GeographyFromText('POINT(1.2456 2)')))));
 
 -- #304 --
 
@@ -269,11 +269,11 @@
 CREATE TABLE utm_dots ( the_geog geography, utm_srid integer);
 INSERT INTO utm_dots SELECT geography(ST_SetSRID(ST_Point(i*10,j*10),4326)) As the_geog, utmzone(ST_SetSRID(ST_Point(i*10,j*10),4326)) As utm_srid FROM generate_series(-17,17) As i CROSS JOIN generate_series(-8,8) As j;
 
-SELECT ST_AsText(the_geog) as the_pt, 
+SELECT ST_AsText(the_geog) as the_pt,
        utm_srid,
-       ST_Area(ST_Buffer(the_geog,10)) As the_area, 
+       ST_Area(ST_Buffer(the_geog,10)) As the_area,
        ST_Area(geography(ST_Transform(ST_Buffer(ST_Transform(geometry(the_geog),utm_srid),10),4326))) As geog_utm_area
-FROM utm_dots 
+FROM utm_dots
 WHERE ST_Area(ST_Buffer(the_geog,10)) NOT between 307 and 315
 LIMIT 10;
 
@@ -328,10 +328,10 @@
     FROM (SELECT regexp_split_to_array(postgis_sfcgal_version(),'\.') AS c) AS r )
 SELECT '#667',
 CASE WHEN vs.major >= 1 AND vs.minor >= 0 AND vs.patch >=5 THEN
-ST_AsEWKT(ST_LineToCurve(ST_Buffer(ST_SetSRID(ST_Point(i,j),4326), j))) 
+ST_AsEWKT(ST_LineToCurve(ST_Buffer(ST_SetSRID(ST_Point(i,j),4326), j)))
 ELSE
 'SRID=4326;CURVEPOLYGON(CIRCULARSTRING(30 40,-50 39.9999999999999,30 40))'
-END As the_geom 
+END As the_geom
 FROM vs, generate_series(-10,50,10) As i CROSS JOIN generate_series(40,70, 20) As j ORDER BY i, j, i*j LIMIT 1;
 
 -- #677 --
@@ -451,11 +451,11 @@
 select '#1060', ST_Relate(ST_GeomFromText('POINT EMPTY',4326), ST_GeomFromText('POINT EMPTY',4326)) As result;
 
 -- #1273 --
-WITH p AS ( SELECT 'POINT(832694.188 816254.625)'::geometry as g ) 
+WITH p AS ( SELECT 'POINT(832694.188 816254.625)'::geometry as g )
 SELECT '#1273', st_equals(p.g, postgis_addbbox(p.g)) from p;
 
 -- Another for #1273 --
-WITH p AS ( SELECT 'MULTIPOINT((832694.188 816254.625))'::geometry as g ) 
+WITH p AS ( SELECT 'MULTIPOINT((832694.188 816254.625))'::geometry as g )
 SELECT '#1273.1', st_equals(p.g, postgis_dropbbox(p.g)) from p;
 
 -- #877, #818
@@ -532,7 +532,7 @@
 select '#1344', octet_length(ST_AsEWKB(st_makeline(g))) FROM ( values ('POINT(0 0)'::geometry ) ) as foo(g);
 
 -- #1385
-SELECT '#1385', ST_Extent(g) FROM ( select null::geometry as g ) as foo; 
+SELECT '#1385', ST_Extent(g) FROM ( select null::geometry as g ) as foo;
 
 -- #657
 SELECT '#657.1',Round(ST_X(ST_Project('POINT(175 10)'::geography, 2000000, 3.1415/2)::GEOMETRY)::numeric,2);
@@ -541,7 +541,7 @@
 
 -- #1305
 SELECT '#1305.1',ST_AsText(ST_Project('POINT(10 10)'::geography, 0, 0));
-WITH pts AS ( SELECT 'POINT(0 45)'::geography AS s, 'POINT(45 45)'::geography AS e ) 
+WITH pts AS ( SELECT 'POINT(0 45)'::geography AS s, 'POINT(45 45)'::geography AS e )
 SELECT '#1305.2',abs(ST_Distance(e, ST_Project(s, ST_Distance(s, e), ST_Azimuth(s, e)))) < 0.001 FROM pts;
 SELECT '#1305.3',ST_Azimuth('POINT(0 45)'::geography, 'POINT(0 45)'::geography) IS NULL;
 
@@ -568,7 +568,7 @@
 -- #1478
 SELECT '#1478', ST_AsText('SRID=1;POINT EMPTY'::geometry::text::geometry);
 
--- #745 
+-- #745
 SELECT '#745', ST_AsEWKT(ST_Split('POLYGON((-72 42 1,-70 43 1,-71 41 1,-72 42 1))',
                                   'LINESTRING(-10 40 1,-9 41 1)'));
 
@@ -597,7 +597,7 @@
 -- #1489
 with inp AS ( SELECT
 	st_multi('POINT EMPTY'::geometry) as mp,
-	st_multi('LINESTRING EMPTY'::geometry) as ml, 
+	st_multi('LINESTRING EMPTY'::geometry) as ml,
 	st_multi('POLYGON EMPTY'::geometry) as ma,
 	st_multi('GEOMETRYCOLLECTION EMPTY'::geometry) as mm
 ) select '#1489',
@@ -629,7 +629,7 @@
 select '#1398b', st_astext(st_snaptogrid(st_project('POINT(20 85)'::geography, 2000000, radians(0.1))::geometry,0.000001));
 
 -- #1543
-with inp as ( select 
+with inp as ( select
 '0105000000020000000102000000040000000000000000000000000000000000000000000000000024400000000000000000000000000000244000000000000024400000000000000000000000000000000001020000000100000000000000000000000000000000000000'
 ::geometry as g )
 select '#1543', st_astext(g), st_astext(st_buildarea(g)) from inp;
@@ -689,7 +689,7 @@
 select '#1755', ST_AsText(st_geographyFromText('SRID=4326;Point(85 35 0)'));
 
 -- #1776 --
-with inp as ( SELECT 
+with inp as ( SELECT
  'POLYGON EMPTY'::geometry as A,
  'POLYGON((0 0, 10 0, 10 10, 0 0))'::geometry as B )
 SELECT '#1776',
@@ -711,8 +711,8 @@
 
 -- #1936 --
 select st_astext(st_geomfromgml(
-    '<gml:Polygon xmlns:gml="http://www.opengis.net/gml/3.2" 
-    gml:id="HPA.15449990010" srsName="urn:ogc:def:crs:EPSG::4326" 
+    '<gml:Polygon xmlns:gml="http://www.opengis.net/gml/3.2"
+    gml:id="HPA.15449990010" srsName="urn:ogc:def:crs:EPSG::4326"
     srsDimension="2">
     <gml:exterior>
     <gml:Ring>
@@ -793,9 +793,9 @@
 -- #2084 --
 SELECT '#2048', num, ST_Within('POINT(-54.394 56.522)', "the_geom"), ST_CoveredBy('POINT(-54.394 56.522)', "the_geom")
 FROM ( VALUES
-(1, '0103000000010000000E00000051C6F7C5A5324BC02EB69F8CF13F4C40F12EA4C343364BC0326AA2CF47434C402BC1A8A44E364BC02A50E10852434C407F2990D959364BC0A0D1730B5D434C404102452C62364BC0ECF335CB65434C400903232F6B364BC0F635E84B6F434C40BD0CC51D6F364BC0D2805EB873434C40B9E6E26F7B364BC0F20B93A982434C40D9FAAF73D3344BC0FE84D04197444C40BD5C8AABCA344BC0CED05CA791444C4023F2237EC5344BC02A84F23E8E444C40BDCDD8077B324BC0C60FB90F01434C409FD1702E65324BC04EF1915C17404C4051C6F7C5A5324BC02EB69F8CF13F4C40'::geometry), 
-(2, '0103000000010000001C00000003F25650F73B4BC098477F523E3E4C40C9A6A344CE3C4BC0C69698653E3E4C40BDD0E979373E4BC0081FA0FB723E4C400FD252793B3E4BC01A137F14753E4C40537170E998414BC070D3BCE314414C4023FC51D499474BC0D4D100DE024F4C40638C47A984454BC024130D52F0504C40B9442DCDAD404BC03A29E96168554C40C7108DEE20404BC07C7C26FBE7554C40195D6BEF533F4BC0E20391459A564C40239FE40E9B344BC08C1ADB6B41514C40132D3F7095314BC0BA2ADF33124F4C409DB91457952D4BC02C7B681F2B4C4C4089DC60A8C32C4BC07C5C3810924B4C40D7ED409DF22A4BC0F64389963C4A4C405D1EF818AC2A4BC00EC84274084A4C401B48A46DFC294BC0B271A8DF85494C40E78AA6B393294BC01ED0EFFB37494C4081C64B3789294BC0DC5BE7DF2E494C409B23329287294BC0F0D6974E2D494C40CD22D5D687294BC0844316D72C494C40F5229D4FE2294BC002F19825AB484C40A3D0BD5AE9294BC06C0776A9A2484C409FD1702E65324BC04EF1915C17404C409F860AA7BD324BC0162CA390E33F4C40539A5C1C23334BC0FE86B04EB03F4C4081511DFF90334BC088FF36D4873F4C4003F25650F73B4BC098477F523E3E4C40'::geometry), 
-(3, '010300000001000000100000008D57CD101A214BC0AECDD34E072C4C400DBB72E6EC274BC0A8088D60E32C4C40CF8FD7E6734E4BC0B22695BE4A324C40BFA74213934F4BC020BE505D4C354C4057CD4BEE454E4BC0BA6CF3940F3D4C40E7BDC5FD263E4BC09A4B297D5B484C4073A46A86701C4BC0B287F08D93364C4045501F86701C4BC05EBDB78D93364C40A37DB6586D1C4BC0841E7D2891364C409FBF445F6D1C4BC01E225C5690364C40D1BA97726D1C4BC06E2AF7EA8D364C4019B60C9B751C4BC0D2FD702575364C40FDE4394B5E1F4BC08C40F231CC2F4C402343DF40F51F4BC022008E3D7B2E4C400BB57B45F9204BC0908CE2EA3A2C4C408D57CD101A214BC0AECDD34E072C4C40'::geometry) 
+(1, '0103000000010000000E00000051C6F7C5A5324BC02EB69F8CF13F4C40F12EA4C343364BC0326AA2CF47434C402BC1A8A44E364BC02A50E10852434C407F2990D959364BC0A0D1730B5D434C404102452C62364BC0ECF335CB65434C400903232F6B364BC0F635E84B6F434C40BD0CC51D6F364BC0D2805EB873434C40B9E6E26F7B364BC0F20B93A982434C40D9FAAF73D3344BC0FE84D04197444C40BD5C8AABCA344BC0CED05CA791444C4023F2237EC5344BC02A84F23E8E444C40BDCDD8077B324BC0C60FB90F01434C409FD1702E65324BC04EF1915C17404C4051C6F7C5A5324BC02EB69F8CF13F4C40'::geometry),
+(2, '0103000000010000001C00000003F25650F73B4BC098477F523E3E4C40C9A6A344CE3C4BC0C69698653E3E4C40BDD0E979373E4BC0081FA0FB723E4C400FD252793B3E4BC01A137F14753E4C40537170E998414BC070D3BCE314414C4023FC51D499474BC0D4D100DE024F4C40638C47A984454BC024130D52F0504C40B9442DCDAD404BC03A29E96168554C40C7108DEE20404BC07C7C26FBE7554C40195D6BEF533F4BC0E20391459A564C40239FE40E9B344BC08C1ADB6B41514C40132D3F7095314BC0BA2ADF33124F4C409DB91457952D4BC02C7B681F2B4C4C4089DC60A8C32C4BC07C5C3810924B4C40D7ED409DF22A4BC0F64389963C4A4C405D1EF818AC2A4BC00EC84274084A4C401B48A46DFC294BC0B271A8DF85494C40E78AA6B393294BC01ED0EFFB37494C4081C64B3789294BC0DC5BE7DF2E494C409B23329287294BC0F0D6974E2D494C40CD22D5D687294BC0844316D72C494C40F5229D4FE2294BC002F19825AB484C40A3D0BD5AE9294BC06C0776A9A2484C409FD1702E65324BC04EF1915C17404C409F860AA7BD324BC0162CA390E33F4C40539A5C1C23334BC0FE86B04EB03F4C4081511DFF90334BC088FF36D4873F4C4003F25650F73B4BC098477F523E3E4C40'::geometry),
+(3, '010300000001000000100000008D57CD101A214BC0AECDD34E072C4C400DBB72E6EC274BC0A8088D60E32C4C40CF8FD7E6734E4BC0B22695BE4A324C40BFA74213934F4BC020BE505D4C354C4057CD4BEE454E4BC0BA6CF3940F3D4C40E7BDC5FD263E4BC09A4B297D5B484C4073A46A86701C4BC0B287F08D93364C4045501F86701C4BC05EBDB78D93364C40A37DB6586D1C4BC0841E7D2891364C409FBF445F6D1C4BC01E225C5690364C40D1BA97726D1C4BC06E2AF7EA8D364C4019B60C9B751C4BC0D2FD702575364C40FDE4394B5E1F4BC08C40F231CC2F4C402343DF40F51F4BC022008E3D7B2E4C400BB57B45F9204BC0908CE2EA3A2C4C408D57CD101A214BC0AECDD34E072C4C40'::geometry)
 ) AS f(num, the_geom);
 
 -- #2112 -- Start
@@ -803,7 +803,7 @@
 FROM (SELECT 'POLYGON((1 1 1, 5 1 1,5 5 1, 1 5 1,1 1 1))'::geometry as a, 'LINESTRING(0 0 2, 0 0 0,5 5 2)'::geometry as b
      ) as foo;
 
-SELECT '#2112b', ST_3DDistance(a,b), ST_ASEWKT(ST_3DShortestLine(a,b)) 
+SELECT '#2112b', ST_3DDistance(a,b), ST_ASEWKT(ST_3DShortestLine(a,b))
 FROM (SELECT 'POLYGON((1 1 1, 5 1 1,5 5 1, 1 5 1,1 1 1))'::geometry as a, 'LINESTRING(1 0 2, 1 0 0,5 5 -1)'::geometry as b
      ) as foo;
 -- 2112 -- End

Modified: trunk/regress/split.sql
===================================================================
--- trunk/regress/split.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/split.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -14,7 +14,7 @@
 -- Split line by line of different SRID
 select st_split('SRID=10;LINESTRING(0 0, 10 0)', 'SRID=5;LINESTRING(5 1, 10 1)');
 
--- Split line by disjoint line 
+-- Split line by disjoint line
 select '4', st_asewkt(ST_Split('SRID=10;LINESTRING(0 0, 10 0)', 'SRID=10;LINESTRING(20 0, 20 20)'));
 
 -- Split line by touching line
@@ -37,7 +37,7 @@
 -- Split single-hole polygon by line crossing both exterior and hole
 select '21', st_asewkt(ST_Split('SRID=12;POLYGON((0 0, 10 0, 10 10, 0 10, 0 0),(2 2, 8 2, 8 8, 2 8, 2 2))', 'SRID=12;LINESTRING(5 -5, 5 15)'));
 
--- Split single-hole polygon by line crossing only exterior 
+-- Split single-hole polygon by line crossing only exterior
 select '22', st_asewkt(ST_Split('SRID=12;POLYGON((0 0, 10 0, 10 10, 0 10, 0 0),(5 2, 8 2, 8 8, 5 8, 5 2))', 'SRID=12;LINESTRING(2 -5, 2 15)'));
 
 -- Split double-hole polygon by line crossing exterior and both holes
@@ -52,16 +52,16 @@
 -- Split multiline by disjoint line
 select '32', st_asewkt(st_split('SRID=10;MULTILINESTRING((0 0, 10 0),(0 5, 10 5))', 'SRID=10;LINESTRING(5 10, 5 20)'));
 
--- Split multiline by point on one of them 
+-- Split multiline by point on one of them
 select '40', st_asewkt(st_split('SRID=10;MULTILINESTRING((0 0, 10 0),(0 5, 10 5))', 'SRID=10;POINT(5 0)'));
 
--- Split multipolygon by line 
+-- Split multipolygon by line
 select '50', st_asewkt(ST_Split('SRID=12;MULTIPOLYGON(((0 0, 10 0, 10 10, 0 10, 0 0),(2 2, 8 2, 8 4, 2 4, 2 2),(2 6,8 6,8 8,2 8,2 6)),((20 0,20 10, 30 10, 30 0, 20 0),(25 5, 28 5, 25 8, 25 5)))', 'SRID=12;LINESTRING(5 -5, 5 15)'));
 
--- Split geometrycollection by line 
+-- Split geometrycollection by line
 select '60', st_asewkt(ST_Split('SRID=12;GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0, 10 0, 10 10, 0 10, 0 0),(2 2, 8 2, 8 4, 2 4, 2 2),(2 6,8 6,8 8,2 8,2 6)),((20 0,20 10, 30 10, 30 0, 20 0),(25 5, 28 5, 25 8, 25 5))),MULTILINESTRING((0 0, 10 0),(0 5, 10 5)))', 'SRID=12;LINESTRING(5 -5, 5 15)'));
 
--- Split 3d line by 2d line 
+-- Split 3d line by 2d line
 select '70', st_asewkt(ST_Split('SRID=11;LINESTRING(1691983.26 4874594.81 312.24, 1691984.86 4874593.69 312.24, 1691979.54 4874586.09 312.24, 1691978.03 4874587.16 298.36)', 'SRID=11;LINESTRING(1691978.0 4874589.0,1691982.0 4874588.53, 1691982.0 4874591.0)'));
 
 -- Split collapsed line by point
@@ -71,11 +71,11 @@
 
 -- Split long line by vertex point
 -- See http://trac.osgeo.org/postgis/ticket/2173
-with inp as ( SELECT 
+with inp as ( SELECT
 '01020000001000000034030F8FB15866C0F2311FFD3B9A53C0571C87CF1BB65BC0182DB847DB9052C0EBD57BDEEBF658C05CA18B9FA81B52C074384E71C20552C05AD308B7C38351C0A4B3920AA7914CC0ACD200FB29784FC0F8892AEE70E14040C0C8143E325651C0234604DC104E5440EF10F2807BF850C08FEE52B6CAE15F4002BF1C6676B450C0051A57A65BB061405B9E445AEC9F50C05AF3E1D5815665405E3A4A2BB6CF51C0591DE7ECD21F66400D33BFE91C7E53C0000000E0FF7F6640000000C04E9353C0000000000080664000000000008056C000000000008066C000000000008056C000000000008066C0000000E04D9353C034030F8FB15866C0F2311FFD3B9A53C0'
   ::geometry as g, 14 as p )
 select '82', st_equals(g, st_union(
-    st_geometryn(st_split(g, st_pointn(g,p)), 1), 
+    st_geometryn(st_split(g, st_pointn(g,p)), 1),
     st_geometryn(st_split(g, st_pointn(g,p)), 2))) from inp;
 
 -- Split line by multiline
@@ -102,4 +102,4 @@
   'SRID=3;MULTIPOINT(2 6,5 0,5 20,2 20,8 20,8 0,5 -2,0 0, 5 -5, 10 20)'
 ));
 
--- TODO: split line by collapsed line 
+-- TODO: split line by collapsed line

Modified: trunk/regress/sql-mm-circularstring.sql
===================================================================
--- trunk/regress/sql-mm-circularstring.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/sql-mm-circularstring.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,36 +1,36 @@
 SET client_min_messages TO warning;
 
 SELECT 'ndims01', ST_ndims(ST_geomfromewkt('CIRCULARSTRING(
-                0 0 0 0, 
-                0.26794919243112270647255365849413 1 3 -2, 
+                0 0 0 0,
+                0.26794919243112270647255365849413 1 3 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2)'));
 SELECT 'geometrytype01', geometrytype(ST_geomfromewkt('CIRCULARSTRING(
-                0 0 0 0, 
-                0.26794919243112270647255365849413 1 3 -2, 
+                0 0 0 0,
+                0.26794919243112270647255365849413 1 3 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2)'));
 SELECT 'ndims02', ST_ndims(ST_geomfromewkt('CIRCULARSTRING(
-                0 0 0, 
-                0.26794919243112270647255365849413 1 3, 
+                0 0 0,
+                0.26794919243112270647255365849413 1 3,
                 0.5857864376269049511981127579 1.4142135623730950488016887242097 1)'));
 SELECT 'geometrytype02', geometrytype(ST_geomfromewkt('CIRCULARSTRING(
-                0 0 0, 
-                0.26794919243112270647255365849413 1 3, 
+                0 0 0,
+                0.26794919243112270647255365849413 1 3,
                 0.5857864376269049511981127579 1.4142135623730950488016887242097 1)'));
 SELECT 'ndims03', ST_ndims(ST_geomfromewkt('CIRCULARSTRINGM(
-                0 0 0, 
-                0.26794919243112270647255365849413 1 -2, 
+                0 0 0,
+                0.26794919243112270647255365849413 1 -2,
                 0.5857864376269049511981127579 1.4142135623730950488016887242097 2)'));
 SELECT 'geometrytype03', geometrytype(ST_geomfromewkt('CIRCULARSTRINGM(
-                0 0 0, 
-                0.26794919243112270647255365849413 1 -2, 
+                0 0 0,
+                0.26794919243112270647255365849413 1 -2,
                 0.5857864376269049511981127579 1.4142135623730950488016887242097 2)'));
 SELECT 'ndims04', ST_ndims(ST_geomfromewkt('CIRCULARSTRING(
-                0 0, 
-                0.26794919243112270647255365849413 1, 
+                0 0,
+                0.26794919243112270647255365849413 1,
                 0.5857864376269049511981127579 1.4142135623730950488016887242097)'));
 SELECT 'geometrytype04', geometrytype(ST_geomfromewkt('CIRCULARSTRING(
-                0 0, 
-                0.26794919243112270647255365849413 1, 
+                0 0,
+                0.26794919243112270647255365849413 1,
                 0.5857864376269049511981127579 1.4142135623730950488016887242097)'));
 
 SELECT 'isClosed01', ST_IsClosed(ST_geomfromewkt('CIRCULARSTRING(
@@ -89,33 +89,33 @@
 the_geom_4d GEOMETRY(CIRCULARSTRINGZM));
 
 INSERT INTO public.circularstring (
-        id, 
+        id,
         description
       ) VALUES (
-        1, 
+        1,
         '180-135 degrees');
 UPDATE public.circularstring
         SET the_geom_4d = ST_Geomfromewkt('CIRCULARSTRING(
-                0 0 0 0, 
-                0.26794919243112270647255365849413 1 3 -2, 
+                0 0 0 0,
+                0.26794919243112270647255365849413 1 3 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2)')
         WHERE id = 1;
 UPDATE public.circularstring
         SET the_geom_3dz = ST_Geomfromewkt('CIRCULARSTRING(
-                0 0 0, 
-                0.26794919243112270647255365849413 1 3, 
+                0 0 0,
+                0.26794919243112270647255365849413 1 3,
                 0.5857864376269049511981127579 1.4142135623730950488016887242097 1)')
         WHERE id = 1;
 UPDATE public.circularstring
         SET the_geom_3dm = ST_Geomfromewkt('CIRCULARSTRINGM(
-                0 0 0, 
-                0.26794919243112270647255365849413 1 -2, 
-                0.5857864376269049511981127579 1.4142135623730950488016887242097 2)') 
+                0 0 0,
+                0.26794919243112270647255365849413 1 -2,
+                0.5857864376269049511981127579 1.4142135623730950488016887242097 2)')
         WHERE id = 1;
-UPDATE public.circularstring       
+UPDATE public.circularstring
         SET the_geom_2d = ST_Geomfromewkt('CIRCULARSTRING(
-                0 0, 
-                0.26794919243112270647255365849413 1, 
+                0 0,
+                0.26794919243112270647255365849413 1,
                 0.5857864376269049511981127579 1.4142135623730950488016887242097)')
         WHERE id = 1;
 
@@ -127,46 +127,46 @@
         '2-segment string');
 UPDATE public.circularstring
         SET the_geom_4d = ST_Geomfromewkt('CIRCULARSTRING(
-                -5 0 0 4, 
-                0 5 1 3, 
-                5 0 2 2, 
-                10 -5 3 1, 
+                -5 0 0 4,
+                0 5 1 3,
+                5 0 2 2,
+                10 -5 3 1,
                 15 0 4 0)')
         WHERE id = 2;
 UPDATE public.circularstring
         SET the_geom_3dz = ST_Geomfromewkt('CIRCULARSTRING(
-                -5 0 0, 
-                0 5 1, 
-                5 0 2, 
-                10 -5 3, 
+                -5 0 0,
+                0 5 1,
+                5 0 2,
+                10 -5 3,
                 15 0 4)')
         WHERE id = 2;
 UPDATE public.circularstring
         SET the_geom_3dm = ST_Geomfromewkt('CIRCULARSTRINGM(
-                -5 0 4, 
-                0 5 3, 
-                5 0 2, 
-                10 -5 1, 
+                -5 0 4,
+                0 5 3,
+                5 0 2,
+                10 -5 1,
                 15 0 0)')
         WHERE id = 2;
 UPDATE public.circularstring
         SET the_geom_2d = ST_Geomfromewkt('CIRCULARSTRING(
-                -5 0, 
-                0 5, 
-                5 0, 
-                10 -5, 
+                -5 0,
+                0 5,
+                5 0,
+                10 -5,
                 15 0)')
         WHERE id = 2;
 
-SELECT 'astext01', ST_astext(the_geom_2d) FROM public.circularstring;        
-SELECT 'astext02', ST_astext(the_geom_3dm) FROM public.circularstring;        
-SELECT 'astext03', ST_astext(the_geom_3dz) FROM public.circularstring;        
-SELECT 'astext04', ST_astext(the_geom_4d) FROM public.circularstring;        
+SELECT 'astext01', ST_astext(the_geom_2d) FROM public.circularstring;
+SELECT 'astext02', ST_astext(the_geom_3dm) FROM public.circularstring;
+SELECT 'astext03', ST_astext(the_geom_3dz) FROM public.circularstring;
+SELECT 'astext04', ST_astext(the_geom_4d) FROM public.circularstring;
 
-SELECT 'asewkt01', ST_AsEWKT(the_geom_2d) FROM public.circularstring;        
-SELECT 'asewkt02', ST_AsEWKT(the_geom_3dm) FROM public.circularstring;        
-SELECT 'asewkt03', ST_AsEWKT(the_geom_3dz) FROM public.circularstring;        
-SELECT 'asewkt04', ST_AsEWKT(the_geom_4d) FROM public.circularstring;        
+SELECT 'asewkt01', ST_AsEWKT(the_geom_2d) FROM public.circularstring;
+SELECT 'asewkt02', ST_AsEWKT(the_geom_3dm) FROM public.circularstring;
+SELECT 'asewkt03', ST_AsEWKT(the_geom_3dz) FROM public.circularstring;
+SELECT 'asewkt04', ST_AsEWKT(the_geom_4d) FROM public.circularstring;
 
 SELECT 'asbinary01', encode(ST_AsBinary(the_geom_2d, 'ndr'), 'hex') FROM public.circularstring;
 SELECT 'asbinary02', encode(ST_AsBinary(the_geom_3dm, 'xdr'), 'hex') FROM public.circularstring;

Modified: trunk/regress/sql-mm-compoundcurve.sql
===================================================================
--- trunk/regress/sql-mm-compoundcurve.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/sql-mm-compoundcurve.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,55 +1,55 @@
 SELECT 'ndims01', ST_NDims(ST_Geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
-                0 0 0 0, 
-                0.26794919243112270647255365849413 1 3 -2, 
+                0 0 0 0,
+                0.26794919243112270647255365849413 1 3 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2),
                 (0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2,
                 2 0 0 0,
                 0 0 0 0))'));
 SELECT 'geometrytype01', geometrytype(ST_Geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
-                0 0 0 0, 
-                0.26794919243112270647255365849413 1 3 -2, 
+                0 0 0 0,
+                0.26794919243112270647255365849413 1 3 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2),
                 (0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2,
                 2 0 0 0,
                 0 0 0 0))'));
 SELECT 'ndims02', ST_NDims(ST_Geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
-                0 0 0, 
-                0.26794919243112270647255365849413 1 3, 
+                0 0 0,
+                0.26794919243112270647255365849413 1 3,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1),
                 (0.5857864376269049511983112757903 1.4142135623730950488016887242097 1,
                 2 0 0,
                 0 0 0))'));
 SELECT 'geometrytype02', geometrytype(ST_Geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
-                0 0 0, 
-                0.26794919243112270647255365849413 1 3, 
+                0 0 0,
+                0.26794919243112270647255365849413 1 3,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1),
                 (0.5857864376269049511983112757903 1.4142135623730950488016887242097 1,
                 2 0 0,
                 0 0 0))'));
 SELECT 'ndims03', ST_NDims(ST_Geomfromewkt('COMPOUNDCURVEM(CIRCULARSTRING(
-                0 0 0, 
-                0.26794919243112270647255365849413 1 -2, 
+                0 0 0,
+                0.26794919243112270647255365849413 1 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 2),
                 (0.5857864376269049511983112757903 1.4142135623730950488016887242097 2,
                 2 0 0,
                 0 0 0))'));
 SELECT 'geometrytype03', geometrytype(ST_Geomfromewkt('COMPOUNDCURVEM(CIRCULARSTRING(
-                0 0 0, 
-                0.26794919243112270647255365849413 1 -2, 
+                0 0 0,
+                0.26794919243112270647255365849413 1 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 2),
                 (0.5857864376269049511983112757903 1.4142135623730950488016887242097 2,
                 2 0 0,
                 0 0 0))'));
 SELECT 'ndims04', ST_NDims(ST_Geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
-                0 0, 
-                0.26794919243112270647255365849413 1, 
+                0 0,
+                0.26794919243112270647255365849413 1,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097),
                 (0.5857864376269049511983112757903 1.4142135623730950488016887242097,
                 2 0,
                 0 0))'));
 SELECT 'geometrytype04', geometrytype(ST_Geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
-                0 0, 
-                0.26794919243112270647255365849413 1, 
+                0 0,
+                0.26794919243112270647255365849413 1,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097),
                 (0.5857864376269049511983112757903 1.4142135623730950488016887242097,
                 2 0,
@@ -57,57 +57,57 @@
 
 -- Repeat tests with new function names.
 SELECT 'ndims01', ST_NDims(ST_geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
-                0 0 0 0, 
-                0.26794919243112270647255365849413 1 3 -2, 
+                0 0 0 0,
+                0.26794919243112270647255365849413 1 3 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2),
                 (0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2,
                 2 0 0 0,
                 0 0 0 0))'));
 SELECT 'geometrytype01', geometrytype(ST_geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
-                0 0 0 0, 
-                0.26794919243112270647255365849413 1 3 -2, 
+                0 0 0 0,
+                0.26794919243112270647255365849413 1 3 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2),
                 (0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2,
                 2 0 0 0,
                 0 0 0 0))'));
 SELECT 'ndims02', ST_NDims(ST_geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
-                0 0 0, 
-                0.26794919243112270647255365849413 1 3, 
+                0 0 0,
+                0.26794919243112270647255365849413 1 3,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1),
                 (0.5857864376269049511983112757903 1.4142135623730950488016887242097 1,
                 2 0 0,
                 0 0 0))'));
 SELECT 'geometrytype02', geometrytype(ST_geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
-                0 0 0, 
-                0.26794919243112270647255365849413 1 3, 
+                0 0 0,
+                0.26794919243112270647255365849413 1 3,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1),
                 (0.5857864376269049511983112757903 1.4142135623730950488016887242097 1,
                 2 0 0,
                 0 0 0))'));
 SELECT 'ndims03', ST_NDims(ST_geomfromewkt('COMPOUNDCURVEM(CIRCULARSTRING(
-                0 0 0, 
-                0.26794919243112270647255365849413 1 -2, 
+                0 0 0,
+                0.26794919243112270647255365849413 1 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 2),
                 (0.5857864376269049511983112757903 1.4142135623730950488016887242097 2,
                 2 0 0,
                 0 0 0))'));
 SELECT 'geometrytype03', geometrytype(ST_geomfromewkt('COMPOUNDCURVEM(CIRCULARSTRING(
-                0 0 0, 
-                0.26794919243112270647255365849413 1 -2, 
+                0 0 0,
+                0.26794919243112270647255365849413 1 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 2),
                 (0.5857864376269049511983112757903 1.4142135623730950488016887242097 2,
                 2 0 0,
                 0 0 0))'));
 SELECT 'ndims04', ST_NDims(ST_geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
-                0 0, 
-                0.26794919243112270647255365849413 1, 
+                0 0,
+                0.26794919243112270647255365849413 1,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097),
                 (0.5857864376269049511983112757903 1.4142135623730950488016887242097,
                 2 0,
                 0 0))'));
 SELECT 'geometrytype04', geometrytype(ST_geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
-                0 0, 
-                0.26794919243112270647255365849413 1, 
+                0 0,
+                0.26794919243112270647255365849413 1,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097),
                 (0.5857864376269049511983112757903 1.4142135623730950488016887242097,
                 2 0,
@@ -128,32 +128,32 @@
                 'compoundcurve');
 UPDATE public.compoundcurve
                 SET the_geom_4d = ST_Geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
-                        0 0 0 0, 
-                        0.26794919243112270647255365849413 1 3 -2, 
+                        0 0 0 0,
+                        0.26794919243112270647255365849413 1 3 -2,
                         0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2),
                         (0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2,
                         2 0 0 0,
                         0 0 0 0))');
 UPDATE public.compoundcurve
                 SET the_geom_3dz = ST_Geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
-                        0 0 0, 
-                        0.26794919243112270647255365849413 1 3, 
+                        0 0 0,
+                        0.26794919243112270647255365849413 1 3,
                         0.5857864376269049511983112757903 1.4142135623730950488016887242097 1),
                         (0.5857864376269049511983112757903 1.4142135623730950488016887242097 1,
                         2 0 0,
                         0 0 0))');
 UPDATE public.compoundcurve
                 SET the_geom_3dm = ST_Geomfromewkt('COMPOUNDCURVEM(CIRCULARSTRING(
-                        0 0 0, 
-                        0.26794919243112270647255365849413 1 -2, 
+                        0 0 0,
+                        0.26794919243112270647255365849413 1 -2,
                         0.5857864376269049511983112757903 1.4142135623730950488016887242097 2),
                         (0.5857864376269049511983112757903 1.4142135623730950488016887242097 2,
                         2 0 0,
                         0 0 0))');
 UPDATE public.compoundcurve
                 SET the_geom_2d = ST_Geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
-                        0 0, 
-                        0.26794919243112270647255365849413 1, 
+                        0 0,
+                        0.26794919243112270647255365849413 1,
                         0.5857864376269049511983112757903 1.4142135623730950488016887242097),
                         (0.5857864376269049511983112757903 1.4142135623730950488016887242097,
                         2 0,

Modified: trunk/regress/sql-mm-curvepoly.sql
===================================================================
--- trunk/regress/sql-mm-curvepoly.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/sql-mm-curvepoly.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -103,7 +103,7 @@
                 1 0,
                 0 1,
                 -1 0))'));
-                
+
 SELECT 'ndims05', ST_Ndims(ST_geomfromewkt('CURVEPOLYGON(
                 COMPOUNDCURVE(
                     (5 5 1 0,5 0 1 1,0 0 1 2,0 5 1 3),

Modified: trunk/regress/sql-mm-general.sql
===================================================================
--- trunk/regress/sql-mm-general.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/sql-mm-general.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,12 +1,12 @@
 SELECT ST_HasArc(ST_GeomFromText('POINT(0 0)'));
 SELECT ST_HasArc(ST_GeomFromText('LINESTRING(0 0, 1 1, 1 0)'));
 SELECT ST_HasArc(ST_GeomFromEWKT('CIRCULARSTRING(
-                0 0 0 0, 
-                0.26794919243112270647255365849413 1 3 -2, 
+                0 0 0 0,
+                0.26794919243112270647255365849413 1 3 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2)'));
 SELECT ST_HasArc(ST_GeomFromEWKT('COMPOUNDCURVE(CIRCULARSTRING(
-                0 0 0 0, 
-                0.26794919243112270647255365849413 1 3 -2, 
+                0 0 0 0,
+                0.26794919243112270647255365849413 1 3 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2),
                 (0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2,
                 2 0 0 0,
@@ -42,8 +42,8 @@
                 3 3 3 1,
                 0 3 1 1)
                 ,CIRCULARSTRING(
-                0 0 0 0, 
-                0.26794919243112270647255365849413 1 3 -2, 
+                0 0 0 0,
+                0.26794919243112270647255365849413 1 3 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2))'));
 SELECT ST_HasArc(ST_GeomFromEWKT('MULTIPOLYGON(
                 ((-10 -10, 10 -10, 10 10, -10 10, -10 -10),

Modified: trunk/regress/sql-mm-multicurve.sql
===================================================================
--- trunk/regress/sql-mm-multicurve.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/sql-mm-multicurve.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -5,8 +5,8 @@
                 3 3 3 1,
                 0 3 1 1)
                 ,CIRCULARSTRING(
-                0 0 0 0, 
-                0.26794919243112270647255365849413 1 3 -2, 
+                0 0 0 0,
+                0.26794919243112270647255365849413 1 3 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2))'));
 SELECT 'geometrytype01', geometrytype(ST_geomfromewkt('MULTICURVE((
                 5 5 1 3,
@@ -14,8 +14,8 @@
                 3 3 3 1,
                 0 3 1 1)
                 ,CIRCULARSTRING(
-                0 0 0 0, 
-                0.26794919243112270647255365849413 1 3 -2, 
+                0 0 0 0,
+                0.26794919243112270647255365849413 1 3 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2))'));
 SELECT 'ndims02', ST_ndims(ST_geomfromewkt('MULTICURVE((
                 5 5 1,
@@ -23,8 +23,8 @@
                 3 3 3,
                 0 3 1)
                 ,CIRCULARSTRING(
-                0 0 0, 
-                0.26794919243112270647255365849413 1 3, 
+                0 0 0,
+                0.26794919243112270647255365849413 1 3,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1))'));
 SELECT 'geometrytype02', geometrytype(ST_geomfromewkt('MULTICURVE((
                 5 5 1,
@@ -32,8 +32,8 @@
                 3 3 3,
                 0 3 1)
                 ,CIRCULARSTRING(
-                0 0 0, 
-                0.26794919243112270647255365849413 1 3, 
+                0 0 0,
+                0.26794919243112270647255365849413 1 3,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1))'));
 SELECT 'ndims03', ST_ndims(ST_geomfromewkt('MULTICURVEM((
                 5 5 3,
@@ -41,8 +41,8 @@
                 3 3 1,
                 0 3 1)
                 ,CIRCULARSTRING(
-                0 0 0, 
-                0.26794919243112270647255365849413 1 -2, 
+                0 0 0,
+                0.26794919243112270647255365849413 1 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 2))'));
 SELECT 'geometrytype03', geometrytype(ST_geomfromewkt('MULTICURVEM((
                 5 5 3,
@@ -50,8 +50,8 @@
                 3 3 1,
                 0 3 1)
                 ,CIRCULARSTRING(
-                0 0 0, 
-                0.26794919243112270647255365849413 1 -2, 
+                0 0 0,
+                0.26794919243112270647255365849413 1 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 2))'));
 SELECT 'ndims04', ST_ndims(ST_geomfromewkt('MULTICURVE((
                 5 5,
@@ -59,8 +59,8 @@
                 3 3,
                 0 3)
                 ,CIRCULARSTRING(
-                0 0, 
-                0.26794919243112270647255365849413 1, 
+                0 0,
+                0.26794919243112270647255365849413 1,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097))'));
 SELECT 'geometrytype04', geometrytype(ST_geomfromewkt('MULTICURVE((
                 5 5,
@@ -68,8 +68,8 @@
                 3 3,
                 0 3)
                 ,CIRCULARSTRING(
-                0 0, 
-                0.26794919243112270647255365849413 1, 
+                0 0,
+                0.26794919243112270647255365849413 1,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097))'));
 
 CREATE TABLE public.multicurve (id INTEGER, description VARCHAR,
@@ -90,8 +90,8 @@
                 3 3 3 1,
                 0 3 1 1)
                 ,CIRCULARSTRING(
-                0 0 0 0, 
-                0.26794919243112270647255365849413 1 3 -2, 
+                0 0 0 0,
+                0.26794919243112270647255365849413 1 3 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2))');
 UPDATE public.multicurve
         SET the_geom_3dz = ST_Geomfromewkt('MULTICURVE((
@@ -100,18 +100,18 @@
                 3 3 3,
                 0 3 1)
                 ,CIRCULARSTRING(
-                0 0 0, 
-                0.26794919243112270647255365849413 1 3, 
+                0 0 0,
+                0.26794919243112270647255365849413 1 3,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 1))');
-UPDATE public.multicurve        
+UPDATE public.multicurve
         SET the_geom_3dm = ST_Geomfromewkt('MULTICURVEM((
                 5 5 3,
                 3 5 2,
                 3 3 1,
                 0 3 1)
                 ,CIRCULARSTRING(
-                0 0 0, 
-                0.26794919243112270647255365849413 1 -2, 
+                0 0 0,
+                0.26794919243112270647255365849413 1 -2,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097 2))');
 UPDATE public.multicurve
         SET the_geom_2d = ST_Geomfromewkt('MULTICURVE((
@@ -120,8 +120,8 @@
                 3 3,
                 0 3)
                 ,CIRCULARSTRING(
-                0 0, 
-                0.26794919243112270647255365849413 1, 
+                0 0,
+                0.26794919243112270647255365849413 1,
                 0.5857864376269049511983112757903 1.4142135623730950488016887242097))');
 
 SELECT 'asbinary01', encode(ST_AsBinary(the_geom_2d, 'xdr'), 'hex') FROM public.multicurve;

Modified: trunk/regress/sql-mm-multisurface.sql
===================================================================
--- trunk/regress/sql-mm-multisurface.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/sql-mm-multisurface.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -210,7 +210,7 @@
                 4 11 4,
                 7 8 7)))')
         WHERE id = 1;
-UPDATE public.multisurface        
+UPDATE public.multisurface
         SET the_geom_3dm = ST_geomfromewkt('MULTISURFACEM(CURVEPOLYGON(CIRCULARSTRING(
                 -2 0 0,
                 -1 -1 2,
@@ -250,7 +250,7 @@
                 4 11,
                 7 8)))')
         WHERE id = 1;
-        
+
 SELECT 'asbinary01', encode(ST_AsBinary(the_geom_2d, 'ndr'), 'hex') FROM public.multisurface;
 SELECT 'asbinary02', encode(ST_AsBinary(the_geom_3dm, 'ndr'), 'hex') FROM public.multisurface;
 SELECT 'asbinary03', encode(ST_AsBinary(the_geom_3dz, 'ndr'), 'hex') FROM public.multisurface;

Modified: trunk/regress/sql-mm-serialize.sql
===================================================================
--- trunk/regress/sql-mm-serialize.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/sql-mm-serialize.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -157,7 +157,7 @@
         '010C0000E0E610000002000000010A0000C00200000001080000C00700000000000000000000C0000000000000000000000000000000000000000000000000000000000000F0BF000000000000F0BF000000000000F03F00000000000000400000000000000000000000000000000000000000000000400000000000001040000000000000F03F000000000000F0BF000000000000084000000000000018400000000000000040000000000000000000000000000010400000000000002040000000000000000000000000000000400000000000000040000000000000104000000000000000C000000000000000000000000000000000000000000000000001020000C005000000000000000000F0BF0000000000000000000000000000F03F00000000000000400000000000000000000000000000E03F00000000000000400000000000001040000000000000F03F0000000000000000000000000000084000000000000018400000000000000000000000000000F03F00000000000008400000000000001040000000000000F0BF0000000000000000000000000000F03F000000000000004001030000C001000000050000000000000000001C4000000000000020400000000000001C40000000000000204000000000000024400000000000002440000000000000144000
 0000000000144000000000000018400000000000002C400000000000000840000000000000F03F00000000000010400000000000002640000000000000104000000000000018400000000000001C4000000000000020400000000000001C400000000000002040');
 
 
-    
+
 SELECT id, CASE WHEN ewkt = ST_asEWKT(serialized::geometry) THEN 'pass' ELSE 'fail' END AS result FROM serialize_test ORDER BY id;
 SELECT id, CASE WHEN ST_asEWKB(geomFromEWKT(ewkt)) = serialized THEN 'pass' ELSE 'fail' END AS result FROM serialize_test ORDER BY id;
 

Modified: trunk/regress/tickets.sql
===================================================================
--- trunk/regress/tickets.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/tickets.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -18,25 +18,25 @@
 
 -- #2 --
 SELECT '#2', ST_AsText(ST_Union(g)) FROM
-( VALUES 
-('SRID=4326;MULTIPOLYGON(((1 1,1 2,2 2,2 1,1 1)))'), 
+( VALUES
+('SRID=4326;MULTIPOLYGON(((1 1,1 2,2 2,2 1,1 1)))'),
 ('SRID=4326;MULTIPOLYGON(((2 1,3 1,3 2,2 2,2 1)))')
 ) AS v(g);
 
 -- #11 --
-SELECT '#11', ST_Distance (a.g, ST_Intersection(b.g, a.g)) AS distance 
-FROM (SELECT '01020000000200000050E8303FC2E85141B017CFC05A825541000000E0C0E85141000000205C825541'::geometry AS g) a, 
+SELECT '#11', ST_Distance (a.g, ST_Intersection(b.g, a.g)) AS distance
+FROM (SELECT '01020000000200000050E8303FC2E85141B017CFC05A825541000000E0C0E85141000000205C825541'::geometry AS g) a,
 	 (SELECT 'LINESTRING(4694792.35840419 5638508.89950758,4694793.20840419 5638506.34950758)'::geometry AS g) b;
 	
 -- #21 --
 SELECT '#21', ST_AsEWKT(ST_Locate_Along_Measure(g, 4566)) FROM
-( VALUES 
+( VALUES
 (ST_GeomFromEWKT('SRID=31293;LINESTRINGM( 6193.76 5337404.95 4519, 6220.13 5337367.145 4566, 6240.889 5337337.383 4603 )'))
 ) AS v(g);
 
 -- #22 --
-SELECT ST_Within(g, 'POLYGON((0 0,10 0,20 10,10 20,0 20,-10 10,0 0))') FROM 
-(VALUES 
+SELECT ST_Within(g, 'POLYGON((0 0,10 0,20 10,10 20,0 20,-10 10,0 0))') FROM
+(VALUES
 ('POLYGON((4 9,6 9,6 11,4 11,4 9))')
 ) AS v(g);
 
@@ -45,9 +45,9 @@
 SELECT '#33', AddGeometryColumn( '', 'public', 'road_pg','roads_geom', 330000, 'POINT', 2 );
 DROP TABLE road_pg;
 
--- #44 -- 
-SELECT '#44', ST_Relate(g1, g2, 'T12101212'), ST_Relate(g1, g2, 't12101212') FROM 
-(VALUES 
+-- #44 --
+SELECT '#44', ST_Relate(g1, g2, 'T12101212'), ST_Relate(g1, g2, 't12101212') FROM
+(VALUES
 ('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))', 'POLYGON((1 1, 3 1, 3 3, 1 3, 1 1))')
 ) AS v(g1, g2);
 
@@ -109,15 +109,15 @@
 SELECT '#156', ST_AsEWKT('0106000000010000000103000000010000000700000024213D12AA7BFD40945FF42576511941676A32F9017BFD40B1D67BEA7E511941C3E3C640DB7DFD4026CE38F4EE531941C91289C5A7EFD40017B8518E3531941646F1599AB7DFD409627F1F0AE521941355EBA49547CFD407B14AEC74652194123213D12AA7BFD40945FF42576511941');
 
 -- #157 --
-SELECT 
+SELECT
 	'#157',
-	ST_GeometryType(g) As newname, 
-	GeometryType(g) as oldname 
-FROM ( VALUES 
+	ST_GeometryType(g) As newname,
+	GeometryType(g) as oldname
+FROM ( VALUES
 	(ST_GeomFromText('POLYGON((-0.25 -1.25,-0.25 1.25,2.5 1.25,2.5 -1.25,-0.25 -1.25), (2.25 0,1.25 1,1.25 -1,2.25 0),(1 -1,1 1,0 0,1 -1))') ),
-	( ST_Point(1,2) ), 
-	( ST_Buffer(ST_Point(1,2), 3) ), 
-	( ST_LineToCurve(ST_Buffer(ST_Point(1,2), 3)) ) , 
+	( ST_Point(1,2) ),
+	( ST_Buffer(ST_Point(1,2), 3) ),
+	( ST_LineToCurve(ST_Buffer(ST_Point(1,2), 3)) ) ,
 	( ST_LineToCurve(ST_Boundary(ST_Buffer(ST_Point(1,2), 3))) )
 	) AS v(g);
 
@@ -177,15 +177,15 @@
 -- #262 --
 SELECT '#262', ST_AsText(pt.the_geog) As wkt_pt, ST_Covers(poly.the_geog, pt.the_geog) As geog,
 	ST_Covers(
-		ST_Transform(CAST(poly.the_geog As geometry),32611), 
+		ST_Transform(CAST(poly.the_geog As geometry),32611),
 		ST_Transform(CAST(pt.the_geog As geometry),32611)) As utm,
 	ST_Covers(
-		CAST(poly.the_geog As geometry), 
+		CAST(poly.the_geog As geometry),
 		CAST(pt.the_geog As geometry)
 	) As pca
-FROM (SELECT ST_GeographyFromText('SRID=4326;POLYGON((-119.5434 34.9438,-119.5437 34.9445,-119.5452 34.9442,-119.5434 34.9438))') As the_geog) 
+FROM (SELECT ST_GeographyFromText('SRID=4326;POLYGON((-119.5434 34.9438,-119.5437 34.9445,-119.5452 34.9442,-119.5434 34.9438))') As the_geog)
 	As poly
-    CROSS JOIN 
+    CROSS JOIN
 	(VALUES
 		( ST_GeographyFromText('SRID=4326;POINT(-119.5434 34.9438)') ) ,
 		( ST_GeographyFromText('SRID=4326;POINT(-119.5452 34.9442)') ) ,
@@ -197,18 +197,18 @@
 -- #263 --
 SELECT '#263', ST_AsEWKT(geometry(geography(pt.the_geom))) As wkt,
 	ST_Covers(
-		ST_Transform(poly.the_geom,32611), 
+		ST_Transform(poly.the_geom,32611),
 		ST_Transform(pt.the_geom,32611)) As utm,
 	ST_Covers(
-		poly.the_geom, 
+		poly.the_geom,
 		pt.the_geom)
 	 As pca,
 	ST_Covers(geometry(geography(poly.the_geom)),
 		geometry(geography(pt.the_geom))) As gm_to_gg_gm_pca
 	
-FROM (SELECT ST_GeomFromEWKT('SRID=4326;POLYGON((-119.5434 34.9438,-119.5437 34.9445,-119.5452 34.9442,-119.5434 34.9438))') As the_geom) 
+FROM (SELECT ST_GeomFromEWKT('SRID=4326;POLYGON((-119.5434 34.9438,-119.5437 34.9445,-119.5452 34.9442,-119.5434 34.9438))') As the_geom)
 	As poly
-    CROSS JOIN 
+    CROSS JOIN
 	(VALUES
 		( ST_GeomFromEWKT('SRID=4326;POINT(-119.5434 34.9438)') ) ,
 		( ST_GeomFromEWKT('SRID=4326;POINT(-119.5452 34.9442)') ) ,
@@ -233,7 +233,7 @@
 SELECT '#277', ST_AsGML(2, ST_GeomFromText('POINT(1 1e308)'));
 
 -- #299 --
-SELECT '#299', round(ST_Y(geometry(ST_Intersection(ST_GeographyFromText('POINT(1.2456 2)'), ST_GeographyFromText('POINT(1.2456 2)'))))); 
+SELECT '#299', round(ST_Y(geometry(ST_Intersection(ST_GeographyFromText('POINT(1.2456 2)'), ST_GeographyFromText('POINT(1.2456 2)')))));
 
 -- #304 --
 
@@ -267,11 +267,11 @@
 CREATE TABLE utm_dots ( the_geog geography, utm_srid integer);
 INSERT INTO utm_dots SELECT geography(ST_SetSRID(ST_Point(i*10,j*10),4326)) As the_geog, utmzone(ST_SetSRID(ST_Point(i*10,j*10),4326)) As utm_srid FROM generate_series(-17,17) As i CROSS JOIN generate_series(-8,8) As j;
 
-SELECT ST_AsText(the_geog) as the_pt, 
+SELECT ST_AsText(the_geog) as the_pt,
        utm_srid,
-       ST_Area(ST_Buffer(the_geog,10)) As the_area, 
+       ST_Area(ST_Buffer(the_geog,10)) As the_area,
        ST_Area(geography(ST_Transform(ST_Buffer(ST_Transform(geometry(the_geog),utm_srid),10),4326))) As geog_utm_area
-FROM utm_dots 
+FROM utm_dots
 WHERE ST_Area(ST_Buffer(the_geog,10)) NOT between 307 and 315
 LIMIT 10;
 
@@ -442,11 +442,11 @@
 select '#1060', ST_Relate(ST_GeomFromText('POINT EMPTY',4326), ST_GeomFromText('POINT EMPTY',4326)) As result;
 
 -- #1273 --
-WITH p AS ( SELECT 'POINT(832694.188 816254.625)'::geometry as g ) 
+WITH p AS ( SELECT 'POINT(832694.188 816254.625)'::geometry as g )
 SELECT '#1273', st_equals(p.g, postgis_addbbox(p.g)) from p;
 
 -- Another for #1273 --
-WITH p AS ( SELECT 'MULTIPOINT((832694.188 816254.625))'::geometry as g ) 
+WITH p AS ( SELECT 'MULTIPOINT((832694.188 816254.625))'::geometry as g )
 SELECT '#1273.1', st_equals(p.g, postgis_dropbbox(p.g)) from p;
 
 -- #1292
@@ -497,7 +497,7 @@
 select '#1344', octet_length(ST_AsEWKB(st_makeline(g))) FROM ( values ('POINT(0 0)'::geometry ) ) as foo(g);
 
 -- #1385
-SELECT '#1385', ST_Extent(g) FROM ( select null::geometry as g ) as foo; 
+SELECT '#1385', ST_Extent(g) FROM ( select null::geometry as g ) as foo;
 
 -- #657
 SELECT '#657.1',Round(ST_X(ST_Project('POINT(175 10)'::geography, 2000000, 3.1415/2)::GEOMETRY)::numeric,2);
@@ -506,7 +506,7 @@
 
 -- #1305
 SELECT '#1305.1',ST_AsText(ST_Project('POINT(10 10)'::geography, 0, 0));
-WITH pts AS ( SELECT 'POINT(0 45)'::geography AS s, 'POINT(45 45)'::geography AS e ) 
+WITH pts AS ( SELECT 'POINT(0 45)'::geography AS s, 'POINT(45 45)'::geography AS e )
 SELECT '#1305.2',abs(ST_Distance(e, ST_Project(s, ST_Distance(s, e), ST_Azimuth(s, e)))) < 0.001 FROM pts;
 SELECT '#1305.3',ST_Azimuth('POINT(0 45)'::geography, 'POINT(0 45)'::geography) IS NULL;
 
@@ -533,7 +533,7 @@
 -- #1478
 SELECT '#1478', encode(ST_AsEWKB('SRID=1;POINT EMPTY'::geometry::text::geometry,'ndr'),'hex');
 
--- #745 
+-- #745
 SELECT '#745', ST_AsEWKT(ST_Split('POLYGON((-72 42 1,-70 43 1,-71 41 1,-72 42 1))',
                                   'LINESTRING(-10 40 1,-9 41 1)'));
 
@@ -562,7 +562,7 @@
 -- #1489
 with inp AS ( SELECT
 	st_multi('POINT EMPTY'::geometry) as mp,
-	st_multi('LINESTRING EMPTY'::geometry) as ml, 
+	st_multi('LINESTRING EMPTY'::geometry) as ml,
 	st_multi('POLYGON EMPTY'::geometry) as ma,
 	st_multi('GEOMETRYCOLLECTION EMPTY'::geometry) as mm
 ) select '#1489',
@@ -594,7 +594,7 @@
 select '#1398b', st_astext(st_snaptogrid(st_project('POINT(20 85)'::geography, 2000000, radians(0.1))::geometry,0.000001));
 
 -- #1543
-with inp as ( select 
+with inp as ( select
 '0105000000020000000102000000040000000000000000000000000000000000000000000000000024400000000000000000000000000000244000000000000024400000000000000000000000000000000001020000000100000000000000000000000000000000000000'
 ::geometry as g )
 select '#1543', st_astext(g), st_astext(st_buildarea(g)) from inp;
@@ -661,7 +661,7 @@
 select '#1755', encode(ST_AsBinary(ST_GeographyFromText('SRID=4326;Point(85 35 0)'),'ndr'),'hex');
 
 -- #1776 --
-with inp as ( SELECT 
+with inp as ( SELECT
  'POLYGON EMPTY'::geometry as A,
  'POLYGON((0 0, 10 0, 10 10, 0 0))'::geometry as B )
 SELECT '#1776',
@@ -683,8 +683,8 @@
 
 -- #1936 --
 select st_astext(st_geomfromgml(
-    '<gml:Polygon xmlns:gml="http://www.opengis.net/gml/3.2" 
-    gml:id="HPA.15449990010" srsName="urn:ogc:def:crs:EPSG::4326" 
+    '<gml:Polygon xmlns:gml="http://www.opengis.net/gml/3.2"
+    gml:id="HPA.15449990010" srsName="urn:ogc:def:crs:EPSG::4326"
     srsDimension="2">
     <gml:exterior>
     <gml:Ring>
@@ -768,9 +768,9 @@
 -- #2084 --
 SELECT '#2084', num, ST_Within('POINT(-54.394 56.522)', "the_geom"), ST_CoveredBy('POINT(-54.394 56.522)', "the_geom")
 FROM ( VALUES
-(1, '0103000000010000000E00000051C6F7C5A5324BC02EB69F8CF13F4C40F12EA4C343364BC0326AA2CF47434C402BC1A8A44E364BC02A50E10852434C407F2990D959364BC0A0D1730B5D434C404102452C62364BC0ECF335CB65434C400903232F6B364BC0F635E84B6F434C40BD0CC51D6F364BC0D2805EB873434C40B9E6E26F7B364BC0F20B93A982434C40D9FAAF73D3344BC0FE84D04197444C40BD5C8AABCA344BC0CED05CA791444C4023F2237EC5344BC02A84F23E8E444C40BDCDD8077B324BC0C60FB90F01434C409FD1702E65324BC04EF1915C17404C4051C6F7C5A5324BC02EB69F8CF13F4C40'::geometry), 
-(2, '0103000000010000001C00000003F25650F73B4BC098477F523E3E4C40C9A6A344CE3C4BC0C69698653E3E4C40BDD0E979373E4BC0081FA0FB723E4C400FD252793B3E4BC01A137F14753E4C40537170E998414BC070D3BCE314414C4023FC51D499474BC0D4D100DE024F4C40638C47A984454BC024130D52F0504C40B9442DCDAD404BC03A29E96168554C40C7108DEE20404BC07C7C26FBE7554C40195D6BEF533F4BC0E20391459A564C40239FE40E9B344BC08C1ADB6B41514C40132D3F7095314BC0BA2ADF33124F4C409DB91457952D4BC02C7B681F2B4C4C4089DC60A8C32C4BC07C5C3810924B4C40D7ED409DF22A4BC0F64389963C4A4C405D1EF818AC2A4BC00EC84274084A4C401B48A46DFC294BC0B271A8DF85494C40E78AA6B393294BC01ED0EFFB37494C4081C64B3789294BC0DC5BE7DF2E494C409B23329287294BC0F0D6974E2D494C40CD22D5D687294BC0844316D72C494C40F5229D4FE2294BC002F19825AB484C40A3D0BD5AE9294BC06C0776A9A2484C409FD1702E65324BC04EF1915C17404C409F860AA7BD324BC0162CA390E33F4C40539A5C1C23334BC0FE86B04EB03F4C4081511DFF90334BC088FF36D4873F4C4003F25650F73B4BC098477F523E3E4C40'::geometry), 
-(3, '010300000001000000100000008D57CD101A214BC0AECDD34E072C4C400DBB72E6EC274BC0A8088D60E32C4C40CF8FD7E6734E4BC0B22695BE4A324C40BFA74213934F4BC020BE505D4C354C4057CD4BEE454E4BC0BA6CF3940F3D4C40E7BDC5FD263E4BC09A4B297D5B484C4073A46A86701C4BC0B287F08D93364C4045501F86701C4BC05EBDB78D93364C40A37DB6586D1C4BC0841E7D2891364C409FBF445F6D1C4BC01E225C5690364C40D1BA97726D1C4BC06E2AF7EA8D364C4019B60C9B751C4BC0D2FD702575364C40FDE4394B5E1F4BC08C40F231CC2F4C402343DF40F51F4BC022008E3D7B2E4C400BB57B45F9204BC0908CE2EA3A2C4C408D57CD101A214BC0AECDD34E072C4C40'::geometry) 
+(1, '0103000000010000000E00000051C6F7C5A5324BC02EB69F8CF13F4C40F12EA4C343364BC0326AA2CF47434C402BC1A8A44E364BC02A50E10852434C407F2990D959364BC0A0D1730B5D434C404102452C62364BC0ECF335CB65434C400903232F6B364BC0F635E84B6F434C40BD0CC51D6F364BC0D2805EB873434C40B9E6E26F7B364BC0F20B93A982434C40D9FAAF73D3344BC0FE84D04197444C40BD5C8AABCA344BC0CED05CA791444C4023F2237EC5344BC02A84F23E8E444C40BDCDD8077B324BC0C60FB90F01434C409FD1702E65324BC04EF1915C17404C4051C6F7C5A5324BC02EB69F8CF13F4C40'::geometry),
+(2, '0103000000010000001C00000003F25650F73B4BC098477F523E3E4C40C9A6A344CE3C4BC0C69698653E3E4C40BDD0E979373E4BC0081FA0FB723E4C400FD252793B3E4BC01A137F14753E4C40537170E998414BC070D3BCE314414C4023FC51D499474BC0D4D100DE024F4C40638C47A984454BC024130D52F0504C40B9442DCDAD404BC03A29E96168554C40C7108DEE20404BC07C7C26FBE7554C40195D6BEF533F4BC0E20391459A564C40239FE40E9B344BC08C1ADB6B41514C40132D3F7095314BC0BA2ADF33124F4C409DB91457952D4BC02C7B681F2B4C4C4089DC60A8C32C4BC07C5C3810924B4C40D7ED409DF22A4BC0F64389963C4A4C405D1EF818AC2A4BC00EC84274084A4C401B48A46DFC294BC0B271A8DF85494C40E78AA6B393294BC01ED0EFFB37494C4081C64B3789294BC0DC5BE7DF2E494C409B23329287294BC0F0D6974E2D494C40CD22D5D687294BC0844316D72C494C40F5229D4FE2294BC002F19825AB484C40A3D0BD5AE9294BC06C0776A9A2484C409FD1702E65324BC04EF1915C17404C409F860AA7BD324BC0162CA390E33F4C40539A5C1C23334BC0FE86B04EB03F4C4081511DFF90334BC088FF36D4873F4C4003F25650F73B4BC098477F523E3E4C40'::geometry),
+(3, '010300000001000000100000008D57CD101A214BC0AECDD34E072C4C400DBB72E6EC274BC0A8088D60E32C4C40CF8FD7E6734E4BC0B22695BE4A324C40BFA74213934F4BC020BE505D4C354C4057CD4BEE454E4BC0BA6CF3940F3D4C40E7BDC5FD263E4BC09A4B297D5B484C4073A46A86701C4BC0B287F08D93364C4045501F86701C4BC05EBDB78D93364C40A37DB6586D1C4BC0841E7D2891364C409FBF445F6D1C4BC01E225C5690364C40D1BA97726D1C4BC06E2AF7EA8D364C4019B60C9B751C4BC0D2FD702575364C40FDE4394B5E1F4BC08C40F231CC2F4C402343DF40F51F4BC022008E3D7B2E4C400BB57B45F9204BC0908CE2EA3A2C4C408D57CD101A214BC0AECDD34E072C4C40'::geometry)
 ) AS f(num, the_geom);
 
 -- #2112 -- Start
@@ -778,7 +778,7 @@
 FROM (SELECT 'POLYGON((1 1 1, 5 1 1,5 5 1, 1 5 1,1 1 1))'::geometry as a, 'LINESTRING(0 0 2, 0 0 0,5 5 2)'::geometry as b
      ) as foo;
 
-SELECT '#2112b', ST_3DDistance(a,b), ST_ASEWKT(ST_3DShortestLine(a,b)) 
+SELECT '#2112b', ST_3DDistance(a,b), ST_ASEWKT(ST_3DShortestLine(a,b))
 FROM (SELECT 'POLYGON((1 1 1, 5 1 1,5 5 1, 1 5 1,1 1 1))'::geometry as a, 'LINESTRING(1 0 2, 1 0 0,5 5 -1)'::geometry as b
      ) as foo;
 -- 2112 -- End
@@ -823,7 +823,7 @@
 
 SELECT '#2427', st_astext(st_pointn(ST_CurveToLine('CIRCULARSTRING(-1 0,0 1,0 -1)'),1));
 
-SELECT '#2168',  ST_Distance(g1,g2)::numeric(16,8)  As dist_g1_g2, ST_Distance(g2,g1)::numeric(16,8) AS dist_g2_g1,ST_Distance(g1,g2) - ST_Distance(g2,g1) 
+SELECT '#2168',  ST_Distance(g1,g2)::numeric(16,8)  As dist_g1_g2, ST_Distance(g2,g1)::numeric(16,8) AS dist_g2_g1,ST_Distance(g1,g2) - ST_Distance(g2,g1)
   FROM (SELECT 'POINT(18.5107234 54.7587757)'::geography As g1, 'POINT(18.58218 54.7344227)'::geography As g2) As a;
 
 
@@ -836,11 +836,11 @@
 DROP TABLE images;
 
 -- #2692
-WITH v AS ( SELECT 'CIRCULARSTRING(0 0, 1 1, 2 2)'::geometry AS g FROM generate_series(1,3) ) 
+WITH v AS ( SELECT 'CIRCULARSTRING(0 0, 1 1, 2 2)'::geometry AS g FROM generate_series(1,3) )
 SELECT '#2692a', ST_AsText(st_collect(g)) FROM v;
-WITH v AS ( SELECT 'COMPOUNDCURVE((0 0, 1 1), CIRCULARSTRING(1 1, 1 2, 3 2))'::geometry AS g FROM generate_series(1,3) ) 
+WITH v AS ( SELECT 'COMPOUNDCURVE((0 0, 1 1), CIRCULARSTRING(1 1, 1 2, 3 2))'::geometry AS g FROM generate_series(1,3) )
 SELECT '#2692b', ST_AsText(st_collect(g)) FROM v;
-WITH v AS ( SELECT 'TRIANGLE((0 0, 1 1, 1 0, 0 0))'::geometry AS g FROM generate_series(1,3) ) 
+WITH v AS ( SELECT 'TRIANGLE((0 0, 1 1, 1 0, 0 0))'::geometry AS g FROM generate_series(1,3) )
 SELECT '#2692c', ST_AsText(st_collect(g)) FROM v;
 
 
@@ -862,15 +862,15 @@
 
 SELECT '#2712', ST_AsText(ST_Segmentize('LINESTRING EMPTY'::geometry, 0.5));
 
-SELECT '#2717', 
-   ST_AsText(ST_StartPoint(g)), 
-   ST_AsText(ST_EndPoint(g)), 
-   ST_AsText(ST_PointN(g, 1)), 
-   ST_AsText(ST_PointN(g, 2)), 
-   ST_AsText(ST_PointN(g, 3)), 
-   ST_AsText(ST_PointN(g, 4)), 
+SELECT '#2717',
+   ST_AsText(ST_StartPoint(g)),
+   ST_AsText(ST_EndPoint(g)),
+   ST_AsText(ST_PointN(g, 1)),
+   ST_AsText(ST_PointN(g, 2)),
+   ST_AsText(ST_PointN(g, 3)),
+   ST_AsText(ST_PointN(g, 4)),
    ST_AsText(ST_PointN(g, 5))
-   FROM ( 
+   FROM (
      SELECT 'COMPOUNDCURVE((-1 -1, 1 1), CIRCULARSTRING(1 1, 2 2, 3 1))'::geometry AS g
    ) AS foo;
 
@@ -881,7 +881,7 @@
 SELECT '#2956', st_astwkb(null,0) is null;
 
 -- #2996 --
-WITH 
+WITH
   input AS (SELECT 'SRID=4326;POLYGON((26426 65078,26531 65242,26075 65136,26096 65427,26426 65078))'::geometry AS geom),
   mbc   AS (SELECT (mb).center, (mb).radius FROM (SELECT ST_MinimumBoundingRadius(geom) mb FROM input) sq)
 SELECT '#2996', radius = ST_Length(ST_LongestLine(geom, center)) FROM input, mbc;
@@ -897,7 +897,7 @@
          'LINESTRING(124.983539 1.419224,91.181596 29.647798)'::geography
        , ST_Segmentize('LINESTRING(124.983539 1.419224,91.181596 29.647798)'::geography, 47487290)::geography);
 
-SELECT '#3356', ST_Summary(wkt::geometry) As wkt_geom, 
+SELECT '#3356', ST_Summary(wkt::geometry) As wkt_geom,
    ST_Summary(wkt::geography) As wkt_geog,
    ST_Summary(wkt::geometry::geography) As geom_geog
 FROM (VALUES (
@@ -919,7 +919,7 @@
 select n from unnest(ARRAY[-1,0,1,10,100,1000]) n
 ),
 pts as (
-  select n,(st_dump(st_generatepoints(geom, n))).geom from g,n 
+  select n,(st_dump(st_generatepoints(geom, n))).geom from g,n
 )
 select '#3399' as t, n, count(*) from
 g, pts
@@ -935,9 +935,9 @@
                     </LinearRing>
                 </innerBoundaryIs>
             </Polygon>');
-            
-    
 
+
+
 -- #3437
 WITH
 mp AS (SELECT ST_Collect(ST_MakePoint(-c, c*c)) AS geom FROM generate_series(1, 5) c),

Modified: trunk/regress/typmod.sql
===================================================================
--- trunk/regress/typmod.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/typmod.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -279,7 +279,7 @@
 
 	tmpfile := tmpfile_prefix;
 
-	FOR rec2 IN SELECT * from tm.types ORDER BY id 
+	FOR rec2 IN SELECT * from tm.types ORDER BY id
 	LOOP
 		tmpfile := tmpfile_prefix || rec2.id;
 		sql := 'COPY ( SELECT g FROM tm.types WHERE id = ' || rec2.id || ') TO '
@@ -289,7 +289,7 @@
 	END LOOP;
 
 	FOR rec IN SELECT * from geometry_columns
-		WHERE f_table_name != 'types' ORDER BY 3 
+		WHERE f_table_name != 'types' ORDER BY 3
 	LOOP
 		out_where := rec.f_table_name;
 
@@ -299,7 +299,7 @@
   			AND rec.type NOT LIKE 'TRIANGLE%'
   			AND rec.type NOT LIKE 'TIN%';
 
-		FOR rec2 IN SELECT * from tm.types ORDER BY id 
+		FOR rec2 IN SELECT * from tm.types ORDER BY id
 		LOOP
 			out_srid := ST_Srid(rec2.g);
 			out_type := substr(ST_GeometryType(rec2.g), 4);
@@ -338,7 +338,7 @@
 			-- }
 
 
-			IF NOT hasgeog THEN 
+			IF NOT hasgeog THEN
 				RETURN NEXT;
 				CONTINUE;
 			END IF;
@@ -388,7 +388,7 @@
 		RETURN NEXT;
 
 		IF hasgeog THEN
-			-- Count number of geographies in the table 
+			-- Count number of geographies in the table
 			sql := 'SELECT count(gg) FROM '
 				|| quote_ident(rec.f_table_schema)
 				|| '.' || quote_ident(rec.f_table_name);

Modified: trunk/regress/wkt.sql
===================================================================
--- trunk/regress/wkt.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/regress/wkt.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -493,7 +493,7 @@
 'CURVEPOLYGON (COMPOUNDCURVE ZM (CIRCULARSTRING ZM (0 0 2 5,1 1 2 6,1 0 2 5), (1 0 2 3,0 1 2 2), (0 1 2 2,30 1 2 2), CIRCULARSTRING ZM (30 1 2 2,12 1 2 6,1 10 2 5, 1 10 3 5, 0 0 2 5)))'
 ::text as g ) as foo;
 
-SELECT g, 
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'CURVEPOLYGON(COMPOUNDCURVE((5 5 1 0,5 0 1 1,0 0 1 2,0 5 1 3), CIRCULARSTRING(0 5 1 3,1.5 7.5 1 4,5 5 1 0)),(1.5 5 2 0,2.5 6 3 1,3.5 5 2 2,1.5 5 2 0), COMPOUNDCURVE(CIRCULARSTRING(1.5 2 2 0,1 2.5 3 1,3.5 2 2 2),(3.5 2 2 2,3.5 4 1 3,1.5 4 1 4,1.5 2 2 0)))'
@@ -501,31 +501,31 @@
 
 -- MULTICURVE --
 
-SELECT g, 
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'MULTICURVE EMPTY'
 ::text as g ) as foo;
 
-SELECT g, 
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'MULTICURVE ((5 5, 3 5, 3 3, 0 3), CIRCULARSTRING (0 0, 0.2 1, 0.5 1.4), COMPOUNDCURVE (CIRCULARSTRING (0 0,1 1,1 0),(1 0,0 1)))'
 ::text as g ) as foo;
 
-SELECT g, 
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'MULTICURVE M ((5 5 1, 3 5 2, 3 3 3, 0 3 1), CIRCULARSTRING M (0 0 0, 0.2 1 3, 0.5 1.4 1), COMPOUNDCURVE M (CIRCULARSTRING M (0 0 0,1 1 1,1 0 0),(1 0 0,0 1 5)))'
 ::text as g ) as foo;
 
-SELECT g, 
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'MULTICURVE Z ((5 5 1, 3 5 2, 3 3 3, 0 3 1), CIRCULARSTRING Z (0 0 0, 0.2 1 3, 0.5 1.4 1), COMPOUNDCURVE Z (CIRCULARSTRING Z (0 0 0,1 1 1,1 0 0),(1 0 0,0 1 5)))'
 ::text as g ) as foo;
 
-SELECT g, 
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'MULTICURVE ZM ((5 5 1 3, 3 5 2 2, 3 3 3 1, 0 3 1 1), CIRCULARSTRING ZM (0 0 0 0, 0.2 1 3 -2, 0.5 1.4 1 2), COMPOUNDCURVE ZM (CIRCULARSTRING ZM (0 0 0 0,1 1 1 2,1 0 0 1),(1 0 0 1,0 1 5 4)))'
@@ -534,31 +534,31 @@
 
 -- MULTISURFACE --
 
-SELECT g, 
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'MULTISURFACE EMPTY'
 ::text as g ) as foo;
 
-SELECT g, 
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'MULTISURFACE (CURVEPOLYGON (CIRCULARSTRING (-2 0, -1 -1, 0 0, 1 -1, 2 0, 0 2, -2 0), (-1 0, 0 0.5, 1 0, 0 1, -1 0)), ((7 8, 10 10, 6 14, 4 11, 7 8)))'
 ::text as g ) as foo;
 
-SELECT g, 
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'MULTISURFACE M (CURVEPOLYGON M (CIRCULARSTRING M (-2 0 0, -1 -1 1, 0 0 2, 1 -1 3, 2 0 4, 0 2 2, -2 0 0), (-1 0 1, 0 0.5 2, 1 0 3, 0 1 3, -1 0 1)), ((7 8 7, 10 10 5, 6 14 3, 4 11 4, 7 8 7)))'
 ::text as g ) as foo;
 
-SELECT g, 
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'MULTISURFACE Z (CURVEPOLYGON Z (CIRCULARSTRING Z (-2 0 0, -1 -1 1, 0 0 2, 1 -1 3, 2 0 4, 0 2 2, -2 0 0), (-1 0 1, 0 0.5 2, 1 0 3, 0 1 3, -1 0 1)), ((7 8 7, 10 10 5, 6 14 3, 4 11 4, 7 8 7)))'
 ::text as g ) as foo;
 
-SELECT g, 
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'MULTISURFACE ZM (CURVEPOLYGON ZM (CIRCULARSTRING ZM (-2 0 0 0, -1 -1 1 2, 0 0 2 4, 1 -1 3 6, 2 0 4 8, 0 2 2 4, -2 0 0 0), (-1 0 1 2, 0 0.5 2 4, 1 0 3 6, 0 1 3 4, -1 0 1 2)), ((7 8 7 8, 10 10 5 5, 6 14 3 1, 4 11 4 6, 7 8 7 8)))'
@@ -566,31 +566,31 @@
 
 -- POLYHEDRALSURFACE --
 
-SELECT g, 
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'POLYHEDRALSURFACE EMPTY'
 ::text as g ) as foo;
 
-SELECT g, 
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'POLYHEDRALSURFACE (((0 0,0 0,0 1,0 0)),((0 0,0 1,1 0,0 0)),((0 0,1 0,0 0,0 0)),((1 0,0 1,0 0,1 0)))'
 ::text as g ) as foo;
 
-SELECT g, 
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'POLYHEDRALSURFACE M (((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))'
 ::text as g ) as foo;
 
-SELECT g, 
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'POLYHEDRALSURFACE Z (((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))'
 ::text as g ) as foo;
 
-SELECT g, 
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'POLYHEDRALSURFACE ZM (((0 0 0 0,0 0 1 0,0 1 0 2,0 0 0 0)),((0 0 0 0,0 1 0 0,1 0 0 4,0 0 0 0)),((0 0 0 0,1 0 0 0,0 0 1 6,0 0 0 0)),((1 0 0 0,0 1 0 0,0 0 1 0,1 0 0 0)))'
@@ -605,31 +605,31 @@
 'TRIANGLE ((1 2 3,4 5 6,7 8 9,1 2 0))'
 ::text as g ) as foo;
 
-SELECT g, 
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'TRIANGLE EMPTY'
 ::text as g ) as foo;
 
-SELECT g,  
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'TRIANGLE ((1 2 3,4 5 6,7 8 9,1 2 3))'
 ::text as g ) as foo;
 
-SELECT g,  
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'TRIANGLE M ((1 2 3,4 5 6,7 8 9,1 2 3))'
 ::text as g ) as foo;
 
-SELECT g,  
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'TRIANGLE Z ((1 2 3,4 5 6,7 8 9,1 2 3))'
 ::text as g ) as foo;
 
-SELECT g,  
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'TRIANGLE ZM ((1 2 3 -1,4 5 6 -2,7 8 9 -3,1 2 3 -1))'
@@ -644,31 +644,31 @@
 'TIN ZM ( ((0 0 0 0, 0 0 1 0, 0 1 0 4, 0 0 0 0)), ((0 0 0 1, 0 1 0 2, 1 1 0 3, 0 1 0 1)) )'
 ::text as g ) as foo;
 
-SELECT g, 
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'TIN EMPTY'
 ::text as g ) as foo;
 
-SELECT g,  
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'TIN ( ((0 0, 0 0, 0 1, 0 0)), ((0 0, 0 1, 1 1, 0 0)) )'
 ::text as g ) as foo;
 
-SELECT g,  
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'TIN Z ( ((0 0 0, 0 0 1, 0 1 0, 0 0 0)), ((0 0 0, 0 1 0, 1 1 0, 0 0 0)) )'
 ::text as g ) as foo;
 
-SELECT g,  
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'TIN M ( ((0 0 0, 0 0 1, 0 1 0, 0 0 0)), ((0 0 0, 0 1 0, 1 1 0, 0 0 0)) )'
 ::text as g ) as foo;
 
-SELECT g,  
+SELECT g,
       ST_AsText(g::geometry),
       ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
 'TIN ZM ( ((0 0 0 0, 0 0 1 0, 0 1 0 4, 0 0 0 0)), ((0 0 0 1, 0 1 0 2, 1 1 0 3, 0 0 0 1)) )'

Modified: trunk/topology/postgis_topology.c
===================================================================
--- trunk/topology/postgis_topology.c	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/postgis_topology.c	2016-04-27 14:45:28 UTC (rev 14869)
@@ -2123,7 +2123,7 @@
     return 0;
   }
 
-  
+
   if ( face_left != face_right )
   {
     POSTGIS_DEBUGF(1, "Deletion of edge %" LWTFMT_ELEMID " joins faces %"
@@ -2530,7 +2530,7 @@
   return SPI_processed;
 }
 
-static LWT_ISO_NODE* 
+static LWT_ISO_NODE*
 cb_getNodeWithinBox2D ( const LWT_BE_TOPOLOGY* topo, const GBOX* box,
                      int* numelems, int fields, int limit )
 {
@@ -2602,7 +2602,7 @@
   return nodes;
 }
 
-static LWT_ISO_EDGE* 
+static LWT_ISO_EDGE*
 cb_getEdgeWithinBox2D ( const LWT_BE_TOPOLOGY* topo, const GBOX* box,
                      int* numelems, int fields, int limit )
 {
@@ -2674,7 +2674,7 @@
   return edges;
 }
 
-static LWT_ISO_FACE* 
+static LWT_ISO_FACE*
 cb_getFaceWithinBox2D ( const LWT_BE_TOPOLOGY* topo, const GBOX* box,
                      int* numelems, int fields, int limit )
 {

Modified: trunk/topology/test/cache_geometries.sql
===================================================================
--- trunk/topology/test/cache_geometries.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/cache_geometries.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -12,13 +12,13 @@
 
 --ALTER TABLE features.city_streets ADD the_geom geometry;
 UPDATE features.city_streets set the_geom =
-  st_multi(topology.Geometry(feature)); 
+  st_multi(topology.Geometry(feature));
 
 --ALTER TABLE features.traffic_signs ADD the_geom geometry;
 UPDATE features.traffic_signs set the_geom =
-  st_multi(topology.Geometry(feature)); 
+  st_multi(topology.Geometry(feature));
 
 --ALTER TABLE features.land_parcels ADD the_geom geometry;
 UPDATE features.land_parcels set the_geom =
-  st_multi(topology.Geometry(feature)); 
+  st_multi(topology.Geometry(feature));
 

Modified: trunk/topology/test/hierarchy.sql
===================================================================
--- trunk/topology/test/hierarchy.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/hierarchy.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -38,7 +38,7 @@
     (SELECT layer_id FROM topology.layer WHERE table_name = 'big_parcels'),
     (SELECT topoelementarray_agg(ARRAY[id(feature), 1])
      FROM features.land_parcels
-     WHERE feature_name in ('F3','F6')) 
+     WHERE feature_name in ('F3','F6'))
   ));
 
 --
@@ -71,8 +71,8 @@
     (SELECT layer_id FROM topology.layer WHERE table_name = 'big_streets'),
     (SELECT topoelementarray_agg(ARRAY[id(feature), 3])
      FROM features.city_streets
-     WHERE feature_name in ('R4')) 
-  )); 
+     WHERE feature_name in ('R4'))
+  ));
 
 --
 -- Signs

Modified: trunk/topology/test/invalid_topology.sql
===================================================================
--- trunk/topology/test/invalid_topology.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/invalid_topology.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,6 +1,6 @@
 BEGIN;
 
--- Create the topology. 
+-- Create the topology.
 -- NOTE:
 --  Returns topology id... which depend on how many
 --  topologies where created in the regress database
@@ -128,7 +128,7 @@
 -- Next edge crosses node N14
 INSERT INTO invalid_topology.edge VALUES(27, 15, 13, 27, -27, 6, 3,
   'LINESTRING(9 14, 21 14, 35 14)');
--- Next edge is not simple 
+-- Next edge is not simple
 INSERT INTO invalid_topology.edge VALUES(28, 3, 3, 28, 28, 2, 2,
   'LINESTRING(25 35, 28 30, 27 27, 27 32, 25 35)');
 -- Next edge crosses E2
@@ -146,7 +146,7 @@
 INSERT INTO invalid_topology.edge VALUES(32, 4, 4, 31, -31, 12, 12,
   'LINESTRING(20 37, 20 42, 21 42, 21 37, 20 37)');
 
--- Next edge is not valid 
+-- Next edge is not valid
 INSERT INTO invalid_topology.edge VALUES(33, 3, 3, 28, 28, 13, 13,
   '01020000000100000000000000000039400000000000804140');
 

Modified: trunk/topology/test/load_features.sql
===================================================================
--- trunk/topology/test/load_features.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/load_features.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -20,7 +20,7 @@
 
 BEGIN;
 
--- 3. Create feature tables  
+-- 3. Create feature tables
 
 CREATE SCHEMA features;
 

Modified: trunk/topology/test/more_features.sql
===================================================================
--- trunk/topology/test/more_features.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/more_features.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -7,7 +7,7 @@
     'city_data', -- Topology name
     3, -- Topology geometry type (polygon/multipolygon)
     1, -- TG_LAYER_ID for this topology (from topology.layer)
-    '{{3,3}}') -- face_id:3 
+    '{{3,3}}') -- face_id:3
     );
 
 INSERT INTO features.land_parcels VALUES ('F6', -- Feature name
@@ -15,7 +15,7 @@
     'city_data', -- Topology name
     3, -- Topology geometry type (polygon/multipolygon)
     1, -- TG_LAYER_ID for this topology (from topology.layer)
-    '{{6,3}}') -- face_id:3 
+    '{{6,3}}') -- face_id:3
     );
 
 INSERT INTO features.land_parcels VALUES ('F3F4', -- Feature name

Modified: trunk/topology/test/regress/addedge.sql
===================================================================
--- trunk/topology/test/regress/addedge.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/addedge.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -3,16 +3,16 @@
 SELECT topology.CreateTopology('tt') > 0;
 
 SELECT 'e1',  topology.addEdge('tt', 'LINESTRING(0 0, 8 0)');
--- Equal edge 
+-- Equal edge
 SELECT 'e*1', topology.addEdge('tt', 'LINESTRING(0 0, 8 0)');
 
 -- Failing cases (should all raise exceptions) -------
 
--- Contained with endpoint contact 
+-- Contained with endpoint contact
 SELECT 'e*2', topology.addEdge('tt', 'LINESTRING(1 0, 8 0)');
--- Contained with no endpoint contact 
+-- Contained with no endpoint contact
 SELECT 'e*3', topology.addEdge('tt', 'LINESTRING(1 0, 7 0)');
--- Overlapping 
+-- Overlapping
 SELECT 'e*4', topology.addEdge('tt', 'LINESTRING(1 0, 9 0)');
 -- Contains with endpoint contact
 SELECT 'e*5', topology.addEdge('tt', 'LINESTRING(0 0, 9 0)');
@@ -20,11 +20,11 @@
 SELECT 'e*6', topology.addEdge('tt', 'LINESTRING(-1 0, 9 0)');
 -- Touches middle with endpoint
 SELECT 'e*7', topology.addEdge('tt', 'LINESTRING(5 0, 5 10)');
--- Crosses 
+-- Crosses
 SELECT 'e*8', topology.addEdge('tt', 'LINESTRING(5 -10, 5 10)');
 -- Is touched on the middle by endpoint
 SELECT 'e*9', topology.addEdge('tt', 'LINESTRING(0 -10, 0 10)');
--- Touches middle with internal vertex 
+-- Touches middle with internal vertex
 SELECT 'e*10', topology.addEdge('tt', 'LINESTRING(0 10, 5 0, 5 10)');
 
 -- Endpoint touching cases (should succeed) ------

Modified: trunk/topology/test/regress/addface.sql
===================================================================
--- trunk/topology/test/regress/addface.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/addface.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -102,12 +102,12 @@
 'POLYGON((3 1,4 1,4 2,3 2,3 1))'
 );
 
--- Register hole in right face 
+-- Register hole in right face
 SELECT 't2.f5',  topology.addFace('t2',
 'POLYGON((12 2,12 4,14 4,14 2,12 2))'
 );
 
--- Attempt to register a not-fully-defined face 
+-- Attempt to register a not-fully-defined face
 SELECT topology.addFace('t2',
 'POLYGON((12 2,12 5,14 5,14 2,12 2))'
 );
@@ -124,7 +124,7 @@
 -- Test edge touching face ring on both endpoints but not covered
 -- (E1 with F1)
 --
---         
+--
 --   N2 +-------.
 --      |\  F1  |
 --   E1 | \     | E3
@@ -133,7 +133,7 @@
 --      | /E2   |
 --      |/      |
 --   N1 +-------'
--- 
+--
 SELECT topology.CreateTopology('t3') > 0;
 
 SELECT 't3.e1',  topology.addEdge('t3', 'LINESTRING(0 0, 0 10)');

Modified: trunk/topology/test/regress/addnode.sql
===================================================================
--- trunk/topology/test/regress/addnode.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/addnode.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -35,7 +35,7 @@
 -- Now allow computing containing face:
 SELECT 'p7',  topology.addNode('nodes', 'POINT(5 25)', false, true);
 
--- Check all nodes 
+-- Check all nodes
 SELECT node_id, containing_face, st_astext(geom) from nodes.node
 ORDER by node_id;
 

Modified: trunk/topology/test/regress/addtopogeometrycolumn.sql
===================================================================
--- trunk/topology/test/regress/addtopogeometrycolumn.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/addtopogeometrycolumn.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -39,7 +39,7 @@
 	'tg12','GEOMETRY');
 
 select l.layer_id, l.schema_name, l.table_name, l.feature_column,
- l.feature_type, l.level, l.child_id 
+ l.feature_type, l.level, l.child_id
 from topology.layer l, topology.topology t
 where l.topology_id = t.id and t.name = 'tt'
 order by l.layer_id;

Modified: trunk/topology/test/regress/createtopogeom.sql
===================================================================
--- trunk/topology/test/regress/createtopogeom.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/createtopogeom.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -14,25 +14,25 @@
 SELECT 'l1', topology.AddTopoGeometryColumn('MiX', 'MiX', 'poi', 'feat', 'POINT');
 
 -- A Layer of type 1 (POINT) cannot contain a TopoGeometry of type 2 (LINE)
-SELECT topology.CreateTopoGeom( 'MiX', 2, 1, '{{12,2}}'); 
+SELECT topology.CreateTopoGeom( 'MiX', 2, 1, '{{12,2}}');
 -- A Layer of type 1 (POINT) cannot contain a TopoGeometry of type 3 (POLY)
-SELECT topology.CreateTopoGeom( 'MiX', 3, 1, '{{13,3}}'); 
+SELECT topology.CreateTopoGeom( 'MiX', 3, 1, '{{13,3}}');
 -- A Layer of type 1 (POINT) cannot contain a TopoGeometry of type 4 (COLL.)
-SELECT topology.CreateTopoGeom( 'MiX', 4, 1, '{{12,2}}'); 
+SELECT topology.CreateTopoGeom( 'MiX', 4, 1, '{{12,2}}');
 
 -- Node 78 does not exist in topology MiX (trigger on "relation" table)
-SELECT topology.CreateTopoGeom( 'MiX', 1, 1, '{{78,1}}'); 
+SELECT topology.CreateTopoGeom( 'MiX', 1, 1, '{{78,1}}');
 
 SELECT 'n1',  topology.addNode('MiX', 'POINT(0 0)');
 
 -- Success !
 SELECT layer_id(tg), id(tg), type(tg) FROM (
  SELECT topology.CreateTopoGeom( 'MiX', 1, 1, '{{1,1}}') as tg
-) foo; 
+) foo;
 
 -- Invalid TopoGeometry type (out of range)
-SELECT CreateTopoGeom( 'MiX', 5, 1, '{{1,1}}'); 
-SELECT CreateTopoGeom( 'MiX', 0, 1, '{{1,1}}'); 
+SELECT CreateTopoGeom( 'MiX', 5, 1, '{{1,1}}');
+SELECT CreateTopoGeom( 'MiX', 0, 1, '{{1,1}}');
 
 CREATE TABLE "MiX".f_lineal (id int);
 SELECT 'l2', AddTopoGeometryColumn('MiX', 'MiX', 'f_lineal', 'feat', 'LINE');
@@ -65,6 +65,6 @@
 SELECT 'LINESTRING EMPTY', ST_AsEWKT( CreateTopoGeom( 'MiX', 2, 4, '{{0,0}}' ) );
 SELECT 'POLYGON EMPTY', ST_AsEWKT( CreateTopoGeom( 'MiX', 3, 4, '{{0,0}}' ) );
 SELECT 'GEOMETRYCOLLECTION EMPTY', ST_AsEWKT( CreateTopoGeom( 'MiX', 4, 4, '{{0,0}}' ) );
--- } Test emptyness 
+-- } Test emptyness
 
 SELECT DropTopology('MiX');

Modified: trunk/topology/test/regress/getnodeedges.sql
===================================================================
--- trunk/topology/test/regress/getnodeedges.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/getnodeedges.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -2,7 +2,7 @@
 
 \i load_topology.sql
 
-SELECT 'N'||node_id, (topology.GetNodeEdges('city_data', node_id)).* 
+SELECT 'N'||node_id, (topology.GetNodeEdges('city_data', node_id)).*
 	FROM city_data.node ORDER BY node_id, sequence;
 
 SELECT topology.DropTopology('city_data');

Modified: trunk/topology/test/regress/getringedges.sql
===================================================================
--- trunk/topology/test/regress/getringedges.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/getringedges.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -2,10 +2,10 @@
 
 \i load_topology.sql
 
-SELECT 'R'||edge_id, (topology.GetRingEdges('city_data', edge_id)).* 
+SELECT 'R'||edge_id, (topology.GetRingEdges('city_data', edge_id)).*
 	FROM city_data.edge;
 
-SELECT 'R-'||edge_id, (topology.GetRingEdges('city_data', -edge_id)).* 
+SELECT 'R-'||edge_id, (topology.GetRingEdges('city_data', -edge_id)).*
 	FROM city_data.edge;
 
 SELECT topology.DropTopology('city_data');

Modified: trunk/topology/test/regress/gml.sql
===================================================================
--- trunk/topology/test/regress/gml.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/gml.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -16,31 +16,31 @@
 
 -- Output again but with no prefix
 SELECT feature_name||'-noprefix', topology.AsGML(feature, '')
- FROM features.traffic_signs 
+ FROM features.traffic_signs
  WHERE feature_name IN ('S1', 'S2', 'S3', 'S4' )
  ORDER BY feature_name;
 
 -- Output again with custom prefix
 SELECT feature_name||'-customprefix', topology.AsGML(feature, 'cstm')
- FROM features.traffic_signs 
+ FROM features.traffic_signs
  WHERE feature_name IN ('S1', 'S2', 'S3', 'S4' )
  ORDER BY feature_name;
 
 -- Again with no prefix, no srsDimension (opt+=2)
 -- and swapped lat/lon (opt+=16) and short CRS
 SELECT feature_name||'-latlon', topology.AsGML(feature, '', 15, 18)
- FROM features.traffic_signs 
+ FROM features.traffic_signs
  WHERE feature_name IN ('S4');
 
---- } Puntual single-element 
+--- } Puntual single-element
 
 --- Puntual multi element {
 
 SELECT feature_name||'-noprefix', topology.AsGML(feature, '')
- FROM features.traffic_signs 
+ FROM features.traffic_signs
  WHERE feature_name IN ('N1N2N3');
 
---- } Puntual multi-element 
+--- } Puntual multi-element
 
 --- Lineal single element {
 
@@ -52,13 +52,13 @@
 
 -- Output again but with no prefix
 SELECT feature_name||'-noprefix', topology.AsGML(feature, '')
- FROM features.city_streets 
+ FROM features.city_streets
  WHERE feature_name IN ('R3', 'R4' )
  ORDER BY feature_name;
 
 -- Output again with custom prefix
 SELECT feature_name||'-customprefix', topology.AsGML(feature, 'cstm')
- FROM features.city_streets 
+ FROM features.city_streets
  WHERE feature_name IN ('R3', 'R4' )
  ORDER BY feature_name;
 
@@ -74,13 +74,13 @@
 
 -- Output again but with no prefix
 SELECT feature_name||'-noprefix', topology.AsGML(feature, '')
- FROM features.city_streets 
+ FROM features.city_streets
  WHERE feature_name IN ('R1', 'R2' )
  ORDER BY feature_name;
 
 -- Output again with custom prefix
 SELECT feature_name||'-customprefix', topology.AsGML(feature, 'cstm')
- FROM features.city_streets 
+ FROM features.city_streets
  WHERE feature_name IN ('R1', 'R2' )
  ORDER BY feature_name;
 
@@ -104,7 +104,7 @@
  FROM features.land_parcels WHERE feature_name IN ('P4', 'P5')
  ORDER BY feature_name;
 
---- } Areal single-element 
+--- } Areal single-element
 
 --- Areal multi-element {
 
@@ -116,17 +116,17 @@
 
 -- Output again but with no prefix
 SELECT feature_name||'-noprefix', topology.AsGML(feature, '')
- FROM features.land_parcels 
+ FROM features.land_parcels
  WHERE feature_name IN ('P1', 'P2', 'P3' )
  ORDER BY feature_name;
 
 -- Output again with custom prefix
 SELECT feature_name||'-customprefix', topology.AsGML(feature, 'cstm')
- FROM features.land_parcels 
+ FROM features.land_parcels
  WHERE feature_name IN ('P1', 'P2', 'P3' )
  ORDER BY feature_name;
 
---- } Areal multi-element 
+--- } Areal multi-element
 
 --- { Visited table bookkeeping
 
@@ -159,7 +159,7 @@
        ORDER BY feature_name;
 
 -- P2 visits F4,F7
---           E7,E17,E18,E13,E20,E19 
+--           E7,E17,E18,E13,E20,E19
 --           N17,N18,(N13),N10,N9,(N14),N17
 -- P1 visits F3,F6
 --           F3-> E6,(E19),(E9),(E21)
@@ -197,7 +197,7 @@
 
 -- Output in GML2
 SELECT feature_name||'-gml2' as name, topology.AsGML(feature,'',0,2,NULL,'',2)
- FROM features.city_streets 
+ FROM features.city_streets
  WHERE feature_name IN ('R1', 'R2', 'R3', 'R4' )
 UNION
 SELECT feature_name||'-gml2', topology.AsGML(feature,'',0,2,NULL,'',2)

Modified: trunk/topology/test/regress/layertrigger.sql
===================================================================
--- trunk/topology/test/regress/layertrigger.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/layertrigger.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -46,7 +46,7 @@
   select 'after delete n.2: topology.layer count', count(*) from topology.layer;
 ROLLBACK;
 
--- the trigger must accept the delete 
+-- the trigger must accept the delete
 delete from t2.l1;
 delete from t2.relation;
 delete from topology.layer where topology_id=2;

Modified: trunk/topology/test/regress/sqlmm.sql
===================================================================
--- trunk/topology/test/regress/sqlmm.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/sqlmm.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,8 +1,8 @@
 set client_min_messages to WARNING;
 
--- 
+--
 -- ST_InitTopoGeo
--- 
+--
 
 SELECT regexp_replace(ST_InitTopoGeo('sqlmm_topology'), 'id:[0-9]*', 'id:x');
 
@@ -33,7 +33,7 @@
 SELECT topology.ST_AddIsoNode('sqlmm_topology', NULL, 'POINT(10.000000000000001 0)');
 SELECT topology.ST_AddIsoNode('sqlmm_topology', NULL, 'POINT(7 10)');
 
--- non-existent face specification 
+-- non-existent face specification
 SELECT topology.ST_AddIsoNode('sqlmm_topology', 1, 'POINT(20 0)');
 
 -- using other then point
@@ -71,7 +71,7 @@
 SELECT topology.ST_AddIsoEdge('sqlmm_topology', 1, 2, 'LINESTRING(0 0, 1 1)');
 SELECT topology.ST_AddIsoEdge('sqlmm_topology', 1, 2, 'LINESTRING(0 1, 10 0)');
 
--- Node crossing 
+-- Node crossing
 SELECT topology.ST_AddIsoEdge('sqlmm_topology', 1, 2, 'LINESTRING(0 0, 10 0)');
 
 -- Good ones
@@ -94,7 +94,7 @@
 
 SELECT '-- ST_AddIsoNode(2) ------------------------';
 
--- ST_AddIsoNode edge-crossing node 
+-- ST_AddIsoNode edge-crossing node
 SELECT topology.ST_AddIsoNode('sqlmm_topology', NULL, 'POINT(5 9.5)');
 
 -------------------------------------------------------------

Modified: trunk/topology/test/regress/st_addedgemodface.sql
===================================================================
--- trunk/topology/test/regress/st_addedgemodface.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/st_addedgemodface.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -15,7 +15,7 @@
 SELECT topology.ST_AddEdgeModFace('city_data', 5, 6,
  'LINESTRING(36 38, 41 40, 57 33)');
 
--- Non-existent node 
+-- Non-existent node
 SELECT topology.ST_AddEdgeModFace('city_data', 5, 60000,
  'LINESTRING(36 38,57 33)');
 SELECT topology.ST_AddEdgeModFace('city_data', 60000, 6,
@@ -59,15 +59,15 @@
 
 -- Feature composed by face 3 and face 4
 INSERT INTO city_data.fp VALUES ('F3,F4',
-  topology.CreateTopoGeom('city_data', 3, 1, '{{3,3},{4,3}}')); 
+  topology.CreateTopoGeom('city_data', 3, 1, '{{3,3},{4,3}}'));
 
 CREATE TABLE city_data.fc(id varchar);
 SELECT 'L' || topology.AddTopoGeometryColumn('city_data',
   'city_data', 'fc', 'g', 'COLLECTION');
 
--- Feature composed by face 5 and node 4 
+-- Feature composed by face 5 and node 4
 INSERT INTO city_data.fc VALUES ('F5,N4',
-  topology.CreateTopoGeom('city_data', 4, 2, '{{5,3},{4,1}}')); 
+  topology.CreateTopoGeom('city_data', 4, 2, '{{5,3},{4,1}}'));
 
 
 ---------------------------------------------------------------------
@@ -86,7 +86,7 @@
   'LINESTRING(21 14, 35 22)') as edge_id INTO newedge;
 SELECT 'T1', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN (19, 7, 17, 10, 
+  city_data.edge WHERE edge_id IN (19, 7, 17, 10,
   ( SELECT edge_id FROM newedge WHERE id = 1 ) )
   ORDER BY edge_id;
 
@@ -102,7 +102,7 @@
   12, 18, 'LINESTRING(47 14, 35 22)');
 SELECT 'T2', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN (17, 8, 15, 11, 
+  city_data.edge WHERE edge_id IN (17, 8, 15, 11,
   ( SELECT edge_id FROM newedge WHERE id = 2 ) )
   ORDER BY edge_id;
 
@@ -118,7 +118,7 @@
   12, 10, 'LINESTRING(47 14, 35 6)');
 SELECT 'T3', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN (11, 16, 14, 18, 
+  city_data.edge WHERE edge_id IN (11, 16, 14, 18,
   ( SELECT edge_id FROM newedge WHERE id = 3 ) )
   ORDER BY edge_id;
 
@@ -134,7 +134,7 @@
   9, 13, 'LINESTRING(21 6, 35 14)');
 SELECT 'T4', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN (20, 10, 18, 13, 
+  city_data.edge WHERE edge_id IN (20, 10, 18, 13,
   ( SELECT edge_id FROM newedge WHERE id = 4 ) )
   ORDER BY edge_id;
 
@@ -222,7 +222,7 @@
   1, 1, 'LINESTRING(8 30, 5 27, 11 27, 8 30)');
 SELECT 'T12', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN (1, 
+  city_data.edge WHERE edge_id IN (1,
   ( SELECT edge_id FROM newedge WHERE id = 12 ) )
   ORDER BY edge_id;
 
@@ -233,7 +233,7 @@
   2, 2, 'LINESTRING(25 30, 28 27, 22 27, 25 30)');
 SELECT 'T13', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN (2, 
+  city_data.edge WHERE edge_id IN (2,
   ( SELECT edge_id FROM newedge WHERE id = 13 ) )
   ORDER BY edge_id;
 
@@ -246,7 +246,7 @@
   23, 1, 'LINESTRING(9 33, 8 30)');
 SELECT 'T14', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN (1, 
+  city_data.edge WHERE edge_id IN (1,
   ( SELECT edge_id FROM newedge WHERE id = 14 ) )
   ORDER BY edge_id;
 SELECT 'N' || node_id, containing_face
@@ -303,7 +303,7 @@
   25, 26,  'LINESTRING(35 28, 35 45, 63 45, 63 25, 39 25, 39 28)');
 SELECT 'T18', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN ( 4, 5, 43, 
+  city_data.edge WHERE edge_id IN ( 4, 5, 43,
   ( SELECT edge_id FROM newedge WHERE id = 18 ) )
   ORDER BY edge_id;
 
@@ -326,7 +326,7 @@
   10, 11,  'LINESTRING(35 6, 35 6, 44 0, 47 6, 47 6)');
 SELECT 'T20', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN ( 36,  14, 16, 
+  city_data.edge WHERE edge_id IN ( 36,  14, 16,
   ( SELECT edge_id FROM newedge WHERE id = 20 ) )
   ORDER BY edge_id;
 
@@ -344,7 +344,7 @@
   ORDER BY edge_id;
 
 --
--- Split a face containing an hole 
+-- Split a face containing an hole
 -- Faces on both sides contain isolated nodes.
 --
 SELECT 'T22-', 'N' || topology.st_addisonode('city_data', 23, 'POINT(26 36)'), 23;
@@ -354,7 +354,7 @@
   3, 3,  'LINESTRING(25 35, 27 35, 26 34, 25 35)');
 SELECT 'T22', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN ( 
+  city_data.edge WHERE edge_id IN (
     SELECT edge_id FROM newedge WHERE id IN (22, 16)
     UNION VALUES (2),(3) )
   ORDER BY edge_id;
@@ -370,7 +370,7 @@
   2, 3,  'LINESTRING(25 30, 29 32, 29 37, 25 35)');
 SELECT 'T23', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN ( 
+  city_data.edge WHERE edge_id IN (
     SELECT edge_id FROM newedge WHERE id IN (13, 23, 22, 16)
     UNION VALUES (2),(3) )
   ORDER BY edge_id;
@@ -383,7 +383,7 @@
 -- This version goes clockwise
 -- All involved faces contain isolated nodes
 --
-SELECT 'T24-', 'N' || st_addisonode('city_data', 28, 'POINT(19.5 37.5)'), 28; 
+SELECT 'T24-', 'N' || st_addisonode('city_data', 28, 'POINT(19.5 37.5)'), 28;
 SELECT 'T24-', 'N' || st_addisonode('city_data', 28, 'POINT(19 38)'), 28;
 SELECT 'T24-', 'N' || st_addisonode('city_data', 2, 'POINT(20.5 35)'), 2;
 SELECT 'T24-', 'N' || st_addisonode('city_data', 28, 'POINT(20.5 34)'), 28;
@@ -393,7 +393,7 @@
   30, 30,  'LINESTRING(19.5 37.5, 24.5 37.5, 19.5 32.5, 19.5 37.5)');
 SELECT 'T24', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN ( 
+  city_data.edge WHERE edge_id IN (
     SELECT edge_id FROM newedge WHERE id IN (24, 23, 16)
     UNION VALUES (2),(3) )
   ORDER BY edge_id;
@@ -410,7 +410,7 @@
   31, 31,  'LINESTRING(19 38, 19 31, 26 38, 19 38)');
 SELECT 'T25', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN ( 
+  city_data.edge WHERE edge_id IN (
     SELECT edge_id FROM newedge WHERE id IN (25, 24, 23, 16)
     UNION VALUES (2),(3) )
   ORDER BY edge_id;
@@ -425,7 +425,7 @@
   5, 6,  'LINESTRING(36 38, 57 33)');
 SELECT 'T26', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN ( 
+  city_data.edge WHERE edge_id IN (
     SELECT edge_id FROM newedge WHERE id IN (26, 17, 18)
     UNION VALUES (4),(5) )
   ORDER BY edge_id;
@@ -439,7 +439,7 @@
   5, 6, 'LINESTRING(36 38, 50 38, 57 33)');
 SELECT 'T27', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN ( 
+  city_data.edge WHERE edge_id IN (
     SELECT edge_id FROM newedge WHERE id IN (27, 17, 18, 26)
     UNION VALUES (4),(5) )
   ORDER BY edge_id;
@@ -456,7 +456,7 @@
   7, 7, 'LINESTRING(41 40, 38 40, 41 43, 41 40)');
 SELECT 'T28', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN ( 
+  city_data.edge WHERE edge_id IN (
     SELECT edge_id FROM newedge WHERE id IN (26, 27, 28, 17, 18)
     UNION VALUES (4),(5) )
   ORDER BY edge_id;

Modified: trunk/topology/test/regress/st_addedgenewfaces.sql
===================================================================
--- trunk/topology/test/regress/st_addedgenewfaces.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/st_addedgenewfaces.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -15,7 +15,7 @@
 SELECT topology.ST_AddEdgeNewFaces('city_data', 5, 6,
  'LINESTRING(36 38, 41 40, 57 33)');
 
--- Non-existent node 
+-- Non-existent node
 SELECT topology.ST_AddEdgeNewFaces('city_data', 5, 60000,
  'LINESTRING(36 38,57 33)');
 SELECT topology.ST_AddEdgeNewFaces('city_data', 60000, 6,
@@ -59,15 +59,15 @@
 
 -- Feature composed by face 3 and face 4
 INSERT INTO city_data.fp VALUES ('F3,F4',
-  topology.CreateTopoGeom('city_data', 3, 1, '{{3,3},{4,3}}')); 
+  topology.CreateTopoGeom('city_data', 3, 1, '{{3,3},{4,3}}'));
 
 CREATE TABLE city_data.fc(id varchar);
 SELECT 'L' || topology.AddTopoGeometryColumn('city_data',
   'city_data', 'fc', 'g', 'COLLECTION');
 
--- Feature composed by face 5 and node 4 
+-- Feature composed by face 5 and node 4
 INSERT INTO city_data.fc VALUES ('F5,N4',
-  topology.CreateTopoGeom('city_data', 4, 2, '{{5,3},{4,1}}')); 
+  topology.CreateTopoGeom('city_data', 4, 2, '{{5,3},{4,1}}'));
 
 
 ---------------------------------------------------------------------
@@ -86,7 +86,7 @@
   'LINESTRING(21 14, 35 22)') as edge_id INTO newedge;
 SELECT 'T1', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN (19, 7, 17, 10, 
+  city_data.edge WHERE edge_id IN (19, 7, 17, 10,
   ( SELECT edge_id FROM newedge WHERE id = 1 ) )
   ORDER BY edge_id;
 
@@ -102,7 +102,7 @@
   12, 18, 'LINESTRING(47 14, 35 22)');
 SELECT 'T2', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN (17, 8, 15, 11, 
+  city_data.edge WHERE edge_id IN (17, 8, 15, 11,
   ( SELECT edge_id FROM newedge WHERE id = 2 ) )
   ORDER BY edge_id;
 
@@ -118,7 +118,7 @@
   12, 10, 'LINESTRING(47 14, 35 6)');
 SELECT 'T3', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN (11, 16, 14, 18, 
+  city_data.edge WHERE edge_id IN (11, 16, 14, 18,
   ( SELECT edge_id FROM newedge WHERE id = 3 ) )
   ORDER BY edge_id;
 
@@ -134,7 +134,7 @@
   9, 13, 'LINESTRING(21 6, 35 14)');
 SELECT 'T4', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN (20, 10, 18, 13, 
+  city_data.edge WHERE edge_id IN (20, 10, 18, 13,
   ( SELECT edge_id FROM newedge WHERE id = 4 ) )
   ORDER BY edge_id;
 
@@ -222,7 +222,7 @@
   1, 1, 'LINESTRING(8 30, 5 27, 11 27, 8 30)');
 SELECT 'T12', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN (1, 
+  city_data.edge WHERE edge_id IN (1,
   ( SELECT edge_id FROM newedge WHERE id = 12 ) )
   ORDER BY edge_id;
 
@@ -233,7 +233,7 @@
   2, 2, 'LINESTRING(25 30, 28 27, 22 27, 25 30)');
 SELECT 'T13', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN (2, 
+  city_data.edge WHERE edge_id IN (2,
   ( SELECT edge_id FROM newedge WHERE id = 13 ) )
   ORDER BY edge_id;
 
@@ -246,7 +246,7 @@
   23, 1, 'LINESTRING(9 33, 8 30)');
 SELECT 'T14', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN (1, 
+  city_data.edge WHERE edge_id IN (1,
   ( SELECT edge_id FROM newedge WHERE id = 14 ) )
   ORDER BY edge_id;
 SELECT 'N' || node_id, containing_face
@@ -303,7 +303,7 @@
   25, 26,  'LINESTRING(35 28, 35 45, 63 45, 63 25, 39 25, 39 28)');
 SELECT 'T18', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN ( 4, 5, 43, 
+  city_data.edge WHERE edge_id IN ( 4, 5, 43,
   ( SELECT edge_id FROM newedge WHERE id = 18 ) )
   ORDER BY edge_id;
 
@@ -326,7 +326,7 @@
   10, 11,  'LINESTRING(35 6, 35 6, 44 0, 47 6, 47 6)');
 SELECT 'T20', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN ( 36,  14, 16, 
+  city_data.edge WHERE edge_id IN ( 36,  14, 16,
   ( SELECT edge_id FROM newedge WHERE id = 20 ) )
   ORDER BY edge_id;
 
@@ -344,7 +344,7 @@
   ORDER BY edge_id;
 
 --
--- Split a face containing an hole 
+-- Split a face containing an hole
 -- Faces on both sides contain isolated nodes.
 --
 SELECT 'T22-', 'N' || topology.st_addisonode('city_data', 32, 'POINT(26 36)'), 32;
@@ -354,7 +354,7 @@
   3, 3,  'LINESTRING(25 35, 27 35, 26 34, 25 35)');
 SELECT 'T22', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN ( 
+  city_data.edge WHERE edge_id IN (
     SELECT edge_id FROM newedge WHERE id IN (22, 16)
     UNION VALUES (2),(3) )
   ORDER BY edge_id;
@@ -370,7 +370,7 @@
   2, 3,  'LINESTRING(25 30, 29 32, 29 37, 25 35)');
 SELECT 'T23', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN ( 
+  city_data.edge WHERE edge_id IN (
     SELECT edge_id FROM newedge WHERE id IN (13, 23, 22, 16)
     UNION VALUES (2),(3) )
   ORDER BY edge_id;
@@ -383,7 +383,7 @@
 -- This version goes clockwise
 -- All involved faces contain isolated nodes
 --
-SELECT 'T24-', 'N' || st_addisonode('city_data', 39, 'POINT(19.5 37.5)'), 39; 
+SELECT 'T24-', 'N' || st_addisonode('city_data', 39, 'POINT(19.5 37.5)'), 39;
 SELECT 'T24-', 'N' || st_addisonode('city_data', 39, 'POINT(19 38)'), 39;
 SELECT 'T24-', 'N' || st_addisonode('city_data', 31, 'POINT(20.5 35)'), 31;
 SELECT 'T24-', 'N' || st_addisonode('city_data', 39, 'POINT(20.5 34)'), 39;
@@ -393,7 +393,7 @@
   30, 30,  'LINESTRING(19.5 37.5, 24.5 37.5, 19.5 32.5, 19.5 37.5)');
 SELECT 'T24', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN ( 
+  city_data.edge WHERE edge_id IN (
     SELECT edge_id FROM newedge WHERE id IN (24, 23, 16)
     UNION VALUES (2),(3) )
   ORDER BY edge_id;
@@ -410,7 +410,7 @@
   31, 31,  'LINESTRING(19 38, 19 31, 26 38, 19 38)');
 SELECT 'T25', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN ( 
+  city_data.edge WHERE edge_id IN (
     SELECT edge_id FROM newedge WHERE id IN (25, 24, 23, 16)
     UNION VALUES (2),(3) )
   ORDER BY edge_id;
@@ -425,7 +425,7 @@
   5, 6,  'LINESTRING(36 38, 57 33)');
 SELECT 'T26', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN ( 
+  city_data.edge WHERE edge_id IN (
     SELECT edge_id FROM newedge WHERE id IN (26, 17, 18)
     UNION VALUES (4),(5) )
   ORDER BY edge_id;
@@ -439,7 +439,7 @@
   5, 6, 'LINESTRING(36 38, 50 38, 57 33)');
 SELECT 'T27', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN ( 
+  city_data.edge WHERE edge_id IN (
     SELECT edge_id FROM newedge WHERE id IN (27, 17, 18, 26)
     UNION VALUES (4),(5) )
   ORDER BY edge_id;
@@ -456,7 +456,7 @@
   7, 7, 'LINESTRING(41 40, 38 40, 41 43, 41 40)');
 SELECT 'T28', 'E'||edge_id, next_left_edge, next_right_edge,
   left_face, right_face FROM
-  city_data.edge WHERE edge_id IN ( 
+  city_data.edge WHERE edge_id IN (
     SELECT edge_id FROM newedge WHERE id IN (26, 27, 28, 17, 18)
     UNION VALUES (4),(5) )
   ORDER BY edge_id;

Modified: trunk/topology/test/regress/st_addisoedge.sql
===================================================================
--- trunk/topology/test/regress/st_addisoedge.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/st_addisoedge.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -37,7 +37,7 @@
 SELECT topology.ST_AddIsoEdge('tt', 1, 2, 'LINESTRING(0 0, 1 1)');
 SELECT topology.ST_AddIsoEdge('tt', 1, 2, 'LINESTRING(0 1, 10 0)');
 
--- Node crossing 
+-- Node crossing
 SELECT topology.ST_AddIsoEdge('tt', 1, 2, 'LINESTRING(0 0, 10 0)');
 
 -- Good one

Modified: trunk/topology/test/regress/st_addisonode.sql
===================================================================
--- trunk/topology/test/regress/st_addisonode.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/st_addisonode.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -1,7 +1,7 @@
 set client_min_messages to WARNING;
 \set VERBOSITY terse
 
--- Usual city_data input 
+-- Usual city_data input
 
 \i load_topology.sql
 

Modified: trunk/topology/test/regress/st_changeedgegeom.sql
===================================================================
--- trunk/topology/test/regress/st_changeedgegeom.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/st_changeedgegeom.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -13,7 +13,7 @@
 SELECT topology.ST_ChangeEdgeGeom('city_data', 25,
  'LINESTRING(9 35, 13 36)');
 
--- Node crossing 
+-- Node crossing
 SELECT topology.ST_ChangeEdgeGeom('city_data', 3,
   'LINESTRING(25 30, 20 36, 20 38, 25 35)');
 
@@ -37,7 +37,7 @@
 SELECT 'T2', topology.ST_ChangeEdgeGeom('city_data', 5,
  'LINESTRING(41 40, 57 33)');
 
--- Change to edge crossing old self 
+-- Change to edge crossing old self
 SELECT 'T3', topology.ST_ChangeEdgeGeom('city_data', 5,
  'LINESTRING(41 40, 49 40, 49 34, 57 33)');
 
@@ -82,7 +82,7 @@
 SELECT 'T7.1', topology.ST_ChangeEdgeGeom('city_data', 2,
 'LINESTRING(25 30, 28 39, 17 39, 25 30)');
 -- Check face update
-SELECT 'T7F.1', 
+SELECT 'T7F.1',
   ST_Equals(f.mbr, ST_Envelope(ST_GetFaceGeometry('city_data', f.face_id)))
   FROM city_data.face f, city_data.edge e
   WHERE e.edge_id = 2 AND f.face_id = e.left_face;
@@ -95,7 +95,7 @@
 SELECT 'T8', topology.ST_ChangeEdgeGeom('city_data', 26,
  'LINESTRING(4 31, 4 30.4, 5 30.4, 4 31)');
 -- Check face update
-SELECT 'T8F', 
+SELECT 'T8F',
   ST_Equals(f.mbr, ST_Envelope(ST_GetFaceGeometry('city_data', f.face_id)))
   FROM city_data.face f, city_data.edge e
   WHERE e.edge_id = 26 AND f.face_id = e.left_face;
@@ -117,7 +117,7 @@
  'LINESTRING(21 22, 28 18, 35 22)');
 
 -- test enlarging a face MBR by moving an edge
-SELECT 'T11', ST_ChangeEdgeGeom('city_data', 16, 
+SELECT 'T11', ST_ChangeEdgeGeom('city_data', 16,
  'LINESTRING(47 6, 51 10, 47 14)');
 -- Check face update
 SELECT 'T11F',

Modified: trunk/topology/test/regress/st_createtopogeo.sql
===================================================================
--- trunk/topology/test/regress/st_createtopogeo.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/st_createtopogeo.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -29,7 +29,7 @@
 DECLARE
  sql text;
 BEGIN
-  sql := 'select ' || quote_literal(lbl) || '::text, 
+  sql := 'select ' || quote_literal(lbl) || '::text,
        ( select count(node_id) || '' nodes'' from t.node ) as nodes,
        ( select count(edge_id) || '' edges'' from t.edge ) as edges,
        ( select count(face_id) || '' faces'' from t.face
@@ -42,7 +42,7 @@
 -- Invalid geometries
 select null from ( select topology.CreateTopology('t', 4326) > 0 ) as ct;
 select topology.st_createtopogeo('t', null); -- Invalid geometry
-select 'invalid_srid', topology.st_createtopogeo('t', 'POINT(0 0)'); 
+select 'invalid_srid', topology.st_createtopogeo('t', 'POINT(0 0)');
 select null from ( select topology.DropTopology('t') ) as dt;
 
 -- Single point
@@ -214,7 +214,7 @@
 select * from print_isolated_nodes('T15');
 select null from ( select topology.DropTopology('t') ) as dt;
 
--- Three mergeable lines 
+-- Three mergeable lines
 select null from ( select topology.CreateTopology('t') > 0 ) as ct;
 select 'T16', st_asewkt(g) FROM (
 SELECT g, topology.st_createtopogeo('t', g) FROM ( SELECT

Modified: trunk/topology/test/regress/st_modedgeheal.sql
===================================================================
--- trunk/topology/test/regress/st_modedgeheal.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/st_modedgeheal.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -19,12 +19,12 @@
 SELECT topology.ST_ModEdgeHeal('city_data', 2, 3);
 SELECT topology.ST_ModEdgeHeal('city_data', 3, 2);
 
--- Heal to self 
+-- Heal to self
 SELECT topology.ST_ModEdgeHeal('city_data', 25, 25);
 
 -- Good ones {
 
--- check state before 
+-- check state before
 SELECT 'E'||edge_id,
   ST_AsText(ST_StartPoint(geom)), ST_AsText(ST_EndPoint(geom)),
   next_left_edge, next_right_edge, start_node, end_node
@@ -59,7 +59,7 @@
 -------------------------------------------------------------------------
 -------------------------------------------------------------------------
 
--- Now test in presence of features 
+-- Now test in presence of features
 
 SELECT topology.CreateTopology('t') > 1;
 CREATE TABLE t.f(id varchar);
@@ -69,7 +69,7 @@
 SELECT 'E'||topology.AddEdge('t', 'LINESTRING(2  8,  8  8)');      -- 2
 
 INSERT INTO t.f VALUES ('F+E1',
-  topology.CreateTopoGeom('t', 2, 1, '{{1,2}}')); 
+  topology.CreateTopoGeom('t', 2, 1, '{{1,2}}'));
 
 -- This should be forbidden, as F+E1 above could not be
 -- defined w/out one of the edges
@@ -86,12 +86,12 @@
 SELECT 'E'||topology.AddEdge('t', 'LINESTRING(10 0, 5 0)');        -- 4
 
 INSERT INTO t.f VALUES ('F+E3-E4',
-  topology.CreateTopoGeom('t', 2, 1, '{{3,2},{-4,2}}')); 
+  topology.CreateTopoGeom('t', 2, 1, '{{3,2},{-4,2}}'));
 INSERT INTO t.f VALUES ('F-E3+E4',
-  topology.CreateTopoGeom('t', 2, 1, '{{-3,2},{4,2}}')); 
+  topology.CreateTopoGeom('t', 2, 1, '{{-3,2},{4,2}}'));
 
 SELECT r.topogeo_id, r.element_id
-  FROM t.relation r, t.f f WHERE 
+  FROM t.relation r, t.f f WHERE
   r.layer_id = layer_id(f.g) AND r.topogeo_id = id(f.g)
   AND r.topogeo_id in (2,3)
   ORDER BY r.layer_id, r.topogeo_id;
@@ -104,7 +104,7 @@
 SELECT topology.ST_ModEdgeHeal('t', 1, 3);
 
 SELECT r.topogeo_id, r.element_id
-  FROM t.relation r, t.f f WHERE 
+  FROM t.relation r, t.f f WHERE
   r.layer_id = layer_id(f.g) AND r.topogeo_id = id(f.g)
   AND r.topogeo_id in (2,3)
   ORDER BY r.layer_id, r.topogeo_id;
@@ -123,36 +123,36 @@
 SELECT '#1955.1', 'E'||topology.AddEdge('t', 'LINESTRING(0 0, 10 0, 10 10)');        -- 1
 SELECT '#1955.1', 'E'||topology.AddEdge('t', 'LINESTRING(0 0, 0 10, 10 10)'); ;      -- 2
 
-SELECT '#1955.1', count(node_id), 'start nodes' as label FROM t.node GROUP BY label; 
+SELECT '#1955.1', count(node_id), 'start nodes' as label FROM t.node GROUP BY label;
 
 -- Deletes second node. Not very predictable which one is removed
 SELECT '#1955.1', 'H:1,2', 'N' || topology.ST_ModEdgeHeal('t', 1, 2), 'deleted';
 
-SELECT '#1955.1', count(node_id), 'nodes left' as label FROM t.node GROUP BY label; 
+SELECT '#1955.1', count(node_id), 'nodes left' as label FROM t.node GROUP BY label;
 
 SELECT '#1955.2', 'E'||topology.AddEdge('t', 'LINESTRING(50 0, 60 0, 60 10)');        -- 3
 SELECT '#1955.2', 'E'||topology.AddEdge('t', 'LINESTRING(50 0, 50 10, 60 10)'); ;     -- 4
 SELECT '#1955.2', 'E'||topology.AddEdge('t', 'LINESTRING(60 10, 70 10)'); ;           -- 5
 
-SELECT '#1955.2', count(node_id), 'start nodes' as label FROM t.node GROUP BY label; 
+SELECT '#1955.2', count(node_id), 'start nodes' as label FROM t.node GROUP BY label;
 
 -- Only the start node can be deleted (50 0) because the other is shared by
--- another edge 
+-- another edge
 SELECT '#1955.2', 'H:3,4', 'N' || topology.ST_ModEdgeHeal('t', 3, 4), 'deleted';
 
-SELECT '#1955.2', count(node_id), 'nodes left' as label FROM t.node GROUP BY label; 
+SELECT '#1955.2', count(node_id), 'nodes left' as label FROM t.node GROUP BY label;
 
 SELECT '#1955.3', 'E'||topology.AddEdge('t', 'LINESTRING(80 0, 90 0, 90 10)');        -- 6
 SELECT '#1955.3', 'E'||topology.AddEdge('t', 'LINESTRING(80 0, 80 10, 90 10)'); ;     -- 7
 SELECT '#1955.3', 'E'||topology.AddEdge('t', 'LINESTRING(70 10, 80 0)'); ;            -- 8
 
-SELECT '#1955.3', count(node_id), 'start nodes' as label FROM t.node GROUP BY label; 
+SELECT '#1955.3', count(node_id), 'start nodes' as label FROM t.node GROUP BY label;
 
 -- Only the end node can be deleted (90 10) because the other is shared by
--- another edge 
+-- another edge
 SELECT '#1955.3', 'H:6,7', 'N' || topology.ST_ModEdgeHeal('t', 6, 7), 'deleted';
 
-SELECT '#1955.3', count(node_id), 'nodes left' as label FROM t.node GROUP BY label; 
+SELECT '#1955.3', count(node_id), 'nodes left' as label FROM t.node GROUP BY label;
 
 SELECT '#1955', topology.DropTopology('t');
 

Modified: trunk/topology/test/regress/st_modedgesplit.sql
===================================================================
--- trunk/topology/test/regress/st_modedgesplit.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/st_modedgesplit.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -33,12 +33,12 @@
     o := rec.xx;
     RETURN NEXT;
   END LOOP;
-  
+
   -- Check effect on edges (there should be one split)
   sql := '
   WITH node_limits AS ( SELECT max FROM city_data.limits WHERE what = ''node''::text ),
        edge_limits AS ( SELECT max FROM city_data.limits WHERE what = ''edge''::text )
-  SELECT ''E|'' || e.edge_id || ''|sn'' || e.start_node || ''|en'' || e.end_node 
+  SELECT ''E|'' || e.edge_id || ''|sn'' || e.start_node || ''|en'' || e.end_node
          || ''|nl'' || e.next_left_edge
          || ''|nr'' || e.next_right_edge
          || ''|lf'' || e.left_face
@@ -72,7 +72,7 @@
 SELECT 'invalid', ST_ModEdgeSplit('city_data', 10, NULL);
 SELECT 'invalid', ST_ModEdgeSplit('fake', 10, 'SRID=4326;POINT(28 14)');
 
--- Non-isolated edge 
+-- Non-isolated edge
 SELECT 'noniso', ST_ModEdgeSplit('city_data', 10, 'SRID=4326;POINT(28 14)');
 SELECT check_changes();
 
@@ -80,11 +80,11 @@
 SELECT 'iso', ST_ModEdgeSplit('city_data', 25, 'SRID=4326;POINT(11 35)');
 SELECT check_changes();
 
--- Dangling on end point 
+-- Dangling on end point
 SELECT 'dangling_end', ST_ModEdgeSplit('city_data', 3, 'SRID=4326;POINT(25 32)');
 SELECT check_changes();
 
--- Dangling on start point 
+-- Dangling on start point
 SELECT 'dangling_start', ST_ModEdgeSplit('city_data', 4, 'SRID=4326;POINT(45 32)');
 SELECT check_changes();
 
@@ -109,9 +109,9 @@
 -- Robustness of edge splitting (#1711)
 
 -- clean all up first
-DELETE FROM city_data.edge_data; 
-DELETE FROM city_data.node; 
-DELETE FROM city_data.face where face_id > 0; 
+DELETE FROM city_data.edge_data;
+DELETE FROM city_data.node;
+DELETE FROM city_data.face where face_id > 0;
 SELECT 'seq_reset',
        setval('city_data.edge_data_edge_id_seq', 1, false),
        setval('city_data.face_face_id_seq', 1, false),
@@ -121,7 +121,7 @@
 SELECT
 ST_SetSRID(
 '01020000000400000000000000000034400000000000002440000000000000244000000000000024400000000000002240000000000000284000000000000024400000000000003440'
-::geometry, 4326) as line, 
+::geometry, 4326) as line,
 ST_SetSRID(
 '010100000000000000000022400000000000002840'
 ::geometry, 4326) as point,

Modified: trunk/topology/test/regress/st_newedgeheal.sql
===================================================================
--- trunk/topology/test/regress/st_newedgeheal.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/st_newedgeheal.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -19,12 +19,12 @@
 SELECT topology.ST_NewEdgeHeal('city_data', 2, 3);
 SELECT topology.ST_NewEdgeHeal('city_data', 3, 2);
 
--- Heal to self 
+-- Heal to self
 SELECT topology.ST_NewEdgeHeal('city_data', 25, 25);
 
 -- Good ones {
 
--- check state before 
+-- check state before
 SELECT 'E'||edge_id,
   ST_AsText(ST_StartPoint(geom)), ST_AsText(ST_EndPoint(geom)),
   next_left_edge, next_right_edge, start_node, end_node
@@ -59,7 +59,7 @@
 -------------------------------------------------------------------------
 -------------------------------------------------------------------------
 
--- Now test in presence of features 
+-- Now test in presence of features
 
 SELECT topology.CreateTopology('t') > 1;
 CREATE TABLE t.f(id varchar);
@@ -69,7 +69,7 @@
 SELECT 'E'||topology.AddEdge('t', 'LINESTRING(2  8,  8  8)');      -- 2
 
 INSERT INTO t.f VALUES ('F+E1',
-  topology.CreateTopoGeom('t', 2, 1, '{{1,2}}')); 
+  topology.CreateTopoGeom('t', 2, 1, '{{1,2}}'));
 
 -- This should be forbidden, as F+E1 above could not be
 -- defined w/out one of the edges
@@ -86,12 +86,12 @@
 SELECT 'E'||topology.AddEdge('t', 'LINESTRING(10 0, 5 0)');        -- 4
 
 INSERT INTO t.f VALUES ('F+E3-E4',
-  topology.CreateTopoGeom('t', 2, 1, '{{3,2},{-4,2}}')); 
+  topology.CreateTopoGeom('t', 2, 1, '{{3,2},{-4,2}}'));
 INSERT INTO t.f VALUES ('F-E3+E4',
-  topology.CreateTopoGeom('t', 2, 1, '{{-3,2},{4,2}}')); 
+  topology.CreateTopoGeom('t', 2, 1, '{{-3,2},{4,2}}'));
 
 SELECT r.topogeo_id, r.element_id
-  FROM t.relation r, t.f f WHERE 
+  FROM t.relation r, t.f f WHERE
   r.layer_id = layer_id(f.g) AND r.topogeo_id = id(f.g)
   AND r.topogeo_id in (2,3)
   ORDER BY r.layer_id, r.topogeo_id;
@@ -104,7 +104,7 @@
 SELECT topology.ST_NewEdgeHeal('t', 1, 5);
 
 SELECT r.topogeo_id, r.element_id
-  FROM t.relation r, t.f f WHERE 
+  FROM t.relation r, t.f f WHERE
   r.layer_id = layer_id(f.g) AND r.topogeo_id = id(f.g)
   AND r.topogeo_id in (2,3)
   ORDER BY r.layer_id, r.topogeo_id;
@@ -120,36 +120,36 @@
 SELECT '#1955.1', 'E'||topology.AddEdge('t', 'LINESTRING(0 0, 10 0, 10 10)');        -- 1
 SELECT '#1955.1', 'E'||topology.AddEdge('t', 'LINESTRING(0 0, 0 10, 10 10)'); ;      -- 2
 
-SELECT '#1955.1', count(node_id), 'start nodes' as label FROM t.node GROUP BY label; 
+SELECT '#1955.1', count(node_id), 'start nodes' as label FROM t.node GROUP BY label;
 
 -- Deletes second node. Not very predictable which one is removed
 SELECT '#1955.1', 'H:1,2', 'E' || topology.ST_NewEdgeHeal('t', 1, 2), 'created';
 
-SELECT '#1955.1', count(node_id), 'nodes left' as label FROM t.node GROUP BY label; 
+SELECT '#1955.1', count(node_id), 'nodes left' as label FROM t.node GROUP BY label;
 
 SELECT '#1955.2', 'E'||topology.AddEdge('t', 'LINESTRING(50 0, 60 0, 60 10)');        -- 4
 SELECT '#1955.2', 'E'||topology.AddEdge('t', 'LINESTRING(50 0, 50 10, 60 10)'); ;     -- 5
 SELECT '#1955.2', 'E'||topology.AddEdge('t', 'LINESTRING(60 10, 70 10)'); ;           -- 6
 
-SELECT '#1955.2', count(node_id), 'start nodes' as label FROM t.node GROUP BY label; 
+SELECT '#1955.2', count(node_id), 'start nodes' as label FROM t.node GROUP BY label;
 
 -- Only the start node can be deleted (50 0) because the other is shared by
--- another edge 
+-- another edge
 SELECT '#1955.2', 'H:4,5', 'E' || topology.ST_NewEdgeHeal('t', 4, 5), 'created';
 
-SELECT '#1955.2', count(node_id), 'nodes left' as label FROM t.node GROUP BY label; 
+SELECT '#1955.2', count(node_id), 'nodes left' as label FROM t.node GROUP BY label;
 
 SELECT '#1955.3', 'E'||topology.AddEdge('t', 'LINESTRING(80 0, 90 0, 90 10)');        -- 8
 SELECT '#1955.3', 'E'||topology.AddEdge('t', 'LINESTRING(80 0, 80 10, 90 10)'); ;     -- 9
 SELECT '#1955.3', 'E'||topology.AddEdge('t', 'LINESTRING(70 10, 80 0)'); ;            -- 10
 
-SELECT '#1955.3', count(node_id), 'start nodes' as label FROM t.node GROUP BY label; 
+SELECT '#1955.3', count(node_id), 'start nodes' as label FROM t.node GROUP BY label;
 
 -- Only the end node can be deleted (90 10) because the other is shared by
--- another edge 
+-- another edge
 SELECT '#1955.3', 'H:8,9', 'E' || topology.ST_NewEdgeHeal('t', 8, 9), 'created';
 
-SELECT '#1955.3', count(node_id), 'nodes left' as label FROM t.node GROUP BY label; 
+SELECT '#1955.3', count(node_id), 'nodes left' as label FROM t.node GROUP BY label;
 
 SELECT '#1955', topology.DropTopology('t');
 

Modified: trunk/topology/test/regress/st_newedgessplit.sql
===================================================================
--- trunk/topology/test/regress/st_newedgessplit.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/st_newedgessplit.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -33,12 +33,12 @@
     o := rec.xx;
     RETURN NEXT;
   END LOOP;
-  
+
   -- Check effect on edges (there should be one split)
   sql := '
   WITH node_limits AS ( SELECT max FROM city_data.limits WHERE what = ''node''::text ),
        edge_limits AS ( SELECT max FROM city_data.limits WHERE what = ''edge''::text )
-  SELECT ''E|'' || e.edge_id || ''|sn'' || e.start_node || ''|en'' || e.end_node 
+  SELECT ''E|'' || e.edge_id || ''|sn'' || e.start_node || ''|en'' || e.end_node
          || ''|nl'' || e.next_left_edge
          || ''|nr'' || e.next_right_edge
          || ''|lf'' || e.left_face
@@ -72,7 +72,7 @@
 SELECT 'invalid', ST_NewEdgesSplit('city_data', 10, NULL);
 SELECT 'invalid', ST_NewEdgesSplit('fake', 10, 'SRID=4326;POINT(28 14)');
 
--- Non-isolated edge 
+-- Non-isolated edge
 SELECT 'noniso', ST_NewEdgesSplit('city_data', 10, 'SRID=4326;POINT(28 14)');
 SELECT check_changes();
 
@@ -80,11 +80,11 @@
 SELECT 'iso', ST_NewEdgesSplit('city_data', 25, 'SRID=4326;POINT(11 35)');
 SELECT check_changes();
 
--- Dangling on end point 
+-- Dangling on end point
 SELECT 'dangling_end', ST_NewEdgesSplit('city_data', 3, 'SRID=4326;POINT(25 32)');
 SELECT check_changes();
 
--- Dangling on start point 
+-- Dangling on start point
 SELECT 'dangling_start', ST_NewEdgesSplit('city_data', 4, 'SRID=4326;POINT(45 32)');
 SELECT check_changes();
 
@@ -109,9 +109,9 @@
 -- Robustness of edge splitting (#1711)
 
 -- clean all up first
-DELETE FROM city_data.edge_data; 
-DELETE FROM city_data.node; 
-DELETE FROM city_data.face where face_id > 0; 
+DELETE FROM city_data.edge_data;
+DELETE FROM city_data.node;
+DELETE FROM city_data.face where face_id > 0;
 SELECT 'seq_reset',
        setval('city_data.edge_data_edge_id_seq', 1, false),
        setval('city_data.face_face_id_seq', 1, false),
@@ -121,7 +121,7 @@
 SELECT
 ST_SetSRID(
 '01020000000400000000000000000034400000000000002440000000000000244000000000000024400000000000002240000000000000284000000000000024400000000000003440'
-::geometry, 4326) as line, 
+::geometry, 4326) as line,
 ST_SetSRID(
 '010100000000000000000022400000000000002840'
 ::geometry, 4326) as point,

Modified: trunk/topology/test/regress/st_remedgemodface.sql
===================================================================
--- trunk/topology/test/regress/st_remedgemodface.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/st_remedgemodface.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -30,18 +30,18 @@
   q text;
 BEGIN
   sql1 := 'node_id,
-      containing_face 
+      containing_face
   		FROM city_data.node';
   sql2 := 'node_id, containing_face
   		FROM orig_node_summary';
 
   q := '(' ||
           'SELECT ' || quote_literal(lbl) || ',''+'' as op,' || sql1 ||
-          ' EXCEPT ' || 
+          ' EXCEPT ' ||
           'SELECT ' || quote_literal(lbl) || ',''+'',' || sql2 ||
           ') UNION ( ' ||
           'SELECT ' || quote_literal(lbl) || ',''-'',' || sql2 ||
-          ' EXCEPT ' || 
+          ' EXCEPT ' ||
           'SELECT ' || quote_literal(lbl) || ',''-'',' || sql1 ||
        ') ORDER BY node_id, op';
 
@@ -57,7 +57,7 @@
 RETURNS VOID
 AS $$
   TRUNCATE orig_edge_summary;
-  INSERT INTO orig_edge_summary 
+  INSERT INTO orig_edge_summary
   SELECT edge_id,
     next_left_edge, next_right_edge, left_face, right_face
     FROM city_data.edge_data;
@@ -83,11 +83,11 @@
 
   q := '(' ||
           'SELECT ' || quote_literal(lbl) || ',''+'' as op,' || sql1 ||
-          ' EXCEPT ' || 
+          ' EXCEPT ' ||
           'SELECT ' || quote_literal(lbl) || ',''+'',' || sql2 ||
           ') UNION ( ' ||
           'SELECT ' || quote_literal(lbl) || ',''-'',' || sql2 ||
-          ' EXCEPT ' || 
+          ' EXCEPT ' ||
           'SELECT ' || quote_literal(lbl) || ',''-'',' || sql1 ||
        ') order by edge_id, op';
 
@@ -103,7 +103,7 @@
 RETURNS VOID
 AS $$
   TRUNCATE orig_face_summary;
-  INSERT INTO orig_face_summary 
+  INSERT INTO orig_face_summary
   SELECT face_id, mbr
     FROM city_data.face;
 $$ LANGUAGE 'sql';
@@ -121,11 +121,11 @@
 
   q := '(' ||
           'SELECT ' || quote_literal(lbl) || ',''+'' as op,' || sql1 ||
-          ' EXCEPT ' || 
+          ' EXCEPT ' ||
           'SELECT ' || quote_literal(lbl) || ',''+'',' || sql2 ||
           ') UNION ( ' ||
           'SELECT ' || quote_literal(lbl) || ',''-'',' || sql2 ||
-          ' EXCEPT ' || 
+          ' EXCEPT ' ||
           'SELECT ' || quote_literal(lbl) || ',''-'',' || sql1 ||
        ') ORDER BY face_id, op';
 
@@ -207,7 +207,7 @@
 SELECT * FROM check_faces('RM(20)/faces');
 SELECT save_edges(); SELECT save_faces(); SELECT save_nodes();
 
--- Universe flooding existing face 
+-- Universe flooding existing face
 SELECT 'RM(15)', topology.ST_RemEdgeModFace('city_data', 15);
 SELECT * FROM check_nodes('RM(15)/nodes');
 SELECT * FROM check_edges('RM(15)/edges');
@@ -215,7 +215,7 @@
 SELECT save_edges(); SELECT save_faces(); SELECT save_nodes();
 
 
--- Universe flooding existing single-edge (closed) face 
+-- Universe flooding existing single-edge (closed) face
 -- with dangling edge starting from the closing node and
 -- going inside.
 -- Closed edge is in CW order.
@@ -225,7 +225,7 @@
 SELECT * FROM check_faces('RM(2)/faces');
 SELECT save_edges(); SELECT save_faces(); SELECT save_nodes();
 
--- Universe flooding existing single-edge (closed) face 
+-- Universe flooding existing single-edge (closed) face
 -- with dangling edge coming from inside and ending to the closing node
 -- Closed edge is in CW order.
 -- Requires reconstructing the outer ring
@@ -241,7 +241,7 @@
 SELECT * FROM check_faces('RM(27)/faces');
 SELECT save_edges(); SELECT save_faces(); SELECT save_nodes();
 
--- Universe flooding existing single-edge (closed) face 
+-- Universe flooding existing single-edge (closed) face
 -- with dangling edge coming from inside and ending to the closing node
 -- Closed edge is in CCW order.
 -- Requires reconstructing the outer ring
@@ -257,7 +257,7 @@
 SELECT * FROM check_faces('RM(28)/faces');
 SELECT save_edges(); SELECT save_faces(); SELECT save_nodes();
 
--- Universe flooding existing single-edge (closed) face 
+-- Universe flooding existing single-edge (closed) face
 -- with dangling edge starting from closing node and going inside.
 -- Closed edge is in CCW order.
 -- Requires reconstructing the outer ring
@@ -291,7 +291,7 @@
 SELECT save_edges(); SELECT save_faces(); SELECT save_nodes();
 
 -- Universe flooding existing single-edge (closed) face
--- with dangling edges both inside 
+-- with dangling edges both inside
 -- Closed edge in CW order.
 -- Requires reconstructing the outer ring
 SELECT 'NE(32)', topology.ST_AddEdgeNewFaces('city_data', 3, 3, 'SRID=4326;LINESTRING(25 35, 18 35, 18 40, 28 40, 28 27, 18 27, 25 35)');
@@ -307,7 +307,7 @@
 SELECT save_edges(); SELECT save_faces(); SELECT save_nodes();
 
 -- Universe flooding existing single-edge (closed) face
--- with dangling edges both inside 
+-- with dangling edges both inside
 -- Closed edge in CCW order.
 -- Requires reconstructing the outer ring
 SELECT 'NE(33)', topology.ST_AddEdgeNewFaces('city_data', 3, 3,
@@ -323,7 +323,7 @@
 SELECT * FROM check_faces('RM(33)/faces');
 SELECT save_edges(); SELECT save_faces(); SELECT save_nodes();
 
--- Universe flooding existing single-edge (closed) face 
+-- Universe flooding existing single-edge (closed) face
 -- with dangling edge starting from closing node and going outside.
 -- Closed edge is in CW order.
 -- Requires reconstructing the outer ring
@@ -340,7 +340,7 @@
 SELECT * FROM check_faces('RM(34)/faces');
 SELECT save_edges(); SELECT save_faces(); SELECT save_nodes();
 
--- Universe flooding existing single-edge (closed) face 
+-- Universe flooding existing single-edge (closed) face
 -- with dangling edge starting from closing node and going outside.
 -- Closed edge is in CCW order.
 -- Requires reconstructing the outer ring
@@ -362,7 +362,7 @@
 
 
 -------------------------------------------------------------------------
--- Now test in presence of features 
+-- Now test in presence of features
 -------------------------------------------------------------------------
 -- {
 
@@ -394,7 +394,7 @@
 SELECT '*RM(15)', topology.ST_RemEdgeModFace('city_data', 15); -- face_left=8
 
 -- Check that no land_parcel objects had topology changed
-SELECT 'RM(11)', feature_name, 
+SELECT 'RM(11)', feature_name,
  ST_Equals( ST_Multi(feature::geometry), ST_Multi(the_geom) ) as unchanged
  FROM features.land_parcels;
 

Modified: trunk/topology/test/regress/st_remedgenewface.sql
===================================================================
--- trunk/topology/test/regress/st_remedgenewface.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/st_remedgenewface.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -31,18 +31,18 @@
   q text;
 BEGIN
   sql1 := 'node_id,
-      containing_face 
+      containing_face
   		FROM city_data.node';
   sql2 := 'node_id, containing_face
   		FROM orig_node_summary';
 
   q := '(' ||
           'SELECT ' || quote_literal(lbl) || ',''+'' as op,' || sql1 ||
-          ' EXCEPT ' || 
+          ' EXCEPT ' ||
           'SELECT ' || quote_literal(lbl) || ',''+'',' || sql2 ||
           ') UNION ( ' ||
           'SELECT ' || quote_literal(lbl) || ',''-'',' || sql2 ||
-          ' EXCEPT ' || 
+          ' EXCEPT ' ||
           'SELECT ' || quote_literal(lbl) || ',''-'',' || sql1 ||
        ') ORDER BY node_id, op';
 
@@ -58,7 +58,7 @@
 RETURNS VOID
 AS $$
   TRUNCATE orig_edge_summary;
-  INSERT INTO orig_edge_summary 
+  INSERT INTO orig_edge_summary
   SELECT edge_id,
     next_left_edge, next_right_edge, left_face, right_face
     FROM city_data.edge_data;
@@ -84,11 +84,11 @@
 
   q := '(' ||
           'SELECT ' || quote_literal(lbl) || ',''+'' as op,' || sql1 ||
-          ' EXCEPT ' || 
+          ' EXCEPT ' ||
           'SELECT ' || quote_literal(lbl) || ',''+'',' || sql2 ||
           ') UNION ( ' ||
           'SELECT ' || quote_literal(lbl) || ',''-'',' || sql2 ||
-          ' EXCEPT ' || 
+          ' EXCEPT ' ||
           'SELECT ' || quote_literal(lbl) || ',''-'',' || sql1 ||
        ') order by edge_id, op';
 
@@ -104,7 +104,7 @@
 RETURNS VOID
 AS $$
   TRUNCATE orig_face_summary;
-  INSERT INTO orig_face_summary 
+  INSERT INTO orig_face_summary
   SELECT face_id, mbr
     FROM city_data.face;
 $$ LANGUAGE 'sql';
@@ -122,11 +122,11 @@
 
   q := '(' ||
           'SELECT ' || quote_literal(lbl) || ',''+'' as op,' || sql1 ||
-          ' EXCEPT ' || 
+          ' EXCEPT ' ||
           'SELECT ' || quote_literal(lbl) || ',''+'',' || sql2 ||
           ') UNION ( ' ||
           'SELECT ' || quote_literal(lbl) || ',''-'',' || sql2 ||
-          ' EXCEPT ' || 
+          ' EXCEPT ' ||
           'SELECT ' || quote_literal(lbl) || ',''-'',' || sql1 ||
        ') ORDER BY face_id, op';
 
@@ -208,7 +208,7 @@
 SELECT * FROM check_faces('RN(20)/faces');
 SELECT save_edges(); SELECT save_faces(); SELECT save_nodes();
 
--- Universe flooding existing face 
+-- Universe flooding existing face
 SELECT 'RN(15)', topology.ST_RemEdgeNewFace('city_data', 15);
 SELECT * FROM check_nodes('RN(15)/nodes');
 SELECT * FROM check_edges('RN(15)/edges');
@@ -216,7 +216,7 @@
 SELECT save_edges(); SELECT save_faces(); SELECT save_nodes();
 
 
--- Universe flooding existing single-edge (closed) face 
+-- Universe flooding existing single-edge (closed) face
 -- with dangling edge starting from the closing node and
 -- going inside.
 -- Closed edge is in CW order.
@@ -226,7 +226,7 @@
 SELECT * FROM check_faces('RN(2)/faces');
 SELECT save_edges(); SELECT save_faces(); SELECT save_nodes();
 
--- Universe flooding existing single-edge (closed) face 
+-- Universe flooding existing single-edge (closed) face
 -- with dangling edge coming from inside and ending to the closing node
 -- Closed edge is in CW order.
 -- Requires reconstructing the outer ring
@@ -242,7 +242,7 @@
 SELECT * FROM check_faces('RN(27)/faces');
 SELECT save_edges(); SELECT save_faces(); SELECT save_nodes();
 
--- Universe flooding existing single-edge (closed) face 
+-- Universe flooding existing single-edge (closed) face
 -- with dangling edge coming from inside and ending to the closing node
 -- Closed edge is in CCW order.
 -- Requires reconstructing the outer ring
@@ -258,7 +258,7 @@
 SELECT * FROM check_faces('RN(28)/faces');
 SELECT save_edges(); SELECT save_faces(); SELECT save_nodes();
 
--- Universe flooding existing single-edge (closed) face 
+-- Universe flooding existing single-edge (closed) face
 -- with dangling edge starting from closing node and going inside.
 -- Closed edge is in CCW order.
 -- Requires reconstructing the outer ring
@@ -292,7 +292,7 @@
 SELECT save_edges(); SELECT save_faces(); SELECT save_nodes();
 
 -- Universe flooding existing single-edge (closed) face
--- with dangling edges both inside 
+-- with dangling edges both inside
 -- Closed edge in CW order.
 -- Requires reconstructing the outer ring
 SELECT 'NE(32)', topology.ST_AddEdgeNewFaces('city_data', 3, 3, 'SRID=4326;LINESTRING(25 35, 18 35, 18 40, 28 40, 28 27, 18 27, 25 35)');
@@ -308,7 +308,7 @@
 SELECT save_edges(); SELECT save_faces(); SELECT save_nodes();
 
 -- Universe flooding existing single-edge (closed) face
--- with dangling edges both inside 
+-- with dangling edges both inside
 -- Closed edge in CCW order.
 -- Requires reconstructing the outer ring
 SELECT 'NE(33)', topology.ST_AddEdgeNewFaces('city_data', 3, 3,
@@ -324,7 +324,7 @@
 SELECT * FROM check_faces('RN(33)/faces');
 SELECT save_edges(); SELECT save_faces(); SELECT save_nodes();
 
--- Universe flooding existing single-edge (closed) face 
+-- Universe flooding existing single-edge (closed) face
 -- with dangling edge starting from closing node and going outside.
 -- Closed edge is in CW order.
 -- Requires reconstructing the outer ring
@@ -341,7 +341,7 @@
 SELECT * FROM check_faces('RN(34)/faces');
 SELECT save_edges(); SELECT save_faces(); SELECT save_nodes();
 
--- Universe flooding existing single-edge (closed) face 
+-- Universe flooding existing single-edge (closed) face
 -- with dangling edge starting from closing node and going outside.
 -- Closed edge is in CCW order.
 -- Requires reconstructing the outer ring
@@ -363,7 +363,7 @@
 
 
 -------------------------------------------------------------------------
--- Now test in presence of features 
+-- Now test in presence of features
 -------------------------------------------------------------------------
 -- {
 
@@ -395,7 +395,7 @@
 SELECT '*RM(15)', topology.ST_RemEdgeNewFace('city_data', 15); -- face_left=10
 
 -- Check that no land_parcel objects had topology changed
-SELECT 'RN(11)', feature_name, 
+SELECT 'RN(11)', feature_name,
  ST_Equals( ST_Multi(feature::geometry), ST_Multi(the_geom) ) as unchanged
  FROM features.land_parcels;
 

Modified: trunk/topology/test/regress/topogeo_addlinestring.sql
===================================================================
--- trunk/topology/test/regress/topogeo_addlinestring.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/topogeo_addlinestring.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -31,7 +31,7 @@
     o := rec.xx;
     RETURN NEXT;
   END LOOP;
-  
+
   -- Check effect on edges (there should be one split)
   sql := '
   WITH node_limits AS ( SELECT max FROM city_data.limits WHERE what = ''node''::text ),
@@ -82,7 +82,7 @@
 SELECT 'noniso_ex', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(35 6, 35 14)');
 SELECT check_changes();
 
--- Existing non-isolated edge within tolerance 
+-- Existing non-isolated edge within tolerance
 SELECT 'noniso_ex_tol', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(35 7, 35 13)', 2);
 SELECT check_changes();
 
@@ -90,7 +90,7 @@
 SELECT 'contained', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(35 8, 35 12)');
 SELECT check_changes();
 
--- Overlapping 
+-- Overlapping
 SELECT 'overlap', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(45 22, 49 22)') ORDER BY 2;
 SELECT check_changes();
 
@@ -135,9 +135,9 @@
 -- See http://trac.osgeo.org/postgis/ticket/1631
 
 -- clean all up first
-DELETE FROM city_data.edge_data; 
-DELETE FROM city_data.node; 
-DELETE FROM city_data.face where face_id > 0; 
+DELETE FROM city_data.edge_data;
+DELETE FROM city_data.node;
+DELETE FROM city_data.face where face_id > 0;
 
 SELECT '#1631.1', TopoGeo_addLineString('city_data',
   'SRID=4326;LINESTRING(556267.56295432 144887.06663814,556267.566 144888)'
@@ -154,11 +154,11 @@
 -- See http://trac.osgeo.org/postgis/ticket/1641
 
 -- clean all up first
-DELETE FROM city_data.edge_data; DELETE FROM city_data.node; 
-DELETE FROM city_data.face where face_id > 0; 
+DELETE FROM city_data.edge_data; DELETE FROM city_data.node;
+DELETE FROM city_data.face where face_id > 0;
 
 SELECT '#1641.1', TopoGeo_addLineString('city_data',
-  'SRID=4326;LINESTRING(-0.223586 0.474301, 0.142550 0.406124)' 
+  'SRID=4326;LINESTRING(-0.223586 0.474301, 0.142550 0.406124)'
 ) ORDER BY 2;
 SELECT check_changes();
 -- Use a tolerance
@@ -173,11 +173,11 @@
 
 -- Now w/out explicit tolerance (will use local min)
 -- clean all up first
-DELETE FROM city_data.edge_data; DELETE FROM city_data.node; 
-DELETE FROM city_data.face where face_id > 0; 
+DELETE FROM city_data.edge_data; DELETE FROM city_data.node;
+DELETE FROM city_data.face where face_id > 0;
 
 SELECT '#1641.3', TopoGeo_addLineString('city_data',
-  'SRID=4326;LINESTRING(-0.223586 0.474301, 0.142550 0.406124)' 
+  'SRID=4326;LINESTRING(-0.223586 0.474301, 0.142550 0.406124)'
 ) ORDER BY 2;
 SELECT check_changes();
 SELECT '#1641.4', TopoGeo_addLineString('city_data',
@@ -190,8 +190,8 @@
 
 -- See http://trac.osgeo.org/postgis/ticket/1650
 
-DELETE FROM city_data.edge_data; DELETE FROM city_data.node; 
-DELETE FROM city_data.face where face_id > 0; 
+DELETE FROM city_data.edge_data; DELETE FROM city_data.node;
+DELETE FROM city_data.face where face_id > 0;
 
 SELECT '#1650.1' UNION ALL
 SELECT '#1650.2' || TopoGeo_addLineString('city_data',
@@ -208,10 +208,10 @@
 SELECT * FROM ValidateTopology('city_data');
 
 -- Test snapping of line over a node
--- See http://trac.osgeo.org/postgis/ticket/1654 
+-- See http://trac.osgeo.org/postgis/ticket/1654
 
-DELETE FROM city_data.edge_data; DELETE FROM city_data.node; 
-DELETE FROM city_data.face where face_id > 0; 
+DELETE FROM city_data.edge_data; DELETE FROM city_data.node;
+DELETE FROM city_data.face where face_id > 0;
 
 SELECT '#1654.1', 'N', ST_AddIsoNode('city_data', 0, 'SRID=4326;POINT(0 0)');
 SELECT check_changes();
@@ -223,11 +223,11 @@
 -- Consistency check
 SELECT * FROM ValidateTopology('city_data');
 
--- Test snapping of new edge endpoints 
--- See http://trac.osgeo.org/postgis/ticket/1706 
+-- Test snapping of new edge endpoints
+-- See http://trac.osgeo.org/postgis/ticket/1706
 
-DELETE FROM city_data.edge_data; DELETE FROM city_data.node; 
-DELETE FROM city_data.face where face_id > 0; 
+DELETE FROM city_data.edge_data; DELETE FROM city_data.node;
+DELETE FROM city_data.face where face_id > 0;
 
 SELECT '#1706.1', 'E', TopoGeo_AddLineString('city_data',
  'SRID=4326;LINESTRING(20 10, 10 10, 9 12, 10 20)');
@@ -241,11 +241,11 @@
 -- Consistency check
 SELECT * FROM ValidateTopology('city_data');
 
--- Test noding after snap 
--- See http://trac.osgeo.org/postgis/ticket/1714 
+-- Test noding after snap
+-- See http://trac.osgeo.org/postgis/ticket/1714
 
-DELETE FROM city_data.edge_data; DELETE FROM city_data.node; 
-DELETE FROM city_data.face where face_id > 0; 
+DELETE FROM city_data.edge_data; DELETE FROM city_data.node;
+DELETE FROM city_data.face where face_id > 0;
 
 SELECT '#1714.1', 'N', AddNode('city_data', 'SRID=4326;POINT(10 0)', false, true);
 SELECT check_changes();

Modified: trunk/topology/test/regress/topogeo_addpoint.sql
===================================================================
--- trunk/topology/test/regress/topogeo_addpoint.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/topogeo_addpoint.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -29,7 +29,7 @@
 -- Existing non-isolated node within tolerance (closer to edge)
 SELECT 'noniso_ex_tol', TopoGeo_addPoint('city_data', 'POINT(26 30.2)', 3);
 
--- Splitting edge 
+-- Splitting edge
 SELECT 'split', TopoGeo_addPoint('city_data', 'POINT(26 30.2)', 1);
 
 -- Check effect on nodes
@@ -40,7 +40,7 @@
 
 -- Check effect on edges (there should be one split)
 WITH limits AS ( SELECT max FROM city_data.limits WHERE what = 'node'::text )
-SELECT 'E', n.edge_id, n.start_node, n.end_node 
+SELECT 'E', n.edge_id, n.start_node, n.end_node
  FROM city_data.edge n, limits m
  WHERE n.start_node > m.max
     OR n.end_node > m.max

Modified: trunk/topology/test/regress/topogeo_addpolygon.sql
===================================================================
--- trunk/topology/test/regress/topogeo_addpolygon.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/topogeo_addpolygon.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -30,8 +30,8 @@
     o := rec.xx;
     RETURN NEXT;
   END LOOP;
-  
-  -- Check effect on edges 
+
+  -- Check effect on edges
   sql := '
   WITH node_limits AS ( SELECT max FROM city_data.limits WHERE what = ''node''::text ),
        edge_limits AS ( SELECT max FROM city_data.limits WHERE what = ''edge''::text )

Modified: trunk/topology/test/regress/topojson.sql
===================================================================
--- trunk/topology/test/regress/topojson.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/topojson.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -11,13 +11,13 @@
 SELECT 'E' || TopoGeo_addLinestring('city_data', 'LINESTRING(21 14, 28 10)');
 SELECT 'E' || TopoGeo_addLinestring('city_data', 'LINESTRING(35 14, 28 18)');
 
---- Lineal non-hierarchical 
+--- Lineal non-hierarchical
 SELECT 'L1-vanilla', feature_name, topology.AsTopoJSON(feature, NULL)
  FROM features.city_streets
  WHERE feature_name IN ('R3', 'R4', 'R1', 'R2' )
  ORDER BY feature_name;
 
---- Lineal hierarchical 
+--- Lineal hierarchical
 SELECT 'L2-vanilla', feature_name, topology.AsTopoJSON(feature, NULL)
  FROM features.big_streets
  WHERE feature_name IN ('R4', 'R1R2' )
@@ -38,13 +38,13 @@
 -- Now again with edge mapping {
 CREATE TEMP TABLE edgemap (arc_id serial, edge_id int unique);
 
---- Lineal non-hierarchical 
+--- Lineal non-hierarchical
 SELECT 'L1-edgemap', feature_name, topology.AsTopoJSON(feature, 'edgemap')
  FROM features.city_streets
  WHERE feature_name IN ('R3', 'R4', 'R1', 'R2' )
  ORDER BY feature_name;
 
---- Lineal hierarchical 
+--- Lineal hierarchical
 TRUNCATE edgemap; SELECT NULLIF(setval('edgemap_arc_id_seq', 1, false), 1);
 SELECT 'L2-edgemap', feature_name, topology.AsTopoJSON(feature, 'edgemap')
  FROM features.big_streets
@@ -78,9 +78,9 @@
 SELECT 'E' || TopoGeo_addLinestring('city_data', 'LINESTRING(3 47, 33 47, 33 52, 3 52, 3 47)');
 SELECT 'E' || TopoGeo_addLinestring('city_data', 'LINESTRING(10 48, 16 48, 16 50, 10 50, 10 48)');
 
--- And this defines a new feature including both face 1and the new 
+-- And this defines a new feature including both face 1and the new
 -- wrapping face 11 plus the new (holed) face 12
-INSERT INTO features.land_parcels VALUES ('P6', 
+INSERT INTO features.land_parcels VALUES ('P6',
   topology.CreateTopoGeom(
     'city_data', -- Topology name
     3, -- Topology geometry type (polygon/multipolygon)

Modified: trunk/topology/test/regress/validatetopology.sql
===================================================================
--- trunk/topology/test/regress/validatetopology.sql	2016-04-27 14:14:26 UTC (rev 14868)
+++ trunk/topology/test/regress/validatetopology.sql	2016-04-27 14:45:28 UTC (rev 14869)
@@ -3,7 +3,7 @@
 
 -- TODO: merge legacy_validate.sql here
 
--- See ticket #1789 
+-- See ticket #1789
 select null from ( select topology.CreateTopology('t') > 0 ) as ct;
 COPY t.node (node_id, containing_face, geom) FROM stdin;
 1	\N	01010000000000000000E065C002000000008056C0
@@ -14,10 +14,10 @@
 1	1	3	2	2	1	1	0	0	0102000000020000000000000000E065C002000000008056C000000000009865C04FE5D4AD958655C0
 2	3	2	-2	2	-1	1	0	0	01020000000200000000000000009865C04FE5D4AD958655C00000000000E065C000000000008056C0
 \.
-SELECT '#1789', * FROM ValidateTopology('t') UNION 
+SELECT '#1789', * FROM ValidateTopology('t') UNION
 SELECT '#1789', '---', null, null ORDER BY 1,2,3,4;
 
-SELECT '#1797', (ValidateTopology('t')).* UNION 
+SELECT '#1797', (ValidateTopology('t')).* UNION
 SELECT '#1797', '---', null, null ORDER BY 1,2,3,4;
 
 select null from ( select topology.DropTopology('t') ) as dt;



More information about the postgis-tickets mailing list