+ Reply to Thread
Results 1 to 4 of 4

Thread: How do you change the extent on Helloworld?

  1. #1
    John Allen
    Join Date
    Jul 2010
    Posts
    63
    Points
    5
    Answers Provided
    1


    0

    Default How do you change the extent on Helloworld?

    How do you change the (initExtent = ) on the Helloworld application from ESRI?

    I just want my app to open to a different location other than San Diego.

    The Helloworld app's extent code looks like this:
    initExtent = "-1.3296373526814876E7 3930962.41823043 -1.2807176545789773E7 4201243.7502468005">

    What projection or coordinate system is that?

    Need some guidance.

  2. #2
    Simon Klein
    Join Date
    Mar 2011
    Posts
    85
    Points
    21
    Answers Provided
    4


    0

    Default Re: How do you change the extent on Helloworld?

    You could change the initExtent in the xml layout file to the one you like.
    The numbers should be an Envelope I guess.

    You could navigate and zoom to the location and zoomlevel you want and add an singletab listener to the map.
    So when you are at the location you want print the mapView.getExtent in the onsingletab method. The coordinates of this polygon you then could set as your initial extent in the xml.

  3. #3
    John Allen
    Join Date
    Jul 2010
    Posts
    63
    Points
    5
    Answers Provided
    1


    0

    Default Re: How do you change the extent on Helloworld?

    I figured it out.

    ESRI's World Street Map - map service is in Web Mercator.

    I published my own map service with some point data located on the area i needed to be zoomed into, and made sure the map layer coordinate system in ArcMap was set to Web Mercator (Auxillery) then published it as a map service

    I changed the Hello world code to look like this:

    JAVA CODE:
    ________________
    package com.dhec.MPOS;

    import com.esri.android.map.MapView;
    import com.esri.android.map.ags.ArcGISDynamicMapServiceLayer;
    import com.esri.android.map.ags.ArcGISTiledMapServiceLayer;
    import android.app.Activity;
    import android.os.Bundle;

    public class Mapscreen extends Activity {
    MapView map = null;

    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.mapscreen);

    // Retrieve the map and initial extent from XML layout
    map = (MapView)findViewById(R.id.map);
    // Add dynamic layer to MapView
    map.addLayer(new ArcGISTiledMapServiceLayer("" +
    "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"));
    map.addLayer(new ArcGISDynamicMapServiceLayer("" +
    "http://<myserver>/ArcGIS/rest/services/Mobile/TESTJohn/MapServer"));

    }

    protected void onPause() {
    super.onPause();
    map.pause();
    }

    protected void onResume() {
    super.onResume();
    map.unpause();
    }
    }
    _______

    For the initExtent = ""

    I used the initial extent from the rest service from my map service i published.

  4. #4
    John Allen
    Join Date
    Jul 2010
    Posts
    63
    Points
    5
    Answers Provided
    1


    0

    Default Re: How do you change the extent on Helloworld?

    Note: In the above code I removed my server name and put <my server>.
    If you copy and paste, make sure you actually put your server.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts