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've added an alert to the function myReadFunction in order to detect function calls.

As according to my observations, the function readMyFunction is called sometimes while I have been navigating on the map, not every time. The function readMyFunction has not been called when a feature is being viewable or not during map navigation. Could you please explain in which conditions the geoJSON file is read from the server?

 mVectorLayer = new OpenLayers.Layer.Vector("Overlay", {
        strategies: [new OpenLayers.Strategy.BBOX()],
        protocol: new OpenLayers.Protocol.HTTP({
            url: 'http://localhost:56786/jlist.geojson',
            format: new OpenLayers.Format.GeoJSON({
                'read': myReadFunction,
                'internalProjection': map.baseLayer.projection,
                'externalProjection': new OpenLayers.Projection("EPSG:4326")
            })
        }),
        projection: new OpenLayers.Projection("EPSG:900913")
    });

Thanks a lot for your helps and clarifications

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

OpenLayers.Strategy.BBOX : Rreads new features when the viewport invalidates some bounds.

Try adjusting the resFactor {Float}

Optional factor used to determine when previously requested features are invalid. If set, the resFactor will be compared to the resolution of the previous request to the current map resolution. If resFactor > (old / new) and 1/resFactor < (old / new). If you set a resFactor of 1, data will be requested every time the resolution changes. If you set a resFactor of 3, data will be requested if the old resolution is 3 times the new, or if the new is 3 times the old. If the old bounds do not contain the new bounds new data will always be requested (with or without considering resFactor).

You can also play around with the ratio to see if this helps. Default is 2.

share|improve this answer
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.