DroneDeploy
Search…
Map
What many developers think of as a map is known as a plan inside the API. Plans refer to information about the users flights or processed data. Please see Plans for information about how to modify and access plan information.
The map api exposes methods for developers to interact with the map on the user's screen.
Note: You must .subscribe() to methods that draw onto the map. When unsubscribe is called the map changes will be removed.
1
var sub = dronedeployApi.Map.addPolygon(latLng)
2
.subscribe(() => {
3
// This will remove your change from the map.
4
sub.unsubscribe();
5
});
Copied!
Additionally, when you App is removed from the dom all pending subscriptions are destroyed which will in return remove any map change made.

Map.addImageOverlay

Overview
1
var imageUrl = String;
2
var bounds = [{ lat: Number, lng: Number }, ....];
3
dronedeployApi.Map.addImageOverlay(imageUrl, bounds)
4
.subscribe(function(overlay){ console.log(overlay) });
Copied!
Response
1
.subscribe(function(overlay){
2
overlay.bringToBack();
3
overlay.bringToFront();
4
overlay.remove();
5
overlay.setOpacity(0.4);
6
overlay.setUrl(imageUrl);
7
});
Copied!

Map.panTo

1
var location = LatLng;
2
var optionalOptions = {zoom: 20};
3
dronedeployApi.Map.panTo(location, optionalOptions);
Copied!

Map.addTileLayer

Overview
1
var urlTemplate = String;
2
var optionalOptions = {
3
errorTileUrl: String,
4
maxZoom: Number,
5
minZoom: Number,
6
};
7
8
dronedeployApi.Map.addTileLayer(urlTemplate, optionalOptions);
Copied!
Response
1
.subscribe(function(tileLayer){
2
tileLayer.bringToBack();
3
tileLayer.bringToFront();
4
tileLayer.remove();
5
tileLayer.setOpacity(0.4);
6
tileLayer.setUrl(tileTemplate);
7
});
Copied!
Example
1
var urlTemplate = 'https://api.mapbox.com/styles/v1/mapbox/dark-v9/tiles/256/{z}/{x}/{y}';
2
var blankImage = 'data:image/gif;base64,R0lGODlhAQABAAAAACw=';
3
dronedeployApi.Map.addtileLayer(urlTemplate, {
4
errorTileUrl: blankImage,
5
maxZoom: 25,
6
minZoom: 18,
7
});
Copied!

Map.addPolygon

Overview
1
var latLngs = [{lat: Number, lng: Number}, ...];
2
var optionalOptions = {
3
color: String,
4
fill: Boolean,
5
fillColor: String,
6
opacity: Number,
7
weight: Number,
8
};
9
dronedeployApi.Map.addPolygon(latLngs, optionalOptions)
10
.subscribe(function(annotation){ console.log(annotation) });
Copied!
Response
1
.subscribe(function(polygon){
2
polygon.bringToBack();
3
polygon.bringToFront();
4
polygon.getCenter().then(function(latLng){ console.log(latLng) });
5
polygon.getLatLngs().then(function(latLngs){ console.log(latLngs) });
6
polygon.remove();
7
polygon.setLatLngs([{lat: 3, lng: 3}, ...]);
8
polygon.setOpacity(0.4);
9
});
Copied!