Arcgis : zooming it in a certain angle - android

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);

Related

How to increase streets name size/readability?

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).

How to add image at specific location in maps?

In my project i want to add image at particular location in map.For that i used the following code.
public class Sample extends Activity {
#TargetApi(Build.VERSION_CODES.HONEYCOMB)
#SuppressLint("NewApi")
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sample);
// Get a handle to the Map Fragment
GoogleMap map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
LatLng sydney = new LatLng(33.6671688,-117.9053506);
map.setMyLocationEnabled(true);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney, 15));
//add overlay
BitmapDescriptor image = BitmapDescriptorFactory.fromResource(R.drawable.categorymap);
GroundOverlayOptions groundOverlay = new GroundOverlayOptions()
.image(image)
.position(sydney, 1000f)
.transparency(0.1f);
map.addGroundOverlay(groundOverlay);
}
}
By using this code the map is displayed like the following screenshot.
But my requirement is add the image at particular location like the following screenshot.For that i have latitude and longitude values also to show the map location.In that location i want to add the image like following screenshot.
So my question is,how to move the image from left to right like the above screenshot.I tried alot for doing this but didnt solve the issue.So please suggest me how to solve this problem.Thanks inadvance to all...
Try to get the exact positions of the corners of the building and uses the method
public GroundOverlayOptions positionFromBounds (LatLngBounds bounds)
Then it should scale with the mapzoom
Another way is to use anchor
EDIT:
GroundOverlayOptions groundOverlay = new GroundOverlayOptions()
.image(image)
.position(sydney, 1000f)
.transparency(0.1f)
.anchor(0.5, 0.5);
This will instead make the lat/lon to be in center of your image.

Using ArcGis for displaying location on OneMap

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);
}
}

MapView very slow with 1000 overlayitems on the map, even with only 2 visibles

I have a mapview showing 1000 overlayitems on the mapview. The map moves very slow even if only two overlayitems are visibles on the map (huge zoom applyed)
It is possible to optimice the mapview to move more fast if only low cuantity of overlayitems are visibles?
Thanks
You might have fallen in the usual pit. If you've made your own customoverlay make sure that your addOverlay methode don't populate. Populate should first happen when all overlays has been added. If you populate each time you add you'll end up with many overlays on top of each other.
Make sure it uses 2 methods for this process, 1 to add and 1 to populate:
public void addOverlay(CustomOverlayItem overlay) {
mOverlays.add(overlay);
}
public void populateOverlay() {
populate();
}
If that is not the issue then you should look into dynamically removing pins when they are outside the screen range or grouping pins together. I believe there is some open source project that have done the work for you in this regard.
Found a link http://onthefencedevelopment.com/blog/using-google-maps-your-android-applications-%E2%80%93-part-3-adding-place-markers drawing only the overlays which are on the screen. haven't tested it yet but seems promising.
EDIT: it works
subclass MapView, override dispatchDraw(). Detect changes in map center or zoom level:
#Override
public void dispatchDraw(Canvas canvas)
{
super.dispatchDraw(canvas);
GeoPoint gpCenterPoint = getMapCenter();
int nZoomLevel = getZoomLevel();
// either diff't zoom level or change to center point?
if ( (gpCenterPoint.getLatitudeE6() != mCenterPoint.getLatitudeE6()) ||
(gpCenterPoint.getLongitudeE6() != mCenterPoint.getLongitudeE6()) ||
(nZoomLevel != mZoomLevel) )
{
// update pins here
updatePINS();
mZoomLevel = nZoomLevel;
mCenterPoint = gpCenterPoint;
}
}
void updatePINS()
{
int nLatitudeSpan = mapView.getLatitudeSpan();
int nLongitudeSpan = mapView.getLatitudeSpan();
// TODO insert/remove PINS as needed
}

How can I change an overlay's icon from Android's MapView class?

I'm working on a map in Android, with several overlay icons covering it. My problem is that each overlay's icon is static and does not resize with the rest of the map when zooming in and out. This can become awkward if the user zooms too far in or out and the icons appear too big or too small.
My solution is to create multiple image files with different sizes of each icon. However, I'm not sure how to reference these icons from my (extended) MapView class after I've already created them from my :
public class Map extends MapActivity {
...
public onCreate() {
...
//Very simplified copy of my working code:
Drawable defaultDrawable = this.getResources().getDrawable(R.drawable.myicon);
List<Overlay> mapOverlays = mapView.getOverlays();
ItemizedOverlay overlayManager = new OverlayManager(defaultDrawable, this);
OverlayItem myOverlay = new OverlayItem(...);
overlayManager.addOverlay(myOverlay);
}
}
I extended the MapView class so that I could trigger zoom events. The dispatchDraw() method is where I plan to place my icon-replacement code, but I'm not sure how I can access the map's existing overlays and their icons from here (and change just their icons):
public class ZoomSensitiveMapView extends MapView {
private int oldZoomLevel;
...
public void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
if (getZoomLevel() != oldZoomLevel) {
if (getZoomLevel() > 15) {
//Zoomed in closer
//Replace icons with bigger copies
}
else {
//Zoomed out further
//Replace icons with smaller copies
}
oldZoomLevel = getZoomLevel();
}
}
}
I was thinking getOverlays() might work here, but that seems to only return the overlays themselves, not their icons.
Am I on the right track? How can I replace the icons without adjusting their overlay coordinates, etc.? Any help or recommendations would be greatly appreciated here! (Hopefully my explanation is clear enough; if anything is not, please ask me to clarify!) Thanks in advance for your help!
here you can change with line ::
Drawable drawable = this.getResources().getDrawable(R.drawable.androidmarker);
just put your own icon in drawable folder and update with
Drawable drawable = this.getResources().getDrawable(R.drawable.yourIcon);
For more information :: get from here

Categories

Resources