5 votes
Accepted

Leaflet event onclick zoom in and out (JavaScript)

Assuming your map variable is called map, this zooms in when you click the map: map.on('click', function() { map.zoomIn(); }); If you're asking to fire an event when zooming happens, then use: ...
BritishSteel's user avatar
  • 6,637
4 votes
Accepted

Esri leaflet plugin only showing North America tile?

Leaflet includes information about the WGS84 coordinate system generally, but you'll still need to provide information about the origin and levels of detail of your own cached service in order for it ...
john gravois's user avatar
  • 5,073
4 votes
Accepted

Esri Leaflet identify() only on added layer from MapService

By default L.esri.IdentifyFeatures queries all the layers in the map service. https://github.com/Esri/esri-leaflet/blob/v2.2.3/src/Tasks/IdentifyFeatures.js#L20 From the looks of your codepen, it ...
john gravois's user avatar
  • 5,073
3 votes

Show an esri leaflet feature's popup by default

featureLayer.bindPopup() isn't triggered until users interact with an individual graphic. if you want a popup to be created and opened immediately, you can do it yourself using the opportunity ...
john gravois's user avatar
  • 5,073
3 votes
Accepted

Can we set the latlng start point : leaflet

First, read the source code for L.CRS.Simple, particularly, this line: transformation: toTransformation(1, 0, -1, 0), That is a factory method to instantiate an affine transformation from L....
IvanSanchez's user avatar
  • 10.2k
3 votes
Accepted

Need syntax to restyle some data via dynamic layers and ArcGIS REST API

Your link didn't work for me, but this shows green lines: https://earthquake.usgs.gov/arcgis/rest/services/ls/pwfdf_2018/MapServer/export?dynamicLayers=[{"id":6,"name":"Segment Combined Hazard ...
Kirk Kuykendall's user avatar
3 votes
Accepted

Leaflet access dynamic layers globally

Just keep their names in an array in the window object, such as: window.dynamicLayerNames = []; let url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Energy/Infrastructure/MapServer";...
Ulas's user avatar
  • 383
3 votes

Selecting all objects with specific value from GeoJSON in new variable

This is probably more of a question for stackoverflow directly, however if you are able to use ES6, you could use something like this: const filteredFeatures = kitespots.features.filter(item => { ...
Timothy Dalton's user avatar
2 votes
Accepted

Adding button to move map Direction in Leaflet?

You can start here: Leaflet.Pancontrol. Check the code repository and download code to your plugins folder inside leaflet folder. Then in code just reference to the js file/files.
adamczi's user avatar
  • 739
2 votes

proj4leaflet with esri-leaflet 1.0.4

You forgot to include the most important part of the message! L.esri.TiledMapLayer is using a non-mercator spatial reference. Support may be available through Proj4Leaflet this isn't a complaint, ...
john gravois's user avatar
  • 5,073
2 votes
Accepted

dynamicMapLayer esri-leaflet does not return properties of point data

your sample is working fine for me. if you're having trouble clicking on point features, consider calling tolerance() and passing in a number of screen pixels greater than the default value of 3. ...
john gravois's user avatar
  • 5,073
2 votes
Accepted

Leaflet popup does not work with esri rest feature services

This is happening because the points are being drawn below the polygon graphics. The example below demonstrates how to use Leaflet panes to get control over draw order and make sure the points are ...
john gravois's user avatar
  • 5,073
2 votes

Change default leaflet marker color

Very late answer. It might be that this solution was not available in Leaflet at the time of the question, but it might help somebody now. If you create custom icon with AwesomeMarkers plugin and ...
TomazicM's user avatar
  • 25.1k
2 votes

Leaflet error: h.fn is undefined when using layer.on('loading') event

I am posting this solution in case someone is trying to implement something similar like a loading indicator: if (checkBox.checked){ map.addLayer(layer); cursorWait(); layer.on('load', ...
ylka's user avatar
  • 1,077
2 votes
Accepted

Leaflet error: h.fn is undefined when using layer.on('loading') event

you can (and should) skip including the parentheses when you wire up your event listener to a named function. layer.on('loading' , cursorWait); // not cursorWait() it appears also when I zoom in ...
john gravois's user avatar
  • 5,073
2 votes

Correct way to determine the type of Leaflet layer?

This isn't really a Leaflet issue, but a general one with Javascript. And it specifically concerns when you want the objects's name. For comparisons, there are plenty of ways to do it safely (as in ...
Senshi's user avatar
  • 1,767
2 votes
Accepted

Return readable date format in leaflet popup from ArcGIS map/feature service

I'm lost when trying to convert these to readable format, such as 2017-12-31 Read the documentation for Date. After that, it's quite an easy task: var timestampMsec = 1228694400000; var myDate = new ...
IvanSanchez's user avatar
  • 10.2k
2 votes
Accepted

Leaflet fails to overlay my ESRI hosted Tiled Service on the OpenStreetMap basemap

Your own basemap uses the same coordinate system as OSM (wkid:3857/102100) but the origin and levels of detail don't match. here'a another service you can use to compare: https://services....
john gravois's user avatar
  • 5,073
2 votes
Accepted

Unable to pull a bts.dot.gov MapLayer using Leaflet in R

Solved it. I needed to set useCors to FALSE: leaflet() %>% setView(-117.1, 32.9, 10) %>% addEsriBasemapLayer(esriBasemapLayers$Oceans, autoLabels = TRUE) %>% addEsriDynamicMapLayer( ...
nod's user avatar
  • 141
2 votes

Filtering Esri Leaflet feature layers using setWhere() method

I had not realized that the setWhere() method resets an existing filter. Though a filter was set with one condition when each feature layer was created, all desired conditions have to be included when ...
nlibassi's user avatar
2 votes

Selecting all objects with specific value from GeoJSON in new variable

There is a practical library you can use to filter Geojson data, https://github.com/digidem/feature-filter-geojson. With this library you can create mapbox-style-definition like filters. import ...
Deniz's user avatar
  • 186
2 votes
Accepted

A WMTS layer (Topotijdreis) does not show in Leaflet map

I'm not familiar with Leaflet in R, but your problem is most probably use of projected coordinates in setView. Regardless of map projection, Leaflet always requires unpprojected coordinates [lat, lng] ...
TomazicM's user avatar
  • 25.1k
2 votes
Accepted

Add ESRI wayback WMTS service in ipyleaflet

Below is the code that works for me in plain JS. I named wayback time slice parameter timeId. var map = L.map('map', { center: [36, -114.96], zoom: 13 }); var template = 'https://wayback....
TomazicM's user avatar
  • 25.1k
1 vote

Using ArcGIS Tokens to visualize user authenticated data in Esri Leaflet?

You can find a sample which utilizes an OAuth workflow to allow users to sign in and access secure content from ArcGIS Online/Portal here: http://esri.github.io/esri-leaflet/examples/arcgis-online-...
john gravois's user avatar
  • 5,073
1 vote
Accepted

Show an esri leaflet feature's popup by default

In order to allow the popup on a polygon feature to be enabled by default AND make sure it is still clickable afterwards (in case it's closed but needs to be re-opened), this is the code that worked ...
spartmar's user avatar
  • 553
1 vote

ArcGIS getToken/generateToken

Each token generated has an expiration. There's no way to reuse an expired token if that's what you want. Consider the security vulnerability that will be introduced if tokens could be reused. Storing ...
Don's user avatar
  • 626
1 vote
Accepted

Geoprocessing return not showing on map?

the service is returning web mercator northings and eastings (wkid:3857 / 102100) not raw wgs84 lat/lon coordinates (wkid:4326). you can get your GP service to return lat/long coordinates by supplying ...
john gravois's user avatar
  • 5,073
1 vote

Leaflet Custom TileLayer for ArcGIS Cache Tiles in Folder

if the tiled map service has been published to ArcGIS Server, i'd recommend using Esri Leaflet to load it via the service url. you can find a live sample here: http://esri.github.io/esri-leaflet/...
john gravois's user avatar
  • 5,073
1 vote
Accepted

Esri leaflet layers turned off by default in map layer control box

have you already seen this helpful tutorial? http://leafletjs.com/examples/layers-control/ because the control expects a object composed of basemaps (that can only be displayed one at a time) to be ...
john gravois's user avatar
  • 5,073

Only top scored, non community-wiki answers of a minimum length are eligible