[OpenLayers-Users] Feature does not appear in every zoom level

Christoph Lingg christoph at lingg.eu
Tue Aug 3 11:20:50 EDT 2010


Hi Andreas,

thank you for your answer. Unfortunately it didn't work either in IE. Do you know what mechanism is responsible to remove the feature from the map, maybe there is a way to prevent it. If there is no way to achieve this I will have to search another way to stress this region...

Bye,
Christoph

Am 03.08.2010 um 16:58 schrieb Andreas Hocevar:

> Hi,
> 
> does the feature also disappear in Internet Explorer? If not, and if you are not interested in support for older versions of Firefox, Safari and Opera, you could set
> 
> OpenLayers.Renderer.SVG.prototype.MAX_PIXEL = Number.MAX_VALUE;
> 
> before creating your map.
> 
> Regards,
> Andreas.
> 
> On Aug 3, 2010, at 16:28 , Christoph Lingg wrote:
> 
>> Hi list,
>> 
>> I encountered a strange behavior I don't understand: Sometimes I want to cover my whole world map with a dark layer except a distinct region. This is meant to  emphasize a certain region of the world. My approach is creating a polygon with the size of the earth and a hole with the region of interest. Looks like this:
>>> 			var world = new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(-20037508.34, -20037508.34), new OpenLayers.Geometry.Point(-20037508.34, 20037508.34), new OpenLayers.Geometry.Point(20037508.34, 20037508.34), new OpenLayers.Geometry.Point(20037508.34, -20037508.34)]);
>>> 			var hole = new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(r.x1, r.y1), new OpenLayers.Geometry.Point(r.x1, r.y2), new OpenLayers.Geometry.Point(r.x2, r.y2), new OpenLayers.Geometry.Point(r.x2, r.y1)]);
>>> 			var geo = new OpenLayers.Geometry.Polygon([world, hole]);
>>> 
>>> 			this.ftr = new OpenLayers.Feature.Vector(geo, null, {fill: '#000000'});
>>> 			layer.addFeatures([this.ftr]);
>> Everything is black except the region, perfect! But after zooming in, the feature always disappears after a certain zoom level. Maybe the feature is too big?
>> 
>> Do you have an explanation, a solution or a better approach for this requirement?
>> 
>> Cheers,
>> Christoph
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
> 
> 
> 
> -- 
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.




More information about the Users mailing list