Menu
Forum
General Car Audio
Subwoofers
Speakers
Amplifiers
Head Units
Car Audio Build Logs
Wiring, Electrical and Installation
Enclosure Design & Construction
Car Audio Classifieds
Home Audio
Off-topic Discussion
The Lounge
What's new
Search forums
Gallery
New media
New comments
Search media
Members
Registered members
Current visitors
Classifieds Member Feedback
SHOP
Shop Head Units
Shop Amplifiers
Shop Speakers
Shop Subwoofers
Shop eBay Car Audio
Log in / Register
Forum
Search
Search titles and first posts only
Search titles only
Search titles and first posts only
Search titles only
Log in / Join
What’s new
Search
Search titles and first posts only
Search titles only
Search titles and first posts only
Search titles only
General Car Audio
Subwoofers
Speakers
Amplifiers
Head Units
Car Audio Build Logs
Wiring, Electrical and Installation
Enclosure Design & Construction
Car Audio Classifieds
Home Audio
Off-topic Discussion
The Lounge
What's new
Search forums
Menu
Reply to thread
Forum
Off-topic Discussion
The Lounge
OP is a failure
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="The_Quiet_One" data-source="post: 8409452" data-attributes="member: 614562"><p>Sounds like you forgot to bring your kneepads to your "job" today. Maybe that's why your so pissy. //content.invisioncic.com/y282845/emoticons/wink.gif.608e3ea05f1a9f98611af0861652f8fb.gif</p><p></p><p>Here's my sample code I promised you.</p><p></p><p># Author: Guy with no job who hangs out on caraudio.com. Dedicated to TJwubs</p><p></p><p># Description: Identify any Earthquake with a 4.5 or greater magnitude and export it to a feature layer.</p><p></p><p># Version 1.0: Requires 4.5_day.csv file in workspace, editing workspace, and editing projection in make event layer</p><p></p><p># Future Plans: Allow user defined magnitude selection, workspace, and projection.</p><p></p><p># Integrate ability to create .csv file</p><p></p><p># Add Tsunami Speed layer as base map layer for quick low tech calculations</p><p></p><p># Import modules and definitions</p><p></p><p># Sets up overall error check. "Something is wrong" is sent to console if main program fails to run</p><p></p><p>try:</p><p></p><p>import urllib2</p><p></p><p>import arcpy</p><p></p><p>from arcpy import env</p><p></p><p># Defines environment settings</p><p></p><p>env.workspace = r"C:\Users\Souldrop\Desktop\Tsunami_project\Earthquake_Query"</p><p></p><p>env.overwriteOutput = True</p><p></p><p># Opens up placeholder .csv file, clears content, and saves it</p><p></p><p>temp = open("4.5_day.csv", "w")</p><p></p><p>temp.truncate()</p><p></p><p>temp.close()</p><p></p><p># Define url of livestream USGS data for 4.5 mag earthquake for past 24 hours</p><p></p><p>url = 'http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/4.5_day.csv'</p><p></p><p># Opens and writes data to placeholder .csv file. Closes file after complete.</p><p></p><p>u = urllib2.urlopen(url)</p><p></p><p>instance_write = open('4.5_day.csv', 'w')</p><p></p><p>instance_write.write(u.read())</p><p></p><p>instance_write.close()</p><p></p><p># Creates feature layer that shows location of the recorded earthquakes</p><p></p><p>arcpy.MakeXYEventLayer_management("4.5_day.csv", "longitude", "latitude", "4.5_day_Layer",</p><p></p><p>r"C:\Souldrop\Desktop\Tsunami_project\Earthquake_Query\WGS_1984.prj", "#")</p><p></p><p># Saves the created layer to your workspace</p><p></p><p>arcpy.SaveToLayerFile_management("4.5_day_layer", "eq_Event.lyr")</p><p></p><p># Sends the number of matching incidents to console</p><p></p><p>print arcpy.GetCount_management("4.5_day_layer")</p><p></p><p># Error notifications; prints any arcpy error messages.</p><p></p><p>except:</p><p></p><p>print "Something is Wrong, because tjwubs is my hero"</p><p></p><p>print arcpy.GetMessages()</p></blockquote><p></p>
[QUOTE="The_Quiet_One, post: 8409452, member: 614562"] Sounds like you forgot to bring your kneepads to your "job" today. Maybe that's why your so pissy. [IMG]//content.invisioncic.com/y282845/emoticons/wink.gif.608e3ea05f1a9f98611af0861652f8fb.gif[/IMG] Here's my sample code I promised you. # Author: Guy with no job who hangs out on caraudio.com. Dedicated to TJwubs # Description: Identify any Earthquake with a 4.5 or greater magnitude and export it to a feature layer. # Version 1.0: Requires 4.5_day.csv file in workspace, editing workspace, and editing projection in make event layer # Future Plans: Allow user defined magnitude selection, workspace, and projection. # Integrate ability to create .csv file # Add Tsunami Speed layer as base map layer for quick low tech calculations # Import modules and definitions # Sets up overall error check. "Something is wrong" is sent to console if main program fails to run try: import urllib2 import arcpy from arcpy import env # Defines environment settings env.workspace = r"C:\Users\Souldrop\Desktop\Tsunami_project\Earthquake_Query" env.overwriteOutput = True # Opens up placeholder .csv file, clears content, and saves it temp = open("4.5_day.csv", "w") temp.truncate() temp.close() # Define url of livestream USGS data for 4.5 mag earthquake for past 24 hours url = 'http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/4.5_day.csv' # Opens and writes data to placeholder .csv file. Closes file after complete. u = urllib2.urlopen(url) instance_write = open('4.5_day.csv', 'w') instance_write.write(u.read()) instance_write.close() # Creates feature layer that shows location of the recorded earthquakes arcpy.MakeXYEventLayer_management("4.5_day.csv", "longitude", "latitude", "4.5_day_Layer", r"C:\Souldrop\Desktop\Tsunami_project\Earthquake_Query\WGS_1984.prj", "#") # Saves the created layer to your workspace arcpy.SaveToLayerFile_management("4.5_day_layer", "eq_Event.lyr") # Sends the number of matching incidents to console print arcpy.GetCount_management("4.5_day_layer") # Error notifications; prints any arcpy error messages. except: print "Something is Wrong, because tjwubs is my hero" print arcpy.GetMessages() [/QUOTE]
Insert quotes…
Verification
Post reply
Forum
Off-topic Discussion
The Lounge
OP is a failure
Top
Menu
What's new
Forum list