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 use flex and OpenScale and I want to limit visibility just over Morocco using the coordinates, please how can I do that?!

    <os:Map id="fxmap" width="100%" height="100%" zoom="3" center="4.83212,45.75781">
    <os:Mapnik name="base"/>
    <os:DragHandler/>
    <os:ClickHandler/>
    <os:WheelHandler/>
    <os:PanZoom map="{map}" x="{fxmap.x+10}" y="{fxmap.y+10}"/>
</os:Map>

I can do that on the properties of the map ?

share|improve this question
    
I've never heard about Open Scales. This should be an interesting discussion. openscales.org –  jvangeld Dec 17 '11 at 19:29

1 Answer 1

up vote 0 down vote accepted

I'v found a solution not good but it's working and it's mine ^^

import org.openscales.geometry.basetypes.Pixel;
public function reCadreMap(e:MapEvent)
 {

//var x,y,x1,y1;
var maxLon =-1879357.2032504533;//left
var minLon=-015419.9442366438;//right

var maxLat=2440863.5691261655;//down
var minLat=4291633.447018889;//up
var border:Object=map.getLocationFromMapPx(new Pixel(map.width/2,map.height/2));
if(border["lon"]<maxLon){//left

    var lat= border["lat"]/100000;
    var lon=-15;

    map.moveTo(new Location(lon,lat),5,true,true);
}
else if(border["lon"]>minLon){//right
    var lat = (border["lat"]/100000)-5;
    var lon=-4;

    map.moveTo(new Location(lon,lat),4,true,true);
}
else if(border["lat"]>minLat){//up
    var lat = 33;
    var lon=(border["lon"]/100000);

    map.moveTo(new Location(lon,lat),5,true,true);
}
else if(border["lat"]<maxLat){//down
    var lat = 26;
    var lon=(border["lon"]/100000);

    map.moveTo(new Location(lon,lat),5,true,true);
}   

}  

this exemple is for who want to limit visibility, and i'm attending any reaction from you !

share|improve this answer

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.