Select to view content in your preferred language

How add correct coordinates to map in wgs 1984?

671
3
04-16-2021 11:58 PM
Radzhabad
Emerging Contributor
xy = (47.550976, 42.963041)

array = arcpy.Array()
with arcpy.da.InsertCursor(schetchiki_path,['SHAPE@XY', 'Name']) as c:
    c.insertRow([xy,name])
 

d9yQZ

 

Tags (2)
0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

That must be a partial script because whatever you are trying to do might just add a value to the Shape field but it won't do anything for the fields you have shown in your example


... sort of retired...
0 Kudos
curtvprice
MVP Esteemed Contributor

See in the help for python examples: Write geometries.

Or (MUCH easier!) create a table with your xy values in it and use the XY Table To Point, or Make XY Event Layer tools to create your points.

0 Kudos
DougBrowning
MVP Esteemed Contributor

I changed to using Arcade so that the lat/longs are always up to date.  No one remembers to change them when they move a point.  Works great in a web map or ArcPro.

Another option if using SDE is Attribute Rules so that they autoupdate.

WGS 84 in Arcade

CurrentLat
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lon = (Geometry($feature).x / originShift) * 180.0;
var lat = (Geometry($feature).y / originShift) * 180.0;

lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);

return lat;

CurrentLong
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lon = (Geometry($feature).x / originShift) * 180.0;
var lat = (Geometry($feature).y / originShift) * 180.0;

lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);

return lon;

Make sure to config the popup to show 8 decimals.

Hope that helps.  I know not what you asked but it may work for you.

0 Kudos