JMapViewer adding tiles of a region on Panel - jmapviewer

Hi there i'm using JMapViewer to show maps in my swing app and I've successfully created a panel with map tiles on it but these map tiles are of a particular area used in demo source of Map Viewer, i'm confused about how can i show the tiles of some particular area i want. Just like Google maps i want to show some location of my country (Pakistan) in the maps and i don't know how can i do it.
Secondly, Please explain what are Layer's and Layer Group in JMapViewer? Just an idea.
Edit: how can i download tiles of Islamabad region and then add them to maps.
What i've learnt from demo is this:
private void loadMapTiles(){
map().setTileSource(new OsmTileSource.Mapnik());
map().setTileLoader(new OsmTileLoader(map()));
}
But this shows some specific area they have set to.
I've downloaded JTileDownloader but i'm confused about the url thing because i don't now where to get the url of some specific area.

Given a JMapViewer named map, something like this should display Islamabad:
Coordinate c = new Coordinate(33.7167, 73.0667);
map.setDisplayPosition(c, 10);
org.openstreetmap.gui.jmapviewer.Demo, included in the distribution, is a complete example that illustrates how to use Layer. Click the Tree Layers Visible checkbox to see the effect.
Addendum: Here's the result using MapQuest-OSM at 11x zoom; Mapnik seems to work, too. If no TileSource includes the tiles you want, you may need one of the approaches mentioned here.

Related

Loading ESRI raster in Mapbox GL JS

Is it possible to load ESRI raster tiles from a tiles.arcgis.com service? In this mapbox demo, the line that specifies the basemap tiling service (from Stamen, in this case) is this:
'tiles': [
'https://stamen-tiles.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg'
],
When I edit the fiddle example, however, and try to substitute a tileset I'm interested in using, it doesn't seem to work:
'tiles': [
'https://tiles.arcgis.com/tiles/QcN4ko50whTktDF1/arcgis/rest/services/Ortho_Midland2020_0520and0521/MapServer/tile/{z}/{x}/{y}.jpg'
],
I was able to get direct access to some of the individual tiles, like this, but can't seem to get the URL string right. Here is a page with metadata, as well as the start and end tiles for each zoom level.
Can someone please point out where I'm going wrong with that URL string? I've also changed the initial zoom and x/y to be relevant to the dataset:
center: [-84.39479, 43.820487],
zoom: 11
Here is a fiddle that I've been trying out various URLs in. I would super appreciate pointers about how to format the ESRI tileset URL for use in mapbox gl js. Thanks in advance!
Two issues:
First, the URLs should not have .jpg on the end.
Second, ArcGIS online URLs are z/y/x, not z/x/y
So the correct URL is:
https://tiles.arcgis.com/tiles/QcN4ko50whTktDF1/arcgis/rest/services/Ortho_Midland2020_0520and0521/MapServer/tile/{z}/{y}/{x}
Updated JS Fiddle: https://jsfiddle.net/stevage/z9nao1cv/4/

AE Extendscript layered source file

I'm working on a script that does find/replace for missing items in your project. Unfortunately I'm running into a situation detecting and then replacing layered image sources (psd, ai, etc.).
1) I see no way of detecting if a AvItem is a layer within a layered image other than parsing the item.name, which is unreliable because a user can always rename items in the project panel.
2) Once I do know that it is a part of a layered image I cannot figure out how to re-link it to the correct image without replacing the layer with the merged image. item.replace(new_path) will replace that item with the whole image, not the layer within the image. For example:
var item = app.project.item(3); //assuming this is the 'layer' we want to replace
item.replace(new_path);
So is there a secret property somewhere which will reliably tell me if an item is a part of a layered image, and if so is there a way to relink it without replacing the layer with the entire merged image?
EDIT
Here's a function to guess if a layer is part of a layered image. It's not bullet-proof but it should work as long as the user does not rename the item:
function isSourceLayered (av_item) {
// check if there is a "/"
if (av_item.name.indexOf("/") != -1) {
// check if it is in a "layers" folder
if (av_item.parentFolder.name.indexOf("Layers") != -1) {
return true;
}
}
return false;
}
I just asked the same question on the Adobe extendscript forum. Unless there's undocumented features (and I spent a bit of time looking with Extendscript Toolkit's data browser) the fileSource object doesn't seem to have any attributes or methods to do this.
There is a kind of a workaround, you can import the file using ImportOptions.importAs(ImportAsType.COMP) This will import a comp, and you can loop through the layers matching the name, get the source of that layer and use that as your new source. But as you say, it doesn't work if the source has been renamed.
I've written this into a function, it's available on github Edit: I forgot that I changed the way that function works. It doesn't re-import layer sources because of this problem, it just uses the Duplicate menu command.

Exporting images in an image collection from GEE

Please I would like to know the best way to export image bands from an Image Collection in Google Earth Engine for use on my local machine. The image collection contains 21 elements which I would like to export as single image bands or an image composite of all 21 elements. How do I go about this please. Below is a code extract I have written. Thanks
var S1_1 = ee.ImageCollection('COPERNICUS/S1_GRD')
.filterBounds(SA)
.filterDate('2016-10-01', '2017-06-01')
.filterMetadata('transmitterReceiverPolarisation', 'equals', ['VV', 'VH'])
.filterMetadata('resolution_meters', 'equals' , 10);
You may want to see this answer which shows you how to turn an image collection into a single band image. From there, use Export.image.toDrive().

How to attach custom marker to generated route(draggable)?

I´m using the DirectionsService to generate some routes, but i want to change the default letter markers that Google provides (A, B, C, ...) with some of my own. I was able to do this following this example: http://googlemaps.googlermania.com/google_maps_api_v3/en/map_example_direction_customicon.html
I removed the provided markers, obtained the coordinates of the steps an generated the new markers at those locations, so far so good.
My problem is that the route is draggable, so when the marker is dragged, the route must be dragged too, but cant´find a way to link-attack the marker to the route. Any ideas?
You can render the direction as polyline, then you can use as marker what you want. This example was for other targets and is for your request maybe a little bit big, but it shows how it can be done (Gmap study: multi auto routes/direction with unlimited waypoints click by click)

Double clicking a google earth treeview node does not 'flyto' the placemark

I am using the plugin in a desktop application (Visual Studio C#). I am creating a placemark using the following code:
// Create a new coordinate object based on the lat/lon of the device
// TODO :: add lat/lon once data is available
FC.GEPluginCtrls.Geo.Coordinate Coord =
new FC.GEPluginCtrls.Geo.Coordinate(0, 0, 0, AltitudeMode.RelativeToGround);
// Create a placemark and put it in the tree.
kmlTreeView.ParseKmlObject(KmlHelpers.CreatePlacemark(
ge,
Coord,
((Device)DeviceList[i]).sSerialNum, // ID
((Device)DeviceList[i]).sNickname, // Name - shown in tree
((Device)DeviceList[i]).sName)); // Description - shown in bubble
In the TreeView the new nodes show up and when I double-click on them the bubble pops up with information in it but the view does not change. I attempted to verify the property "public bool FlyToOnDoubleClickNode" as shown in the documentation but that property apparently does not exist in the version I am using (1.010).
When I was loading a KML file the double click worked as expected but ever since I've been manually adding the placemarks it does not work.
Any thoughts?
Thanks!
Have you tried manually assigning a <LookAt> or <Camera> ?
That should work
Edit: Well the FlyToOnDoubleClickNode is turned on by default, so your problems lie elsewhere
I do not know why you are having troubles with setting multiple LookAts. Have you tried assigning 'ids' to your LookAt ? Depending on what you are actually doing, that might help.
Otherwise, have you seen setFlyToView()
I am not sure that will help you though, since it relates to KMLs loaded via NetworkLinks
Thats about me for ideas - good luck!
It appears that the coordinates 0,0 are somehow significant. If the coordinates are changed to something else the "FlyTo" works (0.1 and 0.1 work).

Resources