POST
|
hey, is not exactly a "lib", I found de following code: http://www.java2s.com/Open-Source/Android/android-core/platform-sdk/com/android/ddmuilib/location/KmlParser.java.htm http://www.java2s.com/Open-Source/Android/App/geopaparazzi/eu/hydrologis/geopaparazzi/gpx/parser/GpxParser.java.htm but for the moment I'm focus on the gpx parser, which is actually working, so cannot assure if the kml code is working or not... Anyway, in case it was not useful for u, if you do some research on google I'm sure you'll find what you want (when I did it, I found a great amount of examples 🙂 ) Good luck!
... View more
10-09-2013
11:06 PM
|
0
|
0
|
543
|
POST
|
Thanks, I've found a good lib and following your suggestion it seems that will work 🙂
... View more
10-06-2013
11:43 PM
|
0
|
0
|
543
|
POST
|
Hi, I'm using KMLLayer in my app, and for what I've read in the documentation: "To add a KML file(.kml or .kmz) to a map, the KML must be available via a publicly accessible URL. Locally hosted or KML files inside a firewall are not supported" I understand is not possible to read KML file locally. So, my question is, somebody has achieved this by his own? and could point me in the right direction? Maybe with a costum layer? And for the ESRI people, this behaviour is going to be implemented in future realeses of the SDK? Thanks,
... View more
09-26-2013
12:59 AM
|
0
|
5
|
3063
|
POST
|
Hey Dan, First of all, thanks for answering and trying the code. About your question, there are some reasons for which I prefer the add/remove behaviour: - The less important, because I have many layers, and I was not sure about how many layers you could add to the map object without a loss of eficiency. Do you have any specific data about it? Anyway, the two more importants reasons are the following: - In my app I want to offer the user the option to add "manually" layers to the map, that means, the user will be capable to write the URL, and the app will create the new layer with this URL, and then will add it to the map. And in the same way, after that, the user will be able to remove it. - I'm working with tpk's, and depending on the tpk's available in the device I will choose ones or anothers, that is, I don't know from the beginning which ones or how many I'll have. To sum up, I need a dynamic behaviour about the layers in the map... I'm already using the "visibility pattern" for my base layers that always will be in the map, but I cannot do that for the others. The worst thing is that I don't understand why the add/remove code does not work in some devices. And although you say that the preferred approach is setting the visibility, I assume that the add/remove should work too, otherwise which would be the point of add/remove operations? Thanks in advanced, and looking forward the results of your tests Jessica
... View more
05-29-2013
02:57 AM
|
0
|
0
|
571
|
POST
|
Hi, Actually, yes, I'm pretty sure the layer is indeed initialized. After the: [INDENT] mMapView.removeAll(); mMapView.addLayer(basemapTopo);[/INDENT] If I get the layers added to the map: [INDENT]Layer[] list = mMapView.getLayers();[/INDENT] And I check all the properties, I'm getting the following log with my samsung galaxy ace (the one which is not working) [INDENT]05-28 14:38:06.210: I/BASEMAP(9888): l.getHeight():430 05-28 14:38:06.210: I/BASEMAP(9888): l.getID():2236624 05-28 14:38:06.210: I/BASEMAP(9888): l.getMaxScale():0.0 05-28 14:38:06.242: I/BASEMAP(9888): l.getMinScale():0.0 05-28 14:38:06.242: I/BASEMAP(9888): l.getName():Layers 05-28 14:38:06.242: I/BASEMAP(9888): l.getOpacity():1.0 05-28 14:38:06.273: I/BASEMAP(9888): l.getResolution():125234.41916976124 05-28 14:38:06.273: I/BASEMAP(9888): l.getTitle():null 05-28 14:38:06.273: I/BASEMAP(9888): l.getUrl():http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer 05-28 14:38:06.273: I/BASEMAP(9888): l.getWebMapLayerID():null 05-28 14:38:06.273: I/BASEMAP(9888): l.getWidth():320 05-28 14:38:06.273: I/BASEMAP(9888): l.getDefaultSpatialReference()com.esri.core.geometry.SpatialReference@4057f900 05-28 14:38:06.273: I/BASEMAP(9888): l.isInitialized():true 05-28 14:38:06.273: I/BASEMAP(9888): l.isVisible():true 05-28 14:38:06.273: I/BASEMAP(9888): l.getHeight()false[/INDENT] And the same values (except the ones relative to the screen resolution, etc) for my samsung galaxy s3, where the code works. The map getVisibility is the correct one too (value 0 = VISIBLE). I mean, everything looks like it has to work. The map is initialized, the layer too, and it seems that is properly added to the map... but, for some reason, is not being rendered in the device... Anyone from ESRI could confirm that this should work, and try to check it by himself? Thanks
... View more
05-28-2013
05:22 AM
|
0
|
0
|
571
|
POST
|
Hi, thanks for trying! The models and the android version they have are: [INDENT]Devices where the code works: Sony Ericsson st18i / 2.3.4 Sony Ericsson Xpersia P / 4.0.x Samsung Galaxy s3 / 4.1.x �?? 4.2.x LG e610 / 4.1.x Samsung Galaxay Tab / 2.3.6 Devices where DOESN'T work Samsung galaxy note II / 3.0 Samsun galaxy Ace 2.3.6[/INDENT] As you see, it makes no sense neither... why the code is working in some devices and the others not? I've checked the min amb max version and it's ok: [INDENT] <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />[/INDENT] About your question, I can see the grid, but not the layer... it seems that the "map" object is ok, but I don't understand why, th e layer is not being "painted"... I've tried to zoomtoscale in the map, changing map extent, and some other combinations with no luck 😞 I'm really lost about it... any help will be grateful! Thanks,
... View more
05-28-2013
02:54 AM
|
0
|
0
|
571
|
POST
|
Yes, of course! Here's the code of the example "Basemaps" provided for ESRI: [INDENT]public class BasemapsActivity extends Activity { [INDENT] MapView mMapView = null; ArcGISTiledMapServiceLayer basemapStreet; ArcGISTiledMapServiceLayer basemapTopo; ArcGISTiledMapServiceLayer basemapNatGeo; ArcGISTiledMapServiceLayer basemapOcean;[/INDENT] /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { [INDENT] super.onCreate(savedInstanceState); setContentView(R.layout.main); // Retrieve the map and initial extent from XML layout mMapView = (MapView) findViewById(R.id.map); /* create an initial basemap */ basemapStreet = new ArcGISTiledMapServiceLayer(this.getResources() .getString(R.string.WORLD_STREET_MAP)); basemapTopo = new ArcGISTiledMapServiceLayer(this.getResources() .getString(R.string.WORLD_TOPO_MAP)); basemapNatGeo = new ArcGISTiledMapServiceLayer(this.getResources() .getString(R.string.WORLD_NATGEO_MAP)); basemapOcean = new ArcGISTiledMapServiceLayer(this.getResources() .getString(R.string.OCEAN_BASEMAP)); // set visibility basemapTopo.setVisible(false); basemapNatGeo.setVisible(false); basemapOcean.setVisible(false); // attribute ESRI logo to map mMapView.setEsriLogoVisible(true); [/INDENT] [INDENT] // Add basemap to MapView mMapView.addLayer(basemapStreet); mMapView.addLayer(basemapTopo); mMapView.addLayer(basemapNatGeo); mMapView.addLayer(basemapOcean);[/INDENT] // enable map to wrap around date line mMapView.enableWrapAround(true); } public boolean onCreateOptionsMenu(Menu menu) { [INDENT] MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.basemap_menu, menu); return true;[/INDENT] } public boolean onOptionsItemSelected(MenuItem item) { [INDENT] // handle item selection switch (item.getItemId()) { case R.id.World_Street_Map: [INDENT]basemapStreet.setVisible(true); basemapTopo.setVisible(false); basemapNatGeo.setVisible(false); basemapOcean.setVisible(false); return true;[/INDENT] case R.id.World_Topo: [INDENT]basemapStreet.setVisible(false); basemapNatGeo.setVisible(false); basemapOcean.setVisible(false); basemapTopo.setVisible(true); return true;[/INDENT] case R.id.NatGeo: [INDENT]basemapStreet.setVisible(false); basemapTopo.setVisible(false); basemapOcean.setVisible(false); basemapNatGeo.setVisible(true); return true;[/INDENT] case R.id.Ocean_Basemap: [INDENT]basemapStreet.setVisible(false); basemapTopo.setVisible(false); basemapNatGeo.setVisible(false); basemapOcean.setVisible(true);[/INDENT] default: [INDENT]return super.onOptionsItemSelected(item);[/INDENT][/INDENT] } } @Override protected void onPause() { [INDENT] super.onPause(); mMapView.pause();[/INDENT] } @Override protected void onResume() { [INDENT] super.onResume(); mMapView.unpause();[/INDENT] } } [/INDENT] So, the point is, if I comment the "map.addLayer(X)" lines, in the onCreate (setting layers visibility to true), and in every case of the switch, instead of setting the visibility, I do: [INDENT] case R.id.World_Topo: [INDENT]mMapView.removeAll(); mMapView.addLayer(basemapTopo); // basemapStreet.setVisible(false); // basemapNatGeo.setVisible(false); // basemapOcean.setVisible(false); // basemapTopo.setVisible(true);[/INDENT][/INDENT] that means, I remove all the possible layers in the map and I add a new one, for some devices the new layer is not showing. I've tested with diffetent combinations of adding and removing layers and the problem persists. I've tested not doing a "remove" or removeAll", only the "add", and it doesn't work neither (with this I mean, that I guess that the remove is not the problem) I've only solved the issue adding all the layers in the onCreate... but that would mean that you can't add layers dynamically to your map... Any idea what's going on? The same code is working for the following devices: Samsung galaxy s3 Sony ericsson st18i LG e610 Samsung galaxy TAB and not working for: Samsung Galaxy ACE Samsung tab 10.1 Thanks, hope somebody can help me
... View more
05-28-2013
12:44 AM
|
0
|
0
|
571
|
POST
|
Hi again, then, nobody else has experimented the same issue? I've been doing some more research with no luck. Actually, I download de BaseMaps example, given by ESRI, where they only add 4base layers to the mapn in the onCreate, and then they only change the visibility of each depending on which one you choose. I've modified this to use the "add" and "remove" map operations, instead of addind all layers in the on Create and going on changing the visibility, and indeed, it doesn't work neither in my samsung galaxy ace: //In the original code: case R.id.World_Topo: basemapStreet.setVisible(false); basemapNatGeo.setVisible(false); basemapOcean.setVisible(false); basemapTopo.setVisible(true); //In my code case R.id.World_Topo: mMapView.removeAll(); mMapView.addLayer(basemapTopo); And, misteriously (at least for me) the second snippet doesn't work in some devices. Please, could anyone give me some advice of how to solve it? Is it normal? Is it impossible to add/remove layers dynamically? or I have to assume that you have to manage the layers of the map in a kinf od "static way" knowing from the begining all the layers you're going to use? Thanks,
... View more
05-27-2013
11:16 PM
|
0
|
0
|
571
|
POST
|
Hi, I'm having the same problem. Finally, how did you solve it? Thanks in advanced,
... View more
05-13-2013
04:51 AM
|
0
|
0
|
531
|
POST
|
Hi, I'm experimenting a weird behaviour with map.addLayer() method and I'm not sure if it's a bug or I'm missing something. The thing is that in some Android devices (i.e. Samsung Galaxy Ace) when I add layers to the map after the OnCreate method these layers are not showing in the map, but if I add the layers during the onCreate method, these layers are showing correctly. I could guess that you can only use the addLayer method on the OnCreate process, but it has no sense because as I say, this only happens in some Android devices... and that's why I'm not getting which is the exact problem. These are two examples about 2different ways of how I add the layers: map.removeAll(); WMSLayer wms = new WMSLayer("http://mapcache.icc.cat/map/bases/service?",SpatialReference.create(23031)); map.addLayer(wms); or baseLayer.setVisible(false);//I set to not visible the current layer added to the map WMSLayer wms = new WMSLayer("http://mapcache.icc.catmapbasesservice?",SpatialReference.create(23031)); map.addLayer(wms); Anyone has noticed the same? Anyone from ESRI could try to reproduce the problem? Thanks in advanced,
... View more
05-13-2013
01:42 AM
|
0
|
10
|
1143
|
POST
|
Hi, I'm experimenting a weird behaviour with map.addLayer() method and I'm not sure if it's a bug or I'm missing something. The thing is that in some Android devices (i.e. Samsung Galaxy Ace) when I add layers to the map after the OnCreate method these layers are not showing in the map, but if I add the layers during the onCreate method, these layers are showing correctly. I could guess that you can only use the addLayer method on the OnCreate process, but it has no sense because as I say, this only happens in some Android devices... and that's why I'm not getting which is the exact problem. These are two examples about 2different ways of how I add the layers: map.removeAll(); WMSLayer wms = new WMSLayer("http://mapcache.icc.cat/map/bases/service?",SpatialReference.create(23031)); map.addLayer(wms); or baseLayer.setVisible(false);//I set to not visible the current layer added to the map WMSLayer wms = new WMSLayer("http://mapcache.icc.cat/map/bases/service?",SpatialReference.create(23031)); map.addLayer(wms); Anyone has noticed the same? Anyone from ESRI could try to reproduce the problem? Thanks in advanced,
... View more
05-13-2013
01:41 AM
|
0
|
0
|
365
|
POST
|
Hi, one question about this solution. When you talk about the init parameter when you create the layer, I guess you're talking about doing something like that: new ArcGISLocalTiledLayer("file://"+path, true); And then adding this new Layer to the Map, should work and the map should be refreshed, right? but in my case this is not working neither and the map is not showing anything. Myabe I'm not doing the creation and the adding in the right place, could you point me when yo do that in order to work? (I'm having some problems when I add the layers outside the OnCreate method... maybe that's the problem here too?) Thanks,
... View more
05-13-2013
12:59 AM
|
0
|
0
|
428
|
POST
|
Thanks for the links Andy, but that's exactly the opposite of what I'm looking for 😞 ArcGisTiledLayer allows you to read data (tiled cache) previously stored on your SDcard. What I need, is something like the "OfflineableTiledMapServiceLayer" of Windows Mobile SDK: a layer that at the same time that receives the data from the online connection, can store it in the SDcard, and in case you lost the connection, tries to retrieve the info from this stored data. "OfflineableTiledMapServiceLayer is derived from ArcGISTiledMapServiceLayer, which could automatically save tile images from base map layer to a Sqlite database file in IsolatedStorage, then when your phone is offline, it can automatically load tiles from local database as a offline map layer(without any modification of your code)." So... do we have something like that in the ArcGIs Runtime Android SDK? In case not, are you planning to add this functionality in future updatings? Thanks!
... View more
01-25-2013
03:18 AM
|
0
|
0
|
194
|
POST
|
That was exactly what I was looking for! but the problem is that it looks like "OfflineableTiledMapServiceLayer" is only available in Windows Mobile SDK... 😞 Does the corresponding class for the Android SDK exist? If it is, which one is? Or which one can I use in order to achieve a similar behaviour? Thanks,
... View more
01-23-2013
10:08 PM
|
0
|
0
|
194
|
POST
|
After some more research, I�??m pretty sure that the only way to store in the sd the map tiles loaded during a zoom, is to do it one by one �??by hand�?� in a sqllite db for example, although I'm not getting exactly how... am I right? I guess then that ArcGis Runtime for Android dos not offer any special way to do it. I�??ll be very grateful if somebody could enlighten me or confirm my guess... Thanks again!
... View more
01-23-2013
12:55 AM
|
0
|
0
|
194
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|