在利用MO读取Shape文件时出错,如下
var
lyr:MapLayer;
rset:Recordset;
dc:DataConnection;
pt:Point;
s:string;
begin
s:='D:\GS_SHP';
lyr:=MapLayer(CreateOleObject('MapObjects2.MapLayer'));
dc:=DataConnection(CreateOleObject('MapObjects2.DataConnection'));
dc.Database:=s;
lyr.GeoDataset:=dc.FindGeoDataset('GS');
rset:=lyr.Records;
rset.MoveFirst;
while (rset.EOF<>True) do
begin
fid:=rset.Fields.Item('FeatureID').ValueAsString;
pt:=Point(CreateOleObject('MapObjects2.Point'));
pt:=rset.Fields.Item('Shape').Value;--------------------------此处出错,类型无法转换
pt:=Point(rset.Fields.Item('Shape').Value);------------------如此转换也出错,无法强制转换
rset.MoveNext;
end;
end;
请大家帮忙看看,怎么转换,谢谢!