Hexagon Geospatial

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Posts: 44
Registered: ‎10-27-2015

Coordinate readout on mouse click

Hi All,



does anybody knows how can I get current coordinates on mouse click using Portal API?

Any other way than this?





Any help is much appreciated


var cursorX;
var cursorY;

$GP.ready("v1.0", function () {
	document.addEventListener('mousemove', function(e){ 
	cursorX = e.pageX;
        cursorY = e.pageY;

		categoryIndex: 0,
		xtype: "tbbutton",
		text: "Coordinate Readout",
		handler: function (a) {
				"type": "Point" 
			}, function (r) {

function showToolTip () {
	lat = ParseDMS($(".wc_map_coords").find("input")[0].value);
	lon = ParseDMS($(".wc_map_coords").find("input")[1].value);
		{   sourceCrsId: $GP.crs.getCurrent(), 
			targetCrsId: "EPSG:27700",
			points:[{x: lat, y:lon}]
		function (result) {
			easting = result.points[0].x;
			northing = result.points[0].y;
			tooltipText = '<table>'+
			       '<tr><td>Latitude: '+lat+'</td></tr>'+
				   '<tr><td>Longitude: '+lon+'</td></tr>'+
				   '<tr><td>Easting: '+easting+'</td></tr>'+
				   '<tr><td>Northing: '+northing+'</td></tr>'+
			tooltip = new Ext.Tip({
				target: $(".map"),
				html: tooltipText,
				autoShow: true,
				autoScroll: true,
				focusOnToFront: true,
				autoHide: true,
				closable: true
			tooltip.showAt([cursorX, cursorY]);


Thank you in advance.


Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.