I'm attempting to create a feature set using location data from our billing system that contains water meter locations. The location information is in latitude and longitude format so I thought it would be fairly simple to create features from this by inserting the data into the geometry field of the feature. It turns out this is not the case as when I tried just putting in this information, all of my data ended up in Arkansas (I need the points to be in Tennessee). From here I have tried changing the coordinate projection and converting the latitude and longitude to x and y data in feet. This change got my points to be in the correct locations relative to each other but the points are showing to be in the Pacific Ocean.
I'm really at a loss for what is going on and could use some help. We are on an Enterprise Portal version 10.9 and I'm using Python 3.9 if either of those are relevant. I'll go ahead and attach the relevant code that I'm using too.
geometry_layer = model_layer.layers[0]
table_layer = model_layer.tables[0]
for d in data:
if d['Flow'] is None:
flow = None
else:
flow = float(d['Flow'])
if d['Flow_Time'] is None:
flow_time = None
else:
flow_time = dt.datetime.strptime(d['Flow_Time'], '%Y-%m')
if d['Endpoint_SN'] is None:
sn = None
else:
sn = int(d['Endpoint_SN'])
geo = {'attributes':{
'account_full_name': d['Account_Full_Name'],
'account_id': d['Account_ID'],
'endpoint_sn': sn,
'location_address': d['Location_Address_Line1'],
'location_city': d['Location_City'],
'sa_start_date': dt.datetime.strptime(d['SA_Start_Date'], '%Y-%m'),
'read_method': d['Read_Method']
},
###This section is where I'm assuming the problem lies. I'm using a simple coordinate transformation in order to try and get the right x and y values.
'geometry':{
# 'x': float(d['Service_Point_Longitude']),
# 'y': float(d['Service_Point_Latitude']),
'x': (20.902*10**6)*(math.pi/180)*(float(d['Service_Point_Longitude']))*math.cos((math.pi/180)*34.33333333333334),
'y': (20.902*10**6)*(math.pi/180)*(float(d['Service_Point_Latitude'])),
'spatialReference': {'wkid': 102736}
}
}
table = {'attributes':{
'endpoint_sn': sn,
'flow': flow,
'flow_time': flow_time
}
}
geometry_layer.edit_features(adds=[geo])
table_layer.edit_features(adds=[table])