You are not logged in.

Announcement

*** NOTICE: forum.openstreetmap.org is being retired. Please request a category for your community in the new ones as soon as possible using this process, which will allow you to propose your community moderators.
Please create new topics on the new site at community.openstreetmap.org. We expect the migration of data will take a few weeks, you can follow its progress here.***

#1 2011-03-07 15:42:45

Heckflosse
Member
Registered: 2011-03-07
Posts: 3

Automatisches Aktualisieren von POI oder Openlayers-Markern

ich habe das Beispiele auf http://wiki.openstreetmap.org/wiki/Open … er_example gelesen und gut anpassen können. Ich bekomme per GPS verschiedene Fahrzeugpositionen und kann die in einer Textdatei speichern und die werden dann mit Ikonen auf der Karte dargestellt. Wenn ich die Seite neu lade, sieht man auch die neuen Positionen.
Nun meine Frage, da habe ich trotz langem Suchen nach Beispielen ein Brett vor dem Kopf: wie kann meine Internetseite (das o.g. Beispiel) nur die Marker aktualisieren, statt immer die ganze Karte neu zu laden, also nur den Layer Pois?
Ich habe beispiele gefunden, wie Leute die POIs an- und ausschalten, aber keines, wie die Internetseite z.B. 5 Sekunden nur die POIs aktualisiert, ohne den aktuellen Zoom und Ausschnitt zu ändern, die man vielleicht gerade selbst im Browser geändert hat.

Ich habe leider wohl von Internetseiten zuwenig Ahnung, aber kann man aus einem anderen Frame vielleicht auf eine Karte zugreifen? Man müsste ja nur den layer Pois löschen und neu erzeugen. Geht sowas ?

Und natürlich irgendwie regelmäßig...

Danke und Gruß - Thomas

Moderator edit: Please only post in English here. The German subforum is here

Last edited by Lambertus (2011-03-08 12:37:45)

Offline

#2 2011-03-08 12:18:51

greencaps
Member
Registered: 2009-10-05
Posts: 423

Re: Automatisches Aktualisieren von POI oder Openlayers-Markern

So you want a reread of the textfile with pois?

Well I don't know how to accomplish this.

The used code from the openlayers exemple is following:

   var pois = new OpenLayers.Layer.Text( "My Points",
                    { location:"./textfile.txt",
                      projection: map.displayProjection
                    });
    map.addLayer(pois);


If I were you I would try following first.

Place a button on that webpage and in on click let it execute following javascript code.

pois = new OpenLayers.Layer.Text( "My Points Extra",
                    { location:"./textfile.txt",
                      projection: map.displayProjection
                    });

If that does not work then try

pois = new OpenLayers.Layer.Text( "My Points Extra",
                    { location:"./textfile.txt",
                      projection: map.displayProjection
                    });
map.addLayer(pois);


maybe you can find a removeLayer() function?

Offline

#3 2011-03-25 23:46:00

Heckflosse
Member
Registered: 2011-03-07
Posts: 3

Re: Automatisches Aktualisieren von POI oder Openlayers-Markern

Thanx a lot, that was the right option to begin testing. I made buttons and they worked.

Then I found out how to repeat:
I start a javascript function which calls itself ("settimeout") with "onload" and now the textfile (filled by a GPS-application) can change regularily and the cars are displayed properly.

I hope - tonight only simulated by different textfiles.

Thx

Thomas

Offline

Board footer

Powered by FluxBB