首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Windev移动,地址到坐标

Windev移动,地址到坐标
EN

Stack Overflow用户
提问于 2018-06-12 18:45:58
回答 2查看 310关注 0票数 0

我正在用windev mobile构建一个android应用程序。我可以使用声明地址和城市的变量打开地图,但似乎不能以同样的方式在地图上获得标记。ggladdresstocoordinates在windev mobile上不起作用。

我当前的代码是:

代码语言:javascript
复制
//MapDisplayPosition(MAP_Worklocation, Street, City, country)
MyAddress is Address
MyAddress..Street = gnWorkaddress
MyAddress..City = gnWorkplace
MyAddress..Country = "Netherlands"

// Centers the map displayed by the "MAP_Position" control from an address
MapDisplayPosition(MAP_Worklocation, MyAddress)

MAP_Worklocation..Zoom = 17

mymarker is Marker
mymarker..Position = MyAddress
MapAddMarker(MAP_Worklocation, mymarker)
EN

回答 2

Stack Overflow用户

发布于 2018-07-02 17:40:01

使用MapDisplayPosition后,地图将在搜索位置居中,如果您使用MapGetPosition,它将返回坐标。来自Windev Help: MapGetPosition -“返回点的地理位置,该点位于地图控件当前显示的地图中心。”

代码语言:javascript
复制
MyPosition is geoPosition
MyPosition = MapGetPosition(MAP_Worklocation)
EDT_Latitude=MyPosition..Latitude
EDT_Longitude=MyPosition..Longitude
票数 0
EN

Stack Overflow用户

发布于 2018-07-10 16:21:22

我认为问题出在MapDisplayPosition函数中,第二个参数必须是geoPostiion变量,就像你看到的in the help,或者它可能是一个带有地址的字符串,你试过了吗:

代码语言:javascript
复制
sAddress is string = gnWorkaddress + ", " + gnWorkplace + ", " + "Netherlands"

MapDisplayPosition(MAP_Worklocation, sAddress)

此外,您不能将和Address赋值给..Position,您需要一个geoPosition变量;在使用MapDisplayPosition将地图居中后,您可以使用以下命令检索位置:

代码语言:javascript
复制
TmpPos is geoPosition
TmpPos = MapGetPosition(MAP_Worklocation)

然后添加标记:

代码语言:javascript
复制
MyMarker is Marker
MyMarker..Position = TmpPos
MyMarker..ActionClick = ProcMarkerClick

MapAddMarker(MAP_Worklocation, MyMarker)

尝试一下,我个人发现了一种不同的解决方法,因为发件人和地址(stree,邮政编码,城市...)在注册过程中,我需要gps代码,所以我使用了Google Maps Apis

代码语言:javascript
复制
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
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50815287

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档