On Jul 22, 2008, at 11:03 AM, Jani Patokallio wrote: > 5) Can I render arbitrary text instead of icons on the map? I'd > like to > label airports with codes (JFK, LHR, NRT, ...), but there are 17,576 > of > them.
I last looked at this around the time that OpenLayers 2.5 was newly released, so there may be a better way by now (or perhaps all along). There has also been some recent, preliminary work on vector labels (see http://openlayers.org/pipermail/dev/2008-July/003153.html). What I did for OpenLayers 2.5, in brief: 1. Incorporated the Marker.Label patch: http://trac.openlayers.org/ticket/751 2. Created a subclass of OpenLayers.Feature.WFS (e.g., OpenLayers.Feature.WFS.Foo). To use a specific subclass during layer instantiation: var foolayer = new OpenLayers.Layer.WFS( "Foo", "/geoserver/wfs", params, {featureClass: OpenLayers.Feature.WFS.Foo); 3. Overrode processXMLNode() to initialize a variable with the desired label value. 4. Overrode defaultIcon() in my subclass to use a transparent png. 5. Overrode createMaker to call OpenLayers.Marker.Label instead of OpenLayers.Marker You probably realize this, but those 17K points aren't going to perform well in a global view -- check out the option that controls feature download based on zoom level. Cheers, Ryan _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
