Hi All
I am trying to get the coordinates of each vertex and separate they by putting all the latitudes on one field and all the longitudes on one field. This is who I tried to do it but it is not dong what I want it to do:
for (var i = 0; i < gra.geometry.rings.length; i++){
for (var p = 0; p < gra.geometry.rings.length; p++){
crmLatitude = String(gra.geometry.rings);
crmLongitude = String(gra.geometry.rings
);
var LatLon = String(gra.geometry.rings
);
console.log(LatLon);
latlon = LatLon;
}
How can I do it? Please assist.
Kind Regards
Siyabonga Kubeka
Solved! Go to Solution.
crmLatitude = String(gra.geometry.rings[i][p].getLatitude());
crmLongitude = String(gra.geometry.rings[i][p].getLongittude());
crmLatitude = String(gra.geometry.rings[i][p].getLatitude());
crmLongitude = String(gra.geometry.rings[i][p].getLongittude());
Hi Robert,
Thank you very much. One last question, is it possible to use those stored coordinates to recreate the polygon? The idea is to save a map and the polygon, so that it can be opened at another stage. If there is a way, how do I do it?
Regards
Siyabonga Kubeka
https://developers.arcgis.com/javascript/3/jsapi/polygon-amd.html#polygon3
Build the polygon using the coordinates saved.
var singleRingPolygon = new Polygon([[50, 0], [150, 20], [150, -20], [50,0]]);
Hi Robert,
When I use the suggestion above I get the following error saying that getLatitude and getLongitude are not functions.