Skip to main content
added 495 characters in body
Source Link
Stuey17
  • 199
  • 1
  • 13

I am trying to add a number of markers to my map, using HERE maps API. I have my coordinates in a list, and there are 30+ pairs.

var coords = [[60.1697768639186, 24.82923586371288],
[60.170497332447866, 24.828592133548653 ],
[60.17093227431904, 24.827707004572943 ], ..........

https://developer.here.com/documentation/maps/3.1.22.1/dev_guide/topics/marker-objects.html

The documentation outlines that this is the way to add single markers

var parisMarker = new H.map.Marker({lat:48.8567, lng:2.3508});
map.addObject(parisMarker);

var romeMarker = new H.map.Marker({lat:41.9, lng: 12.5});
map.addObject(romeMarker);

var berlinMarker = new H.map.Marker({lat:52.5166, lng:13.3833});
map.addObject(berlinMarker);

So I ultimately want to loop through each element of my coordinate list and add a marker for each pair.

How can I doam trying this?..

// chargepoints = 2 if the chargepoints flask route is completed
if (chargepoints = 2) {

  // ADD THE CHARGEPOINTS TO THE MAP
  for (var i=0; i<coords.length; i++) {

    var chargemarker = new H.map.Marker({lat:coords[i][1], lng: coords[i][0]});map.addObject(chargemarker);

    map.addObject(chargemarker);

}
}

However the markers are not appearing. When I insert some consolg.log("hello"); into different stages in the loop, they appear in the console however.

I am trying to add a number of markers to my map, using HERE maps API. I have my coordinates in a list, and there are 30+ pairs.

var coords = [[60.1697768639186, 24.82923586371288],
[60.170497332447866, 24.828592133548653 ],
[60.17093227431904, 24.827707004572943 ], ..........

https://developer.here.com/documentation/maps/3.1.22.1/dev_guide/topics/marker-objects.html

The documentation outlines that this is the way to add single markers

var parisMarker = new H.map.Marker({lat:48.8567, lng:2.3508});
map.addObject(parisMarker);

var romeMarker = new H.map.Marker({lat:41.9, lng: 12.5});
map.addObject(romeMarker);

var berlinMarker = new H.map.Marker({lat:52.5166, lng:13.3833});
map.addObject(berlinMarker);

So I ultimately want to loop through each element of my coordinate list and add a marker for each pair.

How can I do this?

I am trying to add a number of markers to my map, using HERE maps API. I have my coordinates in a list, and there are 30+ pairs.

var coords = [[60.1697768639186, 24.82923586371288],
[60.170497332447866, 24.828592133548653 ],
[60.17093227431904, 24.827707004572943 ], ..........

https://developer.here.com/documentation/maps/3.1.22.1/dev_guide/topics/marker-objects.html

The documentation outlines that this is the way to add single markers

var parisMarker = new H.map.Marker({lat:48.8567, lng:2.3508});
map.addObject(parisMarker);

var romeMarker = new H.map.Marker({lat:41.9, lng: 12.5});
map.addObject(romeMarker);

var berlinMarker = new H.map.Marker({lat:52.5166, lng:13.3833});
map.addObject(berlinMarker);

So I ultimately want to loop through each element of my coordinate list and add a marker for each pair.

I am trying this..

// chargepoints = 2 if the chargepoints flask route is completed
if (chargepoints = 2) {

  // ADD THE CHARGEPOINTS TO THE MAP
  for (var i=0; i<coords.length; i++) {

    var chargemarker = new H.map.Marker({lat:coords[i][1], lng: coords[i][0]});map.addObject(chargemarker);

    map.addObject(chargemarker);

}
}

However the markers are not appearing. When I insert some consolg.log("hello"); into different stages in the loop, they appear in the console however.

added 118 characters in body
Source Link
Stuey17
  • 199
  • 1
  • 13

I am trying to add a number of markers to my map, using HERE maps API. I have my coordinates in a list, and there are 30+ pairs.

var coords = [[60.1697768639186, 24.82923586371288],
[60.170497332447866, 24.828592133548653 ],
[60.17093227431904, 24.827707004572943 ], ..........

https://developer.here.com/documentation/maps/3.1.22.1/dev_guide/topics/marker-objects.html

The documentation outlines that this is the way to add a single markermarkers

coordsvar parisMarker = new H.map.Marker({lat: 5248.530758567, lng: 132.38513508},);
markermap.addObject(parisMarker);

var romeMarker = new H.map.Marker(coords{lat:41.9, lng: 12.5});
// Add the marker to the map.addObject(romeMarker);

var andberlinMarker center= thenew H.map at the location of the.Marker({lat:52.5166, markerlng:13.3833});
map.addObject(markerberlinMarker);

So I ultimately want to loop through each element of my coordinate list and add a marker for each pair.

How can I do this?

I am trying to add a number of markers to my map, using HERE maps API. I have my coordinates in a list, and there are 30+ pairs.

var coords = [[60.1697768639186, 24.82923586371288],
[60.170497332447866, 24.828592133548653 ],
[60.17093227431904, 24.827707004572943 ], ..........

https://developer.here.com/documentation/maps/3.1.22.1/dev_guide/topics/marker-objects.html

The documentation outlines that this is the way to add a single marker

coords = {lat: 52.53075, lng: 13.3851},
marker = new H.map.Marker(coords);
// Add the marker to the map and center the map at the location of the marker:
map.addObject(marker);

So I ultimately want to loop through each element of my coordinate list and add a marker for each pair.

How can I do this?

I am trying to add a number of markers to my map, using HERE maps API. I have my coordinates in a list, and there are 30+ pairs.

var coords = [[60.1697768639186, 24.82923586371288],
[60.170497332447866, 24.828592133548653 ],
[60.17093227431904, 24.827707004572943 ], ..........

https://developer.here.com/documentation/maps/3.1.22.1/dev_guide/topics/marker-objects.html

The documentation outlines that this is the way to add single markers

var parisMarker = new H.map.Marker({lat:48.8567, lng:2.3508});
map.addObject(parisMarker);

var romeMarker = new H.map.Marker({lat:41.9, lng: 12.5});
map.addObject(romeMarker);

var berlinMarker = new H.map.Marker({lat:52.5166, lng:13.3833});
map.addObject(berlinMarker);

So I ultimately want to loop through each element of my coordinate list and add a marker for each pair.

How can I do this?

clarification of coordinates
Source Link
Stuey17
  • 199
  • 1
  • 13

I am trying to add a number of markers to my map, using HERE maps API. TheI have my coordinates look like thisin a list, and there are 30+ pairs.

var coords = [[60.1697768639186, 24.82923586371288],
[60.170497332447866, 24.828592133548653 ],
[60.17093227431904, 24.827707004572943 ],
[60.170057048001865, 24.826505374933163 ],
[60.170025027084705, 24.82839365008141]];.......

https://developer.here.com/documentation/maps/3.1.22.1/dev_guide/topics/marker-objects.html

The documentation outlines that this is the way to add a single marker

coords = {lat: 52.53075, lng: 13.3851},
marker = new H.map.Marker(coords);
// Add the marker to the map and center the map at the location of the marker:
map.addObject(marker);

So I ultimately want to loop through each element of my coordinate list and add a marker for each pair.

How can I do this?

I am trying to add a number of markers to my map, using HERE maps API. The coordinates look like this.

var coords = [[60.1697768639186, 24.82923586371288],
[60.170497332447866, 24.828592133548653 ],
[60.17093227431904, 24.827707004572943 ],
[60.170057048001865, 24.826505374933163 ],
[60.170025027084705, 24.82839365008141]];

https://developer.here.com/documentation/maps/3.1.22.1/dev_guide/topics/marker-objects.html

The documentation outlines that this is the way to add a single marker

coords = {lat: 52.53075, lng: 13.3851},
marker = new H.map.Marker(coords);
// Add the marker to the map and center the map at the location of the marker:
map.addObject(marker);

So I ultimately want to loop through each element of my coordinate list and add a marker for each pair.

How can I do this?

I am trying to add a number of markers to my map, using HERE maps API. I have my coordinates in a list, and there are 30+ pairs.

var coords = [[60.1697768639186, 24.82923586371288],
[60.170497332447866, 24.828592133548653 ],
[60.17093227431904, 24.827707004572943 ], ..........

https://developer.here.com/documentation/maps/3.1.22.1/dev_guide/topics/marker-objects.html

The documentation outlines that this is the way to add a single marker

coords = {lat: 52.53075, lng: 13.3851},
marker = new H.map.Marker(coords);
// Add the marker to the map and center the map at the location of the marker:
map.addObject(marker);

So I ultimately want to loop through each element of my coordinate list and add a marker for each pair.

How can I do this?

Source Link
Stuey17
  • 199
  • 1
  • 13
Loading