android-mapview

Android getFromLocationName return results outside the bounding box

懵懂的女人 提交于 2019-12-19 19:54:08
问题 I am doing a location search from my android app. User enter an address and I do a lookup with the following code, private void doSearch(String query){ FNMApplication.logInfo("Searching:"+query); //create a geocoder Geocoder gc = new Geocoder(this,Locale.getDefault()); try{ //lookup locations which match the query input by the user List<Address> addresses = gc.getFromLocationName(query, 5, -44.00, 111.00, -12.0, 155.0); //if there are any results save them in an ivar for re-use

How to draw at the current GPS location on MapView using MyLocationOverlay?

[亡魂溺海] 提交于 2019-12-19 04:57:22
问题 I'm trying to draw a custom gps-location icon. I'm using MapView and have created a class MyLocationArrow that extends MyLocationOverlay. I override drawMyLocation() and draw a point at 100,100. But this is the coordinates on screen. How do I get the screen-coordinates from the current GPS-location? 回答1: You can use android.graphics.Point toPixels(GeoPoint in, android.graphics.Point out) Converts the given GeoPoint to onscreen pixel coordinates, relative to the top-left of the MapView that

draw is being constantly called in my android map overlay

痴心易碎 提交于 2019-12-18 20:14:33
问题 I'm trying to draw a route onto my MapView. I've extended Overlay and implemented the draw() method. The route is displayed properly, although while debugging, I added a breakpoint on draw(), and noticed it is being called constantly. I only want it to be re-drawn if someone moves the map or zooms (the draw take into account these changes when drawing the route) What can cause this ? 回答1: There are two draw methods that can be overridden. void draw(android.graphics.Canvas canvas, MapView

Can I use AnimationDrawable in an overlay on a MapView?

只愿长相守 提交于 2019-12-18 13:29:27
问题 I have created an AnimationDrawable in XML, and it works fine. But on moving the drawable into a MapView as an overlay marker (replacing a static drawable that works fine), the animation stubbornly refuses to play. I've moved the call to start() to a button, for testing, and even when pressed several seconds after the MapView has displayed, the animation doesn't start. I'm seeing nothing in logcat. I know start() needs calling after all the windows are set up, but this seems to be a separate

Android MapView draggable marker

泄露秘密 提交于 2019-12-18 12:44:07
问题 I would like to create a draggable marker in Android MapView (com.google.android.maps.MapView), exactly like this: http://koti.mbnet.fi/ojalesa/exam/draggable.html. I've already got an overlay pointing to the location I want, but I'd like the marker icon to be draggable like in the above example. Is there something ready to use for this or is it necessary to implement the dragging logic myself? 回答1: You need to implement the dragging yourself. Here is a sample project demonstrating drag and

Android 2.1 GoogleMaps ItemizedOverlay ConcurrentModificationException

你说的曾经没有我的故事 提交于 2019-12-18 05:23:16
问题 I cannot figure out the origin of the ConcurrentModificationException . In my activity I'm calling updateMapOverlay() . I'm also calling updateMapOverlay() inside another Thread (a TimerTask ) that is invoked on regular intervals. I'm taking the appropriate locks when invoking updateMapOverlay() from both the threads. Is this problem being caused because I'm invoking updateMapOverlay from inside a non-UI thread (i.e., TimerTask ). Has anyone else faced a similar issue ? private void

MapView Marker shadow

情到浓时终转凉″ 提交于 2019-12-18 04:23:28
问题 I am adding different markers to my map... Drawable drawable = app1.getResources().getDrawable(R.drawable.test); drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); OverlayItem overlayitem2 = new OverlayItem(mark, "Test", "t"); overlayitem2.setMarker(drawable); app1.mapOverlay.addOverlay(overlayitem2); app1.mapOverlays.add(app1.mapOverlay); that works but the shadow is at the wrong position. 回答1: I use this: int w = drawable.getIntrinsicWidth(); int h =

How to implemennt OnZoomListener on MapView

╄→尐↘猪︶ㄣ 提交于 2019-12-18 02:51:08
问题 I would like to have onZoomListener on my MapView. The code below is what I have done. It registers if zoom buttons are tapped. Since all new phones now supports pinch to zoom, this is useless. Does anybody have idea how to do real onZoomListener? Thanks. OnZoomListener listener = new OnZoomListener() { @Override public void onVisibilityChanged(boolean arg0) { // TODO Auto-generated method stub } @Override public void onZoom(boolean arg0) { Log.d(TAG, "ZOOM CHANGED"); // TODO Auto-generated

MKMapView refresh after pin moves

大城市里の小女人 提交于 2019-12-18 01:18:13
问题 A custom AnnotationView is updated with new coordinates. But the problem is that it visually updates only after some manipulations with MKMapView, e.g. zooming or moving. What should I do to manually update visual position on a map? PS. I've tried to change region to current map's region. But it does change zoom. It's strange. [mapView setRegion:[mapView region] animated:YES]; 回答1: I am a little shoked after hours of research. The answer is just: [mapView setCenterCoordinate:mapView.region

Custom information bubble on tap for overlay items using osmdroid

一世执手 提交于 2019-12-17 20:09:07
问题 I'm using osmdroid on my new Android project (since I want to be able to use offline maps) but I encounter many difficulties to customize the look 'n feel of the information bubble assigned to an overlay item. Right now, I'm using an ItemizedOverlayWithFocus overlay to display my items; looking at its code, I noticed the whole thing was drawn in the onDrawFinished method so I tried to create my own custom overlay to override this method but this is pretty difficult to get a result. What I