谷歌地图和图像叠加

时间:2012-12-08 09:24:53

标签: android google-maps

我正在尝试将2张图片放在2个不同的gps位置。图像未显示在地图上。我做错了什么。

for (int i = 0; i < subscribedToJourneys.size(); i++) {
        IJourneyDetails journey = subscribedToJourneys.get(i) ;
        Double lat = journey.getSourceGPSX() ;
        Double lng = journey.getSourceGPSY() ;

        Drawable marker = getResources().getDrawable(R.drawable.pushpin);
        marker.setBounds(0, 0, marker.getIntrinsicWidth(),
                marker.getIntrinsicHeight());
        locationMarker = new LocationMarker(this, subscribedToMap, marker,
                (ImageView) findViewById(R.id.drag));
        subscribedToMap.getOverlays().add(locationMarker);
        locationOverlay = new MyLocationOverlay(this, subscribedToMap);
        subscribedToMap.getOverlays().add(locationOverlay);

        lat = journey.getDestinationGPSX() ;
        lng = journey.getDestinationGPSY() ;
        marker.setBounds(0, 0, marker.getIntrinsicWidth(),
                marker.getIntrinsicHeight());
        locationMarker = new LocationMarker(this, subscribedToMap, marker,
                (ImageView) findViewById(R.id.drag));
        subscribedToMap.getOverlays().add(locationMarker);
        locationOverlay = new MyLocationOverlay(this, subscribedToMap);
        subscribedToMap.getOverlays().add(locationOverlay);
    }

public class LocationMarker extends ItemizedOverlay<OverlayItem> {
......
@Override
    public void draw(Canvas canvas, MapView mapView, boolean shadow) {
        super.draw(canvas, mapView, shadow);
        boundCenterBottom(marker);
    }
 ....
 }

编辑:我尝试了以下内容并且有效。 from here

final Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse(
        "http://maps.google.com/maps?" +                "saddr="+YOUR_START_LONGITUDE+","+YOUR_START_LATITUDE+"&daddr="YOUR_END_LONGITUDE+","+YOUR_END_LATITUDE));
     intent.setClassName(
      "com.google.android.apps.maps",
      "com.google.android.maps.MapsActivity");

startActivity(意向);

我现在需要每条路线都有不同的颜色。所有蓝色都让人难以理解。

0 个答案:

没有答案