Shapefile Reader

The Shapefile Reader is available here : https://www.unrealengine.com/marketplace/shapefile-reader 

Quickstart

The basics

The Shapefile Reader plugin allows you to read data from SHP, SHX, and DBF files.  These files formats specifications are available on ESRI website : https://www.esri.com/library/whitepapers/pdfs/shapefile.pdf 

Getting started with the Shapefile Reader plugin is really easy. Using Blueprints, after having installed and activated the plugin:

After following these steps, you should get a graph similar to the one given in the screen capture.

Once your process of the shapefile is done, don’t forget to call Close handler to close the file.

Preventing errors

This code contains two sources of errors that should be avoided.

Firstly, the previous code may fail if there is no shapefile for the given Path. To prevent this, you should always check the return value of the Open Shapefile function: it’s true if the file has been successfully opened, false otherwise.

Secondly, the code may fail if there are no object for the index 0 (i.e. the file is empty). We must know the total number of objects of the shapefile, and ensure that we don’t excess the max index. This can be done by a call to Get Entities Count on the Handler.

After preventing these sources of errors, we have the following graph:

It’s all you need to know to start using the Shapefile Reader to read shapefiles.

Reading DBF files

Now that we know how to read from SHP files, it’s really easy to read from DBF files: it’s the same principle. A screen capture is worth a thousand words, so let’s see it:

As we can see, the main differences are the Open DBF call (instead of Open shapefile), and the access to the data (we’re accessing data of a DBF file instead of data of a SHP file). But globally it’s the same thing.

Advanced

First of all, you need to read a .shp using the open shapefile function

Then, you can iterate through Shapefile's objects

Finally, you can use DBF file in order to get attributes