<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating Features With API Puts them in Incorrect Locations on map. in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/creating-features-with-api-puts-them-in-incorrect/m-p/1341453#M9193</link>
    <description>&lt;P&gt;Hey, can you by any chance provide some sample longitude/latitude values from the data?&lt;/P&gt;</description>
    <pubDate>Wed, 25 Oct 2023 15:34:47 GMT</pubDate>
    <dc:creator>EarlMedina</dc:creator>
    <dc:date>2023-10-25T15:34:47Z</dc:date>
    <item>
      <title>Creating Features With API Puts them in Incorrect Locations on map.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/creating-features-with-api-puts-them-in-incorrect/m-p/1341150#M9189</link>
      <description>&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;    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])&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 24 Oct 2023 20:54:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/creating-features-with-api-puts-them-in-incorrect/m-p/1341150#M9189</guid>
      <dc:creator>ColeHowell</dc:creator>
      <dc:date>2023-10-24T20:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Features With API Puts them in Incorrect Locations on map.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/creating-features-with-api-puts-them-in-incorrect/m-p/1341453#M9193</link>
      <description>&lt;P&gt;Hey, can you by any chance provide some sample longitude/latitude values from the data?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 15:34:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/creating-features-with-api-puts-them-in-incorrect/m-p/1341453#M9193</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2023-10-25T15:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Features With API Puts them in Incorrect Locations on map.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/creating-features-with-api-puts-them-in-incorrect/m-p/1341489#M9196</link>
      <description>&lt;P&gt;Longitude: -87.388224&lt;/P&gt;&lt;P&gt;Latitude: 36.08589&lt;/P&gt;&lt;P&gt;The spatial reference should actually be 103152&lt;/P&gt;&lt;P&gt;I'm wondering if the problem lies in the feature layer being created in Tennessee state plane instead of web mercator and then just letting pro convert it when it needs to. We have another layer with water meters and this seems to be what it's doing. The spatial reference of the layer is web mercator but each individual point is referenced to Tennessee state plane.&lt;/P&gt;&lt;P&gt;Let me know what you come up with. Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 16:04:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/creating-features-with-api-puts-them-in-incorrect/m-p/1341489#M9196</guid>
      <dc:creator>ColeHowell</dc:creator>
      <dc:date>2023-10-25T16:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Features With API Puts them in Incorrect Locations on map.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/creating-features-with-api-puts-them-in-incorrect/m-p/1341568#M9198</link>
      <description>&lt;P&gt;I fixed the issue by changing the wkid to the GCS instead of the PCS and then using the latitude and longitude in the geometry.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 18:02:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/creating-features-with-api-puts-them-in-incorrect/m-p/1341568#M9198</guid>
      <dc:creator>ColeHowell</dc:creator>
      <dc:date>2023-10-25T18:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Features With API Puts them in Incorrect Locations on map.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/creating-features-with-api-puts-them-in-incorrect/m-p/1341590#M9199</link>
      <description>&lt;P&gt;Try something like this snippet as a test. It's absolutely not the most efficient way to do it but requires the least amount of change to your existing code. I tried to find the appropriate transformation WKID but came up short. It appears to do the projection, but I can't verify on my end. You'll just need to update the x/y to point to your data, as well as the attributes:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.features import FeatureSet
from arcgis.geometry import project

geometry = {
    "x": -87.388224,
    "y": 36.08589
}
new_geometry = project(geometries=[geometry], in_sr=4326, out_sr=103152)
point_dict = { 
    "features": [{
        "attributes":{
            "name": "test",
        },
        "geometry": new_geometry[0]
    }]
}
fs = FeatureSet.from_dict(point_dict)

layer.edit_features(adds=fs)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this works, then maybe we can streamline things and switch to using a dataframe to do all the required projections at once.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 18:45:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/creating-features-with-api-puts-them-in-incorrect/m-p/1341590#M9199</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2023-10-25T18:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Features With API Puts them in Incorrect Locations on map.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/creating-features-with-api-puts-them-in-incorrect/m-p/1341687#M9200</link>
      <description>&lt;P&gt;Oh okay, great! Glad to hear you got something working.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 21:06:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/creating-features-with-api-puts-them-in-incorrect/m-p/1341687#M9200</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2023-10-25T21:06:56Z</dc:date>
    </item>
  </channel>
</rss>

