我正在用eye4software制作一个简单的坐标转换器。以下链接为转换器提供了所需的Visual Basic 6代码。坐标转换
http://www.eye4software.com/products/gpstoolkit/source/vb/datumtransformation/
我按照根据链接所提供的资料说的过程。
Private Sub Form1_Load()
Private objProjection As GpsProjection
Private objDatumSrc As GpsDatumParameters
Private objDatumDst As GpsDatumParameters
Set objProjection = CreateObject("Eye4Software.GpsProjection")
Set objDatumSrc = CreateObject("Eye4Software.GpsDatumParameters")
Set objDatumDst = CreateObject("Eye4Software.GpsDatumParameters")
End Sub
Option Explicit
Private objProjection As GpsProjection
Private objDatumSrc As GpsDatumParameters
Private objDatumDst As GpsDatumParameters
Private Sub CommandTranslate_Click()
' Set Source Datum (WGS84)
' The ID for WGS84 is 4326, see 'http://www.eye4software.com/resources/datums' for a full list of supported datums
' To convert from another datum, just change the code below (EPSG code)
objDatumSrc.LoadFromId (4326)
' Set Destination Datum (NAD27)
' The ID for NAD27 is 4267, see 'http://www.eye4software.com/resources/datums' for a full list of supported datums
' To convert to another datum, just change the code below (EPSG code)
objDatumDst.LoadFromId (4267)
' Set Source coordinates
objProjection.Latitude = CDbl(Textlat1.Text)
objProjection.Longitude = CDbl(Textlon1.Text)
' Perform the datum transformation
objProjection.TransformDatum objDatumSrc, objDatumDst
' Display the result
Textlat2.Text = objProjection.Latitude
Textlon2.Text = objProjection.Longitude
End Sub
但我得到一个运行时错误此代码(objDatumSrc.LoadFromId(4326))说所需的对象。由于我是初学者,我无法解决这个问题。请帮帮我。
小问题,但[不要在程序参数中放置括号](http://hashvb.earlsoft.co.uk/Brackets_around_procedure_parameters)。这可能不是问题的原因,但它会在某些时候咬你(同样的错误) – Deanna