Download Free Shapefile Maps – Country Boundary Polygon, Rail-Road, Water polyline etc

Download Free Shapefile Maps – Shapefile is one of the most common and extensively use vector file format of GIS (Geographical Information System), developed by ESRI as an open Specification, which consist of collection of files viz .shp, .shx and .dbf extension with same prefix name. You might be hunting to Download free shapefile for completing either your small industrial work for POC or for academic project use or for any NGO work.

Download GIS Data From Here

Here you will find the links of best resources to Download Shapefile for free, either its polygon, polyline and point feature shapefile, covering different subjects like Administrative Area Boundaries, Roads, Railways, population etc across the world. You may also look to download Digital Terrain DEM.

Download Free Shapefile Maps - different sources

Note: The Data Shapefile Downloaded from provided below link here, may or may not be authentic, accurate or incomplete. To check data correctness and accuracy, you need to research and recheck before using it. Also Shapefiles are downloaded for free from different organization or websites link and should be used according to
their respective terms and conditions, so please read T&C before using it for any purpose.

Download GIS Data From Here

Shapefile download link

  1. World Country Shapefile
  2.  Australia Shapefile download
  3. Argentina
  4. Brazil
  5. Download Shapefile of Canada
  6. Denmark
  7. Fiji
  8. Germany
  9. India
  10. Indonesia
  11. Japan
  12. Kenya
  13. Lebanon
  14. Madagascar
  15. Malaysia Shapefile
  16. Mexico Shapefile
  17. Mongolia
  18. New Zealand
  19. Netherland
  20. Nigeria
  21. Papua New Guinea
  22. Philippines
  23. Poland
  24. Singapore
  25. South Africa Province Shapefile
  26. South Korea
  27. Tunisia
  28. United Kingdom Shapefile
  29. Download Shapefile of United States of America
  30. Vietnam

Download GIS Data of other states of the USA

If you are looking for any shapefile of country which is not listed above please comment below so that we can search in our pitara of shapefile. If we found we can upload it on the same.

Download Free Shapefile Maps – Country Boundary Polygon, Rail-Road, Water polyline etc

1.) Diva GIS

Website is developed by Robert Hijmans, which provides free Shapefile to download, covering around 244 countries. You can directly select the country and category of shapefile and press on OK button to start download. Subject Category option you will find here are Administrative Areas (Boundaries), Inland Water, Roads, RailRoads, Elevation, Land cover, population, Climate  and Gazetteer.

2.) GADM :

GADM is a spatial database of Global Administrative Areas, which covers all countries data defining boundaries such as provinces, taluk, departments, counties, krong etc. GADM listed around 253 countries currently, the different files formats are available along with shapefile such as Esri File Geodatabase, Geopackage(Spatial Lite), R(Spatial Polygon Dataframes), Google Earth .kmz and ESRI personal geodatabase. The coordinate reference system of each file is in longitude/latitude and the datum is WGS84.

3.) Natural Earth Data:

“Natural Earth is a public Domain Map data-set available at at 1:10m(Large scale data), 1:50m(medium scale data), and 1:110 million scales (Small Scale data).” Cultural, physical and raster category data can be downloaded from each scale. Data can be downloaded as shapefile (shp) or GeoDB or as SQLite. Natural Earth is maintained by Nathaneiel V. KELSO and Tom Patterson. Here is the screenshot of shapefile from QGIS (Quantum GIS) tool of 1:10m all shapefile layers uploaded at once.

Download Free Shapefile Maps
QGIS View – Download Free Shapefile Maps

4.) Geofabrik:

Geofabrik provides the current data from the Openstreetmap database, which is available either for free as well as premium shapefiles. Data can be downloaded as .osm and .shp.zip file. Select the continent from the link provided for which you need to download the data. Further you can either select the country for filtering out more and hit the .shp.zip link to download the data.

5.) Open Street Map data

This service is created by Jochen Topf and Christoph Hormann. Following data sets and its subcategories shapefiles can be downloaded from this website.
a.) Coastline Data processing: It covers land polygons of the world area i.e continents and islands, Water polygon i.e polygon for ocean, seas and other water bodies and coastlines as line strings.
b.) Generalized data sets: This section provides you to download Generalized coastline polygon shapefiles.
c.) Antarctic icesheet: Antarctic icesheet polygons and icesheet outlines can be obtained from here.

6.) Gis-Lab info:

World data shapefile can be downloaded from GIS lab. This global data are separated into 4 parts i.e Eur, Noa, Soa and Sas Zones, which you can see the image provided below. This data shapefile is in zipped with 7z compressor and all data are in Latitude / Longitude and WGS84 coordinate system.

Select different zone to Download Free Shapefile Maps
Select different zone to Download Free Shapefile Maps

7.) MapCruzin:

While the website does not look user friendly, you need to hunt over different country shapefiles at different area. Both free as well as paid Shapefile can be obtained and downloaded given.

8.) Sedac data:

SocioEconomic Data and Applications Center provides data as zipfile of ESRI File geodatabases or shapefiles, and have decimal degree geographic coordinates system with datum WGS84 (world Geodetic System spheroid of 1984). Continent based regional data is available as shown below. Before downloading the data, you need to register and sign in to their system.

Continent Based data - Download Free Shapefile
Continent Based data – Download Free Shapefile

9.) Marine Regions:

If you are working on Sea or marine related subject, this website may help you to get the direct data to link to the relevant website from which you can get the shapefile maps data.

It might be possible that the data which you might have downloaded from website provided here, can be of different format which was not required. For this, you can refer to following articles where you can convert different GIS data format to any of it.

Convert KML to shapefile

Convert Shapefile to KML

Convert Shapefile to GeoJSON

Convert GeoJSON to topojson

Merging two or more than two Shapefile

You may also find these links which makes you to download free shapefile map for particular region:

Is the above provided links are not fulfilling your need. Than the best option you can opt for is to create your own shapefile with the help of QGIS and openstreetmap. You can easily download the data from their and then edit it make it more clear according to your requirement. If you are new to QGIS then let me provide you some tutorial link which helps you to digitize the OSM data and create shapefile.

For what purpose you need to download shapefiles? Which project you are working on? Which website you to get the map data? Do share your valuable thoughts by commenting below. I hope that the above list have definitely helped you in finding the right website to get free shapefile download, while their might be possibilities that I have not listed some of the website which should be present in the list. Please help us by providing those links by commenting below.

Different ways to convert Shapefile to GeoJSON – Online or Offline or API

Convert Shapefile to GeoJSON. Shapefile, ESRI made a standard vector file format which is largely adopted in the field of GIS by programmers and geographers . While GeoJSON is also an open standard format designed for Web which largely supported with GIS JavaScript API, other programming API and with GIS (Geographic Information System) software tools too, for easily rendering. GeoJSON is based on JavaScript Object Notation. Here we will explore different methods to convert the files online, or offline or with the help of API which programmers can make use of.

Convert shapefile to geojson

You may be interested to refer following articles:

Different ways to convert Shapefile to GeoJSON

I.) Online Method : Convert Shapefile to GeoJSON:

The simplest and fast way to access the internet is through the online method, as you don’t need to install and configure any tool on your PC. Just drag the Shapefile files, one click on button and convert to GeoJSON. There are many website which provides the tool to convert the files by browsing them to server side and convert and also some client side conversion too. Lets explore the list, which is only client side as client side conversion will secure your file and doesn’t take your data pack for uploading the file:

A.) MAPOG Converter Tool :

IGIS Map tool is one stop solution for all GIS data analysis and conversion.

 Shapefile to Geojson Conversion

  •  Go to the tool MapOG Converter Tool.
  •  If you are already registered then login otherwise sign up.
  • Once get register tap on Converter Button Shown in figure.

Convert shapefile to geojson

  • Upload the Shapefile from data set or Google Drive or Drop Box or already added in drive then choose the file. Lets we want to convert already uploaded file from My Drive then select the file.

Convert shapefile to geojson

  • Tap the file and new window will appear shown below.

Convert shapefile to geojson

  • Select the desired Output in our case choose Geojson. You can also change CRS. Now tap on Convert file button.

Convert shapefile to geojson

  • It will so the table in the next step. You can directly download the converted file or you can check it through clicking on publish button.

Convert shapefile to geojson

  • Below is the screen of published Geojson file.

Convert shapefile to geojson

Whole process is same from new uploaded file from data set or from google drive or from drop box. If you face any problem ping us at website.

You might be interested in Query on Geojson data file then try our tool IGIS Map tool.

This is presented by Engineer Philosophy pvt. ltd, working in GIS Sector an IT company. What you need to do is to just Register, login and upload only .shp and .dbf file and then export the uploaded layer to GeoJSON file by just selecting the option which appear at upper right corner in Navigation bar. You can also explore the attribute table from the website directly and filter the same which no other online tool provides.

different ways to convert Shapefile to Geojson - Online or Offline or API
different ways to convert Shapefile to Geojson – Online or Offline or API

Not only this, but you can classify the Map according to the shapefile dbf attributes and automatically classify and color it. The classified map can be exported as Scalable Vector Graphics i.e svg file.

Disclaimer: The above project is handled by me and my team and the project is in beta phase while you can definetly convert the shapefile to GeoJSON at client side securing your shapefile data. I would welcome your suggestion to improve the tool by commenting below or contacting me.

B.) Map Shapper : 

Map Shapper is the best tool which we should refer first. It is the best online tool which also handles large shapefiles and renders it quickly. Its an open source project and is licensed under MPL 2.0. Just drag the shapefile or zipped shapefile which will render the shapefile on map and can be further exported as geojson file with the option provided in tool itself.

different ways to convert Shapefile to Geojson - Online or Offline or API

With No doubt Map Shaper is much more better than any other tool for now, while the only reason why I placed this tool in second place just because the first tool was my own tool which provides more option for classifying the map, see all attributes in the data table and also exported as svg file.

2.) Offline Method – Convert Shapefile to GeoJSON in QGIS:

You must have installed QGIS  (Quantum GIS) before performing the provided steps. You may also look over other tutorial in QGIS.

1.) Open QGIS Desktop and Select Layer -> Add Layer -> Add Vector Layer or click on Add Vector layer icon appears at the upper left in the application.

different ways to convert Shapefile to Geojson - Online or Offline or API
different ways to convert Shapefile to Geojson – Online or Offline or API

2.) Select the zipped shapefile or any of file i.e .shp or .dbf or .shx by browing the folder. Note, that all the three files i.e .shp, .dbf and .shx file should be present in the same foder with same name.

3.) Once uploaded, the map will be rendered and showed in QGIS application. Now navigate to Layer menu and select Save As option or just from the layers panel select the layer and right click from it to select Save As option.

4.) A window pop up will opne up. From the window just select the GeoJSON format and provide the name of the file in the input box as shown in the image provided below. Save the file. It will export the file in GeoJSON format.

different ways to convert Shapefile to Geojson - Online or Offline or API

3.) Offline Method – Convert Shapefile to GeoJSON with command line ogr2ogr tool:

Firstly you need to install an ogr2ogr tool of GDAL which is a GIS utlitly command line tool so as to convert one file to another. Now if the ogr2ogr is installed globally check by simple tying the ogr2ogr in command line if it is working or not. Or if it residing in some file system you need to navigate to ogr2ogr file and type in the same in command line. Now Just type in the following:

  • “ogr2ogr -f GeoJSON -t_srs crs:84 [name].geojson [name].shp”

To get more option list and format you may see this gdal org link.

This tool will be helpful if you want to convert bulk files from shapefile to geojson. You can refer the .sh script found at github.

4.) Convert Shapefile to GeoJSON -API or library:

Shapefile is a binary file and cannot be viewed directly in notepad or textpad as like with GeoJSON file. So if you want to create your own API, to convert Shapefile to GeoJSON you should first have a knowledge of how to read the binary shapefile. You may refer to some of the articles which I have written some post which would help you to get the basic knowledge to know the format of files and read.

You may further refer to some of the best Shapefile to GeoJSON converter API which is open source project:

https://github.com/wavded/js-shapefile-to-geojson :  This is dedicated library to convert to GeoJSON, created by Marc Harter and Licensed with MIT.

https://github.com/gipong/shp2geojson.js : This library is also MIT Licensed and is inspired by the above wavded library which uploads zipped file of shapefile. The library provided an example to use with leaflet js.

https://github.com/mbloch/mapshaper : Map Shaper as desricbed above is licensed under MPL 2.0 and can be very useful if you want to convert to GeoJSON as well as TopoJSON.

Hope this article helped you. If are facing some problem in converting the shapefile to geojson do comment below with the problem statement. We will definitely look over that. Also you can provide your valuable comment below if you are using any other library or tool to cover the same.

Merge more than two Shapefile in QGIS

Merge more than two Shapefile in QGIS. Do you want to merge two or more than two Shapefile? Do all the Shapefile are of same shape type i.e the Shapefile which can be merged with each other should have an identical shape, i.e either  “Point”, “Line” or “Polygon”? Do Shapefile all 3 files i.e .shx, .shp and .dbf are available? Then let us move to QGIS (Quantum GIS), an Open source Geographic information System Software. If not installed in your system, one of the way to install QGIS, with OSGeo4W provides or either you can install QGIS with standalone software. Let us move to Merge more than two Shapefile:

You may also find how to merge two or more than two features in shapefile.  Also you may read more tutorials in QGIS.

Merge more than two Shapefile in QGIS

1.) Take and copy all Shapefiles to a common folder which you want to merge.

2.) Open up QGIS desktop and select the following from the menu :

  • Vector -> Data Management tools -> merge shapefile to one, which will open up new window “Merge Shapefiles”, as shown below.

Merge more than two Shapefile in QGIS
Merge more than two Shapefile in QGIS

3.) Now select the browse input directory to the folder you created which include all Shapefile that you need to copy. Also browse the Output directory for getting the new merged Shapefile, and name the output file, as shown below:

Merge more than two Shapefile in QGIS
Merge more than two Shapefile in QGIS

4.) Press Ok. It will process your all shapefile and merge it to one. Finished.

  • Note: New .dbf file will contain sum of column of two shapfefile minus common column.

Here you can see the output of two merged Shapefile of Road and Rail Route of India.

1.) Road Shapefile of india

Merge more than two Shapefile in QGIS
India Road – Merge more than two Shapefile in QGIS

2.) Rail Route Shapefile

India Rail - Merge more than two Shapefile in QGIS
India Rail – Merge more than two Shapefile in QGIS

3.) Final Output : Merged Shapefile :

Merge more than two Shapefile in QGIS
Merge more than two Shapefile in QGIS

Hope this helps you to merge two or more shapefile with the help of QGIS tool. You can also find QGIS operation to convert Shapefile to GeoJSONconvert kml to Shapefile and Shapefile to KML. If you find any problem on implementing the above steps do comment below. Your suggestions are always welcome as comment.

c++ program to read shapefile header

c++ program to read shapefile header. Shapefile can be read if you know the format of Shapefile files i.e of .shp, .shx, and .dbf file. ESRI provided technical description of the Shapefile files which describes very clearly about the format of storage of data in all three formats i.e .shp, .shx and .dbf. You can also interpret and take the advantage to make simple GIS tool which can read and edit Shapefile properly. Here is the link of the Shapefile technical descrption :
ESRI Technical Discription. This program reads only Shapefile .shp header, which includes file code, length, version, bounding box coordinates and the type of shape Shapefile you loaded. You can also find simple program that just reads about bounding box of that shapefile. The code is explained with the comments provided in all function that you found.

c++ program to read shapefile header:

#include<iostream>
#include<stdio.h>
#include<conio.h>

using namespace std;

class ByteConverter
{
    public:
        //Convert 32 bits which is stored in BigEndian format to integer. This is performed with the help of bit operation i.e left shifting and operating or.
    static int32_t bigEndianIntRead(char *fileBuf, int startIndex)
    {
        return (((fileBuf[startIndex + 0] & 0xff) << 24) | ((fileBuf[ + 1] & 0xff) << 16)| ((fileBuf[startIndex + 2] & 0xff) << 8) | ((fileBuf[startIndex + 3] & 0xff)));
    }
    //Convert 32 bits which is stored in BigEndian format to integer. This is performed with the help of bit operation i.e left shifting and operating or.
    static int32_t littleEndianIntRead(char *fileBuf, int startIndex)
    {
        return (((fileBuf[startIndex + 3] & 0xff) << 24) | ((fileBuf[startIndex + 2] & 0xff) << 16) | ((fileBuf[startIndex + 1] & 0xff) << 8) | ((fileBuf[startIndex + 0] & 0xff)));
    }
    //Convert 64 bits or 8 Byte which is stored in BigEndian format to integer. This is performed with the help of bit operation i.e left shifting and operating or.
    static double littleEndianDoubleRead(char *fileBuf,int startIndex)
    {
        double convert;
        char *add;
        int j;
        add = new char();
        j=-1;
        for(int i=startIndex; i<startIndex+8; i++)
        {
            j++;
            add[j] = fileBuf[i];
        }
        convert = *reinterpret_cast<double * const>(add);
        return convert;
    }
};

//Class HeaderShapefile have all funtion implemented to desribe every field of shapefile header file.
class HeaderShapefile
{
    public:
        //filecode describes the code of .shp file. As described in Shapefile Technical description of ESRI, filecode
        //value is always constant and should have 9994 value.
    static int32_t fileCode(char*fileBuf, int startIndex)
    {
        return ByteConverter::bigEndianIntRead(fileBuf,startIndex);
    }

        //File length contains Length of the file field
    static int32_t fileLength(char*fileBuf, int startIndex)
    {
       return ByteConverter::bigEndianIntRead(fileBuf,startIndex);
    }
        //Version function
    static int32_t version(char*fileBuf, int startIndex)
    {
        return ByteConverter::littleEndianIntRead(fileBuf,startIndex);
    }
        //Function shapeType describes the type of the shape. It returns an 32 bit integer
        //value. This integer is then matched with the cooresponding shape as described in ESRI shapefile pdf
    static int32_t shapeType(char*fileBuf, int startIndex)
    {
        return ByteConverter::littleEndianIntRead(fileBuf,startIndex);
    }

    //This remaning funtion of the class will calculate the bounding box coordinates of the shapefile.
    //Following values i.e x and y minimum and maximum values also with z and m minimum
    // and maximum values are obtained.


    static double dimensionXMin(char*fileBuf, int startIndex)
    {
        return ByteConverter::littleEndianDoubleRead(fileBuf,startIndex);
    }

    static double dimensionYmin(char*fileBuf, int startIndex)
    {
        return ByteConverter::littleEndianDoubleRead(fileBuf, startIndex);
    }

    static double dimensionXmax(char*fileBuf, int startIndex)
    {
        return ByteConverter::littleEndianDoubleRead(fileBuf, startIndex);
    }

    static double dimensionYmax(char*fileBuf, int startIndex)
    {
        return ByteConverter::littleEndianDoubleRead(fileBuf, startIndex);
    }

    static double dimensionZmin(char*fileBuf, int startIndex)
    {
        return ByteConverter::littleEndianDoubleRead(fileBuf, startIndex);
    }

    static double dimensionZmax(char*fileBuf, int startIndex)
    {
       return ByteConverter::littleEndianDoubleRead(fileBuf, startIndex);
    }

    static double dimensionMmin(char*fileBuf, int startIndex)
    {
       return ByteConverter::littleEndianDoubleRead(fileBuf, startIndex);
    }

    static double dimensionMmax(char*fileBuf, int startIndex)
    {
       return ByteConverter::littleEndianDoubleRead(fileBuf, startIndex);
    }
};

class SizeOfFile
{
    public:
        //This function finds the size of file in Byte
    static long sizeOfFiles(FILE *file)
    {
            long l, e;
            l = ftell(file);
            fseek(file, 0, 2);
            e = ftell(file);
            fseek(file, l, 0);
            return e;
    }
};

int main()
{
    int32_t filecodes, fileLengths, shapeTypes, versions;
    double xmin, ymin, xmax, ymax, mmin, mmax, zmin, zmax;
    string shape;
    char *filePath = "map.shp";
	char*fileBuf;			// Pointer to our buffered data
	FILE *file = NULL;		// File pointer
	// Open the file in binary mode using the "rb" format string
	// This also checks if the file exists and/or can be opened for reading correctly
	if ((file = fopen(filePath, "rb")) == NULL)
		cout << "Could not open specified file" << endl;
	else
		cout << "File opened successfully" << endl;

	// Get the size of the file in bytes
	long fileSize = SizeOfFile::sizeOfFiles(file);

	// Allocate space in the buffer for the whole file
	fileBuf = new char[fileSize];

	// Read the file in to the buffer
	fread(fileBuf, fileSize, 1, file);

	// Now that we have the entire file buffered, we can take a look at some binary infomation

	cout<<"File size = " <<fileSize;
	cout<<"File size get = "<<fileBuf;

    filecodes = HeaderShapefile::fileCode(fileBuf,0);
    fileLengths = HeaderShapefile::fileLength(fileBuf,24);
    versions = HeaderShapefile::version(fileBuf,28);
    shapeTypes = HeaderShapefile::shapeType(fileBuf,32);
    xmin = HeaderShapefile::dimensionXMin(fileBuf,36);
    ymin = HeaderShapefile::dimensionYmin(fileBuf,44);
    xmax = HeaderShapefile::dimensionXmax(fileBuf,52);
    ymax = HeaderShapefile::dimensionYmax(fileBuf,60);
    zmin = HeaderShapefile::dimensionZmin(fileBuf,68);
    zmax = HeaderShapefile::dimensionZmax(fileBuf,76);
    mmin = HeaderShapefile::dimensionMmin(fileBuf,84);
    mmax = HeaderShapefile::dimensionMmax(fileBuf,92);

    /*****************HEADER SHAPEFILE DETAIL*********************/

    cout<<endl<<"/*****************HEADER SHAPEFILE DETAIL*********************/";

    cout<<endl<<"File code = "<<filecodes<<endl;
    cout<<"File Length = "<<fileLengths<<endl;
    cout<<"Version = "<<versions<<endl;

    //This shapefile shapetypes can be found in the technical discription.
    switch(shapeTypes)
    {
        case 0:
            shape = "Null Shape";
            break;
        case 1:
            shape = "Point";
            break;
        case 3:
            shape = "Poly Line";
            break;
        case 5:
            shape = "Polygon";
            break;
        case 8:
            shape = "MultiPoint";
            break;
        case 11:
            shape = "PointZ";
            break;
        case 13:
            shape = "PolyLineZ";
            break;
        case 15:
            shape = "PolygonZ";
            break;
        case 18:
            shape = "MultiPointZ";
            break;
        case 21:
            shape = "PointM";
            break;
        case 23:
            shape = "PolyLineM";
            break;
        case 25:
            shape = "PolygonM";
            break;
        case 28:
            shape = "MultiPointM";
            break;
        case 31:
            shape = "MultiPatch";
            break;
        default:
            shape = "Wrong match found";
            break;
    }
    cout<<"Shape Type = "<<shape<<endl;

    cout<<endl<<"************* Bounding Box **************"<<endl;
    cout<<"X minimum = "<<xmin<<endl;
    cout<<"Y minimum = "<<ymin<<endl;
    cout<<"X maximum = "<<xmax<<endl;
    cout<<"Y maximum = "<<ymax<<endl;
    cout<<"Z minimum = "<<zmin<<endl;
    cout<<"Z maximum = "<<zmax<<endl;
    cout<<"M minimum = "<<mmin<<endl;
    cout<<"M maximum = "<<mmax<<endl;

	cin.get();
	delete[]fileBuf;
        fclose(file);   // Almost forgot this
	return 0;
}

Output of c++ program to read shapefile header:

c++ program to read shapefile header
c++ program to read shapefile header

Get minimum Bounding box of shapefile c++ program

Get minimum Bounding box of shapefile c++ program. This program not only reads shapefile, but makes you aware to read other files, i.e files which have .dbf, .exe, .png etc format without having software. Before that you should know about bits, byte order, and conversion of bytes to other data types and most importantly the format of the files that you want to read.

A shapefile stores non topological geometry. ESRI shapfile mainly contains 3 files, i.e .shp, .shx and .dbf files. To get bounding box details of shapefile, we need to concern about .shp file format. You can find all the technical discription of shapefile, provided by esri in their website.

Shapefile .shp has 3 parts, i.e file header, record header and record contents. File header stores the bounding box of shapefile. You can also see c++ program to read shapefile header. Here is the program:

Get minimum Bounding box of shapefile c++ program

#include<iostream>
#include<stdio.h>
#include<conio.h>

using namespace std;

class ByteConverter
{
    public:
        //Convert 32 bits which is stored in BigEndian format to integer. This is performed with the help of bit operation i.e left shifting and operating or.
    static int32_t bigEndianIntRead(char *fileBuf, int startIndex)
    {
        return (((fileBuf[startIndex + 0] & 0xff) << 24) | ((fileBuf[ + 1] & 0xff) << 16)| ((fileBuf[startIndex + 2] & 0xff) << 8) | ((fileBuf[startIndex + 3] & 0xff)));
    }
    //Convert 32 bits which is stored in BigEndian format to integer. This is performed with the help of bit operation i.e left shifting and operating or.
    static int32_t littleEndianIntRead(char *fileBuf, int startIndex)
    {
        return (((fileBuf[startIndex + 3] & 0xff) << 24) | ((fileBuf[startIndex + 2] & 0xff) << 16) | ((fileBuf[startIndex + 1] & 0xff) << 8) | ((fileBuf[startIndex + 0] & 0xff)));
    }
    //Convert 64 bits or 8 Byte which is stored in BigEndian format to integer. This is performed with the help of bit operation i.e left shifting and operating or.
    static double littleEndianDoubleRead(char *fileBuf,int startIndex)
    {
        double convert;
        char *add;
        int j;
        add = new char();
        j=-1;
        for(int i=startIndex; i<startIndex+8; i++)
        {
            j++;
            add[j] = fileBuf[i];
        }
        convert = *reinterpret_cast<double * const>(add);
        return convert;
    }
};

//Class HeaderShapefile have all funtion implemented to desribe every field of shapefile header file.
class HeaderShapefile
{
    public:

    //This funtion of the class will calculate the bounding box coordinates of the shapefile.
    //Following values i.e x and y minimum and maximum values also with z and m minimum
    // and maximum values are obtained.


    static double dimensionXMin(char*fileBuf, int startIndex)
    {
        return ByteConverter::littleEndianDoubleRead(fileBuf,startIndex);
    }

    static double dimensionYmin(char*fileBuf, int startIndex)
    {
        return ByteConverter::littleEndianDoubleRead(fileBuf, startIndex);
    }

    static double dimensionXmax(char*fileBuf, int startIndex)
    {
        return ByteConverter::littleEndianDoubleRead(fileBuf, startIndex);
    }

    static double dimensionYmax(char*fileBuf, int startIndex)
    {
        return ByteConverter::littleEndianDoubleRead(fileBuf, startIndex);
    }
};

class SizeOfFile
{
    public:
        //This function finds the size of file in Byte
    static long sizeOfFiles(FILE *file)
    {
            long l, e;
            l = ftell(file);
            fseek(file, 0, 2);
            e = ftell(file);
            fseek(file, l, 0);
            return e;
    }
};

int main()
{
    int32_t filecodes, fileLengths, shapeTypes, versions;
    double xmin, ymin, xmax, ymax, mmin, mmax, zmin, zmax;
    string shape;
    char *filePath = "map.shp";
	char*fileBuf;			// Pointer to our buffered data
	FILE *file = NULL;		// File pointer
	// Open the file in binary mode using the "rb" format string
	// This also checks if the file exists and/or can be opened for reading correctly
	if ((file = fopen(filePath, "rb")) == NULL)
		cout << "Could not open specified file" << endl;
	else
		cout << "File opened successfully" << endl;

	// Get the size of the file in bytes
	long fileSize = SizeOfFile::sizeOfFiles(file);

	// Allocate space in the buffer for the whole file
	fileBuf = new char[fileSize];

	// Read the file in to the buffer
	fread(fileBuf, fileSize, 1, file);

	// Now that we have the entire file buffered, we can take a look at some binary infomation

	cout<<"File size = " <<fileSize;

    xmin = HeaderShapefile::dimensionXMin(fileBuf,36);
    ymin = HeaderShapefile::dimensionYmin(fileBuf,44);
    xmax = HeaderShapefile::dimensionXmax(fileBuf,52);
    ymax = HeaderShapefile::dimensionYmax(fileBuf,60);

    /*****************MINIMUM BOUNDING BOX OF SHAPEFILE DETAIL*********************/

    cout<<endl<<"\n/*****************MINIMUM BOUNDING BOX SHAPEFILE DETAIL*********************/\n\n";

    cout<<"X minimum = "<<xmin<<endl;
    cout<<"Y minimum = "<<ymin<<endl;
    cout<<"X maximum = "<<xmax<<endl;
    cout<<"Y maximum = "<<ymax<<endl;

	cin.get();
	delete[]fileBuf;
        fclose(file);   // Almost forgot this
	return 0;
}

Output of Get minimum Bounding box of shapefile c++ program

Get minimum Bounding box of shapefile c++ program
Get minimum Bounding box of shapefile c++ program