Crashed in setTimeout

Hi,can you help me please js people,I am having problem in my application it will crashed if I have 50,000 coordinates to loop in setTimeout.,I tried to comment that part the application will not crashed.I think the setTiemeout has the problem

Thank you in advance.

What is the purpose of the timeout? The way the code is written, the markers will not be staggered one per second. You’re creating all the timeouts immediately, so they’ll all fire together in one second.

Also, 50,000 markers is a lot. Looks like each one adds an event listener, and each one calls setCenter(). Seems like a lot of computation.

50K !!!

I wouldn’t even try to run that code. It would crawl if not outright crash.
(I see by the topic title, that is exactly what happens)

Languages can often be tweaked to do things they aren’t best suited for.
And they can be pushed to near their limits.
But 50K for JavaScript is extreme.

Imagine you put an alert() in there to help debug, would you really want to close 50K alerts?

IMHO you should try to get it working with a much smaller data set first, then tweak and push.

TBH I can’t imagine why you would need 50K, are you mapping every residence in a small country? :wink:

Okay there is something missing in mycode

})(coordinateLatLng[i],i), 1000  * i);

The code works only 10K but morethan 10K my appz starts to crashed.

@Mittineague,50K is the total records that was queried base on user inputted date (From and To Date). now if the user want to query 3 months,I don’t know how much data is stored in database on a certain device,lets just say 150K then I need to draw this coordinates on the map in order to see the history or the path of the device where it is running…I don’t know how to make this work,my application will crashes.

Are you testing for
OVER_QUERY_LIMIT error:
HTTP 403 response

I don’t understand what is meant by these, but maybe you’re exceeding them?
https://developers.google.com/maps-engine/documentation/limits#capacity_query_limits_and_vector_table_limits

Capacity (query limits and vector table limits)

There are two types of Google Maps Engine projects for the purpose of query limits: free projects and paid projects.

Free projects

The limits for free projects are listed in the Google Maps Engine help center.

Paid projects

Paid Google Maps API for Work projects have the following initial usage limits:

1 query per second (QPS) per project.
10,000 queries per day per project.
100,000 features per table.
2000 vertices per feature.
250,000 vertices per table.
Create, modify, or delete up to 50 features in a single request.
Up to 1000 features per page when querying.

It sounds like you are using the “free” and the limits might be the problem
https://support.google.com/mapsengine/answer/6048447?rd=1#freequotas

The limits for the evaluation version of Maps Engine are as follows:

Limit 					Quota
Storage 				10MB
Number of features in a vector table 	10,000
Number of vertices per feature or table	50 vertices per feature; 500,000 vertices per table
Number of map loads per month 		40,000
API query capacity 			One query per second
Number of projects per user 		1

Check the status on the lower-left corner of the Maps Engine dashboard to view your usage stats.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.