Sign up ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have shapefiles i.e. *.shp, *.dbf and *.shx files.

I need to read geo coordinates from these files and overlay the area on Google Maps at the right location.

I believe that *.shp and *.dbf files contain coordinates.

I have also used gotools api to read ArcGIS files and am able to generate map.

Is it possible to do this?

share|improve this question

migrated from Aug 7 '13 at 3:36

This question came from our site for professional and enthusiast programmers.

By "gotools api" do you mean GeoTools? – PolyGeo Aug 8 '13 at 10:23

4 Answers 4

I suggest you taking a look at Reading ESRI Shapefiles with PHP.

It is a class written in PHP that can be used to read shapefiles. Once you manage to read a shapefile, you can easily extract its contents i.e. latitudes and longitudes. Here is a snippet from the webpage:

// including the shapefile reader class
    require '';

// importing the downloaded shapefile
    $shp = new ShapeFile("5961.shp", array('noparts' => false));

Once you got the coordinates from the shapefile on the server side, just put them into an array and use PHP's json_encode() command to create a JSON array from the PHP array, set the content type to application/json or text/json and echo the whole stuff. Then you can process this on the client side easily.

share|improve this answer

If you happen to use Quantum GIS, I found this tutorial It explains how to create the coordinates from a shapefile (containing points) and extract them to Excel so you can plug and play into Google Maps.

Here is a summary,

  1. Open your Shapefile in Quantum GIS (open source GIS tool)
  2. Go to toolbar Vector>geometry tools>Add Geometry Columns. 3.Go to the directory containing your shapefile and open the DBF file in Excel
  3. THe last two columns will contain the coordinates you were looking for so you can plug into Google Maps API.
share|improve this answer

Make sure you shapefile is projected correctly then you can use Google Engine to upload your shapefile, see this link Uploading Data to Google Maps Engine.

share|improve this answer

Open your .dbf in Excel and save it as a .csv

You can then add this .csv file to Google Maps and specify your X,Y columns with the 'Create Map' tool:

enter image description here

@johanvdw I thought the user stated he has the X,Ys already in the .dbf

@Devdatta Tengshe I assumed he is trying to view his shapefile in Google Maps, I've uploaded a screenshot - from here you can import your files into GM as I thought the user was requesting. Maybe I have misunderstood the question!?

share|improve this answer
This would only work if the dbf file contains X and Y columns. If this is not the case you could add them (if your file is a point shape file) using eg saga gis. This has a module "add coordinates to points". – johanvdw Nov 13 '13 at 9:25
I don't see how you can convert the 'shape' part of the ShapeFile into CSV. It's not even clear what the 'Create Map' tool is. – Devdatta Tengshe Nov 13 '13 at 9:25
Edited. I would like to know if I have misinterpreted the question and thus keep/delete my answer accordingly. – Rob Lodge Nov 13 '13 at 9:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.