How to know if a point ( marker ) is visible on the map

20 views
Skip to first unread message

serge44

unread,
May 30, 2011, 12:14:37 PM5/30/11
to osm-gps-map
Hi,

I create a map with several markers ( I already tested 38000 markers).
depending on zoom, not all markers are visible on the map.

I would like to know if a point ( marker ) is visible.
Is there a simple way to do that ?
I use python, but any other languages could help.

I have the latitude and longitude of the point.

Serge

serge44

unread,
Jun 3, 2011, 4:58:33 AM6/3/11
to osm-gps-map
I found a solution for this. Perhaps there are better solution.
I shift all values to be sure there is no more negative values.
Perhaps it should be useful to have such a method for this.

bbox = self.osm.get_bbox()
s_lon = lon + 10.0
s_lat = lat + 10.0
s_bbox_lat1 = bbox[0] + 10.0
s_bbox_lon1 = bbox[1] + 10.0
s_bbox_lat2 = bbox[2] + 10.0
s_bbox_lon2 = bbox[3] + 10.0
result = ( s_bbox_lat1 > s_lat > s_bbox_lat2 ) and
( s_bbox_lon1 < s_lon < s_bbox_lon2 )
Reply all
Reply to author
Forward
0 new messages