[OpenLayers-Users] How to add many(>400) markers to the map?

Adams chris at genieknows.com
Wed Apr 15 07:30:19 EDT 2009


Or a single dictionary, i.e.: g = {}; .. g["_"+x+","+y] = .... for each ...


----- Original Message -----
From: "Adams" <chris at genieknows.com>
To: "users" <users at openlayers.org>
Sent: Wednesday, April 15, 2009 8:26:01 AM GMT -04:00 Atlantic Time (Canada)
Subject: Re: [OpenLayers-Users] How to add many(>400) markers to the map?

Try increasing the cell size.

If you don't want to do that, implement 'g' using nested dictionaries, that way you won't be creating or reading through an array with as many elements as pixels in the view port.

----- Original Message -----
From: "willson" <talentp1982 at yahoo.com.cn>
To: users at openlayers.org
Sent: Wednesday, April 15, 2009 12:52:42 AM GMT -04:00 Atlantic Time (Canada)
Subject: Re: [OpenLayers-Users] How to add many(>400) markers to the map?




I don't think a lot of experimentation is required, I would implement it 
as such:

g = [view port width / cell size][view port height / cell size]

For each point, p:
   px <- convert p to view port PX
   px <- floor(px / cell size)
   if px in g is valid and g[px.x][px.y] not defined:
     g[px.x][px.y] <- p
 
for each cell in g, if defined:
    render g[x][y] as marker

I'd run this on zoom end, and move end (after pan completes, or after 
mouse button released)

The only configuration is the cell size, where 1 would mean there would 
be at most 1 marker for a given pixel, and the values increase from 
there. A higher value would mean better preformance, a lower would have 
a higher density of points.

- Chris

altserg at yahoo.com wrote:
> I think the proper solution would be to limit number of markers depending on zoom level and visible map region. If you're at high zoom level and markers are too close to each other, they will overlap and you do not really see anything. Solution is to render not all markers but skip markers if distance between them is too close (probably distance should be determined by experimenting). When user zooms in, app should communicate with server and request more markers for visible region. 
>
> opengts tracking system has the very same problem. I was going to implement something like I explained above myself but it's quite low on my priority list. But if you have the solution, I'd like to use it ;)
>
> Serg
>
>
>
> ----- Original Message ----
>   
>> From: willson <talentp1982 at yahoo.com.cn>
>> To: users at openlayers.org
>> Sent: Tuesday, April 14, 2009 12:26:40 PM
>> Subject: Re: [OpenLayers-Users] How to add many(>400) markers to the map?
>>
>>
>>
>>
>> Hi,
>> if you were using Geoserver and wms, dynamic symbolizer could help you. 
>> Check the following out:
>>
>> http://blog.geoserver.org/2008/12/08/dynamic-symbolizers-part-1/
>>
>> - mika -
>>
>>
>> willson kirjoitti:
>>     
>>> Hi,
>>> try to search mailing list for strategies, performance. I have the same 
>>>       
>> problem not solved yet. It looks I will have to render at server site.
>>     
>>> Michal
>>>
>>>
>>> Hi everyone, this is the first post on this forum. I have search the problem 
>>>       
>> on the forum, but find no anwser.
>>     
>>> What I need to solve is:  I have more than 400 points need to show on the map, 
>>>       
>> these points query my db every 10 secs, and change their color according to the 
>> return value. 
>>     
>>> I use the openlayers.layer.marker to implement, but in ie the markers make the 
>>>       
>> map so slow when zooming.
>>     
>>> Then I move to  openlayers.layer.vector, but it's even slower than marker.
>>> Any suggestion in such "Adding large and dynamically changed markers"  
>>>       
>> situation?
>>     
>>>
>>>
>>> hi, render in serverside(may be wms) can improve the performance much, but how 
>>>       
>> to make markers dynamically change color? Any solution?
>>     
>>>  
>>>       
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>
>>
>> hi,
>> Yes, I am using geoserver and wms. I have look at the link, but it may be not 
>> the answer. Since the data in my db change frequently,  and the marker need to 
>> reflect these changes. For example , I have a table, and a column named "kpi", 
>> when kpi<0.01, the marker's color is green, else is red. It may be not an "sld" 
>> issue.
>>
>> -- 
>> View this message in context: 
>> http://n2.nabble.com/How-to-add-many%28%3E400%29-markers-to-the-map--tp2631715p2632376.html
>> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>     
>
>
>
>       
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
>   


_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users



  I have try cluster strategy on vector layers that has 400 point feature, when zooming the map it is even slower than that hasn't used any strategy. May be calculate the cluster use too much cpu. 
In firefox, zooming time cost:
none strategy: < 1 secs (accpetable)
cluster strategy:  about 4 secs  (-_-!!)
-- 
View this message in context: http://n2.nabble.com/How-to-add-many%28%3E400%29-markers-to-the-map--tp2631715p2636795.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.

_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users



More information about the Users mailing list