How to Read Features and Coordinates from ESRI Shapefile using Python

Here is an example of how to read in features and coordinates from an ESRI Shapefile using Python in a script using the OGR library:

In this example, the code will open the shapefile, read in the features and coordinates, and then output the coordinates to the console. You can replace this step with your own code to do something with the features and coordinates, such as displaying them on a map or storing them in a database.

In order to read in features and coordinates from an ESRI Shapefile using Python, you will need to import the OGR library. The OGR library is part of the GDAL library, which is a powerful library for working with GIS data. The OGR library is used to read and write vector data, it supports a variety of vector formats including ESRI Shapefile. 

In the example I provided before, the library is imported at the beginning of the script using the following line of code:

This line imports the OGR library, allowing you to use its functions and methods to read in features and coordinates from the shapefile.

It’s important to note that you may need to install GDAL library to use the OGR library, you can install it via pip by running pip install gdal in your command prompt or terminal.

How to Read Features and Coordinates from ESRI Shapefile using VB.net

Reading features and coordinates from an ESRI Shapefile in Microsoft Visual Studio can be done by creating a new project and adding the necessary references to the OGR library. Here are the general steps to follow:

  1. Create a new project in Microsoft Visual Studio. This can be a Console Application, Windows Forms Application, or any other type of project that suits your needs.

  2. Add a reference to the OGR library. This can be done by right-clicking on the project in the Solution Explorer and selecting “Add Reference.” Then, browse to the location where the OGR library is installed and select the appropriate DLLs to add as references.

  3. Use the code shown below to read in the features and coordinates from the shapefile. You will need to update the path of the shapefile to the actual path on your local machine or server.

  4. Add any additional code to display the features and coordinates on a map or store them in a database. This can be done by using other libraries such as MapWinGIS or SharpMap for displaying on a map or ADO.NET for storing in a database.

  5. Build and run the project to test the code and ensure that it is working correctly.

It’s worth noting that this is just a general overview of the steps involved in implementing the reading of features and coordinates from an ESRI Shapefile in Microsoft Visual Studio, and the actual implementation will depend on the specific requirements and constraints of the project. Additionally, you may need to install the GDAL library to be able to use the OGR library on your machine.

Here is an example of how to read in features and coordinates from an ESRI Shapefile using VB.net in a Windows Forms application in Microsoft Visual Studio:

In this example, the code is placed in the Load event of the form, which will be executed when the form is loaded. You can also place this code in a button click event or any other event that suits your needs. It’s important to note that you will need to update the path of the shapefile to the actual path on your local machine or server. Also, you may need to add a reference to the OGR library, you can do this by right-clicking on the project in the Solution Explorer and selecting “Add Reference.” Then, browse to the location where the OGR library is installed and select the appropriate DLLs to add as references.

Additionally, as with any software development project, it’s important to thoroughly test your code and ensure it’s working correctly before deploying it. You can also add additional code to display the features and coordinates on a map or store them in a database, this can be done by using other libraries such as MapWinGIS or SharpMap for displaying on a map or ADO.NET for storing in a database. It’s also important to consider how you want to present the data to the user, you can use the data you get from the shapefile to create a map, a table, or any other type of visualization that fits your needs.

It’s worth noting that this is a basic example that can be extended and customized to suit the specific requirements of your project, and it’s recommended to consult the documentation of the OGR library and other related libraries to have a deeper understanding of the functionality they offer and how to use them correctly.

Development of Web-Based Application for Shapefile Coordinate System Conversion for Malaysia

By Elysonia Alim
Supervised by Dr. Shahabuddin Amerudin
UTM Undergraduate Thesis Year 2018
It is difficult to process GIS vector data when they are not aligned with one another. The need for different coordinate systems rose from the fact that some coordinate systems are better fitted to describe the phenomenon happening in a specific area. However, even commercial software had been proven to have questionable accuracy in coordinate system conversions. The purpose of this study is to develop a web application capable of converting the coordinate system of a GIS data format such as a shapefile for Peninsular Malaysia. The web application named Coordinate Conversion Application (CCA v1.1) was developed using Django 2.0 with Python 3.6 and is capable of 5 coordinate transformations namely WGS84 to GDM2000 (forward and backward), WGS84 to MRSO (old) (forward only), MRSO (old) to Cassini (old) (forward and backward). Results obtained were compared with existing software such as GDTS v4.01 and ArcGIS 10.3, and analysis shows that CCA v1.1 has achieved satisfactory accuracy

Source

Published in ACRS 2018

Development of Web-Based Application for Shapefile Coordinate System Conversion for Malaysia


By Elysonia Alim and Shahabuddin Amerudin

It is difficult to process GIS vector data when they are not aligned with one another. The need for different coordinate systems rose from the fact that some coordinate systems are better fitted to describe the geographical phenomenon occurring in a specific area. However, even commercial software had been proven to have questionable accuracy in coordinate system conversions. The purpose of this study is to develop a web application capable of converting the coordinate system of a GIS data format such as a shapefile for Peninsular Malaysia. The web application named Coordinate Conversion Application (CCA v1.1) was developed using Django 2.0 with Python 3.6 and is capable of five-coordinate transformations namely WGS84 to GDM2000 (forward and backward), WGS84 to MRSO (old) (forward only), MRSO (old) to Cassini (old) (forward and backward). Results obtained were compared with existing software such as GDTS v4.01 and ArcGIS 10.3, and analysis shows that CCA v1.1 has achieved satisfactory accuracy.

Published in Proceedings Asian Conference on Remote Sensing ACRS 2018 pg. 449

Development of Web-Based Application for Shapefile Coordinate System Conversion for Malaysia

Elysonia Alim and Shahabuddin Amerudin

Department of Geoinformation, Faculty of Geoinformation and Real Estate, Universiti Teknologi Malaysia, 81310 Skudai, Johor, Malaysia
Email: elysoniaalim@gmail.com; shahabuddin@utm.my

KEYWORDS: coordinate system, conversion, shapefile

ABSTRACT: It is difficult to process GIS vector data when they are not aligned with one another. The need for different coordinate systems rose from the fact that some coordinate systems are better fitted to describe the geographical phenomenon occurring in a specific area. However, even commercial software had been proven to have questionable accuracy in coordinate system conversions. The purpose of this study is to develop a web application capable of converting the coordinate system of a GIS data format such as a shapefile for Peninsular Malaysia. The web application named Coordinate Conversion Application (CCA v1.1) was developed using Django 2.0 with Python 3.6 and is capable of five-coordinate transformations namely WGS84 to GDM2000 (forward and backward), WGS84 to MRSO (old) (forward only), MRSO (old) to Cassini (old) (forward and backward). Results obtained were compared with existing software such as GDTS v4.01 and ArcGIS 10.3, and analysis shows that CCA v1.1 has achieved satisfactory accuracy.

Topic: Web GIS Applications

Download Published Paper

Development of Web-Based Application for GIS Data Format Coordinate System Conversion

By Elysonia Alim and Shahabuddin Amerudin (Supervisor)

Unpublished 2018 4th Year Undergraduate Project’s Technical Paper

It is difficult to process GIS vector data when they are not aligned with one another. The need for different coordinate systems rose from the fact that some coordinate systems are better fitted to describe the phenomenon happening in a specific area. The purpose of this study is to develop a web application capable of converting the coordinate system of a GIS data format such as a shapefile for Peninsular Malaysia. The web application named Coordinate Conversion Application (CCA) was developed using Django and Python and is capable of 5 coordinate transformations namely WGS84 to GDM2000 and vice versa, WGS84 to MRSO (old), MRSO (old) to Cassini (old) and vice versa. Results obtained were compared with existing software such as GDTS and ArcGIS, and analysis shows that CCA has achieved satisfactory accuracy.

Download Unpublished Technical Paper