Changes between Version 84 and Version 85 of PostGIS_Raster_SoC_Idea_2012/Distance_Analysis_Tools


Ignore:
Timestamp:
Aug 17, 2012, 12:45:23 PM (12 years ago)
Author:
qliu
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • PostGIS_Raster_SoC_Idea_2012/Distance_Analysis_Tools

    v84 v85  
    972972            END LOOP;
    973973        END LOOP;
    974                
    975                 -- There is place for optimization here for a more efficient scanning method
    976         FOR x IN 1..width LOOP
    977             FOR y IN 1..height LOOP
    978                                 newx := ST_Raster2WorldCoordX(newrast, x, y);
    979                                 newy := ST_Raster2WorldCoordY(newrast, x, y);
    980                                 -- If pixel is the source point then Eculidean distance is zero
    981                                 IF THEN
    982                                         newval := 0;
    983                                 ELSE
    984                                         exesql := "SELECT ST_Distance(ST_GeomFromText('POINT(" || newx || " " || newy || ")'," || newsrid || "),ST_Transform(" || sourcegeomcolumn || "," || newsrid || ")) FROM " || sourcetable || " ORDER BY $1 <-> $2 LIMIT 1;";
    985                                         newval := EXECUTE(exesql);
    986                                 END IF;
    987                                 newrast := ST_SetValue(newrast, band, x, y, newval);
    988             END LOOP;
    989         END LOOP;
     974
    990975        RETURN newrast;
    991976    END;