Uncaught TypeError: Cannot read property 'PeFactory' of null

411
1
Jump to solution
08-19-2019 11:03 PM
Highlighted
Occasional Contributor

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);

});

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Esri Contributor

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

Reply
0 Kudos
1 Reply
Highlighted
Esri Contributor

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

Reply
0 Kudos