Use geotools to read and draw the shapefile format-(learn GIS [1 ])

Source: Internet
Author: User
Tags dedicated server

ESRI shapefile(SHP) is an open space data format developed by ESRI. Currently, this file format has become an open standard in the geographic information software field, indicating the importance of ESRI in the global geographic information system market.

 

 

 

 

 

I read some documents and was interested in one sentence. "The shapefile file does not contain the topological data structure"

 

[Several other problems arising therefrom]

What is topology?

What file formats contain topology data structures?

Why does its shapefile file not contain the topology data structure (the format of the Mapinfo company's MIF/Mid file does not seem to include it )?

Why should the file format of a topological data organization contain the topological data structure?

 

It is relatively simple to find some materials, but I have explained the above questions.

 

 

 

 

The above is a bit biased: P

 

 

 

 

 

Because you need to support the shapefile format in your own GIS framework, you need to read and write the shapefile format.

 

It is not complicated because the format of the MIF/Mid file of MapInfo has been parsed. However, due to the tight time, we hope to find a solution that can read and write the shapefile format, then you can write it yourself :)

 

I searched the internet for half a day and found geotools.

 

 

I found this tool on this page. If you are interested, you can check that there are a lot of GIS software.

 

Http://zh.wikipedia.org/w/index.php? Title = GIS % E8 % BB % 9f % E4 % BB % B6 % E5 % 88% 97% E8 % a1 % A8 & variant = ZH-CN

 

 

Geotools: Geo tools is a free Java-based drawing toolkit that allows you to browse maps interactively on a Web browser without the need for dedicated server support.

 

 

Then I downloaded four packages on the geotools homepage (version is geotools-2.5.5)

 

Geotools-2.5.5-src.zip geotools-2.5.5-guide.zip geotools-2.5.5-doc.zip geotools-2.5.5-bin.zip

 

 

I was surprised when I decompress the package. The number of source code in the package greatly exceeds my imagination (many coughs). The Read and Write Functions of shapefile are only a small part.

 

After reading the materials, geotools has been in history for a long time, and this project is still activated now :) it seems that this solution should be okay.

 

 

 

First, read the shapefile

Http://docs.codehaus.org/display/GEOTDOC/04+How+to+Read+a+Shapefile

After unzip, all the jar packages in the build directory are packaged into the project, and then copy the example program on the above page to directly create a test class to run it.

 

 

Ignore a few warnings ~~~~~~

 

 

 

How to Use geotools to draw shapefile

Http://docs.codehaus.org/display/GEOTDOC/09+ShapeLab

The example in the above address is used mainly, but it is a bit problematic to run the example program on the above page. Here we record how to solve the problem for memo.

 

Run the shapelab program in the preceding example. A jmappane class is missing in Java. This problem occurs when many people reply in the lower part of the page. This problem also occurs. It seems that no one maintains this class in the new version, so this class is no longer available in 2.5.5. In the past, 2.3.x had this class. How can we re-download 2.3.x?

This method is not very good. It seems that it is not so nice to use the old version, so you have to download this class ~~

 

 

Http://www.koders.com/

 

 

I found jmappanel in this website and three jmappanel dependent classes.

 

Highlightchangedevent highlightchangelistener highlightmanager

 

 

 

 

Finally, shapelab. Java is running. I read a SHP file and the running effect is as follows:

 

 

What is this river? :) it's easy to guess ~~~~~~~~~~~

 

 

 

 

 

 

 

 

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.