TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ahmed elbarbary
NA
1.6k
278.4k
cannot push markers on map although have latitude and longtu
Dec 31 2019 7:07 PM
I using angular 7
google map already display without points pushed on it .
meaning all points not display on map although i have latitude and
longtude for more points
but these points not exists on map .
step 1 : on html component
<agm-map
[latitude]=
"lat"
[longitude]=
"lng"
[zoom]=
"zoom"
[disableDefaultUI]=
"false"
[zoomControl]=
"false"
>
<agm-marker
*ngFor=
"let m of markers;"
[latitude]=
"m.lat"
[longitude]=
"m.long"
>
</agm-marker>
</agm-map>
step2 :service.ts
getLocationData(ids: Array<number>) {
let observableBatch = [];
ids.forEach((id) => {
observableBatch.push(
this
.http.get(
'http://192.168.7.45:9200/location/_doc/'
+id)
.map(res => res ));
});
return
Observable.forkJoin(observableBatch);
}
step3 :on component.ts
export class ManagelocationsComponent implements OnInit, AfterViewInit {
markers=[];
this
.partDetailsService.getLocationData(locationArr).subscribe(res => {
res.forEach((item, index) => {
let dataLocation = res[index][
'_source'
][
'GPS1'
];
var
loc = dataLocation.split(
','
);
this
.markers.push(
parseFloat(loc[0].trim()),
parseFloat(loc[1].trim())
})
console.log(
"marker values is"
+
this
.markers);
Result points for latitude and longtude from browser
marker values is
5.2951916,100.28825170000005,30.788892,120.632503,13.658933,100.634069,10.328074,123.983185,31.332119,120.723465,31.9195204,120.1029251,18.588375,99.033632,31.301726,120.673733,31.306624,121.616856,14.3091,121.033,22.783944,113.798342,14.173507,121.129545,29.9211,103.797,10.328071,123.98318500000005,2.679124,101.978932,34.593,133.495,43.6407309,-70.32520110000002,31.8406,120.482,1.37437,103.863366,15.4507,120.605,37.5127,126.786
google map not show points above why and how to solve it .
Reply
Answers (
0
)
How to pass result of foreach loop to functinon LatLng?
when call service result res not accept : Array<any>