How to attach custom marker to generated route(draggable)? - google-maps-api-3

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)

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/

Here.com api, getMapPackageAtGeoCoordinates for multiple coordinates

getMapPackageAtGeoCoordinates: take only 1 value as parameter.
I've a long list of NMAGeoCoordinates and I'm looking for a way to get the "packageId" without doing multiple calls (or using a bounding box as parameter)
UPDATE
My iOS app has a list of routes (hundreds of them) and each route has multiple intermediate points.
For each route should be possible to download the map data offline.
I'm using this api:
https://developer.here.com/documentation/ios-premium/dev_guide/topics/maps-offline-maploader.html
I'm not using the other method based on NMAMapDataPrefetcher because I need to have control over packages installed.
So given a list of NMAGeoCoordinates I need to get a list of possible NMAMapPackage to download.
I can't use the start or destination coordinate because each route can include multiple countries.
I can't call getMapPackageAtGeoCoordinates multiple times to get a complete list of possible countries included in a route (it's to many calls, on the order of tens for each route)
So I'm wondering if there a better way to solve this problem, maybe using a bounding box to get all the NMAMapPackage included in a route.
I've also checked the REST api:
https://developer.here.com/documentation/routing/topics/resource-calculate-route.html
looks like there a way to calculate a route and get a summary of country traversed, usign the RouteAttributeType "summaryByCountry". The response include a field "country" using an ISO 3166-1-alpha-3 format, but there no way to convert this value to an NMAMapPackage id.
There is no other way except you describe to receive NMAMapPackage using geoCoordinates.
This is the only way to use bounding box to download area he needs without multiple invocations.
#interface NMAGeoBoundingBox : NSObject<NSCoding>
+ (nullable instancetype)geoBoundingBoxContainingGeoCoordinates:(nonnull NSArray<NMAGeoCoordinates *> *)coordinates
#interface NMAMapDataPrefetcher : NSObject
- (NSInteger)fetchMapDataForBoundingBox:(nonnull NMAGeoBoundingBox *)boundingBox
error:(NMAPrefetchRequestError *_Nullable)error
NS_SWIFT_NAME(fetchMapDataForBoundingBox(_:error:));

JMapViewer adding tiles of a region on Panel

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.

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

IvoryGoogleMap - can't display infoWindow

i'm trying to use IvoryGoogleMap to display a simple map with markers and infoWindows using this code:
$marker ->setPosition($place->getLat(), $place->getLng());
$infoWindow ->setContent('<p>Default content</p>');
$marker ->setInfoWindow($infoWindow);
$map ->addMarker($marker);
and all i'm getting is a map with marker(s) but when i click on one of them, nothing happens. Have you any idea what am i doing wrong ?
Ok, problem solved. Here is the solution from bundle's author egeloen (on github):
======================================================================
This functionality doesn't exist natively. If you want to open an info window with a click event on a marker, you need to use the ivory_google_map.event service. This service allow you to generate all events you want.
In your case, the event is :
$clickEvent = $this->get('ivory_google_map.event');
$clickEvent->setInstance($marker->getJavascriptVariable());
$clickEvent->setEventName('click');
$clickEvent->setHandle(sprintf('function(){%s.open(%s, %s);}',
$infoWindow->getJavascriptVariable(),
$map->getJavascriptVariable(),
$marker->getJavascriptVariable()
);
$map->getEventManager()->addEvent($clickEvent);

Resources