I have the code below that is taking an SQL Query and making it into a feature class / shapefile that will be used in an JavaScript application. So it needs to be projected using WGS_1984_Web_Mercator. I know that the latitude/longitude in the table is not in this coordinate system.
When I import the shapefile created below into my project it is not projecting in WGS_1984_Web_Mercator as the points are not in the right spot. How can I fix this?
cnxn = pyodbc.connect("DSN=AR")
cursor = cnxn.cursor()
cursor.execute("Select STORENAME, LATITUDE, LONGITUDE FROM GISWEB.VW_MCYWEB WHERE DISTRICTID = 949")
datarray = []
for row in cursor:
datarray.append(tuple(row))
dtype = np.dtype([('STORENAME', '|S25'), ('xCoord', '<f8'), ('yCoord', '<f8')])
npyarr = np.array(datarray, dtype)
#webmercator 3857 - WGS_1984_Web_Mercator 3785
##SR = arcpy.Describe("C:/data/texas.gdb/fd").spatialReference
sr = arcpy.SpatialReference(3785)
#out_fc = "C:/inetpub/mystores3"
out_fc = "//SP000XSSQL51/wwwroot/GIS maps and shapefiles/GISWeb/BaseLayers/mystorestest"
if arcpy.Exists(out_fc):
arcpy.Delete_management(out_fc)
arcpy.da.NumPyArrayToFeatureClass(npyarr, out_fc, ['xCoord','yCoord'], sr)