I am trying to do the following:
When you click on a button, a country or a set of highlighted countries are displayed.
next, click on a country and you zoom in to a highlighted city or cities.
I want to display the city/cities as a clickable layer when you zoom in
Currently, I can click and zoom in on a highlighted country and the city looks like a dot.. (ICGC WEB PORTAL )
Any suggestions are welcome!!
Chris
Solved! Go to Solution.
the click event for your cityLayer isn't triggered because you're adding it to the map before (and therefore underneath) the countries.
I want to display the city/cities as a clickable layer
what is a 'clickable layer'?
the city looks like a dot
what do you expect the cities to look like?
you'll have to be a lot more specific about what exactly what you're trying to accomplish and what you've already tried in order for someone to be able to help you.
By clickable I mean when you click on the city, data about the city will be
displayed in the side panel
So here is what I am trying to make happen:
Step 1, Click on the country and zoom into and center on the city.
Step 2. Click on the city and data about the city is displayed in the side
panel
I defined a city url:
var cityURL = 'http://....../StRaphaelOSM/MapServer/;
and added the following code
var cityLayer = L.esri.featureLayer().addTo(map);
cityLayer.on('click', function(evt) {
var bounds = evt.layer.getBounds()
map.fitBounds(bounds);
});
the click event for your cityLayer isn't triggered because you're adding it to the map before (and therefore underneath) the countries.
John:
Thanks for pointing that out!!
Problem solved!!
Chris