Вы находитесь на странице: 1из 44

La go Vit Nam v nhng con s

(Dn Vit) - Go l lng thc quan trng nht Vit Nam. N cng l ngun lng thc quan trng nht cho hn na loi ngi, nht l cc nc ng , ng Nam v Nam . Vi ngi Vit d bt c u, n cm ch vic n ni chung gm nhiu th ch khng ch c cm. Cm, go, thc, la l nhng t thun Vit v gn vi lch s, vi cuc sng ca ngi Vit t ngn i nay. T BSCL, qua min Trung, n ng bng Bc B v ln tn ro cao, ngi Vit d thuc sc tc no cng u bit trng la. V la, go s cn gn vi ngi Vit lu di, d vi s pht trin, c th ngi Vit s tiu th ngy cng t go i, d s lao ng trc tip lm ra la go c gim i.

Theo s liu ca T chc Lng thc v Nng nghip (FAO) ca Lin Hp Quc, Vit Nam ng u th gii v ht tiu v ht iu, go ng th 5 cng vi cao su v u . Vit Nam c 24 mt hng nng nghip thc phm ng hng t 1 n 10 th gii (37 mt hng ng t hng 1 n 20) cho thy vai tr ca ccsn phm nng nghip Vit Nam.

Xt v sn lng go, nm 2009 Vit Nam ng th 5 sau Trung Quc (197 triu tn), n (131 triu tn), Indonesia (64 triu tn) v Banglades (45 triu tn). Xt v th hng trong nc, theo sn lng, go l sn phm nng nhip hng u ca Vit Nam vi tng sn lng (nm 2009) l 38,9 triu tn, tnh ra tin l 10,4 t USD. Nm 2011 B NNPTNT d tnh sn lng go Vit Nam l 42 triu tn. Nm 2009 Vit Nam xut khu 5,969 triu tn go (chim 15,35% sn lng) v nm 2011 chc t 7 triu tn go xut khu. Thi Lan tuy ng th 7 th gii v sn lng (nm 2009: 31,5 triu tn, sau Myanmar 32,7 triu tn) nhng ng u th gii v xut khu go (Vit Nam xp th 2). Theo Tng cc Thng k, xut khu go ca Vit Nam nm 1995 l 1,988 triu tn v n nm 2010 l 6,886 triu tn (nm 2011 chc chn vt 7 triu tn!). C th thy lng xut khu go ca Vit Nam trong 16 nm qua tng gn 3,5 ln v ng gp khng nh cho xut khu ca Vit Nam (nm 2010 t 3,23 t USD chim 4,5% tng kim ngch xut khu ca c nc). Nhc ti nhng con s trn, nu nhn li 25-30 nm trc, nhng nm cui 1970 v cc nm 1980, khi c nc thiu go n v mi n 1988 Vit Nam vn cn nhp khu 0,45 triu tn go, ri ngi nng dn thc s ginh li c quyn t do sn xut ca mnh v 2 nm sau, nm 1990 Vit Nam c th xut khu 1 triu tn go, chng ta c th thy sc sng ca ngi nng dn Vit Nam mnh m n th no nu khng b chnh sch sai lm cn tr. Nu chnh sch ca Nh nc thc y, h tr hot ng ca b con nng dn th thnh tch la go ca Vit Nam cn cao hn na. Cc nc cng nghip c t l lao ng nng nghip trn tng lao ng rt nh. T l gim nhanh nhng sn lng tuyt i vn tng ng k. Nm 2010, t l lao ng nng nghip l 17% Ba Lan, 12,7% Malaysia, 5,2% Hn Quc, 2,22% Nht Bn v 2% Php. T l ny ta l 63,2%! Mun tr thnh nc cng nghip hin i ch t sau 30 nm na chng ta cn c c cu lao ng nng nghip c 10% khong nh Malaysia hin nay! Quc hi bn c lm sao gi cho c 3,8 triu ha din tch trng la. Nu gi c 3,8 triu ha trong tng lai 25-30 nm c l ch cn 10-20 nghn trang tri trng la quy m ln (t vi trm n 1.000 ha/trang tri) vi s lao ng t vi chc n vi trm ngi mt trang tri. Ni cch khc s lao ng sn xut la hng ha s ch cn c 2-3 triu ngi. Khng c s liu lao ng lm la go, nhng c th d cm t con s lao ng nm 2010 trong nng nghip l 29,63 triu trong tng s 46,91 triu lao ng (theo FAO), th c th thy thch thc l v cng to ln. S lao ng nng nghip l 29,63 triu v mc tng l 1,22%/nm. y l cc s liu xut pht. Hy xt vi kch bn pht trin. Gi s, mc tng lao ng khng i v mi nm chuyn c 1 triu lao ng nng nghip sang lnh vc cng nghip v dch v, th sau 30 nm s lao ng trong nng nghip s cn 6,87 triu (khi tng lao ng s l 68,3 triu), ni cch khc lao ng nng nghip s chim 10,47%. Nu mi nm ch chuyn c 0,5 triu lao ng khi nng nghip, th sau 30 nm vn cn 24,08 triu lao ng nng nghip (chim 36,75% tng lao ng). Nu mc tng lao ng gim c xung 1%/nm, v s lao ng rt ra khi lnh vc nng nghip vn l 1 triu/nm (0,5 triu/nm), th sau 30 nm s lao ng nng nghip cn 6,09 triu chim 9,73% lao ng (22,82 triu chim 36,45% lao ng). C th thy gim tc tng lao ng cng c tc ng ng k, nhng vic chuyn lao ng nng nghip sang cng nghip v dch v vn phi l nhim v chnh. Vi vic rt 1 triu lao ng khi lnh vc nng nghip, th Vit Nam cn 30 nm mi t t l lao ng nng nghip

xung c 10% (mc tng t nh ca Malaysia hin nay), cn rt 0,5 triu/nm th sau 30 nm na vn cha th gi l c c cu lao ng ca mt nn kinh t hin i. Cn ht sc n lc mi c th lm c v phi lm nu mun t nc c nn nng nghip tin tin! C chnh sch ra sao gip b con nng dn tin hnh s chuyn i v i ny l trch nhim ht sc ln i vi Nh nc v ton x hi. TS Nguyn Quang A Chnh sch la go Vit Nam: Cn h iu hnh mi
Th S u 7: (GMT + 7)

Trong iu kin hin nay v chc chn s cn rt lu, an ninh lng thc vn l vn mang tnh ton cu v VN vn l quc gia ng gp c trch nhim cho th gii. Chng ta x c nh la go l vn chin lc v c nhiu chnh s ch tt song khi m nhiu quc gia sn xut la go hng u a ra nhng iu chnh quan trng v chnh s ch VN cng phi ngh n mt h iu hnh mi sao cho vn gi vng nguyn tc bo m - an ninh lng thc quc gia v nng cao thu nhp cho ngi trng la - ng thi b sung tnh linh hot Theo TS Trn Vn t - nguyn ch nh chuyn gia ca FAO (Th i Lan thay i chnh s ch la go cn Vit Nam? ti liu Festival La go VN ln II) u tin mc tiu tng li nhun cho ngi trng la cng quc s xut khu go Th i Lan c nhng iu chnh v chnh s ch chp nhn s gim bt khong triu tn go mi nm v nhng ngi v qu n qun cho VN m h nm gi nhiu nm lin

M hnh VFA va c quyn xut khu go, va n nh gi la s chm dt nm 2012 (biu tng VFA trn Con ng la go ti Festival La go VN ln II). nh: Dng Thu
Tng t l Trung Quc mc d vi din tch t trng la mnh mng nhiu gp ln nc ta nhng h ch trng ch sn xut go va m bo an ninh lng thc quc gia nn gim t 37 triu hcta nm 976 xung cn 3 triu hcta nm 9 Ti hi tho nh v thng hiu go Vit trong khun kh Festival La go VN ln II kin ca nhiu chuyn gia nh nghin c u v thng gia cng cp n yu cu thay i chin lc xut khu go xy dng thng hiu tp trung vo phn khc cht lng cao nng cao v hon thin chui gi tr gip tng li nhun cho ngi trng la Trc yu cu ngh nhng nh hoch nh chnh s ch la go VN quan tm my vic: Mt l tip cn linh hot hn i vi quy hoch s dng t trong vic thc hin ch trng gi 3 8 triu hcta t trng la c ng v Nh nc khng nh Trong phn bit khu vc trng la trng yu v khng trng yu da trn s ph hp v sinh th i nng nghip nng sut t c ng ca bin i kh hu

Hai l p dng phn vng theo khng gian c chnh s ch h tr kh c nhau vng li vnh ai v c c khu vc trng la bnh thng kh c c xem xt mc tiu sn xut la cho an ninh lng thc hay la hng ha T ch bit hn c c h thng v chin lc xut khu go mang tnh x hi v tnh thng mi c chnh s ch r rng phn bit gia mc tiu tng cng h tr nhm thc hin mc tiu chnh tr - x hi gii phng mt phn g nh nng tng li nhun ng thi cng nng cao tr ch nhim cho nhm thng mi nh hng li trng tm chuyn t c c ch c nng thng mi sang tp trung vo c c mc tiu x hi hng ha cng v qun tr ri ro Ba l tip tc tng cng chin lc a ngnh lng ghp nhiu chng trnh mc tiu nh xy dng nng thn mi xa i gim ngho chng suy dinh dng tr em cng m ng nhim v an ninh lng thc v chng suy dinh dng ch khng t ht g nh nng ln vai ngi trng la

Festival La go VN ln II: Thng hiu yu, kh nng gi tr xut khu Sng 10.11, di s ch tr ca Th trng B NNPTNT Dip Knh Tn, Hi tho quc t Con ng pht trin la go cht lng cao VN c t chc vi s tham d ca cc chuyn gia hng u v la go VN trong v ngoi nc. Ti cuc hi tho, mt ln na cc i biu nhn mnh, ht go VN em v cho t nc nhiu ngoi t hn, cn thay i t duy t ngi trng la cho n nh xut khu. Khng th sn xut nh l theo kiu nng h m phi sn xut tp trung theo m hnh cnh ng mu ln hay thnh lp Cty c phn nng nghip a cc ging la cho phm cht go tt, c thng hiu vo sn xut vi quy m ln p ng cho nhu cu xut khu. Tham lun ca Cc Trng trt B NNPTNT cho rng, hin nay BSCL c nhiu b ging mi da trn thnh tu ca cng ngh sinh hc, nhng hu ht u khng gi c cht lng lu di, do k thut canh tc lc hu, ht go cn ln nhiu tp cht. Chnh v vy m cht lng go khng cao, kh tiu th ti th trng kh tnh. Nhiu i biu tin rng, VN hon ton c kh nng sn xut go c thng hiu mnh nh Thi Lan, tuy nhin do cn vng nhiu c ch, chnh sch nn kh lm. in hnh nh Sc Trng, sau 20 nm mi sn xut thnh cng cc ging la thm ST (t ST1 n ST 20) nhng mun sn xut i tr th rt kh do t ai thuc quyn s dng ca nng h. N.H * Theo d bo ca FAO, tng sn lng go th gii nm 2011 vo khong 463,8 tn, sn lng go thng mi khong 31,4 triu tn. Vi tng sn lng go xut khu 7 triu tn nm nay, VN chim khong 22,3% v BSCL s chim khong 20% sn lng go thng mi ca th gii. * Trn th gii ngy nay, la go c coi l mt mt hng chnh tr hn l mt hng kinh t, t trng la go bun bn trn th trng cn thp hn nhiu so vi tng sn lng sn xut ra hng nm; gi c trn th trng quc t l thuc nhiu vo chnh sch an ninh lng thc... Do vy, nu t mc tiu sn xut la vi mc ch an ninh lng thc quc gia, Nh nc cn c chnh sch thch hp cho ngi trng la, lm cho ngh trng la tr nn hp dn hn. (TS L Vn Bnh - Vin trng Vin La BSCL)
Trn Hu Hip

La go Vit Nam: Nng sut cao, tn tht ln


> nh v thng hiu la go phi t nng dn TP - La go Vit Nam c ging tt, nng sut thuc loi cao nht th gii, nhng tn tht sau thu hoch ln gp 2-3 ln so vi n , Nht Bn l nhn nh chung ti cc cuc hi tho khoa hc trong khun kh Festival La go Vit Nam ln hai tnh Sc Trng (t ngy 8 n 11-11).

Thu hoch la BSCL . 9-11 tn/ha La nhiu a phng BSCL t nng sut bnh qun 7 tn/ha/v, c cho l cao nht th gii. c bit, ging OM6976 c a vo kho nghim nhiu tnh BSCL t nng sut 9-11 tn/ha/v m Trung tm Kho kim nghim Ging-Sn phm cy trng vng Nam B nh gi c th coi l s t ph v nng sut. Trong 3 nm t 2008 n 2011, BSCL, c hng trm ging la lai to t cc c s nghin cu a ra kho nghim v c php sn xut i tr 31 ging, sn xut th 48 ging. c tnh, din tch sn xut ging mi mi nm t 600.000 800.000 ha. Trong , khong 90% ging la n t Vin La BSCL v ni y chn c nhng ging la ngn ngy giu cht st, khng su bnh v nng sut cao, thch nghi vng nhim phn mn. Vin Nghin cu Duyn hi Nam Trung B c ging chu hn, trng Ty Nguyn t nng sut 7 tn/ha/v; trng Nam Trung B t 6,5 tn/ha/v. Thnh cng trong cng tc ging cn phi k n vic ph bin rng ri cho nng dn vi ch trng khuyn khch cng ng lm ging. Ht ging u dng t cc c s nghin cu ch p ng 3 5% din tch gieo trng, nhng tnh An Giang, 90% din tch gieo s s dng ging tng ng xc nhn, nh hng trm t v h nng dn sn xut ging. Mt hn 10.000 t ng/nm TS Phm Vn Tn Phn vin C in nng nghip v Cng ngh sau thu hoch cho bit, BSCL c mc tn tht sau thu hoch ln ti 13,7%, trong khi n c t l 6%, Nht Bn 3,9-5,6%. Tn tht ln 2 cng on: sy 4,2% v tn tr 2,6%. Tng sn lng la ca BSCL nm 2011 l 23 triu tn; tn tht hai khu ny l gn 1,6 triu tn. Vi gi 7.000 ng/kg, s tin mt l hn 10.000 t ng.

Tn tht t sy cn dn ti tn tht trong xay xt mc cao 3%. La khng c sy ng k thut, khng t m cn thit 13-14% nn khi xay xt, ht go nguyn v trng thu c rt thp. Mt nghin cu ca i hc Nng lm TPHCM cho thy, la c m 14% khi xay xt s c 50% go nguyn, nhng nu m 16% th go nguyn ch cn 34%. Hin nay, la sy ng k thut ca BSCL ch khong 38% tng sn lng. TS Tn cho bit, quy trnh cng ngh sau thu hoch BSCL hin nay l quy trnh ngc. La thu hoch xong c nng dn v thng li phi sy s qua, em bn cho doanh nghip xay xt, lau bng, khi thnh go ri mi tip tc sy n m 14% ng bao tiu th. Tnh trng ny ko di c nguyn nhn cng ngh sy la lc hu. BSCL s dng l sy tnh v ngang v sy ng, khng th sy c la c m trn 30%, m hu ht la h thu BSCL c m rt cao li cn sy trong thi gian ngn v gieo s ng lot trnh ry v thu hoch trong ma ma. TS Tn ngh cn cng ngh sy la mi. Theo nhiu chuyn gia, cn t chc li chui cung ng sau thu hoch tht gn v hiu qu. Trong , hun luyn cng nh u t cho nng dn v thng li h c kh nng sy la n m 1825% l rt quan trng, sau doanh nghip sy tip t m 14% trc khi a vo xay xt.

L lt lun l mi him ho c bit i vi cc th ln, in hnh l Kuala Lumpur. Bin i s dng t l mt trong nhng nhn t nh hng n l lt. Bi vit ny cp n vic s dng GIS v Vin Thm trong nghin cu d bo l lt ti Klang Valley (Kuala Lumpur).

Trong nghin cu ny M hnh s cao (DEM) c ni suy t bn a hnh c ng ng cao l 20 mt. Ton b lu vc sng c chia thnh cc lu vc ph sau m hnh ho thu vn. Mc ngp lt c d bo bng m hnh SCS TR-55 (Soil Conservation Service Technical Release 55). Cng vic tnh dng chy trn da trn phng php Runoff Curve Number, mt phung php da trn hin trng s dng t ca khu vc nghin cu. Bn hin trng s dng t c thnh lp t nh v tinh SPOT-XS v d liu v lng ma c s dng lm d liu tnh ton. 1. Gii thiu Lu vc sng Klang thuc khu vc b bin pha Ty ca bn o Peninsular Malaysia. Hu ht din tch ca lu vc b th ho v vn ang tip tc th ho vi tc cao trong bao gm c th Kuala Lumpur. Vic th ho nhanh c th l nguyn nhn gia tng qu trnh lng cn v nhim. c nhiu d n di dn c thc hin, khi m vn l lt vn ang l mt loi thin tai t nhin e do ti khu vc ny.

L lt l mt trong nhng mi him ho t nhin ph bin v l nguyn nhn mt hng t la mi nm. Vic chuyn i s dng t t t nng nghip sang t th c th nguyn nhn chnh. Theo JICA (1989), c hai yu t t nhin gy l lt ti vng ny l bo gi ma v bo c km ma to. Nghin cu r nt nht l hin tng khi c bo km ma rt to thng hay xy ra l qut. Chnh v c tnh ca l qut, xy ra trong khu vc nh v thi gian ngn (3-5 gi), nn vic nghin cu d bo l rt quan trng v vic xc nh loi hnh ca l d dng hn xc nh phm vi chu nh hng ca l. Vin thm v GIS c s dng rng ri, c bit nht l trong nh gi cc vn lin quan n thin tai v y l nhu cu xc nh phm vi v thng tin chi tit v khu vc, din tch b nh hng t thin tai cng nh cc hot ng cu tr, khi phc. Thng tin vin thm rt ph hp cc bin php thng thng trong vic tip cn, iu tra khu vc ang b l lt. Bi vit ny s tho lun v vic s dng DEM v nh v tinh SPOT lm thng s c s cho m hnh thu vn SCS TR-55) lm d bo l thng qua 4 im o trn sng. 2.M hnh s cao M hnh s cao DEM c to lp t bn a hnh 1:50 000, khong cao u 20 mt theo 2 bc. Bc 1 l chuyn i bn a hnh t dng ng sang dng im cao. Bc th 2 l ni suy a hnh theo phng php TIN (triangulated irregular network). Thng tin c chit xut bng 2 cch, bng phn tch nh tnh hoc nh lng trn d liu s cao. T m hnh s cao c th to cc hng nhn khc nhau, phn tch dc, a hnh, thu vn v m phng l. 3.Lu vc Vi mc ch m hnh ho thu hc th vic chia lu vc l cn thit. Theo Mc Cuen, (1998), ranh gii ca mt lu vc c nh ngha l tp hp ca tt c cc im thu nc chy v 1 ca sng v nc s chy theo hng c dc ln nht. Trong phng php ny DEM c s dng thay th cc

ng ng cao. Nhng iu kin cn ca phng php Graphical Peak Discharge l khu vc nghin cu c chia thnh nhng lu vc nh ng nht 4. Phn tch d liu Vin thm nh v tinh SPOT-XS c nn chnh bng thut ton a thc vi 20 im khng ch. S dng phng php phn loi c kim nh nh phn loi hin trng s dng t trong khu vc c 4 trm o. Khu vc th nghim c gii hn bng bn a hnh (1991) khu vc Kuala Lumpur. Khu vc ng nht c xc nh ti 4 im o l tt c khu vc th. 5. M hnh ho thu vn M hnh SCS TR55 (USDA, 1986) lm n gin ho vic nh gi kh nng tiu thot v dng chy trn trong mt lu vc nh. Chng c nhn mnh i vi khu vc th v nhng lu vc ang th ho. C hai phng php c s dng trong m hnh ny l: - 1. Phng php s ng cong tiu thot - 2. Phng php dng chy trn (xem chi tit cng thc ti http://www.gisdevelopment.net/aars/acrs ... 4106.shtml)

6.Tho lun Qua phn tch s b bng m hnh TR55 cho thy y l m hnh d bo ngp lt c th p dng c trong lu vc thnh th nh Kuala Lumpur, Malaysia. Vic s dng DEM phn loi cc khu vc ng nht rt d dng bi hu ht cc phn mm GIS. S thay i s dng t c th d dng ghi nhn bi nh v tinh. M hnh thu vn c s dng trong bi vit ny da trn h thng phn loi t ca M v kh nng thch hp khi ng dng vo Malaysia vn cn cha chc chn. Cn u t cho nghin cu lm c s l lun v thc tin trong cc tnh hung thc t. C th thy vic tch hp Vin thm v GIS c trin vng rt cao trong vic d on ngp lt. Trong qun l thin tai chng c th ch ra cc khu vc b nh hng v s d dng hnh ng gim thit hi cho cng ng. _________________ HungGIS Pro

ng dng SWAT cho H cha i Li


Th vin xin gi n qu bn c bi b o "Nghin cu ng dng m hnh ton thng s phn b SWAT nh gi nh hng ca vic s dng t n bi lng h cha nc, ng dng tnh ton cho lu vc h cha nc i Li." do TS Phm Th Hng Lan - B Mn Chnh tr sng v B bin thuc Trng i hc Thy Li bin son Tm tt Mt trong nhng nguyn nhn gy nn bi lng h cha l do tc ng ca con ngi n thm ph trn b mt lu vc. V vy, vic nh gi nh hng ca vic s dng t n bi lng h cha l cn thit t xut c cc bin php gim thiu bi lng lng h. Bo co ny gii thiu mt cng c mnh hin nay, l nghin cu ng dng m hnh ton thng s phn b SWAT nh gi nh hng ca vic s dng t n bi lng h cha nc, ng dng tnh ton cho lu vc h cha nc i Li. M u Lu nay chng ta ch quan tm n vic tnh to n bi lng h ch a m cha c nhiu nghin c u c th v vic nh gi nh hng ca c c

yu t kh c nh vic s dng t n bi lng do c c bin ph p gim thiu bi lng mi ch a ra m c chung chung cha c th C c nghin c u trc y cng ch nghin c u nh gi hin trng xi mn b mt lu vc cha tnh to n tng lng bn c t vn chuyn n h ch a Do vic nghin c u nh gi nh hng ca vic s dng t n bi lng h ch a l cn thit H ch a nc i Li nm ven chn ni Tam o thuc a phn huyn M Linh tnh Vnh Phc (trc kia l tnh Vnh Ph) c xy dng trong nhng nm 96 - 97 vi nhim v chnh l cp nc ti cho 2700 - 3 ha t canh t c ca huyn Tam o M Linh (Vnh Phc) v Sc Sn (H Ni) Lu vc h i Li nm trong vng nhit i gi ma c c c hnh th din bin thi tit din bin ph c tp ma vi cng ln nn dn n hin tng xi mn b mt lu vc tng i ln Mt kh c c c hot ng khai th c lu vc v mc ch kinh t cng lm gia tng hin tng xi mn b mt lu vc Lng bn c t b xi mn lm gia tng lng dng chy bn c t n h do lm tng lng bn c t bi lng trong h Vi l do bi b o i su gii thiu vic ng dng m hnh to n thng s phn b SWAT d tnh lng dng chy bn c t n h ch a t phn tch c c nguyn nhn nh hng n vic gia tng lng dng chy bn c t n h ra c c bin ph p lm gim thiu lng bn c t n h 2. ng dng m hnh ton thng s phn b SWAT tnh ton lng dng chy bn ct n h cha nc i Li Gii thiu chung v m hnh SWAT M hnh Cng c nh gi t v nc SWAT (Soil and Water Assement Tools) l mt m hnh vt l c xy dng t nhng nm 9 s do tin s Dr Jeff Arnold thuc trung tm nghin c u t nng nghip USDAAgricultural Research Service (ARS) xy dng nn M hnh ny c xy dng m phng nh hng ca vic qun l s dng t n ngun nc bn c t v hm lng cht hu c trong t trn h thng lu vc sng trong mt khong thi gian no Tin thn ca m hnh SWAT l m hnh SWRRB ((Simulator for Water Resources in Rural Basins) (Williams et al., 1985; Arnold et al., 1990)) v m hnh ROTO ((Routing Outputs to Outlet) (Arnold et al 995)) M hnh chia lu vc ra lm c c vng hay c c lu vc nh Phng ph p s dng c c lu vc nh trong m hnh khi m phng dng chy l rt tin li khi m c c lu vc ny c s liu v s dng t cng nh c tnh ca t Xt v ton lu vc th m hnh SWAT l mt m hnh phn b M hnh ny chia dng chy thnh 3 pha: pha mt t pha di mt t (s t mt ngm) v pha trong sng Vic m t c c qu trnh thu vn c chia lm hai phn chnh: Phn th nht l pha lu vc vi chu trnh thu vn kim so t khi lng nc bn c t cht hu c v c chuyn ti ti c c knh chnh ca mi lu vc Phn th hai l din to n dng chy bn c t hm lng c c cht hu c ti h thng knh v ti mt ct ca ra ca lu vc - Pha mt t din t c c thnh phn dng chy mt phn xi mn - Pha s t mt din t c c thnh phn dng chy s t mt dng chy ngm - Pha trong sng din t din to n lng dng chy ti mt ct ca ra ca lu vc

ng dng m hnh ton thng s phn b SWAT tnh ton lng dng chy bn ct n h cha nc i Li S liu u vo ca m hnh SWAT bao gm s liu khng gian (c c bn ) v c c s liu thuc tnh + C c s liu khng gian C c bn c dng tnh to n bao gm: - Bn a hnh lu vc h i Li c th hin di dng m hnh s cao (DEM) - Bn mng li sng sui lu vc h i Li c m phng trc tip t nn bn m hnh s cao DEM - Bn t lu vc h i Li: Trn lu vc ch yu l t Feralit. - Bn thm ph tc vt ng vi hin trng rng v s dng t ca nm 983 v nm 993 trong lu vc h i Li C c s liu khng gian c x l bng m hnh s ho cao (DEM) Bn a hnh c a vo m hnh di dng Grid l DEM cn bn s dng t v loi t c a vo m hnh di dng Grid hoc Shape. + C c s liu thuc tnh bao gm: - V tr a l c c trm thu vn trong v ngoi lu vc h i Li c dng tnh to n trong m hnh SWAT. - S liu kh tng cn thit chy m hnh SWAT bao gm nhit khng kh trung bnh (ti cao ti thp) tc gi b c x mt tri m tng i tuyt i ca khng kh S liu kh tng trung bnh ngy ca trm Tam o c dng trong tnh to n cho lu vc h i Li - S liu ma trung bnh ngy lu lng bnh qun ngy Do m hnh chy cho s liu ngy s liu ma ngy ca c c trm o trn lu vc khng y thi gian qua trc khng lin tc v khng tng ng vi dng chy bnh qun ngy V vy chui s liu ma bnh qun ngy ti trm Ngc Thanh v trm i Li s c dng trong tnh to n cho m hnh SWAT. S liu dng chy bnh qun ngy ti trm Ngc Thanh s dng so s nh kt qu tnh to n kim nghim ca m hnh + Kt qu tnh ton th nghim v kim nh m hnh SWAT So snh tng quan gia dng chy tnh ton v thc o ti lu vc sng Thanh Lc trong trng hp th nghim m hnh SWAT

So snh tng quan gia dng chy tnh ton v thc o ti lu vc sng Thanh Lc trong trng hp th nghim m hnh SWAT

Sau khi hiu chnh c c thng s ca m hnh thu c kt qu l gia lu lng thc o v lu lng tnh to n trn lu vc sng Thanh Lc (dng chy th nghim m hnh) cho h s tng quan theo ch tiu Nash 2 l R = 79 M hnh cho kt qu tng i tt Phng trnh tng quan gia lu lng tnh to n v lu lng thc o ca lu vc sng Thanh Lc l Y= 8 X + Kt qu chy kim nghim m hnh cho h s tng quan 2 gia lu lng tnh to n v lu lng thc o theo ch tiu Nash l R = 0.85 v phng trnh tng quan l Y = 7 X + 3 y l kt qu chp nhn c quan h ny kh cht ch cho thy b thng s x c nh c trong phn chy th nghim m hnh l ng tin cy 3. nh gi nh hng ca vic s dng t n bi lng h cha Thng k t bn hin trng rng ca lu vc h i Li trong hai nm 983 v 993 ta thy so vi nm 983 th din tch rng ca nm 993 c s thay i mnh v din tch cng nh v loi rng T l t trng gim ng k thay vo l c c loi rng t nhin v nhn to thm ph thc vt c ci thin iu c t c dng tch cc ti ti nguyn thin nhin cng nh gim kh nng xi mn b mt lu vc Tuy nhin t l din tch t nng nghip xen ln khu dn c vn chim t l ln y l khu vc c kh nng xi mn b mt cao v thm ph chu t c ng tiu cc ca con ngi mt c ch lin tc do canh t c xy dng Lu vc h i Li l mt lu vc c din tch nh trn lu vc t

xm Feralit l ch yu y l loi t c chua ln t l mn cao v vy xi mn ca t l tng i ln Lng xi mn trn b mt lu vc c th trn tng lu vc con c tnh to n da vo m hnh SWAT kt qu tnh to n nh hnh v sau: Bn hin trng xi mn lu vc h cha nc i Li ng hin trng rng nm 1993

Kt qu tnh to n t m hnh cho thy m c xi mn lu vc ng vi hin trng rng nm 993 so vi nm 983 th ln hn do s bin i thm ph trn lu vc din tch t trng trn lu vc ca nm 993 tng 2 nhiu so vi nm 983 (nm 983 l 3 8km tng ng 6 7% cn nm 2 1993 l 22.88 km tng ng 37 75% Theo thng k hin trng rng nm 993 so vi hin trng rng nm 983 tuy c tng ln v loi rng song din tch cn nh din tch t trng ln. Kt qu tnh to n cho thy ng vi hin trng rng nm 983 th lng bn c t l lng n h l: Go = 6369 (tn/nm) trong khi ng vi hin trng rng nm 993 th lng bn c t l lng n h l 9 35 (t?n/nm) nh vy khi din tch rng trn lu vc b gim th lng bn c t gia nhp vo h s tng c bit trong ma l Trong ma kit nhn chung th khi din tch rng gim th dng chy c xu hng tng ln m c xi mn b mt cng gia tng v m c tng ny ni tri trong ma l cn trong ma cn th li c xu hng gim r hn Hin tng xi mn lu vc gy nh hng rt ln n lng bn c t n h ch a phng tr nh v gim m c xi mn lu vc cng nh gim lng bn c t n h ch a c th i vi lu vc h ch a nc i Li c th p dng c c bin ph p sau: - Tng che ph ca rng bng c c bin ph p nh: trng cy gy rng thng v h lu tng cng c c bin ph p bo v rng gim thiu hin tng cht ph rng lm lng ry khai th c rng c quy hoch c bit l nhng ni c m c xi mn cao - Gim dc ca lu vc: Thc hin sn xut nng nghip theo hnh th c rung bc thang trng rng theo nhng l bc thang to thnh nhng vnh ai xen k - o c c rnh song song theo c c ng ng m c c t c dng

lm gim vn tc dng chy ngng t bn c t - Gim thiu s dng cht ho hc v thuc tr su trong sn xut nhm gim m c nhim nc v c c cht c hi trong nc 4. Kt lun Qua phn tch c c m hnh to n trn nhn thy vic ng dng m hnh to n thng s phn b tnh to n lng dng chy bn c t n h v nh gi nh hng ca vic s dng t n bi lng h ch a l cn thit Qua nn p dng c c bin ph p bo v phng chng v gim thiu m c xi mn cng nh lng bn c t n h nu trn ng thi nng cao trnh dn tr v thc hin c c bin ph p xo i gim ngho trong vng nng cao nhn th c ngi dn gip cho vic bo v t bo v rng v mi trng c tt hn nhm gim thiu lng bn c t bi lng trong h nng cao tui th ca h Ti liu tham kho 1. V Vn Tun nh gi bc u nh hng ca h ch a Ho Bnh n mi trng Tp ch "Hot ng Khoa hc Cng ngh v Mi trng" B Khoa hc Cng ngh v Mi trng 9-1998 2. Phm Th Hng Lan. S dng m hnh to n thng s phn b trong bi to n quy hoch qun l lu vc Tp ch khoa hc k thut Thy li v Mi trng / 3. Nguyn S nh, n tt nghip nm 5 gi o vin hng dn Phm Th Hng Lan 4. H Vn Khi, M hnh tnh ton chuyn ti bn c t v bi xi i vi h thng sng hoc knh Tp ch C hc nm Abstract "Applied hydrology mathematical model to assess impact on land use to sedimentation of Dailai Reservoirs" One reason of sedimentation in reservoirs is the impact of human to land use in watershed. Therefore, the impacting of land use on sedimentation in reservoir is necessary. This paper presents the Application of the SWAT Model on land use Impact Assessment on DaiLai Reservoir.

Introduction

123-129 v row t 44-54

125-53

129-59

A Geographic Information System is a type of application which has a set of facilities to capture, store, retrieve, maintain, and display geographic data and information. GIS applications are developed to meet many purposes, from simple purposes like GIS data exploration to sophisticated purposes like watershed mapping. Different commercial libraries are available for developers to use and implement in their applications, like ArcObject from ESIR and Map Suite from ThinkGeo. Unfortunately, the cost of license for these libraries is usually high, which makes the GIS application development process not viable for free lance programmers and small firms. In this series of tutorials, I am going to describe in detail how to build a desktop GIS application using the Open Source MapWinGIS library and C#. MapWinGIS is an ActiveX control for GIS development, with built-in support for many Raster and Vector formats.MapWinGIS.ocx is the core of MapWindow GIS, the well known Open Source, multi-purpose, GIS desktop application. The

first step in reading this tutorial is acquiring MapWinGIS.ocx from the MapWindow GIS Open Source project website, then installing it to your computer using the installation procedures provided by the project site.

Create Your Map


Preparation
In this tutorial, I am using .NET Framework 3.5 and Microsoft Visual Studio 2008 Professional Edition. Actually, you can use Visual Studio Express Edition without any problem. I am also using a set of GIS data in ESRI shapefile format, which I have provided above as a zipped file. I recommend you to download this data compressed file, decompress it, and place the file contents in an independent folder. Now, you are ready to go to the next step.

Create a Project and Add a Reference to MapWinGIS Components


Now, fire up your Visual Studio and create a new Windows Forms application. Point to the Project menu, then click Add Reference. In the Add Reference dialog box, point to COM tab, then select MapWinGIS Components from the Component Name list and click OK.

Now, you have a new reference in your project and you can show its name under References in the Solution Explorer.

Now, we are going to add the Map control to our toolbox. The Map control is a control used as a container and interactive display area for geographic data. To add this control to the toolbox, point to the General tab in the toolbox and right click. Select Choose Item from the menu. The Choose Toolbox Item dialog box will appear. Select the COM Component tab and then select Map Control. To add it to the toolbox, click OK.

Now, you can see the Map Control icon in the toolbox contained by the General tab.

Time to Create Your GUI


Now, it's time to build your interface. Drag a ToolStrip control from the Menu & Toolbars tab in the toolbox and drop it to the form. Add five buttons to the ToolStrip, and name these buttons toolCursor, toolZoomExtent,toolZoomIn, toolZoomOut, and toolPan. You can also assign meaningful labels and images to the buttons (you can use the images that I have in my project resources). Drag the Map control from the toolbox and drop it to the form. In the Properties window, set the Dock property of the Map control to Fill and set the CursorMode property to cmNone.

Load your GIS data to the Application Pragmatically

Now, we will add two ESRI Shapefiles for our map. The ESRI Shapefile or simply a Shapefile is a popular geospatial vector data format for geographic information systems software. In the Form1_Load event, add the following code:
Collapse | Copy Code
//Add first layer to your map int intHandler1; //integer index to handle the layer //create a new instance for MapWinGIS.Shapefile //MapWinGIS.Shapefile is a data provider for ESRI Shapefile MapWinGIS.Shapefile shapefile1 = new MapWinGIS.Shapefile(); //Define the data source for MapWinGIS.Shapefile instance shapefile1.Open(@"D:\GISSampleData\base.shp", null ); //display the layer on the map intHandler1 = axMap1.AddLayer(shapefile1, true); //Add second layer int intHandler2; MapWinGIS.Shapefile shapefile2 = new MapWinGIS.Shapefile(); shapefile2.Open(@"D:\GISSampleData\nile.shp", null); intHandler2 = axMap1.AddLayer(shapefile2, true);

In the first line, we have created an integer variable (intHandler1). In the second line, we have created an instance (shapefile1) for the MapWinGIS.Shapefile class. MapWinGIS.Shapefile is a container for geometric entities that represent real world geographic features. In the third line, the data source for the new object (shapefile1) is defined. This data source is an ESRI Shapefile. This data source shows Egypt as a polygon. In the fourth line, we have added this new object to our map control (axMap1) and made it visible. The function AddLayeris used to add a geographic layer to the map control and return an integer indicating the layer handler. Lines 4 to 8 add the second Shapefile to the Map control and make it visible. It is now time to run your first GIS application; strike F5 in your key board to show Egypt's map in the map control.

Change Your Feature Symbol


Customizing different symbology for different geographic features included in the map is one of the most important tasks for a GIS developer. In this lesson, I am going to present the easiest way to customize features symbology. Actually, MapWinGIS provides many advanced methods to symbolize GIS data, which I will discuss in an advanced lesson. Now, add the following code after the previous code in Form1_Load event:
Collapse | Copy Code
//Set Filling color of the ploygon shapefile axMap1.set_ShapeLayerFillColor(intHandler1, (UInt32)(System.Drawing.ColorTranslator.ToOle (System.Drawing.Color.SaddleBrown))); //Set the line color axMap1 .set_ShapeLayerLineColor (intHandler2 , (UInt32)(System.Drawing.ColorTranslator.ToOle (System.Drawing.Color.Yellow))); //Set the line width axMap1.set_ShapeLayerLineWidth(intHandler2,5);

In the first line, we use the set_ShapeLayerFillColor method of the Map control (axMap1). This method uses the layer handler (intHandler1) and a color in UInt32 format to set the fill color for the defined layer. There are many other useful methods provided by the Map control to customize the layer symbology, likeset_ShapeLayerFillStipple which defines the filling type of the layer, andset_ShapeLayerFillTransparency which defines the transparency level of the layer. In the second line, another method is used. This method set_ShapeLayerLineColor - defines the color of line for line-geometry layers using the layer handler and the UInt32 format for color. In the third line, I have used theset_ShapeLayerLineWidth method to define the width of the line-geometry layer using this layer handler, and afloat number denotes the line width. Run your application to see how it displays your map now.

Add Some Actions to Your Map


Sure, you want to add some amazing actions like zoom in, zoom out, and pan for your map. Adding such actions is a very simple task with MapWinGIS. The CursorMode property for

the Map control provides these tasks in an easy to use way; you have to assign the mode that you want to this property to use it directly in your map. In the following code, I am going to play with the CursorMode property using the Click event for each button in my toolbar.
Collapse | Copy Code
private void toolCursor_Click(object sender, EventArgs e) { axMap1.CursorMode = MapWinGIS.tkCursorMode.cmNone; } private void toolZoomIn_Click(object sender, EventArgs e) { axMap1.CursorMode = MapWinGIS.tkCursorMode.cmZoomIn; } private void toolZoomOut_Click(object sender, EventArgs e) { axMap1.CursorMode = MapWinGIS.tkCursorMode.cmZoomOut; } private void toolPan_Click(object sender, EventArgs e) { axMap1.CursorMode = MapWinGIS.tkCursorMode.cmPan; }

To set your map to the maximum map extent, you will use the ZoomToMaxExtents method of the Map control. Just call this method using the Click event as follows to display your map in the maximum extent:
Collapse | Copy Code
private void toolZoomExtent_Click(object sender, EventArgs e) { axMap1.ZoomToMaxExtents(); }

Time to test these new features; run your application, and check every button.

Conclusion
MapWinGIS is the most easy way to create GIS desktop applications. The above features show the principle tasks required by a GIS programmer. Future lessons in this series will look at many useful and advanced features of MapWinGIS.

Introduction
The objective of this series is to present a simple and easy to use approach to develop a desktop GIS application. My tool pack includes only MapWinGIS.ocx from MapWindow GIS Project which is one of the most successful open sourceGIS projects for

Windows platform. MapWinGIS.ocx provides the full set of tools to maintain and display GIS data and it is free of charge under MPL license. In the previous lesson, we discussed the basics required to display GIS data on the MapWinGIS.ocx Map Control. We also discussed how to customize the symbology of the displayed GIS data. In this lesson, I am going to teach you how to advance your symbology skills and use labeling functionality on your map. As mentioned in the previous lesson, I am using .NET Framework 3.5 and Visual Studio 2008 professional edition in the code attached here, but you can use Visual Studio express edition to get the same results. You have to downloadMapWinGIS.ocx and install it on your machine too. You can download it from the official site of MapWindow Project.

Attributes and Symbology


One of the most amazing features of GIS is combining the description of the geographic entity with its geometry. Indeed, every geographic entity may describe using different attributes. For example, the attributes of land parcel may include area, perimeter, owner name, land use, etc. which these attributes may use to create different maps using different symbology approaches. In the previous lesson, we had used a simple symbology approach where all features in the GIS layer presented use a single symbol. In this lesson, we will know how we can create a quantitative map using attribute data. According to ESRI Shapefile specification that was published by ESRI in July 1998, Shapefile technically means three files have the same name and different extensions: 1. *.shp is the main file that includes the geometric presentation of the geographic entities 2. *.shx is the index file, and 3. *.dbf is the attribute file ESRI Shapefile uses Dbase IV DBF file format to store the attributes of the GIS layer. The data attached to this lesson is a single ESRI Shapefile that presents Arab League Countries. The attributes of this shapefile are organized in two fields CNTRY_NAME and POP_CNTRY. CNTRY_NAME is a text field which includes the name of the country.POP_CNTRY is an unsigned long integer field that includes the population of the country.

Create Your GUI


The GUI of our application is composed of a single Windows Form. This form has a tool strip named toolStrip1which has five buttons, toolCursor, toolZoomExtent, toolZoomIn, toolZoomOut and toolPan. The code of these buttons is discussed in the previous lesson. The form has a split container named splitContainer1 which is split vertically into two panels splitContainer1.panel1 to left and splitContainer1.panel2 to right. The left panel includes three buttons, btnReset, btnQuant and btnLablel. The right panel includes theMapWinGIS.ocx Map Control component named axMap1. You have also added a reference for MapWinGIS.ocx to your project. The previous lesson includes details for reference adding procedure.

The following figure shows the GUI of the application attached to this lesson:

Set Your Public Variables


I am using two public variables in this application. The first is an integer that denotes the layer handler and the second is MapWinGIS.Shapefile. These variables will be declared directly after the first clause of the class declaration as shown in the following:
Collapse | Copy Code
//Create a layer handler public int intHandler; //Create a new instance for MapWinGIS.Shapefile public MapWinGIS.Shapefile myShapefile = new MapWinGIS.Shapefile();

These items should be public because many methods will use these items.

Create a SetBasicSymbology Method

This objective of this method is to set the symbology of the layer to a specific predefined symbology every time it is called. It does not return any value. The following code shows this method:
Collapse | Copy Code
public void SetBasicSymbology() { //Set Filling color of the polygon shapefile axMap1.set_ShapeLayerFillColor(intHandler, (UInt32)(System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Honeydew))) ; //Set the outline color of the polygon features axMap1 .set_ShapeLayerLineColor(intHandler, (UInt32)(System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Goldenrod)) ); }

Load Your Data


Now, we will load our data to our form, the following code should add to Form1_Load event:
Collapse | Copy Code
private void Form1_Load(object sender, EventArgs e) { //Define the data source of Shapefile instance myShapefile.Open(@"D:\GISSampleData2\arabcntry.shp", null); //Display the layer on the map control intHandler = axMap1.AddLayer(myShapefile, true); SetBasicSymbology(); }

This code loads the shapefile (D:\GISSampleData2\arabcntry.shp) into MapWinGIS.Shapefile instance (myShapefile), then adds it to the map control (axMap1) and stores its handler in intHandler. Finally, we will call SetBasicSymbology() to set the layer symbology to the basic symbology.

btnReset Code
The objective of btnReset is to reset the symbology of the layer to the basic symbology every time a user clicks it. The code of btnReset is the following:
Collapse | Copy Code
private void btnReset_Click(object sender, EventArgs e) { SetBasicSymbology(); }

btnQuant Code

The code of btnQUnat is the main target of this lesson. This code customizes the layer symbology to show the population of each country using a spectrum of two colors. The first color is aqua color which illustrates the less populated country; another color is Dark Blue which illustrates the most populated country. Any country that has population among the less and most population will be colored with a color among aqua and dark blue. To do that, you have to know which field in the shapefile table includes the population and calculate the minimum and maximum population. The code will be added to the btnQuant_Click event to let the user click this button and make his/her quantitative map that shows the population in the Arab League Countries. The code is the following:
Collapse | Copy Code
private void btnQuant_Click(object sender, EventArgs e) { //Create a new instance for MapWinGIS.Table MapWinGIS.Table myTable = new MapWinGIS.Table(); //Define the data source of Table instance myTable.Open(@"D:\GISSampleData2\arabcntry.dbf", null); //Define the index of the field will used in symbology int myFieldIndex = 1; //Get the number of rows in the table int numberOfRows = myTable.NumRows; //Create an array to store the cell values of the field double[] myCellsValues = new double[numberOfRows]; //Populate the array with cell values restored from the Table instance for (int i = 0; i < numberOfRows - 1; i++) { myCellsValues[i] = System.Convert.ToDouble(myTable.get_CellValue(1, i)); } //Get the minimum and maximum values double minValue = myCellsValues.Min(); double maxValue = myCellsValues.Max(); //Create a new instance for MapWinGIS.ShapefileColorScheme MapWinGIS.ShapefileColorScheme myScheme = new MapWinGIS.ShapefileColorScheme(); //Set the layer handler to the MapWinGIS.ShapefileColorScheme instance myScheme.LayerHandle = intHandler; //Set the field index to use in symbology myScheme.FieldIndex = myFieldIndex; //Create a new instance for MapWinGIS.ShapefileColorBreak MapWinGIS.ShapefileColorBreak myBreak = new MapWinGIS.ShapefileColorBreak(); //Set the minimum value in the field as a start value myBreak.StartValue = minValue; //Set the start color of the scheme myBreak.StartColor = (UInt32)(System.Drawing.ColorTranslator.ToOle (System.Drawing.Color.Aqua)); //Set the maximum value in the field as an end value myBreak.EndValue = maxValue; //Set the end color of the scheme myBreak.EndColor = (UInt32)(System.Drawing.ColorTranslator.ToOle (System.Drawing.Color.DarkBlue)); //Add the break to the color scheme myScheme.Add(myBreak); //Upgrade display using the scheme axMap1.ApplyLegendColors(myScheme);

In the first line, we declare and initiate a new instance of MapWinGIS.Table class and name it myTable. This class is designed to present the table of ESRI Shapefile. The instance of this class includes a collection of instance for Field class. Each Field instance is used to present a field in the table of shapefile. The instances have zero-based index. Each Field instance has a collection of instances for CellValue class. CellValue instance presents the values of the cells organized in a Field instance. In the second line, we load our dbf table in MapWinGIS.Table instance (myTable) using Open method. In the third line, we declare an integer (myFieldIndex) and assign one to him. This integer is used to identify the field we will use in symbology as the second field ( POP_ CNTRY). The fourth line is used to get the number of rows in the table using NumRows method of MapWinGIS.Tableinstance (myTable). In the fifth line, we declare and create an array (myCellsValues) composed of a number of double elements equal to the number of rows in the table. Now, we will use For loop to populate our new array (myCellsValues) by the values of CellValue instance inmyTable. Then we will get the minimum and maximum values in the array using Min and Max methods for array. The minimum and maximum values are assigned to two variables minValue and maxValue of double type. Now, we will declare and create a new instance for MapWinGIS.ShapefileColorScheme class and name itmyScheme. This class is designed to describe the complex color scheme for the layer based on the values stored in the shapefile table field. The scheme is joined to a specific layer by the handler of this layer, and to the field by the field index. The instance of this class has a collection of MapWinGIS.ShapefileColorBreak instances.

MapWinGIS.ShapefileColorBreak class is used to describe a color theme used to color


the geographic entities in the layer based on a region of values. This region of values is limited by two properties for eachMapWinGIS.ShapefileColorBreak instance: StartValue and EndValue. The color of theme is identified by two another properties for the instance: StartColor and EndColor. In this application, I had used one MapWinGIS.ShapefileColorBreak instance named myBreak, and I had assigned the minValue and maxValue to StartValue and EndValue properties respectively. Also, I had assigned aqua and dark blue colors to StartColor and EndColor properties respectively.

After assigning the properties of the MapWinGIS.ShapefileColorBreak instance (myBreak), I had used Addmethod to add it to MapWinGIS.ShapefileColorBreak instances collection of myScheme. The final step is to use ApplyLegendColors method of Map Control (axMap1) to use this scheme to symbolize the layer. Now, strike F5 to run the application and click btnQuant button to get your new map.

Add Labels to Your Map


Labels are very important to make your map meaningful. Most of the GIS users and developers use values stored in the table to label their features, and that is what I am going to do. Add the following code to btnLabel_Clickevent:
Collapse | Copy Code
private void btnLabel_Click(object sender, EventArgs e) { //Define a string to store the label of the feature string myLabel;

//define two double variables to use as a coordinates for label position double x, y; //Use a loop to read the cell value that is used as a label and //set the label on the map for (int i = 0; i < myShapefile.NumShapes -1; i++) { //assign the value of the cells of the field number zero to the label myLabel = System.Convert.ToString( myShapefile.get_CellValue(0, i)); //Calculate the x position for the label x = myShapefile.get_Shape(i).Extents.xMin + (myShapefile.get_Shape(i).Extents.xMax myShapefile.get_Shape(i).Extents.xMin) / 2; //Calculate the y position for the label y = myShapefile.get_Shape(i).Extents.yMin + (myShapefile.get_Shape(i).Extents.yMax myShapefile.get_Shape(i).Extents.yMin) / 2; //add the label on the map axMap1.AddLabel( intHandler, //Layer handler myLabel, //Label string (UInt32)(System.Drawing.ColorTranslator.ToOle (System.Drawing.Color.Black)), //Color of the label x, y, //Position of the label MapWinGIS.tkHJustification.hjCenter //Justification of the label ); } }

To add labels for your map, you have to know which field includes the values of labels and where you will set the labels on the map. In the previous code, I was creating a string variable named myLabel and two double variables x and y to use to locate the label on the map. Then, I was using the for loop to read the cell values from the first field for all shapes in the shapefile, and each loop I was assigning this value to (myLabel) string variable and getting the position of the label as the center of the shape. Finally, I was using AddLabel method of Map Control (axMap1) to add this label (myLabel) using Black color as a font color in a position identified by x and y. Now, strike F5 to run the application and click btnLabel to show the label on your map.

Now, we have many useful ideas to use MapWinGIS.ocx to build a GIS application. In the next lesson, together we are going to explore how useful arial photographs and satellite images can be for our applications.

Introduction
In the previous lessons, we had learned how to display and manage vector data using MapWInGIS.ocx and embed these functions in a Windows application developed using C#. In this lesson, I am going to teach you how to manage raster data in the same manner. The objectives of the reader are to understand how to add the raster layer to the map control, how to manipulate the raster symbology, how to get the raster information, and how to join the cursor to the location on raster. As usual, my tools pack includes MapWinGIS.ocx, which is an ActiveX control that can be used in any language that supports ActiveX (e.g., C#, VB, Microsoft Access, Microsoft PowerPoint, ).MapWinGIS.ocx is Open Source, and you can download it free of charge under the MPL license. All code examples and screenshots in this article are based on the Microsoft Visual C# 2008 Professional Edition, but the reader can use Microsoft Visual C# Express Edition to get the same results.

Build a Desktop GIS Application Using MapWinGIS and C# - Part 1 Build a Desktop GIS Application Using MapWinGIS and C# - Part 2

Raster Data in GIS


Raster data is a very common and useful data model in GIS. Any raster may be introduced as an array of columns and rows. A row intersects a column to create a rectangular area called raster cell. In the most common raster forms, the width of the column equals the height of the row, so the raster cell shape is square. The raster cell often represents a squared area on the study area. Each cell has two identifiers (X, Y) that demonstrate the coordinates of the cell location. The first identifier/coordinate, X, denotes the column that passes across the cell. The second identifier/coordinate, Y, denotes the row that passes across the cell. In general purpose raster formats like Joint Photographic Experts Group (JPEG) and Graphical Interchange File Format (GIFF), X, Y express directly the number of columns and rows that pass across the cell, but in GIS raster data format, these coordinates are connected to the world coordinate system to describe the geographic location of the cell in real life.

Raster cells are usually illustrated using a digital value which may be discrete (integer-like data types) or continuous (real-like data types). These digital values are used to represent geographic features. For example, digital values may be 1 to describe the existence of a feature, and 0 to describe the absence of a feature. The following figure shows how to illustrate a geographical feature using these previous two values (1 and 0), where the blue squares express the cells marked with one, and white squares express the cells marked with zero.

The discrete digital values in GIS raster data are used to model discrete phenomenon like land use and administrative units, where continuous digital values are often used to represent continuous phenomenon like terrain elevation and soil acidity. GIS professionals know many ways to get raster data. They can produce it directly using different tools like automatic scanning and vector data rasterization. They can get raster data as aerial photographs and remotely sensed data.

Sample Application
The sample application in this lesson demonstrates many features of GIS raster data manipulation usingMapWinGIS.ocx. In the following sections, I will discuss these features in detail, and I will ignore the features that were discussed in the early lessons.

Ready, Steady, Gooooooo


In the beginning, you have to start a new Windows application. Give your project a name. I named mine "GISSampleApplication3". In the Solution Explorer window, select the project node, right click on it, and select Add Reference from the context menu. Use the COM tab in the Add Reference window that will appear, findMapWinGIS.ocx in the list, and add it. Now, you have all the functionalities of MapWinGIS.ocx in your project, but you still need to add the visualization functionality provided by the MapWinGIS.ocx Map control. To add this control to your toolbox, select the General tab in the toolbox, right click on it, select Choose Items from the context menu, select the COM component tab from the Choose Toolbox Items window, find the Map control, check it, and press OK. Now, the Map control tool will be shown in your toolbox. The above steps are described in detail with illustration inlesson 1.

Give me Something to See

The sample application of the current lesson is a simple, single-form application. This form has a ToolStrip namedtoolStrip1 which has five buttons: toolCursor, toolZoomExtent, toolZoomIn, toolZoomOut, andtoolPan. The code for these buttons is discussed in lesson 1. The form also has a status bar namedStatusStrip1docked at the bottom. The status bar contains a ToolStripStatusLabel calledToolStripStatusLabel1. The form has a SplitContainer named splitContainer1 which is split vertically into two panels: splitContainer1.panel1 to the left and splitContainer1.panel2 to the right. The left panel includes a single button named tbnInfo. The right panel includes the MapWinGIS.ocx Map Control component named axMap1 which is docked to fill the right panel completely.

Let's Write Some Code


Now it's time for some real work. We will now discuss the required code to achieve our lesson's objectives and its meaning. After the beginning brace of the declaration of the Form1 class, add the following code:
Collapse | Copy Code
#region PublicDeclaration //(1) Create an integer variable to store the raster grid layer handler public int intHandler; //(2) Create an instance for the grid raster public MapWinGIS.Grid myGrid = new MapWinGIS.Grid(); //(3) Create a new grid header object public MapWinGIS.GridHeader myHeader = new MapWinGIS.GridHeader(); //(4) Create an image instance to store and display the raster public MapWinGIS.Image myImage = new MapWinGIS.Image(); #endregion

This set of type declaration shows the four main types required to manipulate the raster grid data in MapWinGIS. The first type is the layer handler which is stored in an integer variable (intHandler). The layer handler is a unique value used to manipulate the layers. The second type is MapWinGIS.Grid. This is a specific MapWinGIS type used to store the raster grids. The third type is MapWinGIS.GridHeader, which is another type provided by MapWinGIS to manipulate the raster header. The fourth type is MapWinGIS.Image. It is a type provided by MapWinGIS, and is used to store an image copy of the raster, which can be used to visualize the raster grid data in the Map control. All pervious MapWinGIS types are reference types, and require the new keyword to be initiated. Now we have all the required instances to manipulate our raster. The raster used in this lesson is a sample digital elevation model DEM for a study area in the north western desert of Egypt created by achieving an interpolation for a set of elevation points collected from the field and from topographic maps. This raster is stored in GeoTIFF format. The GeoTIFF format is a regular TIFF format with additional information about the spatial domain of the data. Add the following code in the Form1_Load event:
Collapse | Copy Code
#region LoadTheData //(1) Open the grid myGrid.Open(@"D:\SampleData\dem.tif",

MapWinGIS.GridDataType.DoubleDataType, false,MapWinGIS.GridFileType.GeoTiff, null); //(2) Get the header of the raster myHeader = myGrid.Header; //Symobolize the raster grid //(3) Create a raster grid color scheme MapWinGIS.GridColorScheme myScheme = new MapWinGIS.GridColorScheme(); //(4)Assign the no data color to lack myScheme.NoDataColor = System.Convert.ToUInt32( System.Drawing.ColorTranslator.ToOle( // System.Drawing.Color.FromArgb(0, 0, 0))); //(5) Set the attributes of the color scheme myScheme.UsePredefined( (double)myGrid.Minimum, (double)myGrid.Maximum, MapWinGIS.PredefinedColorScheme.DeadSea ); //Convert the grid to an image //(6) Create a Utili instance MapWinGIS.Utils myUtil = new MapWinGIS.Utils(); //(7) and use it to convert the grid to the image myImage = myUtil.GridToImage(myGrid, myScheme, null); //(8) Finally add the layer to the map intHandler = axMap1.AddLayer(myImage, true); #endregion

The first step to display the data is to load the raster data from the file to the grid instance (myGrid). The Openmethod is used to load the data into the grid instance. The Open method needs five arguments: The first argument is the full path to the file that contains the raster data. The second argument is the type of grid data which is presented in MapWinGIS as an enum typeMapWinGIS.GridDataType, which represents six elements. These elements include four defined elements (ShortDataType for short integer data type pixels, LongDataType for long integer data type pixels,FloatDataType for single precision data type pixels, and DoubleDataType for a double precision data type pixels) and two undefined elements (UnknownDataType for use with unknown data types, andInvalidDataType for invalid data types). The third argument is a bool value that shows if the raster should read from RAM (true) or from file (false). The fourth argument is a GridFileType. MapWinGIS provides an enumeration to describe the grid file type supported by MapWinGIS itself. The supported grid file types are: ASCII grid file format (MapWinGIS.GridFileType.Ascii), Band Interleaved by Line format (MapWinGIS.GridFileType.Bil), Binary grid file format (MapWinGIS.GridFileType.Binary), Digital Terrain Elevation Data file format (MapWinGIS.GridFileType.DTed), ERMapper Compressed Wavelet file format (MapWinGIS.GridFileType.Ecw), ESRI Grid file format (MapWinGIS.GridFileType.Esri), ArcView Binary Raster file format (MapWinGIS.GridFileType.Flt), GeoTIFF raster file format (MapWinGIS.GridFileType.GeoTiff), MrSID raster file format

(MapWinGIS.GridFileType.MrSid), PCI PAux raster file format (MapWinGIS.GridFileType.PAux), PCI Geomatics database file format for raster data (MapWinGIS.GridFileType.PCIDsk), and United States Geological Survey USGS Spatial Data Transfer Standard raster data format (MapWinGIS.GridFileType.Sdts). Beside these types, the user can assign two different enums:MapWinGIS.GridFileType.InvalidGridFileType, which may be used to handle data with gaps or errors, and MapWinGIS.GridFileType.UseExtension, which lets the user open different common raster formats. The last argument required for the Open method is the callback. null is assigned for this argument in most common cases.

The second step is to assign the grid header to the header instance (myHeader). The grid header includes basic information about the raster grid like its width, height, pixel resolution etc. After the second step, the grid and its header are loaded to the computer memory, and for that reason, the procedure requires a time. The objective of steps 3, 4, and 5 is to prepare the symbology required to display the grid. The third step is a creation of the raster grid color scheme. The raster grid color scheme is presented by the MapWinGIS.GridColorScheme class in MapWinGIS. In step 3, an instance (myScheme) of this class is created and initiated. In the fourth step, we will set a color to illustrate the no-data pixels using the NoDataColor property of theMapWinGIS.GridColorScheme instance (myScheme). The assigned color is black. The fifth step is to use theUsePredefined method for the instance myScheme to assign a predefined grid color scheme setting for mySchemesettings. This method requires three components: the minimum pixel value, the maximum pixel value, and the predefined grid color scheme. The minimum and maximum pixel values can easily be got using the grid instance properties Minimum and Maximum. The predefined grid color scheme introduced in MapWinGIS as an enumeration type includes eight elements:

MapWinGIS.PredefinedColorScheme.DeadSea MapWinGIS.PredefinedColorScheme.Desert MapWinGIS.PredefinedColorScheme.FallLeaves MapWinGIS.PredefinedColorScheme.Glaciers MapWinGIS.PredefinedColorScheme.Highway1 MapWinGIS.PredefinedColorScheme.Meadow MapWinGIS.PredefinedColorScheme.SummerMountains MapWinGIS.PredefinedColorScheme.ValleyFires

And now, its show time. Let's add the code required to display our grid. To display the grid, you have to convert it to an image. Conversion of a grid to an image requires an instance of the MapWinGIS.Utils class. In step 7, this instance (myUtil) is created and initiated. In step 8, the method GridToImage - which is provided byMapWinGIS.Utils (myUtil) is used to convert the gird the first argument (myGrid) to an image using a defined grid color scheme the second argument (myScheme). The third argument required for the GridToImagemethod is the callback. Now, add the image (myImage) to the Map

control (axMap1) using the AddLayer method. Don't forget to assign the required code to the navigation buttons. The code for these buttons is available in lesson 1. Now, strike the F5 function key in your keyboard to start debugging the application, and if you did everything right, you will get the following screen:

Something About my Grid


Each raster grid has a set of basic information called metadata in some technical literature which is required to understand many facts about the grid and the geographic features presented by the grid. The most common and important information icludes the pixel dimensions in measurement unit (e.g., Meter), the width and the height of the grid in pixels, and the lower left corner coordinates. This information helps the programmer to know and calculate many useful information like the width and the height of the grid in the measurement unit (width (or height) in measurement unit = width (or height) in pixels * pixel edge length), the area of the grid (width in pixels * height in pixels * pixel edge length * pixel edge length). All these basic data are available in the GridHeader instance (myHeader). Add the following code to the btnInfo_Click event:
Collapse | Copy Code
//(1) Get the width and height of the //grid in pixels int width = myHeader.NumberCols; int hight = myHeader.NumberRows; string sizeInPixels = String.Format("Grid sizs - in pixels - is ({0},{1})\n", width, hight); //(2) Get the width and height of the pixel double deltaX = myHeader.dX; double deltaY = myHeader.dY;

string pixelDimensions = String.Format("Pixel dimensions are ({0},{1})\n", deltaX, deltaY); //(3) Get the lower left corner coordiantes double xLlLocation = myHeader.XllCenter; double yLlLocation = myHeader.YllCenter; string lowerLeftCorner = String.Format("Lower Left corner coordinates ({0},{1})\n", xLlLocation ,yLlLocation ); //(4) Show the message string infoMessage = sizeInPixels + pixelDimensions + lowerLeftCorner; MessageBox.Show(infoMessage, "Raster Information", MessageBoxButtons.OK, MessageBoxIcon.Information);

In the first set of statements, the properties NumberCols and NumberRows of the GridHeader instance (myHeader) were used, and the restored values stored in the width and height integer data variables. These properties restore the number of columns and the number of rows, respectively. In the second set, the properties dXand dY of the GridHeader instance (myHeader) were used, and the restored values stored in the deltaX anddeltaY integer data variables. In the third set, the properties xllCenter and yllCenter of the GridHeaderinstance (myHeader) were used, and the restored values stored in the xLlLocation and xLlLocation integer data variables. These two variables represent the coordinates of the center of the lower left corner pixel. The fourth and the last set of the code is where we will build a string to represent the previous information and launch it visually to let the user read it. Strike the F5 function key in your keyboard. You will get something like this as the output:.

Tell Me, Where Am I???


Some of the most important functions GIS provides are where it is and what it is. For raster data, this information can be introduced using the PixelToProj method for the Map control instance and the get_Value method for the Grid instance, respectively. Go to Form1 in Design view and select the axMap1 control. Press F4 to get axMap1's Properties window. Find the SendMouseMove property in axMap1's Properties window and set it to true. This action will activate axMap1_MouseMoveEvent. Now, bring this event axMap1_MouseMoveEvent for the axMap1 event list, and double click it to open it in Code view. Add the following code for this event:
Collapse | Copy Code

//(1) Get the location of the cursor // form the MapControl and transform it to //the projection location double X =0; double Y =0; axMap1.PixelToProj(e.x, e.y, ref X, ref Y); //(2) Get the value of pixel at specified point double pixelVal = (double) myGrid.get_Value(e.x, e.y); //(3) Print the result to the status toolbar. string pointLocation = String.Format("Cursor location ({0},{1}) " + "and the pixel value is {2}",X,Y, pixelVal ); toolStripStatusLabel1.Text = pointLocation;

The first set of code aims to identify the location of the cursor on the axMap1 control. In this code, we will declare two double type variables X, Y, and assign an initial value (0) for both. The PixelToProj method for the axMap1instance is used, and it needs four arguments: the first two arguments are the position of the cursor on axMap1, which is represented by e.x and e.y, and the variables where the converted value will be stored. These variables, X,Y, should be passed using the keyword ref. After using this method, the values of X and Y will store the location of the cursor on axMap1 in the projection measurement unit. The second set of code aims to identify the value of the pixel where the cursor is. In this code, we will declare a double type variable pixelVal and assign a value returned by the method get_Value for the Grid instance (myGrid). The method get_Value requires two arguments representing the location of the cursor. These arguments are represented using e.x and e.y. Now, strike F5, and try to move the cursor above the map and show how the status bar will change directly to show you the location of the cursor and the value of the pixel located in this location.

Conclusion
MapWinGIS presents an easy-to-use approach to display and manipulate raster data in a two level manipulation. The first level treats the grid so the programmer can return information like the width and the height of the grid or the lower left corner coordinates. The second level treats the grid data on the pixel level, where the programmer can set or return the value of the pixel using its location. Using the same toolbox, programmers may display and manipulate images which add great functionality for GIS programmers and support their applications that include procedures to handle complex raster formats like multispectral images and aerial photographs.

Preface
This lesson is part 4 of a series of lessons aimed to show the capabilities of MapWinGIS.ocx to develop Windows-based desktop GIS standalone applications using C#. If you are reading about MapWinGIS.ocx the first time, I strongly recommend reading the previous three articles before. These articles are available here: Part 1, Part 2, andPart 3.

Introduction
Many GIS specialists believe that data creation is one of the most important GIS activities. GIS data may be created in different ways, it may draw directly or

be imported from secondary sources. In this article, I am going to discuss how to manage data creation using MapWinGIS.ocx and C#. I am using .NET Framework 3.5 and Microsoft Visual Studio 2008 Professional Edition. Actually, you can use Visual Studio Express Edition without any problems. Also, you have to install MapWinGIS.ocx in your machine. Finally, the data used in this article is attached as a zipped file.

Objective
The objective of the following program is to create a point shape file using secondary data stored in comma separated values in *.csv text format. A CSV file is a specially formatted plain text file which stores table-style information in a very simple format, with one record on each line, and each field within that record separated by a comma. In this tutorial, a series of locations were stored in a CSV file named road.csv. Each location was described using three parameters. The first parameter is the ID which is the integer index. The second and third parameters are the location coordinates in a Universal Transverse Mercator metric coordinate format. The following figure shows the contents of the road.csv file shown in Notepad++ software.

I have to mention here that many data gathering devices such as GPS and echo sounders can export gathered data. For instance, NMEA 0183 files that download from GPS devices is some kind of CSV file format.

Methodology
Three main problems should be considered by the programmer when working on CSV to shape file conversion software. These problems are how to create a new shape file, how to read CSV file contents and parse it properly, and finally, how to create the shapes and add it to the shape file. The following figure shows a detailed methodology to convert a CSV file to a shape file.

The first step is to create a new shape file instance using the MapWinGIS API. The second step is to add a new index field for the new shape file table. It is recommended to add at least one field to the shape file in the creation phase. In this example, the index field will be the integer data type. These steps represent the first task to be considered by the developer, which is the shape file creation task. After finishing this task, we have an empty shape file. If we terminate the program at this point, we will lose the shape file, because it is empty. The shape file should include some shapes to be a real shape file, and has a location and size on the storage media. Before adding the shapes for the shape file, we have to create these shapes using data provided by the CSV file. So, the next task is to open the CSV file and read its contents. The third step is to open the CSV file. This is a very easy step because, this file is a text file. Reading the CSV file contents line by line and analyzing the line to extract the ID, x, and y data is the fourth step. Analyzing the CSV line is done using secondary subroutines. These subroutines introduce the fourth step. The fifth step is to create the shapes using the MapWinGIS API. After creating the shapes, the shapes should be added to the shape file, which is the sixth step. Steps from four to six will repeated while the CSV file still has rows to read. The final step is to save the shape file.

Time to write some code


I think we have a complete road map to develop a simple software to convert a CSV file to an ESRI shape file. So, let's write some funny code. In this tutorial, we will use a console application template. Start your Visual Studio and create a new Console Application project. We need to add a reference to MapWinGIS. You can get a detailed description of how to add this reference for your project in the first tutorial in this series. Before writing the core of our code - the CSV to shape file conversion code - we have to develop a simple code to parse the CSV file contents. The following code box shows three static methods: GetIndex, GetX, and GetY, where each method receives a CSV raw and returns a specific component from this raw (Index, X, Y field values).
Collapse | Copy Code
private static double GetY(string sentence) { string strY = sentence.Substring(sentence.LastIndexOf(";") + 1); double result = Convert.ToDouble(strY); return result; } private static double GetX(string sentence) { string strNewSentense = sentence.Substring(sentence.IndexOf(";")+1); string strX = strNewSentense.Substring(0, strNewSentense.IndexOf(";")); double result = Convert.ToDouble(strX); return result; } private static Int16 GetIndex(string sentence) { string strId = sentence.Substring(0, sentence.IndexOf(";")); Int16 result = Convert.ToInt16(strId); return result; }

Back to the main method for the console project, where we will write the core code. In the first line, add the code required to create a new instance (myShapefile) for

the Shapefile class. In the second line, use the methodCreateNew to create a new physical shape file by assigning its full path and its geometry type. The geometry type for the shape file is defined by the ShapefileType enumerator. This enumerator can define 14 geometry types. The most common geometry types provided by this enumerator are SHP_POINT, SHP_POLYLINE, and SHP_POLYGON for the point, polyline, and polygon geometry types. It is strongly recommended to add a new field for your shape file table when you do new shape file creation, regardless of whether you add values for this field cells or not. The third line shows how to create a new instance (myField) for the MapWinGIS.Filed class. The following three lines show how to set the field properties. There are many available field properties, but the common properties are those three. The first property is Name, which is a string and is assigned as the name of a new field. You have to note that; the Shapefile format use the old format *.dbf to store attributes; you have to consider all the restrictions of file naming in your work. This means, the name string should be less than 12 letters, and not include special characters or spaces. The second property is Type, which defines the data type that can be stores in this new field. MapWinGIS provides an enumerator (FieldType) that includes all the available data types that may be accepted by the Field class. This enumerator provides DOUBLE_FIELD, INTEGER_FIELD, and STRING_FIELD for double precision, integer, and string data, respectively. The third property is the Width. This property defines the width (how many letters or digits) for the field. Integer values only set to this property. Finally, we have to add this new field for the table. The method EditInsertField of the instance myShapefile is used to add the new field for the table. You have to note this: using this method requires you to set the value of the table object EditTableproperty to be true. Fortunately, when we use the CreateNew method, both the EditTable and EditShapeproperties are automatically set to true.
Collapse | Copy Code
//Create new shapefile Shapefile myShapefile = new Shapefile(); //Define the path of the new shapefile and geometry type myShapefile.CreateNew(@"D:\GISLesson04\road.shp", ShpfileType.SHP_POINT); //Create new field MapWinGIS.Field myField = new Field(); //Set the field properties myField.Name = "ID"; myField.Type = FieldType.INTEGER_FIELD; myField.Width = 10; //Add the filed for the shapefile table int intFieldIndex = 0; myShapefile.EditInsertField(myField, ref intFieldIndex, null);

Now we have a new shape file with a single field table ready to use. If we finish the application in this situation, MapWinGIS will delete the shape file physically because there is no meaning for a shapeless shape file. You have to add at least one shape file to be accepted by MapWinGIS to save this new shape file. However, we have a CSV file full of data needed for the drawing and that what we will do in the following section. To read the contents of the CSV file - remember, a CSV file is a text file - we use the StreamReader instance (myFile), and then we can use this as a stream reader instance to read the contents of the CSV file line by line using a while loop. This loop will stop when it arrives at the end of the CSV file. Within the while block, with each loop, we

will create a new instance (myShape) of the Shape class. The Shape class defines the shapes inside the shape file. Each Shape includes one or more points. This new instance should be created using the method Create for the instance myShape. This method requires an argument that defines the geometry of the shape. This geometry is provided by the enumeratorShapefileType which was mentioned before. After creating the Shape instance myShape, we have to draw it - or define it spatially - using the point data in the CSV file. To do that, we have to create a new instance for the Pointclass called myPoint. This instance has two properties (x, y) which define the location of the point. Now is the time when the parsing methods designed before will be useful. We will use the GetX and GetY methods to get the x and y value from the CSV line, and set these values to the myPoint (x ,y) properties. After creating the point, we will add it to the Shape instance (myShape) using the method InsertPoint. Then, we will add this shape to the shape file instance (myShapefile) using the method EditInsertShape.
Collapse | Copy Code
System.IO.StreamReader myFile = new System.IO.StreamReader(@"D:\GISLesson04\road.csv"); // Using while loop to read csv file line by line while ((myLine = myFile.ReadLine()) != null) { if (myCounter > 0) { MapWinGIS.Shape myShape = new Shape(); myShape.Create(ShpfileType.SHP_POINT); MapWinGIS.Point myPoint = new Point(); myPoint.x = GetX(myLine); myPoint.y = GetY(myLine); int myPointIndex = 0; myShape.InsertPoint(myPoint, ref myPointIndex); myShapefile.EditInsertShape(myShape, ref myShapeIndex); myShapeIndex++; } myCounter++; }

When the while loop reaches the end of the CSV file, every line in the CSV file will match a point in the shape file. The final step is to stop editing the shape file. To do that, we have to use the method StopEditingShapes of themyShapefile instance. Now, you can display your new shape file using any GIS software. You may display it using the MapWinGIS application as we did before in the early lessons. For me, I will display the shape file in MapWindowsGIS, which is the Open Source desktop GIS application for Microsoft Windows built completely on MapWinGIS.

Вам также может понравиться