Hi,

You don't really need a text file, you can generate XML directly from the PHP 
and have OpenLayers read that. One good format to use for the XML is GeoRSS as 
OpenLayers already has a parser for that.
The OpenLayers parser uses GeoRSS with Atom rather than RSS 2.0.

Look at http://www.free-map.org.uk. The annotations (red stars) are generated 
from a GeoRSS feed generated in turn by a PHP script from the database.

Here is how I create the layer (as you can probably tell, annotation.php 
generates the GeoRSS feed):

freemap.layerAnnotations = new OpenLayers.Layer.Vector ("Annotations",
            { strategies: [new OpenLayers.Strategy.BBOX()],
             protocol: new OpenLayers.Protocol.HTTP
                 ( { url: "/freemap/annotation.php?action=getByBbox",
                    format: new OpenLayers.Format.GeoRSS() } ),
            styleMap: asm } );

You can alternatively define your own format if you don't want to use GeoRSS. 
See
http://www.free-map.org.uk/otv/RouteJSON.js
as an example (this is JSON based, and creates LineStrings, but it's the same 
general idea).

Nick
_______________________________________________
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev

Reply via email to