Hexagon Geospatial
MENU

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 
Reply
Highlighted
Regular Contributor
Posts: 248
Registered: ‎05-01-2016

problem with SDK code on IE 11 browser only

[ Edited ]

I have javacsript code to find all parcels intersecting with a line or a polygon that the user enters

   $GP.map.draw.clear();
                $GP.ui.info("Click to draw shape");

                $GP.map.draw({ type: "Polygon" },
                    function (r) {
                        var coords = r.feature.get_geoJSON().geometry.coordinates;
                        // coordinates order may vary depending on the CRS definition

                        createAnalysis(r.feature.get_geoJSON().geometry);

and it works fine on Chrome and Firefox.  It has been tested a lot on these two browsers and never fails.  On IE11 the red line that the user starts to draw does not appear.  Rarely it will appear if Developer Tools are turned on.but then there is an error in the Developers Debug Console.  (Attached here)    

Other code that finds parcels interesecting with a circle where the user just clicks on a point and enters a radius value to define the circle works fine.  The circle points are then calculated based on the center clicked.  The difference is that the line and polygon code has to find the coordianates of all the points.  Any idea what could be causign the error in IE11 and also EDGE

Technical Evangelist
Posts: 1,101
Registered: ‎09-11-2015

Re: problem with SDK code on IE 11 browser only

Hi Jane,

 

It works fine for me:

Drawing.gif

 

Although there are some caveats:

  1. Make sure that you don't run the Portal site in Compatibility View (this is usually a default setting for intranet sites)
  2. Developer Console opened breaks the behavior (possibly due to different compatibility setting behavior)
  3. If you have console.log in the code, it could break the JS code on IE, if there's no Dev. Console opened, see e.g.: https://stackoverflow.com/questions/3326650/console-is-undefined-error-for-internet-explorer/

 

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Regular Contributor
Posts: 248
Registered: ‎05-01-2016

Re: problem with SDK code on IE 11 browser only

[ Edited ]

Thanks - I;m not running in IE in compatibility mode or using console references and I see that the redlining examples provided from examplesess.aspx work fine on IE 11 so it must be something in my code.

This is an extremely simplified listing of it that has most of the code removed and still fails

                
function SelectByLine_TEST() {
$GP.map.draw.clear();
$GP.ui.info("Click to draw line");

$GP.map.draw({ type: "LineString" },
function (r) {
var coords = r.feature.get_geoJSON().geometry.coordinates;
// coordinates order may vary depending on the CRS definition

createAnalysisxx(r.feature.get_geoJSON().geometry);

});

function createAnalysisxx(geometry) {


var geometry2 = geometry.coordinates[0].reduce(function (prev, current) {
return prev = prev.concat(current)
}, []),
ab = JSON.stringify([geometry]).slice(37, -23);
$GP.ui.info(ab);

$GP.ui.info("# of points entered = " + coords.length);


var coordArray = JSON.parse("[" + ab + "]");

}

};
 

 

Regular Contributor
Posts: 248
Registered: ‎05-01-2016

Re: problem with SDK code on IE 11 browser only

I've reduced the code to shown below and it is still failing.  I'm sure it is getting to this code (changed the $GP.ui.info message)

One time it worked when I had the $GP.map.draw.clear(); commented out but after that it did not.

I am sure compatibility mode is off including for the local machine ( i am running with just the machine name in the url as it is behind a firewall).  This same code does work with the Examples (i copied it from there)

 

                function SelectByLine_ORIGINAL() {
               //     $GP.map.draw.clear();
                    $GP.ui.info("Click to draw a line");

                    $GP.map.draw({ type: "LineString" }, function () {
                        $GP.ui.info("The path has been drawn");
                   });
Technical Evangelist
Posts: 1,101
Registered: ‎09-11-2015

Re: problem with SDK code on IE 11 browser only

[ Edited ]

How do you actually run it? Can you perhaps create a simplet JS file that will add a button (such as HelloWorld.js), add this code to the file and reference the file in other ASPX page, such as Full.aspx? In order to get rid of influence of other custom script files.

 

It could be something else breaking the functionallity.

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Regular Contributor
Posts: 248
Registered: ‎05-01-2016

Re: problem with SDK code on IE 11 browser only

[ Edited ]

I run it from a button.  The example with the same code works in my gwmpub.aspx session with same maps.  The error message i get from the debugged is always the same as the one i posted at the start.

I have only 5 lines of code now!

It works fine on Chrome and FireFox

This is all the code assigned to the button and i do get the message to Enter the points so the code is being reached and i am sure it is the right code being reached by the message that is displayed... 

 

                function SelectByLine_ORIGINAL() {
               //     $GP.map.draw.clear();
                    $GP.ui.info("Click to draw a line");

                    $GP.map.draw({ type: "LineString" }, function () {
                        $GP.ui.info("The path has been drawn");
                   });

Once it worked when i had the $GP.map.draw.clear(); commented out and i was sure that was it but it is failing again  (still working fine on other browsers) 

Technical Evangelist
Posts: 1,101
Registered: ‎09-11-2015

Re: problem with SDK code on IE 11 browser only

What I meant was to make sure there is as few custom script files referenced as possible, in this ASPX page section:

<asp:ScriptManager runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true">
     <Scripts>
         <asp:ScriptReference Path="js/MapConfig.js" />
         <asp:ScriptReference Path="js/LayoutHelper.js" />
         <asp:ScriptReference Path="js/API.min.js" />
         <asp:ScriptReference Path="js/StyleConfig.js" />
         <asp:ScriptReference Path="js/HelloWorld.js" />
Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Regular Contributor
Posts: 248
Registered: ‎05-01-2016

Re: problem with SDK code on IE 11 browser only

Yes - i have no changes to any of those files except HelloWorld.js  In helloworld the only thing i do at startup is to zoom to the area of interest based on bbox in url and determine which buttons to display based on another url parameter (user type)

Are you able to run the very short code from a button?  I am thinking something is wrong with my IE but we are using several different versions.  I don't know why it works (very rarely)

The error message is always the same

Technical Evangelist
Posts: 1,101
Registered: ‎09-11-2015

Re: problem with SDK code on IE 11 browser only

Yes, it works fine on my IE11

IE.png

 

Can you perhaps try to delete Portal cache (...\src\Application\App_Data\Cache)?

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Regular Contributor
Posts: 248
Registered: ‎05-01-2016

Re: problem with SDK code on IE 11 browser only

version.png Maybe our IE Is out of date 

I always get this message:

SCRIPT5007: Unable to get property 'set_visibility' of undefined or null reference

File: Compositor.WebClient.ashx, Line: 67686, Column: 13

 

The message to start entering the line does display and the cursor changes to +

I deleted the cache you suggested (there were old files there) but it didn't help.

WIll try upgrade to IE

 

 

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