2012-07-19 47 views
0
for(var i = 0; i < jsonIncident.length; i++) 
{ 
    var x = jsonIncident[i].Latitude   
    var y = jsonIncident[i].Longitude 

    //I can only retreive lat and lon for the image position 
    //However to add an image i need it to be in x and y format. 


    var type = jsonIncident[i].IncidentType 
    var time = jsonIncident[i].MyDate 
    var loc = jsonIncident[i].MyDate 
    var desc = jsonIncident[i].Description 
    var image 

    //This where you add the image 

    var incident = new esri.Graphic({ "geometry": { "x": x, "y": y, 
     "spatialReference": { "wkid": 3414 } 
     }, "attributes": { "Title": type, 
     "Time": time, "Location": loc, "Description": desc, } }); 

     incident.setSymbol(image); 
     incident.setInfoTemplate(infoTemplate); 
     map.graphics.add(incident); 

} 

map.infoWindow.resize(320, 130); 
+0

也許我錯過了一些東西,但你能解釋一下你是什麼意思嗎?轉換lan和lon到X Y' – psubsee2003 2012-07-19 01:02:14

+0

因爲你添加圖像的部分,它只能在X中取任何Y格式。然而,什麼im檢索是在經緯度和緯度格式(: – user1536452 2012-07-19 01:08:11

+0

真的沒有回答這個問題。這個解釋只是重申轉換緯度/經度爲X Y.你的緯度和經度以度/分/秒或十進制度或其他數據類型?我對ESRI API不熟悉什麼是X和Y?整數是否是雙精度?如果我們能夠爲您提供幫助,您需要提供更多細節 – psubsee2003 2012-07-19 01:14:31

回答