Display contour lines on Google Earth

Source: Internet
Author: User
Tags mdb database php and mysql

On New Year's Day, I had nothing to worry about. I flipped through the hard disk and found that something that was a long time ago was the tool for displaying contour lines on Google Earth. I tried it again according to the steps. Because I don't want to process it in my laptop, I can process it remotely to the server and complete it step by step. However, the effect is not obvious. It may be that the network speed is slow and Remote Desktop refresh is unbearable, go to the company after work.

Okay, a lot of nonsense. It's actually a very early tool andArticle: The SRTM data is used to display the contour lines on Google Earth (Click here in the end). However, the operation process is a bit problematic. After Google finds this original article, it can be used throughout the process. However, I found a similar article in the process of searching for kml format: using PHP and MySQL to create kml, but I haven't tried it yet, but I have some ideas and processed some data, the data of nearly 6 million records, whether it is SQL Server or access, is about mb. My days, how can I put it online. I am going to release MySQL later, because MySQL on the DH host outside China does not seem to have a limit on the size. However, the conversion from MSSQL to MySQL is painful. This will be discussed later. Next we will follow the original article of a fishbone and add my remarks to start this process. I also hope you will have more exchanges.

The original text is as follows, personal remarks appear in brackets, the final tool compressed package, please click this link: http://files.cnblogs.com/Tangf/GoogleEarthViewSTRMline.rar

======================================

Use SRTM data to display contour lines on Google Earth

Keyword: SRTM goolge Earth kml contour line globalmapper script

0. File description
Kml2contourmdb.exe, generate a global er script, and convert kml into an mdb database
DB/, folder, store database templates and ASP files
Contour. mdb, database file
Contour. asp, ASP file
Inc_color.asp, contour color configuration. (-50 meters-8500 meters)

1. Raw Materials
Download the srtmdata from http://srtm.csi.cgiar.org/selection/inputcoord.asp. On the world map, select the region you want to download, and then download the geotif data. The downloaded file is a zip compressed file. decompress the file, for example, z_58_8.tif, do not modify the file name.

(Note: When downloading, select the Tif format instead of the ASC format. I downloaded the STRM data. However, after opening the result, I found it was ASC data and had to download the TIF data again, I downloaded the experiment from the 59_5 lattice. The downloaded data is zip and needs to be decompressed. If you download STRM near the Chinese coverage, it will look like 4 GB .)

2. Tools
1. if global mapper V9 has not been installed on your computer, install it first. You can download it at the following URL:
Http://down1.3ddown.com/5z1gKhPK/Down/2007/09B/Global.Mapper.v9.00.zip
Http://down1.3ddown.com/5z1gKhPK/Crack/2007/09B/Global.Mapper.v9.00-Crack.zip
(After the first file is installed, copy global_mapper9.exe In the compressed file to the installation folder)
2. Download the tool I created.
3. Install iis5/6.

3. Start Conversion
1. Convert TIF to kml.
Run kml2contourmdb.exe and click [geotiff to kml]. Then, in the new window that appears, perform the following operations: [Add file]-> select the extracted tif file-> [conversion]-> Generate a global mapper script in the text box below-> [run]

(Note: When adding the tif file, you must first change strm in the strm_59_5.tif File Name of the tif file to Z, that is, the file name is z_59_5.tif. Otherwise, the message "TM" is incorrect)
After you click "run", the CPU starts to 100%. After a while, the memory also starts to rise. It is best to set the virtual memory to more than MB.
The generated global mapper script is used to generate a contour line with a precision of 50 meters and then save it as a kml file. If the entire block conversion takes too long (how long? P41.8a over 2.83, memory 512 M, Virtual Memory 1g, Hard Drive lights red for more than two hours, prompt conversion failure, crazy), So divide each block into five small pieces for conversion, the original one has 5x5 degrees, and now it has become 5x5 (1 degree x 5 ). Although this process is done, it may take about 30 minutes to process each piece of data (Be patient or wait for the computer to process the data normally ). After conversion, the kml transferred from each TIF is about m-300m. Therefore, if there are many files to be processed, pay attention to the remaining space on the hard disk.
After a long wait, the CPU is reduced to 2-3 bytes, And the global_mapper9.exe process in the Process Manager disappears. This means that the conversion has been completed. In the folder where the TIF is stored, multiple kml files (5 kml for each TIF) have been generated ).
2. Convert kml to MDB to facilitate our search.
Run kml2mongomdb.exe and perform the following operations:
[Add file]-> select kml file-> [start import]-> wait for completion... 3
Figure 3 Status: (4) processed files, (5) progress bar, current file progress, title bar number, current number of lines/number of bus lines.
It also takes more than 10 minutes to import data (each TIF). After importing data to the database, each kml is imported to a table, and each TIF generates an MDB file. The file splitting is for ease of management. After a TIF is imported, the generated MDB file is about-MB. Importing 10 MDB files takes several GB. The file is too large to manage. To optimize table sharding, the MDB File Name and table name are automatically calculated based on the request's longitude and latitude.

(After the conversion is complete, it cannot be displayed after the final release, prompting that there is no link to the database. The result shows that the Link error is caused by different database names. The final file name of pai_59_05.mdb must be changed to pai_59_5.mdb, this is because ASP files are read. In addition, in the conversion process, the progress bar is final fixed at 99%, indicating completion, not 100% .)

4. Release
1. Copy all the files in the DB folder to your website folder or IIS virtual folder.
2. Add a Netlink in GE to point to your newly published website, such as http: // localhost/contour. asp.

(Via post browsing, it is said that a question mark should be added at the end of the website when Netlink is added, that is, the added URL should be http: // localhost/contour. asp ?, Instead of the above URL, I also modified a file name error in the ASP file, which was also told by the post author. Make sure that the path is exactly the same as the ASP path in the contour. asp file)

5. Complete

6. Problems
1. contour line color, gradient from-50-8500 meters, blue to red, does not look obvious in the local area, so it is best to obtain the highest contour line and the lowest contour line, and then re-calculate the color of the contour line. If you have other friends who have completed this function, please send me an email.
2. When importing kml, it occupies a large amount of resources. Because MSXML control is used, and kml has too many nodes, It is very slow and occupies a large amount of memory. Consider using sax.
3. Once again, please be patient when handling this. I have no choice but to store so much data.

7. Copyright
Free to use, free to spread, free to modifyCode(Remember to keep the original author, ).

Update: My

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.