I'm currently rendering my map on osmdroid using the following code:
The problem is that I'm running the app on a GS6 Edge, and it's completely impossible to read the street names: http://img.ctrlv.in/img/15/10/03/560f4427e54c9.png
Is it possible to increase the street name size or even increase the zoom? (It's currently set to 100)
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
getActivity().setTitle(FRAGMENT_NAME);
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_map_view, container, false);
mMapView = (MapView) view.findViewById(R.id.mapview);
mMapView.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE);
mMapView.setMultiTouchControls(true);
mMapController = (MapController) mMapView.getController();
mMapController.setZoom(100);
GeoPoint gPt = new GeoPoint(-23.5784,-46.4078);
mMapController.setCenter(gPt);
return view;
You're using Mapnik (aka OSM) map tiles, which are rastered graphics. The only way to make it bigger (that I know of) is to either a) use a different tile source (try bing), or b) try using osmbonuspack + mapsforge (which can render OSM tiles on the fly and thus can control the font size).
Related
How do i zoom it in arcgis map at a certain angle for android?
Sorry , im quite new to it .. Thanks
This are my codes . i also tried implementing it below zoom to resoulution but it doesnt work.
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Retrieve the map and initial extent from XML layout
mMapView = (MapView)findViewById(R.id.map);
/* create a #ArcGISTiledMapServiceLayer */
tileLayer = new ArcGISTiledMapServiceLayer(
"http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
// Add tiled layer to MapView
mMapView.addLayer(tileLayer);
}
Can you see your tiled layer on the android simulator or on device? If yes then you have done well so far. Just add these lines below the mMapView.addLayer(tileLayer); to achieve zoomTo
Point zoomtopoint = getCenter();
mMapView.zoomTo(zoomtopoint, 1.0);
When adding some markers on a map using Google Maps Android API v2, the markers are no set to the right positions and move when zooming.
When zooming in they get closer to the right positions, as if they were translated by a factor related to the zoom.
What's wrong?
Example zooming in:
fragment
public class CenterMapFragment extends Fragment {
private GoogleMap mMap;
private List<Center> mCenterList;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.center_map_fragment, container, false);
}
#Override
public void onActivityCreated (Bundle savedInstanceState){
super.onActivityCreated(savedInstanceState);
mMap = ((SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map))
.getMap();
if (mMap != null) {
mCenterList = MyApplication.dbHelper.getAllCenter();
for(Center center : mCenterList){
mMap.addMarker(new MarkerOptions().position(new LatLng(center.lat, center.lng)).icon(BitmapDescriptorFactory
.fromResource(R.drawable.myicon)));
}
}
}
}
layout
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
For custom markers you need also use
MarkerOptions.anchor(float u, float v)
which describes where is the pointer point on the marker. By default this point is located at middle-bottom of the image.
To show an window info, you have to use setInfoWindowAdapter on your "mMap" or have a title set for your marker.
About the icon, it seems to be moving when you zoom out, but the anchor always point to the same place on the map. You can set an anchor if the image you're using don't follow Google's icon pattern (anchor on the middle of the botton of the image). For that you have to do use MarkerOptions' method anchor(u,v)
I am using the ArcGis for the first time in my android application(java).
I have got the X and Y co-ordinates of a location by "one map" http://www.onemap.sg/API/Help/RESTExamples.aspx,
now I want t display this point as a red dot in Map.
X-26005.0765
Y-30007.0973
Does anyone know any tutorial to follow. I saw the "Hello Map Tutorial".
Can Anyone direct me to the tutorial or documentation with example.
Asmita
You must use Graphics layer to add a graphical representation of your point.
The code below is an example were you print a point in the coordinates that you gaved.
public class Test extends Activity {
// View elements
MapView map;
GraphicsLayer measures = new GraphicsLayer();
Point point;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Get elements of the view
map = (MapView) findViewById(R.id.map);
map.addLayer(measures);
Point point = new Point(26005.0765, 30007.0973);
measures.addGraphic(new Graphic(point,new SimpleMarkerSymbol(Color.RED,10,STYLE.CIRCLE)));
map.zoomTo(point, 0);
}
}
I am working on an Android app that displays multiple markers on a Google MapView. Everything works perfectly but I would like the markers to have an animation when they appear on the map.
Here's an example of something similar on iPhone. See 1'20".
Here is how I add them to my MapView.
for(int i=0; i<myMarkerList.length(); i++){
GeoPoint x = new GeoPoint(
(int)(lat*1E6),
(int)(lng*1E6));
oItem = new OverlayItem(x, title, String.valueOf(nb_marker));
pin.setAlpha(255);
oItem.setMarker(pin);
if (oItem != null)
mapOverlay.addOverlay(oItem); // add the overlay item to the overlay
}
mapOverlays.add(mapOverlay); // add the overlay to the list of overlays
mapView.invalidate(); // update the map shown
It is so pretty on iPhone, and someone must have already done something similar on Android but I can't seem to find any useful info.
EDIT: Okay so I recon I either have to override the draw method which will be long and not that pretty, or just give up with OverlayItems.
Thank you for your time.
Best regards,
Tom
You can use this tutorial for a reference, it uses animations, so I think that suits your solution.
Code from the tutorial :
//Reference to our MapView
MapView mapView = (MapView) activity.findViewById(R.id.mapview);
//Get a LayoutInflater and load up the view we want to display.
//The false in inflater.inflate prevents the bubble View being added to the MapView straight away
LayoutInflater inflater = activity.getLayoutInflater();
LinearLayout bubble = (LinearLayout) inflater.inflate(R.layout.bubble, mapView, false);
//Set up the bubble's close button
ImageButton bubbleClose = (ImageButton) bubble.findViewById(R.id.bubbleclose);
bubbleClose.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Animation fadeOut = AnimationUtils.loadAnimation(ResultsMapResultsDisplayer.this.activity, R.anim.fadeout);
bubble.startAnimation(fadeOut);
bubble.setVisibility(View.GONE);
}
});
private void displaySearchResultBubble(final SearchResult result) {
//Hide the bubble if it's already showing for another result
map.removeView(bubble);
bubble.setVisibility(View.GONE);
//Set some view content
TextView venueName = (TextView) bubble.findViewById(R.id.venuename);
venueName.setText(result.getName());
//This is the important bit - set up a LayoutParams object for positioning of the bubble.
//This will keep the bubble floating over the GeoPoint result.getPoint() as you move the MapView around,
//but you can also keep the view in the same place on the map using a different LayoutParams constructor
MapView.LayoutParams params = new MapView.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,
result.getPoint(), MapView.LayoutParams.BOTTOM_CENTER);
bubble.setLayoutParams(params);
map.addView(bubble);
//Measure the bubble so it can be placed on the map
map.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
//Runnable to fade the bubble in when we've finished animatingTo our OverlayItem (below)
Runnable r = new Runnable() {
public void run() {
Animation fadeIn = AnimationUtils.loadAnimation(activity, R.anim.fadein);
bubble.setVisibility(View.VISIBLE);
bubble.startAnimation(fadeIn);
}
};
//This projection and offset finds us a new GeoPoint slightly below the actual OverlayItem,
//which means the bubble will end up being centered nicely when we tap on an Item.
Projection projection = map.getProjection();
Point p = new Point();
projection.toPixels(result.getPoint(), p);
p.offset(0, -(bubble.getMeasuredHeight() / 2));
GeoPoint target = projection.fromPixels(p.x, p.y);
//Move the MapView to our point, and then call the Runnable that fades in the bubble.
mapController.animateTo(target, r);
}
I seen your example app. From that i think you need only Glow in your markers, right? If yes then its possible through the styles and its having glow property also.
So I got it to work using a simple ArrayList of ImageViews and animation on them, no MapOverlay.
I want to display a large-ish image, around 800 x 800 pixels. I'd like to be able to pan it in all four directions by dragging with a finger. I'd also like to be able to zoom in and out. I need to be able to know the pan values and zoom values, because I have to draw small text strings at certain locations over the image.
For example, if the pan is 100 pixels to the right, I need to know that so I can add that offset to all my elements.
Wondering what a good way to do this is. Should I implement it myself in the paint method within a View I implement? Is there some other standard method of doing it? It's essentially like a google maps view, only one large tile, but I have to draw my pins on top of it with pan and zoom,
Thanks
Hi guys i tried some months ago with no success, at last i just load the images inside a webview enabling the zoom controls and i was able to do the panning of my image...
public class PhotoZoom extends Activity {
private static final FrameLayout.LayoutParams ZOOM_PARAMS =
new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT,
Gravity.BOTTOM);
private WebView PhotoZoom;
private long lastTouchTime = -1;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.photo_zoom);
PhotoZoom = (WebView) findViewById(R.id.PhotoZoom);
PhotoZoom.setBackgroundColor(Color.BLACK);
Bundle bundle = getIntent().getExtras();
String Photoname = bundle.getString("URLPhoto");
PhotoZoom.loadUrl("content://com.jorgesys.pan/sdcard/myimages/" +fotoname);
WebSettings webSettings = PhotoZoom.getSettings();
webSettings.setSavePassword(false);
webSettings.setSaveFormData(false);
webSettings.setJavaScriptEnabled(true);
webSettings.setSupportZoom(true);
FrameLayout mContentView = (FrameLayout) getWindow().getDecorView().findViewById(android.R.id.content);
View zoom = PhotoZoom.getZoomControls();
mContentView.addView(zoom, ZOOM_PARAMS);
zoom.setVisibility(View.VISIBLE);
}
}