[OpenLayers-Users] Proportional Symbols from GMLattributes/OpenLayers

Arnd Wippermann arnd.wippermann at web.de
Wed Jul 14 17:09:41 EDT 2010


Hi,

Use for your gml layer the option extractAttributes: true to get features
with attributes.

Use a styleMap for your layer, where your pointRadius is set by an attribute
:

var template = {
    strokeColor: "#0000FF",
    ...
    pointRadius: "${yourAttribute}"
};

styleMapRotation = new OpenLayers.StyleMap(new OpenLayers.Style(template));


or you use a styleMap with context, if you want calculate the radius by
other conditions :

function set_styleMapRotation()
{
    var context = {
        getPointRadius : function(ft){
            var zoomOffset = map.projection == "EPSG:4326" ? 1 : 8;
            var fktr=1;
            var diffZ = map.getZoom() - zoomOffset;
            return diffZ > 0 ? 7 + 3*diffZ*fktr : 8;
        }
    };
    var template = {
        strokeColor: "#0000FF",
        ...
        pointRadius: "${getPointRadius}"
    };

    styleMapRotation = new OpenLayers.StyleMap(new
OpenLayers.Style(template, {context:context}) );
}
set_styleMapRotation();

Example with pointRadius set by the attribute for the population of cities
and label size by zoomLevel
http://gis.ibbeck.de/OLClient/OLClient.asp?KARTE=k10000

Arnd 

-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von geotech
Gesendet: Mittwoch, 14. Juli 2010 03:58
An: users at openlayers.org
Betreff: [OpenLayers-Users] Proportional Symbols from
GMLattributes/OpenLayers


I know there is an easy solution to this problem just haven't found what I'm
looking for. This is my situation, I'm using FeatureServer to load my
overlay points from shapefiles to .gml . I'm using an OSM baselayer with a
reprojection from UTM to lat/lon. What I want to do is display point symbols
using a ratio to the attribute value aka proportional symbols.Is there an
Openlayers.get.attribute or something along those lines that I can pull an
attribute value from the gml or is this a matter of hacking JavaScript to
get the results I'm looking for.
--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/Proportional-Symbols-from-GML-attribu
tes-OpenLayers-tp5290622p5290622.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list