[OpenLayers-Dev] text rendering support in openlayers for wfs
layers
Bart van den Eijnden (OSGIS)
bartvde at osgis.nl
Mon Nov 5 14:48:24 EST 2007
Probably there has been duplicate development here, since there is also
a sandbox from CampToCamp if I recall correctly: But if you zoom in in
that sandbox in IE you get duplicate text labels.
http://dev.openlayers.org/sandbox/camptocamp/text/examples/vector-features-with-text.html
Best regards,
Bart
dave c schreef:
> I posted on this last month but i didnt get any response so i went ahead
> anyways. Now what i put together is only a first pass of sorts and is a
> little crude in places but i was hoping that someone here could have a look
> at it and tell me if it could be used within openlayers as i dont want to
> have to continually be updating it myself. Of course you may not like the way
> i went about it or have no plans to implement text rendering.
>
> Using openlayers 2.5 stable, I created a patch for this version if anyone
> wants to have a look. The patch is called patch.txt and is attached to this
> mail. So run "patch -p0 < ../patch.txt" to update.
>
> Just a few quick points and issues i had.
>
> One reason to get text rendering working for example was, i needed to be able
> to output the names of certain hospitals on a map centered on there point on
> the map. Firstly i have "extractAttributes: true" and added an layer option
> called "textAttrToDisplay" which is the name of the attribute to be
> displayed within each feature that was coming from my database.
>
> Now biggest issue i had was in svg the text was rendering upside down due to
> the "transform scale(1,-1)" and so i just created a 2nd root node called
> textroot which i appended to the renderedRoot and added all text nodes to it
> instead. Of course this wasn't an issue in vml. Is there a better way ?
>
> I tried finding a quick example that you could quickly test this out on
> yourselves, but all the wfs examples i looked at in openlayers did not return
> any other data except there co-ordinates, but i assume a number of ye would
> be able to get it running quickly with your own local datasets.
>
> So as an example of its use, say this is some of the data returned from my
> database,
> <gml:featureMember>
> <fs:hospital fid="1">
> <fs:geometry>
> <gml:Point>
> <gml:coordinates>99771.29,47991.03</gml:coordinates>
> </gml:Point>
> </fs:geometry>
> <fs:hospname>Bantry</fs:hospname>
> <fs:county>Co Cork</fs:county>
> <fs:he_admin_area>South</fs:he_admin_area>
> <fs:address>Bantry</fs:address>
> <fs:recordno>21</fs:recordno>
> <fs:regionname>Region 2</fs:regionname>
> </fs:hospital>
> </gml:featureMember>
>
> And i wanted to display the hospital name, i would add textAttrToDisplay as an
> option to the layer with the value hospname.
>
> var lOptions = {
> extractAttributes: true,
> textAttrToDisplay : 'hospname'
> }
>
> layer2 = new
> OpenLayers.Layer.WFS( "Hospital", "http://localhost/~dave/featureserver/featureserver.cgi/hospital?format=WFS",
> { maxfeatures:10}, lOptions);
> map.addLayer(layer2);
>
>
> Just looking for a bit of advice on this. Am i going about it the right way,
> and could i eventually submit this, so i wouldn't have to maintain it with
> with each update to openlayers itself.
>
> Thanks
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
--
Bart van den Eijnden
OSGIS, Open Source GIS
bartvde at osgis.nl
http://www.osgis.nl
More information about the Dev
mailing list