[GRASS-dev] Re: [GRASS GIS] #224: cache bug in DGLib
GRASS GIS
trac at osgeo.org
Fri Oct 8 11:34:09 EDT 2010
#224: cache bug in DGLib
----------------------+-----------------------------------------------------
Reporter: martinl | Owner: grass-dev@…
Type: defect | Status: reopened
Priority: major | Milestone: 6.4.0
Component: Vector | Version: 6.4.0
Resolution: | Keywords: vector, dglib, cache
Platform: All | Cpu: All
----------------------+-----------------------------------------------------
Changes (by huhabla):
* cc: huhabla (added)
* status: closed => reopened
* version: svn-develbranch6 => 6.4.0
* resolution: fixed =>
Comment:
It seems to me that this bug still exists in the release version of grass
6.
v.net.path produces wrong results on my 64Bit SUSE 11.2 system in case the
cache is enabled.
You can reproduce the error using the following script within the
spearfish location:
{{{
g.region vect=roads
d.mon start=x0
d.erase
g.copy vect=roads,roads_path --o
v.db.addcol roads_path col="forward double precision, backward double
precision"
# define traveling costs as inverse of speed limit:
v.db.update roads_path col=forward val=1/50
v.db.update roads_path col=backward val=1/50
v.db.update roads_path col=forward val=1/75 where="label='interstate'"
v.db.update roads_path col=backward val=1/75 where="label='interstate'"
v.db.update roads_path col=forward val=1/5 where="label='unimproved road'"
v.db.update roads_path col=backward val=1/5 where="label='unimproved
road'"
v.db.update roads_path col=forward val=1/25 where="label='light-duty road,
improved surface'"
v.db.update roads_path col=backward val=1/25 where="label='light-duty
road, improved surface'"
v.db.select roads_path
# cat x y x y
echo "1 601241.63900415 4914234.39834025 592750.64315353 4925991.16182573"
> /tmp/input.txt
echo "2 601241.63900415 4914234.39834025 595808.58921162 4926703.69294606"
>> /tmp/input.txt
echo "3 601241.63900415 4914234.39834025 604507.406639 4915125.06224066"
>> /tmp/input.txt
echo "4 601241.63900415 4914234.39834025 591206.82572614 4919103.36099585"
>> /tmp/input.txt
echo "5 601241.63900415 4914234.39834025 590791.18257261 4926614.62655602"
>> /tmp/input.txt
echo "6 601241.63900415 4914234.39834025 591088.07053942 4927119.33609959"
>> /tmp/input.txt
echo "7 601241.63900415 4914234.39834025 596194.54356846 4917322.03319502"
>> /tmp/input.txt
echo "8 601241.63900415 4914234.39834025 600172.84232365 4925575.5186722"
>> /tmp/input.txt
echo "9 601241.63900415 4914234.39834025 605041.80497925 4920736.24481328"
>> /tmp/input.txt
echo "10 601241.63900415 4914234.39834025 599074.35684647
4914946.92946058" >> /tmp/input.txt
echo "11 601241.63900415 4914234.39834025 595452.32365145
4920676.86721992" >> /tmp/input.txt
echo "12 601241.63900415 4914234.39834025 608277.88381743
4924269.21161826" >> /tmp/input.txt
v.net.path roads_path afcol=forward abcol=backward out=mypath type=line
dmax=50 file=/tmp/input.txt --o
d.vect map=roads_path at user1 color=255:0:0 lcolor=0:0:0 fcolor=170:170:170
display=shape type=point,line,boundary,area icon=basic/circle size=5
width=4 layer=1 lsize=8 xref=left yref=center llayer=1
d.vect map=mypath at user1 color=0:0:0 lcolor=0:0:0 fcolor=170:170:170
display=shape type=point,line,boundary,area icon=basic/circle size=5
width=2 layer=1 lsize=8 xref=left yref=center llayer=1
}}}
Screenshot is attached.
Disabling the caching mechanism in Vlib/net.c solves the problem:
{{{
grass64_release/lib/vector> svn diff
Index: Vlib/net.c
===================================================================
--- Vlib/net.c (Revision 43825)
+++ Vlib/net.c (Arbeitskopie)
@@ -486,22 +486,22 @@
pclip = NULL;
if (List != NULL) {
- nRet =
+ /*nRet =
dglShortestPath(&(Map->graph), &pSPReport, (dglInt32_t) from,
(dglInt32_t) to, clipper, pclip,
&(Map->spCache));
- /* comment out above and uncomment below to debug dglib cache */
- /* nRet =
+ comment out above and uncomment below to debug dglib cache */
+ nRet =
dglShortestPath(&(Map->graph), &pSPReport, (dglInt32_t) from,
- (dglInt32_t) to, clipper, pclip, NULL); */
+ (dglInt32_t) to, clipper, pclip, NULL);
}
else {
- nRet =
+ /*nRet =
dglShortestDistance(&(Map->graph), &nDistance, (dglInt32_t)
from,
(dglInt32_t) to, clipper, pclip,
&(Map->spCache));
- /* comment out above and uncomment below to debug dglib cache */
- /* nRet =
+ comment out above and uncomment below to debug dglib cache */
+ nRet =
dglShortestDistance(&(Map->graph), &nDistance, (dglInt32_t)
from,
- (dglInt32_t) to, clipper, pclip, NULL); */
+ (dglInt32_t) to, clipper, pclip, NULL);
}
if (nRet == 0) {
}}}
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/224#comment:10>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list