我认为问题出在 MapDisplayPosition 函数中,第二个参数必须是 geoPostiion 变量,正如您在帮助中看到的那样,或者它可能是带有地址的字符串,您是否尝试过:
sAddress is string = gnWorkaddress + ", " + gnWorkplace + ", " + "Netherlands"
MapDisplayPosition(MAP_Worklocation, sAddress)
此外,您不能将 and 分配Address
给 a ..Position
,您需要一个 geoPosition 变量;使用 MapDisplayPosition 将地图居中后,您可以使用以下命令检索位置:
TmpPos is geoPosition
TmpPos = MapGetPosition(MAP_Worklocation)
然后添加标记:
MyMarker is Marker
MyMarker..Position = TmpPos
MyMarker..ActionClick = ProcMarkerClick
MapAddMarker(MAP_Worklocation, MyMarker)
试试这个,我个人找到了一个不同的解决方法,因为在注册期间写了 from 和 address (stree, zip code, city...),我需要 gps 代码,所以我使用了Google Maps APIs:
oQuery is httpRequest
// Replace blank spaces with +, for URL.
sTempStreet is string = Replace(MyStreet," ","+")
sTempCity is string = Replace(MyCity," ","+")
oQuery..URL = "https://maps.googleapis.com/maps/api/geocode/json?address="+sTempStreet+",+"+sTempCity+"+"+stTempZIP+"+"+stTempCountry+",+stTempState&key=*<yourapikeyhere>*"
oQuery..Method = httpGet
oResponse is httpResponse
oResponse = HTTPSend(oQuery)
vInfo is Variant
vInfo = JSONToVariant(oResponse..Content)
sGPSLatitude = vInfo.results[1].geometry.location.lat
sGPSLongidute = vInfo.results[1].geometry.location.lng