Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Measure tool for length and Area
Old 09-05-2011, 01:34 AM Measure tool for length and Area
Junior Talker

Posts: 1
Trades: 0
I write code using ext js,openlayers and GeoExt for measuring length and area
,it is working inside inside of india in the world map but this measure tool is not working outside of india in the world map.

My code for Measure length:
To Load map:
var projWGS84 = new OpenLayers.Projection("EPSG:4326");
var projSphericalMercator = new OpenLayers.Projection("EPSG:900913");
var bounds = new OpenLayers.Bounds(68.137, 6.783, 97.336, 37.086);
bounds.transform(projWGS84, projSphericalMercator);
map.maxExtent = bounds;
var gphy = new OpenLayers.Layer.Google("Google Street", {
'sphericalMercator':true
//maxExtent: new OpenLayers.Bounds(-20037508, -20037508,20037508, 20037508)

}
);
var osmLayer = new OpenLayers.Layer.OSM();

// Add the background images via WMS


// Add the background images via WMS

//map.addLayer(bglayer);
// map.addControl(new OpenLayers.Control.MousePosition());
map.addLayers([gphy, osmLayer]);

Measure Length:
Measure = new Ext.SplitButton({
text:"Measure",
iconCls:"icon-measure-length",
toggleGroup:"navigate",
group: "navigate",
enableToggle:true,
allowDepress:false,
handler: function(button, event) {
// allowDepress should deal with this first condition
if(!button.pressed) {
button.toggle();
} else {
button.menu.items.itemAt(activeIndex).setChecked(t rue);
}
},
listeners: {
toggle: function(button, pressed) {
// toggleGroup should handle this
if(!pressed) {
button.menu.items.each(function(i) {
i.setChecked(false);
});
}
},
render: function(button) {
// toggleGroup should handle this
Ext.ButtonToggleMgr.register(button);
}
},
menu: new Ext.menu.Menu({
items: [
new Ext.menu.CheckItem(
new GeoExt.Action({
text: "Length",
toggleGroup:"navigate",
iconCls:"icon-measure-length",
group: "navigate",
enableToggle:true,
allowDepress:false,
map: map,
control: new OpenLayers.Control.Measure(OpenLayers.Handler.Path , {
eventListeners: {
measure: function(evt) {
Ext.MessageBox.show({

title: 'Line length :',
buttons: Ext.MessageBox.OK,
width:200,
msg:"Line Length: " + evt.measure.toFixed(2) + " " + evt.units

});
}
}
})

})
)

}
})

})
)
]
})
})
ManoharaG is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-06-2011, 08:57 AM Re: Measure tool for length and Area
Super Spam Talker

Posts: 879
Name: Paul W
Trades: 0
You'd be better asking on Google forum surely.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


*** New:
Please login or register to view this content. Registration is FREE
PaulW is online now
Reply With Quote
View Public Profile
 
Reply     « Reply to Measure tool for length and Area
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.30168 seconds with 12 queries