C_Sharp 板


LINE

最近在尝试用C#读S-57格式的档案 用的是由 http://download.osgeo.org/gdal/ 下载的gdal source code 也有试过搭用FW Tools 2.4.7 http://fwtools.maptools.org/ 我试着把里面的ogrinfo.cs make 起来 但是执行的结果不如预期.. 我用的环境是VS 2005 ogr相关的dll, 我试过拿gdal source make出来的 gdal_csharp.dll 等九个dll 或是把FW Tools里的直接拿来用, 都有一样问题.. 不知有没有先进有遇过一样的问题 我执行的source code如下: using System; using System.Collections.Generic; using System.Text; using OSGeo.OGR; using OSGeo.OSR; namespace ogrinfo { class OGRInfo { public static void usage() { Console.WriteLine("usage: ogrinfo {data source name}"); System.Environment.Exit(-1); } public static void Main(string[] args) { if (args.Length != 1) usage(); // Using early initialization of System.Console Console.WriteLine(""); /* -------------------------------------------------------------------- */ /* Register format(s). */ /* -------------------------------------------------------------------- */ Ogr.RegisterAll(); /* -------------------------------------------------------------------- */ /* Open data source. */ /* -------------------------------------------------------------------- */ DataSource ds = Ogr.Open(args[0], 0); if (ds == null) { Console.WriteLine("Can't open " + args[0]); System.Environment.Exit(-1); } /* -------------------------------------------------------------------- */ /* Get driver */ /* -------------------------------------------------------------------- */ Driver drv = ds.GetDriver(); if (drv == null) { Console.WriteLine("Can't get driver."); System.Environment.Exit(-1); } // TODO: drv.name is still unsafe with lazy initialization (Bug 1339) Console.WriteLine("Using driver " + drv.name); /* -------------------------------------------------------------------- */ /* Iterating through the layers */ /* -------------------------------------------------------------------- */ for (int iLayer = 0; iLayer < ds.GetLayerCount(); iLayer++) { Layer layer = ds.GetLayerByIndex(iLayer); if (layer == null) { Console.WriteLine("FAILURE: Couldn't fetch advertised layer " + iLayer); System.Environment.Exit(-1); } Console.WriteLine(layer.GetName()); //ReportLayer(layer); } } } 主要会执行到的code我标了一下颜色了.. 执行结果是 Using driver S57 DSID Point Line Area Meta ds.GetLayerCount() 只传回 5, 只有5个layer layer的Name印出来就只有 DSID/Point/Line/Area/Meta 这五个 但是如果是用FW_Tools里或是gdal自己make出来的 就可以读到如下比较完整的layer using driver `S57' successful. 1: DSID (None) 2: ACHARE 3: BCNSPP (Point) 4: BRIDGE 5: BUISGL 6: BUAARE 7: BOYSPP (Point) 8: CBLSUB (Line String) 9: COALNE (Line String) 10: DEPARE 11: DEPCNT (Line String) 12: DOCARE (Polygon) 13: DRYDOC (Polygon) 14: FSHFAC 15: HRBARE (Polygon) 16: HRBFAC 17: LAKARE (Polygon) 18: LNDARE 19: LNDELV 20: LNDMRK 21: LIGHTS (Point) 22: MORFAC 23: OBSTRN 24: PILBOP 25: RTPBCN (Point) 26: RDOSTA (Point) 27: RAILWY (Line String) 28: RESARE (Polygon) 29: RIVERS 30: ROADWY 31: SBDARE 32: SLCONS 33: SISTAT (Point) 34: SISTAW (Point) 35: SOUNDG (3D Multi Point) 36: TOPMAR (Point) 37: TSSBND (Line String) 38: TSSLPT (Polygon) 39: TSEZNE (Polygon) 40: TUNNEL 41: UWTROC (Point) 42: WATTUR 43: WRECKS 44: TS_FEB 45: M_COVR (Polygon) 46: M_NSYS (Polygon) 47: M_QUAL (Polygon) 48: C_AGGR (None) --



※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.124.122.57







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:iOS站内搜寻

TOP