When I apply bikelayer for bike trails it always draw near specific area despite the fact I changed lat and long of map

171
4
07-14-2020 06:35 AM
JavedIqbal1
New Contributor

When I apply bikelayer for bike trails it always draw near specific area despite the fact I changed lat and long of map:

Code:

require([
"esri/Map",
"esri/views/MapView",
"esri/layers/FeatureLayer"
],
function(
Map,
MapView,
FeatureLayer
) {

var map = new Map({
basemap: "topo-vector"
});

var view = new MapView({
container: "viewDiv",
map: map,
center: [-82.438496,28.010780],
zoom: 13
});

var bikeTrailsRenderer = {
type: "simple",
symbol: {
type: "simple-line",
style: "short-dot",
color: "#FF0000",
width: "5px"
}
};

var bikeTrails = new FeatureLayer({
url:
"https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trails/FeatureServer/0",
renderer: bikeTrailsRenderer,
definitionExpression: "USE_BIKE = 'YES'"
});

map.add(bikeTrails, 1);

Tags (1)
0 Kudos
4 Replies
Egge-JanPollé1
MVP Regular Contributor

Hi Javed,

Yes, you are perfectly right.

From the coordinates you are giving [-82.438496,28.010780], I can see that you are centering your map on Tampa, Florida.

The trails layer you are adding to your map only contains a handful of trails near Santa Monica, California. (It most probably is just a sample data set for testing and demonstration purposes.)

So, even though you center your map somewhere else, the trails layer will always appear where it is.

If you want to show bike trails in Tampa, you will go and have to look for another data source.

HTH,

Egge-Jan

0 Kudos
JavedIqbal1
New Contributor

Hi

0 Kudos
JavedIqbal1
New Contributor

Hello

0 Kudos
JavedIqbal1
New Contributor

Thanks for your replay.

Actually I am very new to this API . I can't understand your below point:

"another data source."

How can I do that ? Basically all I want to show bike trails in Tampa Florida.

0 Kudos