POST
|
The problem is that when the bitmap is the entire map there is a lag in generating the bitmap. If the bitmap is a smaller area the lag is unnoticeable. This a bug we are fixing. The code posted earlier if executed twice works without a problem. Try using the code below, if you single tap on the map twice you will see the bitmap. map.setOnSingleTapListener(new OnSingleTapListener() { /** * */ private static final long serialVersionUID = 1L; public void onSingleTap(float arg0, float arg1) { Polygon polygon = map.getExtent(); Envelope env = new Envelope(); polygon.queryEnvelope(env); Bitmap bitmap = map.getDrawingMapCache(arg0, arg1, 100, 100)); // Bitmap bitmap = map.getDrawingMapCache(0, 0, // map.getWidth(), map.getHeight())); Log.d(TAG, "width = " + map.getWidth() + " ht = " + map.getHeight()); ImageView img = new ImageView(HelloWorld.this); img.setImageBitmap(bitmap); map.addView(img); } }); Thanks Archana
... View more
05-29-2012
12:29 PM
|
0
|
0
|
543
|
POST
|
There is no need to instantiate a FetureLayer from a sub-layer of a DynamicLayer if the user wants to show Popup for that sub-layer and the popup is configured in a web map. All the user needs to do are to retrieve the popupInfo and graphic from the sub-layer. One of our samples "PopupInWebmapForViewing" demonstrates how to show popups for DynamicLayer and FeatureLayer. The following code snippet is for DynamicLayer. // Query dynamic map service layer and display popups. ArcGISDynamicMapServiceLayer dynamicLayer = (ArcGISDynamicMapServiceLayer) layer; // Retrieve layer info for each sub-layer of the dynamic map service layer. ArcGISLayerInfo[] layerinfos = dynamicLayer.getAllLayers(); if ( layerinfos == null ) continue; // Loop through each sub-layer for (ArcGISLayerInfo layerInfo : layerinfos) { // Obtain PopupInfo for sub-layer. PopupInfo popupInfo = dynamicLayer.getPopupInfo(layerInfo.getId()); // Skip sub-layer which is without a popup definition. if ( popupInfo == null || ! popupInfo.isInitialized() ) { continue; } // Check if a sub-layer is visible. ArcGISLayerInfo info = layerInfo; while ( info != null && info.isVisible() ) { info = info.getParentLayer(); } // Skip invisible sub-layer if ( info != null && ! info.isVisible() ) { continue; }; // Check if the sub-layer is within the scale range double maxScale = ((layerInfo.getMaxScale() != 0)) ? layerInfo.getMaxScale():popupInfo.getMaxScale(); double minScale = ((layerInfo.getMinScale() != 0)) ? layerInfo.getMinScale():popupInfo.getMinScale(); if ((maxScale == 0 || map.getScale() > maxScale) && (minScale == 0 || map.getScale() < minScale)) { // Query sub-layer which is associated with a popup definition and is visible and in scale range. new RunQueryDynamicLayerTask(env, popupInfo, dynamicLayer.getSpatialReference(), id).execute(dynamicLayer.getUrl() + "/" + layerInfo.getId()); // get graphics and show popup } }
... View more
04-09-2012
10:21 AM
|
0
|
0
|
581
|
POST
|
Fundamentally the first two coordinates must be screen coordinates. If you have that correct it should just work. We will be releasing shortly, this functionality should work. map.setOnSingleTapListener(new OnSingleTapListener() { @Override public void onSingleTap(float arg0, float arg1) { Bitmap bitmap = map.getDrawingMapCache(arg0,arg1,100,100); ImageView img = new ImageView(ClassName.this); img.setImageBitmap(bitmap); map.addView(img);}});
... View more
04-03-2012
02:13 PM
|
0
|
0
|
806
|
POST
|
Awesome! Its great to hear back from users when stuff works.
... View more
01-06-2012
08:22 AM
|
0
|
0
|
322
|
POST
|
The current SDK samples are supported on devices not on the emulator. Thanks
... View more
01-05-2012
09:16 AM
|
0
|
0
|
325
|
POST
|
Please take a look at the location service sample. That should help you. Also what you are doing should work. Are you seeing any errors?
... View more
01-05-2012
09:14 AM
|
0
|
0
|
349
|
POST
|
You can use the graphicsLayer.getGraphic(...) method to get the graphic you just tapped on, then show the info template contents in a callout (MapView.getCallout()) map.setOnSingleTapListener(new OnSingleTapListener() { @Override public void onSingleTap(float x, float y) { gl.addGraphic(new Graphic(map.toMapPoint(x,y), new SimpleMarkerSymbol(Color.RED, 15, STYLE.CIRCLE))); int[] ids = gl.getGraphicIDs(x, y, 15, 1); InfoTemplate infoTemp = new InfoTemplate(); infoTemp.setContentTemplate("Where is the data ${type}"); try { HashMap<String, Object> attrs = new HashMap<String, Object>(); attrs.put("type", "Point"); Graphic gg = new Graphic(map.toMapPoint(x,y),new SimpleMarkerSymbol(Color.YELLOW, 25, STYLE.DIAMOND),attrs, infoTemp); gl.addGraphic(gg); Log.d(TAG,""+gg.getInfoTemplate().getContent(gg)); Callout callout = map.getCallout(); callout.setContent(createContent(ContactInfoTemplate.this, gl.getGraphic(ids[0]).getInfoTemplate(),gg)); callout.show(map.toMapPoint(x,y)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); public View createContent(Context context, InfoTemplate info, Graphic gg) { LinearLayout layout = new LinearLayout(context); TextView txt = new TextView(context); txt.setText("Content: "+gg.getInfoTemplate().getContent(gg)); TextView txtAttr = new TextView(context); txt.setText("Attr: "+(String)gg.getAttributeValue("type")); layout.addView(txt); layout.addView(txtAttr); return layout; }
... View more
01-04-2012
11:29 AM
|
0
|
0
|
322
|
POST
|
Please take a look at the GeometryEditing sample, it has the magnify tool. You may have found a bug with getMapDrawingCache, we are looking into it. Thanks Archana
... View more
01-04-2012
07:19 AM
|
0
|
0
|
285
|
POST
|
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mMapView = (MapView)findViewById(R.id.map); mMapView.addLayer(new ArcGISDynamicMapServiceLayer(getString(R.string.url))); //Retrieve the non-configuration instance data that was previously returned. Object init = getLastNonConfigurationInstance(); if (init != null) { mMapView.restoreState((String) init); } } The code works with the additional lines as shown in red.
... View more
01-03-2012
03:50 PM
|
0
|
0
|
658
|
POST
|
That is correct, and there are two ways you can create an instance, either by using the new operator MapView m = new MapView(this) Or in xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <!-- MapView layout and initial extent --> <com.esri.android.map.MapView android:id="@+id/map" android:layout_width="fill_parent" android:layout_height="fill_parent" initExtent = "-19332033.11, -3516.27, -1720941.80, 11737211.28"> </com.esri.android.map.MapView> </LinearLayout> In code you would have to use the following : map = (MapView)findViewById(R.id.map); Here is the code to create mapview by using the new operator: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); map = new MapView(this); map.addLayer(new ArcGISDynamicMapServiceLayer(getString(R.string.url))); setContentView(map); //Retrieve the non-configuration instance data that was previously returned. Object init = getLastNonConfigurationInstance(); if (init != null) { map.restoreState((String) init); } } protected void onPause() { super.onPause(); map.pause(); }
... View more
01-03-2012
02:30 PM
|
0
|
0
|
658
|
POST
|
Hi, Could you post the errors that you are getting? 1) Make sure the url that you use while creating a layer, has the fully qualified path name to your server e.g myserver.esri.com or the ip address 2) If you have a service thats on arcgis.com, if its a secure service then the credentials must be supplied. Please take a look at the helloworld sample from the sdk, it will help you get started. You could replace the url there with your service url. Thanks Archana
... View more
01-03-2012
12:19 PM
|
0
|
0
|
262
|
POST
|
hi, This looks like a bug. A workaround would be to call Parser.NextToken() before making the Graphic.FromJSON() call. thanks Archana
... View more
01-03-2012
12:00 PM
|
1
|
0
|
186
|
POST
|
Hello Dennis, Here is the code from the onCreate() method in the helloworld sample from the sdk. Its been modified to get the url from values->string.xml. Thanks Archana ----------------------------------------------------------------------------- public void onCreate(Bundle savedInstanceState) { // could not see these two lines in the code posted super.onCreate(savedInstanceState); setContentView(R.layout.main); // Retrieve the map and initial extent from XML layout map = (MapView)findViewById(R.id.map); // Add dynamic layer to MapView //map.addLayer(new ArcGISDynamicMapServiceLayer("" + "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer")); map.addLayer(new ArcGISDynamicMapServiceLayer(getString(R.string.url_map_tiles))); //Retrieve the non-configuration instance data that was previously returned. Object init = getLastNonConfigurationInstance(); if (init != null) { map.restoreState((String) init); } }
... View more
01-03-2012
11:26 AM
|
0
|
0
|
658
|
Title | Kudos | Posted |
---|---|---|
1 | 01-03-2012 12:00 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|