- BUGFIX in line_locate_point()
- Fixed handling of postgresql paths
- Fixed a premature exit in postgis_restore.pl
+ - Fixed memory bug in line_substring()
PostGIS 1.1.0
2005/12/21
return 1;
}
+/*
+ * TODO: implement point interpolation
+ */
POINTARRAY *
ptarray_substring(POINTARRAY *ipa, double from, double to)
{
* so far. create a new point some distance down the current
* segment.
*/
- if ( state == 0 )
+ if ( state == 0 ) /* before */
{
if ( from < tlength + slength ) {
dseg = (from - tlength) / slength;
}
}
- if ( state == 1 )
+ if ( state == 1 ) /* inside */
{
+ /* Need interpolation */
if ( to < tlength + slength ) {
dseg = (to - tlength) / slength;
pt.x = (p1.x) + ((p2.x - p1.x) * dseg);
memcpy(optsptr, &pt, ptsize);
optsptr+=ptsize;
nopts++; break;
- } else {
- memcpy(optsptr, &p2, ptsize);
+ }
+
+ /* Copy verbatim point */
+ else {
+ pt.x = p2.x;
+ pt.y = p2.y;
+ pt.z = 0; pt.m = 0;
+ memcpy(optsptr, &pt, ptsize);
optsptr+=ptsize;
nopts++;
}
--- postgis-users/2006-January/010613.html
select 'line_locate_point', line_locate_point(geomfromtext('LINESTRING(-1953743.873 471070.784,-1953735.105 471075.419,-1953720.034 471081.649)', 6269), geomfromtext('POINT(-1953720.034 471081.649)', 6269));
select 'line_locate_point', line_locate_point(geomfromtext('LINESTRING(-1953743.873 471070.784,-1953735.105 471075.419,-1953720.034 471081.649)', 6269), geomfromtext('POINT(-1953743.873 471070.784)', 6269));
+
+--- postgis-devel/2006-January/001951.html
+select 'line_substring', asewkt(line_substring(geomfromewkt('SRID=4326;LINESTRING(0 0 0 0, 1 1 1 1, 2 2 2 2, 3 3 3 3, 4 4 4 4)'), 0.5, 0.8));
line_locate_point|0.528602749909894
line_locate_point|1
line_locate_point|0
+line_substring|SRID=4326;LINESTRING(2 2 0 0,3 3 0 0,3.2 3.2 0 0)