Opened 15 years ago
Last modified 9 years ago
#859 new defect
v.patch: category abuse
Reported by: | hamish | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 6.4.6 |
Component: | Vector | Version: | svn-develbranch6 |
Keywords: | v.digit | Cc: | |
CPU: | x86-64 | Platform: | Linux |
Description
Hi,
I am trying to patch together a couple hundred individual lines into a single map. Each line has been given a unique category number so that when their (identical) tables are merged they will not conflict.
after creating an empty vector with v.in.ascii and creating a matching table for it, the patch loop looks like this:
for MAP in `g.mlist vect pattern="track_*"` ; do v.patch -a -e in="$MAP" out=tracks --overwrite --quiet done
g.mlist+v.db.select for some input maps:
cat|filename 10101|M02-001-0101 10224|M02-001-0224 10346|M02-001-0346 12305|M02-001-2305 20044|M02-002-0044 20209|M02-002-0209 20333|M02-002-0333 20458|M02-002-0458 20650|M02-002-0650 20813|M02-002-0813 20944|M02-002-0944 21112|M02-002-1112 21253|M02-002-1253 21434|M03-002-1434 21557|M03-002-1557 21721|M03-002-1721 21854|M03-002-1854
v.db.select for v.patch output:
cat|filename 10102|M02-001-0101 20327|M02-001-0224 30674|M02-001-0346 42980|M02-001-2305 63025|M02-002-0044 83235|M02-002-0209 103569|M02-002-0333 124028|M02-002-0458 144679|M02-002-0650 165493|M02-002-0813 186438|M02-002-0944 207551|M02-002-1112 228805|M02-002-1253 250240|M03-002-1434 271798|M03-002-1557 293520|M03-002-1721 315375|M03-002-1854
you can see that the category value in the output patch becomes:
1 + map1 1 + map1 + 1 + map2 1 + map1 + 1 + map2 + 1 + map3 . . .
how to make max_cat() or what ever is doing it stop?
- I cannot guarantee that input maps arrive sorted by cat, smallest to largest.
- It has to check if the cat is already used, if so it has to decide what to do with existing database attributes. Probably exit with a fatal error.
- I suppose this needs a flag: you either care to preserve the cat but accept fatal errors and a small time penalty; or you don't mind reassigning cats to avoid fatal errors.
thanks, Hamish
Note:
See TracTickets
for help on using tickets.
if the attribute table is not being copied (the -e flag is not used) then allowing duplicate cats is in fact wanted. again a flag could be used to avoid duplicates if that's what the user wants.