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);
Asked
Active
Viewed 487 times
0

Peter Ritchie
- 35,463
- 9
- 80
- 98

user1536452
- 21
- 1
- 5
-
maybe I'm missing something, but can you explain what you mean by `convert lan and lon to X Y` – psubsee2003 Jul 19 '12 at 01:02
-
becuase the part where you add the image, it can only take in X any Y format. However, what im retrieving is in lat and lon format(: – user1536452 Jul 19 '12 at 01:08
-
that really didn't answer the question. That explanation is just restating converting lat/lon to X Y. Are your latitude and longitude in degrees/minutes/seconds, or decimal degrees, or some other data type? And I'm not familiar with the ESRI API. What are X and Y? Are the integers? doubles? You need to provide more detail if we are going to be able to help you. – psubsee2003 Jul 19 '12 at 01:14
-
This is a example of lat and lon – user1536452 Jul 19 '12 at 01:18
-
"Latitude":1.2989858745434002,"Longitude":103.84342613728055 – user1536452 Jul 19 '12 at 01:18
-
To add an image it got to be in x and y format. They are coordinates on the map. – user1536452 Jul 19 '12 at 01:19
-
but the point I am trying to make are X and Y are not a format, they are just parameters in a constructor for a specific object in a 3rd party API. So you need to explain what you are trying to convert Latitude and Longitude too. Are X and Y just double? If so then there is no conversion needed. Latitude is Y and Longitude is X – psubsee2003 Jul 19 '12 at 01:21
1 Answers
0
I believe you can create a graphic using either projected or geographic coordinate systems. See http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jshelp_start.htm#jshelp/inside_graphics.htm

Peter Ritchie
- 35,463
- 9
- 80
- 98