Android:纬度和经度正确,但标记打印在错误的位置
我正在获取“哥德堡”中的所有 's 商店,并在我的地图视图上添加一个标记。 问题是,使用这段代码,我的标记在非洲都聚集在一起。
我检查过坐标是否正确,所以事实并非如此。
有人知道问题是什么吗?
df = ((ClassHandler)getApplication()).getStoreDatabadeFacade();
Cursor plotstore = df.getAllStorePos("Göteborg");
startManagingCursor(plotstore);
plotstore.moveToFirst();
while(plotstore.isAfterLast() == false){
GeoPoint addStore = new GeoPoint(plotstore.getColumnIndex("lat"), plotstore.getColumnIndex("long"));
//OverlayItem overlayitem = new OverlayItem(addStore, plotstore.getString(plotstore.getColumnIndex("_ID")), plotstore.getString(plotstore.getColumnIndex("ADDRESS")));
OverlayItem overlayitem = new OverlayItem(addStore, plotstore.getString(plotstore.getColumnIndex("_id")), plotstore.getString(plotstore.getColumnIndex("address")));
itemizedStoreOverlay.addOverlay(overlayitem);
storeOverlays.add(itemizedStoreOverlay);
plotstore.moveToNext();
}
I'm fetching all the 's stores in "Göteborg" and adding a marker on my mapView.
The problem is that with this code my markers get all bunched up in Africa.
I've checked that coordinates is correct so it isnt that.
Anyone know what's the problem is?
df = ((ClassHandler)getApplication()).getStoreDatabadeFacade();
Cursor plotstore = df.getAllStorePos("Göteborg");
startManagingCursor(plotstore);
plotstore.moveToFirst();
while(plotstore.isAfterLast() == false){
GeoPoint addStore = new GeoPoint(plotstore.getColumnIndex("lat"), plotstore.getColumnIndex("long"));
//OverlayItem overlayitem = new OverlayItem(addStore, plotstore.getString(plotstore.getColumnIndex("_ID")), plotstore.getString(plotstore.getColumnIndex("ADDRESS")));
OverlayItem overlayitem = new OverlayItem(addStore, plotstore.getString(plotstore.getColumnIndex("_id")), plotstore.getString(plotstore.getColumnIndex("address")));
itemizedStoreOverlay.addOverlay(overlayitem);
storeOverlays.add(itemizedStoreOverlay);
plotstore.moveToNext();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
getColumnIndex
不是只返回cursor
中列的索引,而不是该索引处的值吗?您似乎正确地将其用于id
:但不适用于
lat
和long
:尝试更改此设置(以及
”长”
)到:Doesn't
getColumnIndex
just return the index of the column within thecursor
, rather than the value at that index? You seem to be using it correctly for theid
:but not for the
lat
andlong
:Try changing this (and the
"long"
) to: