Uncaught TypeError: Cannot read property 'PeFactory' of null

1364
1
Jump to solution
08-19-2019 11:03 PM
NadirHussain
Occasional Contributor II

Dear All,

I am facing this problem.when i want to convert into utm coordinates i am getting the fallowing error.

 Uncaught TypeError: Cannot read property 'PeFactory' of null

i did not understand what is null in my code i check every thing.please help.

Thanks in advance.

require([
"esri/map",
"esri/layers/FeatureLayer",
"esri/dijit/Search",
"esri/geometry/coordinateFormatter",
"esri/SpatialReference",
"esri/geometry/Point",
"esri/InfoTemplate",
"dojo/domReady!"
], function (Map, FeatureLayer, Search,coordinateFormatter,SpatialReference,Point, InfoTemplate) {

var lt="44.0505";
var lg="17.5183";
var pt = new Point(lt, lg, new esri.SpatialReference({ wkid: 4326 }));
alert(pt.x+"_HELLO____"+pt.y);
var str = coordinateFormatter.toUtm(pt, "north-south-indicators", true);
alert(str);

});

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Hi Nadir,

You just need to add coordinateFormatter.load(); statement after alert (pt.x+"_HELLO___" + pt.y);

Null because coordinateFormatter is not loaded yet.

I share with you sample code : https://codepen.io/thanhtetaung/pen/BaBLxaV how to use it.

On mouse move on the map, you can see UTM format at lower left corner.

View solution in original post

1 Reply
by Anonymous User
Not applicable

Hi Nadir,

You just need to add coordinateFormatter.load(); statement after alert (pt.x+"_HELLO___" + pt.y);

Null because coordinateFormatter is not loaded yet.

I share with you sample code : https://codepen.io/thanhtetaung/pen/BaBLxaV how to use it.

On mouse move on the map, you can see UTM format at lower left corner.