[OpenLayers-Users] StyleMap for vector layer
Matt Priour
mpriour at kestrelcomputer.com
Mon Jan 7 16:10:20 PST 2013
Your styleMap looks good. It is probably a projection problem.
If your features have their geometry defined in WGS84 Lon Lat
coordinates, but the base map layer is OSM, Mapquest, Google, Bing or
other web mercator tiles, then you need to add the 'projection' option
to your vector layer definition.
var my_layer = new OpenLayers.Layer.Vector("My Layer", {
styleMap: gangnam_style,
projection: 'EPSG:4326'
});
Matt Priour
On 1/7/2013 4:12 PM, Morescratch wrote:
> Hi all,
>
> I am missing something relevant in my code. I can't get a Vector layers to
> use a StyleMap. Here is the offending code:
>
> var gangnam_style = new OpenLayers.StyleMap({
> "default": new OpenLayers.Style(
> {
> strokeColor: "#990000",
> fillColor: "#990000"
> })
> });
>
> var my_layer = new OpenLayers.Layer.Vector("My Layer", { styleMap:
> gangnam_style });
>
> Any ideas on what I am missing?
>
>
>
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/StyleMap-for-vector-layer-tp5026037.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130107/c5a4900d/attachment.html>
More information about the Users
mailing list