Parse seismic space data on the USGS website page

Source: Internet
Author: User
Author: Flyingis
You are welcome to repost this article, but please note the author and original article links, Prohibited for commercial purposes! The USGS official website updates the world's earthquake information in real time every day, including the location, coordinates, magnitude, and distance from the epicenter to the Earth's surface. The coordinate system uses the central coordinate system WGS84, how to collect these real-time information into your system for further scientific computing and spatial analysis requires some methods to parse data and spatial computing.

One of the mainstream GIS application strategies is integration and sharing, which is also the overall demand for technology development. The following content does not focus on how to share, but on the data layer, to parse the seismic space data on the USGS website page.

Seismic information source URL: http://quake.wr.usgs.gov/recenteqs/Quakes/quakes0.htm

Mainstream seismic data can be extracted from the website. net, Java, develop a small program, relatively independent, but more space analysis and applications are directly based on the GIS desktop platform, just as we have implemented a set of mathematical analysis ideas on the MatLab platform, we need to introduce more external resources to enrich the variables and arrays. Therefore, we can directly extract data using Python in the ArcMap of the GIS desktop platform. Different from common variables and arrays, the introduction of spatial data also requires us to consider coordinate transformation, symbol settings, and other related information, python Based on AO can help us implement them one by one.

The urllib module is part of the standard Python library to extract the most primitive seismic data:
Q = urllib. urlopen (r 'HTTP: // quake.wr.usgs.gov/recenteqs/Quakes/quakes0.htm ')
For l in q. readlines ():
If l. find ("<STRONG>") = 0:
L = l [8:]
L = l. replace ("font color", "FC ")
If l. find ('<a href = "/recenteqs/maps') = 0:
QuakeI = l. split ()
Magnbench = float (quakeI [2])
X =-float (quakeI [7] [:-1])
Y = float (quakeI [6] [:-1])

Point = arcpy. Point (x, y)
Feature = cur. newRow ()
Feature. shape = point
Feature. setValue ("magn.pdf", magn.pdf)
All attribute information such as cur. insertRow (feature), including x/y coordinate data, has been obtained. Those who are familiar with AO must be very familiar with the meaning and development process of "cur. insertRow (feature. If you are not familiar with it, please refer to the following explanation:
# Define the WGS84 coordinate reference system
SR = arcpy. SpatialReference (r "C: \ workspace \ demo3 \ WGS 1984.prj ")
# Create a FeatureClass
Arcpy. CreateFeatureclass_management (OS. path. dirname (tmpFC ),
OS. path. basename (tmpFC ),
"POINT ",
Spatial_reference = SR)
# Add an attribute field to indicate the earthquake magnitude
Arcpy. AddField_management (tmpFC, "magn1_"," DOUBLE ")
# Obtain the insert cursor of the FeatureClass
Cur = arcpy. InsertCursor (tmpFC) So "cur. insertRow (feature)" is to add the information of every tuples obtained on all websites to the tmpFC temporary FeatureClass.

Now that the data has been obtained, the task is completed according to the traditional data parsing method. However, for GIS applications, the data needs to be displayed on the basic map, there are two questions to consider:

1. Is the coordinate system of the obtained data the same as the basic map data? If they are not the same, coordinate transformation is required.
2. How do I symbolic display?

Assume that the coordinate of the basic map is north_america_albert s_wash_area_conic.prj. You can use the following two lines of code to complete the Coordinate Conversion:

SR = arcpy. SpatialReference (r "C: \ workspace \ demo3 \ north_america_albert s_wash_area_conic.prj ")
Arcpy. Project_management (tmpFC, outFC, SR, "NAD_1983_To_WGS_1984_1 ")
You can customize the symbolic form or refer to the existing layer style, for example:

Arcpy. ApplySymbologyFromLayer_management (OS. path. splitext (OS. path. basename (outFC) [0],
R "c: \ workspace \ demo3 \ earthquake. lyr") so that we can complete the parsing and perform further analysis based on the data in ArcMap. ArcMap 9.3 needs to write development scripts in a separate IDLE environment and manually add the results to the ArcMap platform software. ArcMap 9.4 directly integrates the Python runtime environment, dynamic prompts, real-time help, and application interaction are added during the development process, which is very convenient in scientific computing and spatial analysis.

Illustration:

Original Software Interface

Import or directly write Python code

Automatic prompt

Help Information on the right

Final Result

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.