The Layer class makes it easy to organize groups of data by storing them in separate layers on the map. Grouping your data into layers provides a number of benefits such as the ability to hide or attach events to all IPrimitive shapes in a layer with a single line of code, while also providing providing a performance benefit over manually looping through each shape and performing these tasks.
The Layer class allows you to add events which are triggered when interacting with the IPimitive shapes that are in the layer. The benefit of this is that you only need to add the event on the layer and not on each individual shape. This results in less memory being used by the application and slightly faster response times by the events. This class has been deprecated and replaced with the Layer class.
However, to minimize migration efforts we have added an EntityCollection class for backwards compatibility which wraps the Layer class.
This wrapper flattens all child entity collections of an EntityCollection into a single layer. This may result in some rendering differences when compared to V7. This EntityCollection class should only be used if migrating an app from V7 that requires minimal code changes. Skip to main content. Exit focus mode. Constructor Layer id? This can be used to iterate over the individual shapes. See also: zIndexing in Bing Maps V8 Events The Layer class allows you to add events which are triggered when interacting with the IPimitive shapes that are in the layer.
Name Arguments Description click MouseEventArgs Occurs when the mouse is used to click the map or when a touch end event occurs on an IPrimitive shape in the layer. Yes No. Any additional feedback? Skip Submit. Is this page helpful? Adds a shapes to the layer, at the specified index if specified. Gets an array of shapes that are in the layer. Sets the zIndex of the layer. See also: zIndexing in Bing Maps V8. Occurs when the mouse is used to click the map or when a touch end event occurs on an IPrimitive shape in the layer.
Data Layer: Drag and Drop GeoJSON
Occurs when the mouse is used to double click the map or when a touch end event occurs on an IPrimitive shape in the layer. Occurs when the left mouse button is pressed or a touch start event occurs on an IPrimitive shape in the layer.Leaflet plugin supports many types of map layer. In this article we have map layers as Google map, Open street map, Stamen map, Here map and Bing map layer. What is plugin?
Leaflet plugin that enables the use of Google Map tiles. After this you are allowed to use Google function by which you can add map to your document.
To show this map on browser you need to use the leaflet and stamen API. To use stamen API add the given link in head tag of your html document. Now to add division with leaflet and set its latitude longitude of centre, map and setView methods have used.
There are other types of map also available like terrain, toner and watercolor world widely.
Some maps like Burning map or mars map etc. As we are using this with leaflet, its library has to be link with our document then a container should be present to attach map. After getting API id and code you can run this statement. The line shows that you need to add the Map tile then API id and code. For adding Bing map we have downloaded Leaflet-Bing-Layer. To download Leaflet-Bing-Layer. After having that key, take it into a variable and add a map container in your code with centre and zoom level.
Now you can use the bing method present inside the tileLayer class then add key as parameter. After adding and styling container you can use L. Here street is parameter, there are some other parameter too that you can use in place of street. After that addTo method is used to add map to the container. There are many mapping service company which provide base layer either for free or for some cost.
Leaflet provide a convenient method to add different base map layers. I hope this article helped you in rendering base map layer. If you find any difficulty in implementing the same, do let us know by commenting below.
Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Following the example in the documentation. Every Map has a Data object by default, so most of the time there is no need to construct one.
For example:. Map document. LatLng Learn more. Asked 3 years, 8 months ago. Active 3 years, 8 months ago. Viewed 8k times. Mike Stratton. Mike Stratton Mike Stratton 3 3 silver badges 16 16 bronze badges. Active Oldest Votes. Following the example in the documentation Data class google. Data class A layer for displaying geospatial data.
Points, line-strings and polygons can be displayed. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name.OpenLayers v6. Check out the docs and the examples to get started. The full distribution can be downloaded from the release page.
OpenLayers makes it easy to put a dynamic map in any web page. It can display map tiles, vector data and markers loaded from any source. OpenLayers has been developed to further the use of geographic information of all kinds. OGC mapping services and untiled layers also supported. Mobile support out of the box. Build lightweight custom profiles with just the components you need. Style your map controls with straight-forward CSS.
Hook into different levels of the API or use 3rd party libraries to customize and extend functionality. In case you are not ready yet for the latest version of OpenLayers, we provide links to selected resources of older major versions of the software.
Please consider upgrading to benefit of the latest features and bug fixes. Get best performance and usability for free by using recent versions of OpenLayers. A high-performance, feature-packed library for all your mapping needs.
Latest OpenLayers v6. Quick Start Seen enough already? Go here to get started. Get the Code Get the latest release or dig through the archives.
Tutorials Spend time learning the basics and graduate up to advanced mapping techniques. Workshop Want to learn OpenLayers hands-on? Get started with the workshop. Older versions In case you are not ready yet for the latest version of OpenLayers, we provide links to selected resources of older major versions of the software.
Latest v5: v5. Fork the repo. Open a ticket. Ask a question.This tutorial will show you how to group several layers into one, and how to use the layers control to allow users to easily switch different layers on your map.
Instead of adding them directly to the map, you can do the following, using the LayerGroup class:. Easy enough! Now you have a cities layer that combines your city markers into one layer you can add or remove from the map at once. Leaflet has a nice little control that allows your users to control which layers they see on your map.
There are two types of layers: 1 base layers that are mutually exclusive only one can be visible on your map at a timee. In this example, we want to have two base layers a grayscale and a colored base map to switch between, and an overlay to switch on and off: the city markers we created earlier. One will contain our base layers and one will contain our overlays. The key sets the text for the layer in the control e. The first argument passed when creating the layers control is the base layers object.
The second argument is the overlays object. Both arguments are optional: you can pass just a base layers object by omitting the second argument, or just an overlays objects by passing null as the first argument. In each case, the omitted layer type will not appear for the user to select. Also note that when using multiple base layers, only one of them should be added to the map at instantiation, but all of them should be present in the base layers object when creating the layers control.
Finally, you can style the keys when you define the objects for the layers. For example, this code will make the label for the grayscale map gray:.
See this example stand-alone.Note: Support for 3D on mobile devices may vary, view the system requirements for more information.
The layer is the most fundamental component of a Map. It is a collection of spatial data in the form of graphics or images that represent real-world phenomena. Maps may contain different types of layers. For a broad overview of each layer type available in the API, see this table in the class description for Layer. All layers inherit properties, methods and events from Layer.
Some of these common properties are discussed in this tutorial. To learn about properties specific to different layer types, search the samples for that layer type e. Prior to completing the following steps, you should be familiar with views and Map. If necessary, complete the following tutorials first:.
In this sample we'll create layers for streets and highways using the Esri World Transportation service and a service containing data about housing density in New York City. You may set additional properties on the layers including an idminScalemaxScaleopacityand visible. These may either be set in the constructor or directly on the instance at another point in your application.
The id uniquely identifies the layer, making it easy to reference in other parts of the application. If this isn't set directly by the developer, then it is automatically generated when the layer is created. The minScale and maxScale properties control the visibility of the layer at various scales.
Using these properties can improve app performance at certain scales and enhance the cartography of the map. The visible property is true by default. Layers may be added to the map in several ways.
These are all discussed in the documentation for Map. In this sample we'll add each layer to the map in a different way. Add the transportation layer to the map using map.
Use the addEventListener method to listen to a change event on the checkbox element created in the first step. When the box is checked on and off it will toggle the visibility of the transportation layer on and off.
Like visibleany property of any layer may be set directly on the layer instance. This is accomplished in the snippet below. Even though the layer is not visible to the view in this sample, it still exists as part of the map.The TrimbleMaps Map includes several default layers.
The visibility for each layer can be set, retrieved, or toggled. The Traffic layer displays an overlay that is color coded to indicate the flow of traffic on the roads. The Weather Alert layer displays overlays for various types of alerts.
Interactivity can be to the Weather Alert layer via the controls listed below. The click control makes the weather alerts on the map clickable. A popup with alert details is shown when the alert is clicked. The Weather Alert Filter control can also except parameters to set the filters and control visibility.
Traffic The Traffic layer displays an overlay that is color coded to indicate the flow of traffic on the roads. Set the visibility of the traffic layer. Set the visibility of the weather radar layer. Set the visibility of the weather alert layer. WeatherAlertClickControl ; myMap. WeatherAlertLegendControl ; myMap. WeatherAlertFilterControl ; myMap. Default: All Filters results based on the alert severity.
Default: All Filters results based on the alert urgency. Default: All Filters results based on the alert certainty.