Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have several layers that are point geometries. I am defining them custom markers symbols and such symbols have colors (red, yellow and green) to represent values.

Since there are several of them in an area, I started with marker clusters, but quickly realized that clusters are good only if all markers mean the same (like redfin home markers).

I would like to stick to markers but to avoid visual clutter - I would like to resize them based on the zoom level. If I design these markers in SVG, I could achieve this - as its easy to size SVG than raster formats, similar to this link http://mapbox.com/tilemill/docs/guides/advanced-map-design/#images_as_icons

Please send me any examples or sample sites you have developed or come across so that I can see the visual appeal of having several custom markers in maps.

Thanks, Ramesh

share|improve this question
    
    
Hi Mapperz - I am looking for markers resizing based on zoom levels. These appear to be the same size. –  Ramesh Elaiyavalli Oct 1 '12 at 17:20
add comment

1 Answer

up vote 2 down vote accepted

In my application I am using PNG images to represent the markers and use Rules, added to the Style of the layer, to set their size based upon the zoomlevel.

var markerStyle = new OpenLayers.Style({
    externalGraphic : '${imagePath}',
    pointRadius     : 15
});

var markerStyleMap = new OpenLayers.StyleMap({
    'default' : markerStyle
});

markerStyleMap.styles['default'].addRules([
    new OpenLayers.Rule({
        minScaleDenominator : 10,
        maxScaleDenominator : 4999,
        symbolizer          : { pointRadius: 15}
    }),

    new OpenLayers.Rule({
        minScaleDenominator : 5000,
        maxScaleDenominator : 9999,
        symbolizer          : { pointRadius: 10}
    }),

    ...
]);

var layer = new OpenLayers.Layer.Vector("markers", {
    projection : "EPSG:900913"
});

layer.styleMap = markerStyleMap;

The URL of the image representing the marker is set as an attribute on the feature and can be referenced by using the ${imagePath} notation in the style :

var marker = new OpenLayers.Feature.Vector(pointGeometry, {
     id        : markerId,
     imagePath : '...url of the image to use...'  
});
share|improve this answer
    
Thanks Geert. Yes, this is one way to implement sizing of markers. The concern I have is that raster images (PNG, TIFF) don't work all that well compared to vector formats in zooming in/ out. Are there other examples of SVG based markers? –  Ramesh Elaiyavalli Oct 3 '12 at 14:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.