Select to view content in your preferred language

Creating Point Feature Class from Fields in Table

828
1
11-14-2013 05:10 PM
NumaGremling
Deactivated User
Hi everyone one,

I wrote a script that searches Tweets and writes them to a table in a geodatabase. I got this to work finally, and now I would like to map out the tweets that have a location attached to them.

As you can see in the following screenshot, I have a latitude and longitude field already:

[ATTACH=CONFIG]29125[/ATTACH]

What would be the best approach to use these two fields and create a point feature class? I initially was thinking about Add XY, but I do not think that works with my data. I stumbled upon tokens (SHAPE@XY, for instance), and I was wondering if that might be what I need to implement.

Here is my current cursor in case that helps:

cursor = arcpy.da.InsertCursor("E:/Redlands/MIP/Files/Twitter.gdb/TweetTable4", ("DateRun", "Username", "GeoEnabled", "Coordinates", "Latitude", "Longitude", "PostTime", "Tweet"))


Any advice is appreciated. Thank you!
Tags (2)
0 Kudos
1 Reply
NumaGremling
Deactivated User
Problem solved; figured it out after more browsing.

In case anyone is interested, I first used Make XY Event Layer, which is a temporary layer, and then I saved it to a feature class, using Feature To Point.

        # Define input parameters
    inputTable = "E:/Redlands/MIP/Files/Twitter.gdb/TweetTable"
    xLong = "Longitude"
    yLat = "Latitude"
    outputLayer = "tweet_pts"

        # Create layer with above inputs
    arcpy.MakeXYEventLayer_management(inputTable, xLong, yLat, outputLayer)

         # Save the event layer as a feature class
    arcpy.FeatureToPoint_management(outputLayer, "E:/Redlands/MIP/Files/Twitter.gdb/TweetPoints")
0 Kudos