Select to view content in your preferred language

Python or ModelBuilder Help

2302
12
11-07-2019 09:43 AM
JustinMays
Emerging Contributor

Hello All,

I am trying to transition to ArcGIS Pro. I am not very good at programming and needed some help with either Python or ModelBuilder. 

I am tasked with creating maps for our documents to show sampling locations. I currently have all the layers such as the basemap, roads, boundaries, etc. added to the project. Currently, I manually import an edited excel file and I use the "display XY Data" to display the Lat and Long of our tracks to the map. The attribute table contains the following information shown in the attached file.

The excel file is data we took while moving in our vehicle that is equipped with GPS. What I am trying to do is use the information and place a marker point and use a style on that point anywhere that our vehicle was parked for more than 5 min. The excel file name is never the same and is created from data from Igor. The excel file is usually named in the following format (XXXXX DAQ Data XXXXXX.xlsx) where "X" are numbers for the date and case number. I am not sure if this is possible but I figured I would start with my question here.

Hopefully I posted this in the correct area!

Thank you in advance for any help!

Justin

0 Kudos
12 Replies
GarrettSeay1
Occasional Contributor

Can you share some of your excel? In particular, an area where you know you sat 5 min?

0 Kudos
JoeBorgione
MVP Emeritus

You might want to start with excel to table, which will translate your excel table into a geodatabase table format.  You provide the in excel name, the out geodata base, and the new table name.  IMHO, working with a table is easier than excel worksheets.

That should just about do it....
0 Kudos
RobertBorchert
Honored Contributor

I am wondering what your question is?

right click on your excel table and select Create Feature Class > From XY Table...

It should work unless your somewhere near Willa, Washington

JustinMays
Emerging Contributor

Hi Robert,

I am trying to automate or at least speed up the process some how by using a Python script or ModelBuilder to bring in the excel files, add them to the map, display all the coordinates on the map, then place a marker on any location where the markers were at a location for more that 5 minutes.

Hope this helps,

Justin

0 Kudos
JustinMays
Emerging Contributor

Thank you all for getting back to me. I have attached a excel file as asked. This is a edited file and only contains the information that I need. It is also in xls instead of xlsx but I don't think it matters much.

Thanks again for the help. 

Justin

0 Kudos
RobertBorchert
Honored Contributor

What are you using for GPS. Many if not most will have available software to create points as shape files for you. 

0 Kudos
JustinMays
Emerging Contributor

I believe is is an Airmar system. But I get the data from another person in excel format.

0 Kudos
JakeSkinner
Esri Esteemed Contributor

Hi Justin,

One way you can do this is the following:

1.  Import the table into a File Geodatabase using the Excel to Table tool as Joe Borgione‌ mentioned

2.  Create a new TEXT field (i.e. Time_Str) and calculate this to your Time_ field.  This will convert your date to a string

3.  Create another field of type Long or Double (i.e. Date_Dbl)

3.  Calculate the new field (Date_Dbl) by converting the TEXT field to epoch seconds using the field calculator and the following expression:

time.mktime(datetime.datetime.strptime(!Time_Str!, "%m/%d/%Y %I:%M:%S %p").timetuple()) * 1000

4.  Convert the table to a point feature class using the XY Table to Point tool

5.  Dissolve the feature class based on the Latitude and Longitude fields for the Dissolve Fields and the Date_Dbl field for the Statistic Field.  Set the Statistic Type to Range

Note, you will want to make sure you Lat/Long fields are exact for when the vehicle was not moving.  Looks like some are rounded differently. 

6.  This should give you an output with a Range field that shows the epoch time of how long the vehicle was not moving. 

If the value is greater than 300000, it was idle for more than 5 minutes.

JustinMays
Emerging Contributor

Thank you for the write up. I will give this a shot. I might not get it completed today but I will respond with the results I get. Thank you all again for the help.

Justin

0 Kudos