[OpenLayers-Users] Lines disappearing at higer zoom

Andreas Hocevar ahocevar at opengeo.org
Wed Dec 17 13:51:18 EST 2008


Hi Marten,

in general, features that span over a long distance are problematic.
Als doing a grid like that produces quite a lot of features.

So what you could try instead is draw a grid for the current extent or
a bit more, and do that on the moveend event of the map.

Regards,
Andreas.

On 12/12/08, Maarten Deen <mdeen at xs4all.nl> wrote:
> Eric Lemoine wrote:
>> So you use 2.7, and possibly found a bug in the lib. Could you please
>> provide the list with a simple example showing the problem?
>
> Sure.
>
> I have a test page at <http://www.maasluip.nl/ebt/test.html>
> It show a series of east-west lines. If you zoom in to a high enough level,
> the
> lines will disappear, except when you are close enough to the start or end
> of
> the line. Moving the map closer to the start of the line will make the line
> reappear suddenly.
>
> So I guess it is some sort of "how far is the current point away from the
> starting point, in pixels" bug.
> This occurs on Firefox at zoomlevel 13, but IE is not affected by the bug in
> this example.
> There is another example at <http://www.maasluip.nl/ebt/ebttest.html> with
> longitudal and lateral lines. Here IE also displays the bug, but at
> different
> zoomlevels than Firefox.
>
> Code to draw the lines on a map is straightforward:
> for (var p=0; p <= 80; p++)
> {
>    var pointList = [];
>
>    var lonLat0 = new OpenLayers.LonLat(0,
> p).transform(map.displayProjection,
> map.projection);
>    var lonLat1 = new OpenLayers.LonLat(30,
> p).transform(map.displayProjection,
> map.projection);
>    newPoint = new OpenLayers.Geometry.Point(lonLat0.lon, lonLat0.lat);
>    pointList.push(newPoint);
>    newPoint = new OpenLayers.Geometry.Point(lonLat1.lon, lonLat1.lat);
>    pointList.push(newPoint);
>
>    var lineFeature = new OpenLayers.Feature.Vector(
>      new OpenLayers.Geometry.LineString(pointList));
>
>    vectorLayer.addFeatures([lineFeature]);
> }
>
> This will draw one line each 1 degrees of latitude, in a box from
> (0,0)-(30,80)
>
> Regards,
> Maarten
>
>> 2008/12/7, Maarten Deen <mdeen at xs4all.nl>:
>>> I'm using the online one at <http://www.openlayers.org/api/OpenLayers.js>
>>>
>>> Maarten
>>>
>>> Eric Lemoine wrote:
>>>> Hello
>>>>
>>>> What version of the lib are you using? A bug looking like what you're
>>>> describing was fixed in 2.7.
>>>>
>>>> Cheers,
>>>>
>>>> Eric
>>>>
>>>> 2008/12/7, Maarten Deen <mdeen at xs4all.nl>:
>>>>> I have a map on which I draw longitude and latitude lines. The strange
>>>>> thing
>>>>> is:
>>>>> these lines disappear at higer zoom levels.
>>>>> In Firefox 3, the longitude disappears from zoom 10 and the latitude
>>>>> from
>>>>> zoom
>>>>> 11, in IE 6, it is zoom 14 and 13 respectively.
>>>>>
>>>>> The map is at <http://www.maasluip.nl/ebt/ebttest.html>
>>>>>
>>>>> Regards,
>>>>> Maarten
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>> Users at openlayers.org
>>>>> http://openlayers.org/mailman/listinfo/users
>>>>>
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at openlayers.org
>>> http://openlayers.org/mailman/listinfo/users
>>>
>>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>

-- 
Sent from my mobile device

Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Users mailing list