Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As the title suggests,I have GeoJSON vectors on OpenLayers map where user should add X/Y offset (i.e 5 meters north,5 meters east).I plan to add some control for it.

Since vectors are drawn map with OpenLayers.Rule object,as I searched for some offset option,then all I found was graphicXOffset & graphicYOffset which eludes normal vectors but only used for external graphics.

Is there any easy way to accomplish this feature on client ?

share|improve this question

Did you try the feature's move(x,y) method?

You can attach a callback on your control's click event, that calls a function like this:

moveAllFeatures = function(layer,x,y){
  var all = layer.features.length;
  for(var i = 0;i<all;i++){

OpenLayers geometry move

share|improve this answer
Unfortunately,when layer is redrawn,it is again re-requested and all features in the layer will be at the same position.Moving them is a way,but looping all the features is not a solution. – Myra May 12 '13 at 18:22
I know this problem. If you have not so much element on your layer (few thousands), you can use the Fixed strategy instead of BBOX. The Fixed strategy loads all the features and doesnt change them. The BBOX strategy reloads all features when the viewport changes enough to invalidate the current BBOX. btw i just work on a custom bbox strategy, that doesn't remove features, only adds new features to the requested area. – Laposhasú Acsa May 12 '13 at 18:50
It is dangerous to load entire vector elements at once.Such workload could not be handled by browser.I don't think Fixed Strategy would solve my problem – Myra May 12 '13 at 19:24

Your Answer


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.