how to update POIs or markers on open street maps without refreshing the whole map

3 messages Options
Embed this post
Permalink
Hany Harraz

how to update POIs or markers on open street maps without refreshing the whole map

Reply Threaded More More options
Print post
Permalink
Hi All,
I'm thinking of building a website that has openstreetmaps integrated to it, I need to show my position on the map each time I send my coordinates from my mobile, is there a way to show this without refreshing the page? like adding a layer that shows a pointer to some coordinates and can be refreshed without refreshing the whole page or map?

--
With best Regards
Hany Harraz

_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
helmi03

Re: how to update POIs or markers on open street maps without refreshing the whole map

Reply Threaded More More options
Print post
Permalink

My example code:

function setLonLat(marker, lonlat) {
    var newPx = map.getLayerPxFromLonLat(newLonLat);
    marker.moveTo(newPx);
}

var marker = new OpenLayers.Marker(new OpenLayers.LonLat(102.2168, 3.09185), new OpenLayers.Icon());                                                          
var markers = new OpenLayers.Layer.Markers( "Markers" );
markers.addMarker(marker);
map.addLayer(markers);

// To move the marker
var newLonLat = new OpenLayers.LonLat(102.1399, 5.72857);
setLonLat(marker, newLonLat);

>> I mean I wanted to build an apoplication that uploads my current position like every 5 mins or so, is this the best way to do it?


On Fri, Oct 30, 2009 at 5:39 AM, Hany Harraz <[hidden email]> wrote:
Hi All,
I'm thinking of building a website that has openstreetmaps integrated to it, I need to show my position on the map each time I send my coordinates from my mobile, is there a way to show this without refreshing the page? like adding a layer that shows a pointer to some coordinates and can be refreshed without refreshing the whole page or map?

--
With best Regards
Hany Harraz

_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
helmi03

Re: how to update POIs or markers on open street maps without refreshing the whole map

Reply Threaded More More options
Print post
Permalink
These browser nowadays pretty good at handling bigger DOM. As recommended in http://trac.openlayers.org/wiki/FrequentlyAskedQuestions, you should keep ~100-200 Features in vector layer. marker.moveTo() for number of markers within 100-200 should be OK.

>> this looks pretty easy, but for few number of markers, what if I have more than one won't that be very consuming to the resources?!
from what I understand I will have to keep a reference of all markers used.

On Sat, Oct 31, 2009 at 4:43 AM, helmi <[hidden email]> wrote:

My example code:

function setLonLat(marker, lonlat) {
    var newPx = map.getLayerPxFromLonLat(newLonLat);
    marker.moveTo(newPx);
}

var marker = new OpenLayers.Marker(new OpenLayers.LonLat(102.2168, 3.09185), new OpenLayers.Icon());                                                          
var markers = new OpenLayers.Layer.Markers( "Markers" );
markers.addMarker(marker);
map.addLayer(markers);

// To move the marker
var newLonLat = new OpenLayers.LonLat(102.1399, 5.72857);
setLonLat(marker, newLonLat);

>> I mean I wanted to build an apoplication that uploads my current position like every 5 mins or so, is this the best way to do it?


On Fri, Oct 30, 2009 at 5:39 AM, Hany Harraz <[hidden email]> wrote:
Hi All,
I'm thinking of building a website that has openstreetmaps integrated to it, I need to show my position on the map each time I send my coordinates from my mobile, is there a way to show this without refreshing the page? like adding a layer that shows a pointer to some coordinates and can be refreshed without refreshing the whole page or map?

--
With best Regards
Hany Harraz

_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users




_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users