I'm trying to convert Shapefiles from the State of Texas Senate Districts website into a GeoJSON file for use with Google Maps API. I'm using QGIS to facilitate but I can't get the projection/coordinates right. So far I've tried Google Mercator (EPSG:900913) and WGS 84 (EPSG:4326) with no luck. I'm using the OpenLayers to verify results and it keeps placing Texas near the Gulf of Guinea (0 lat, 0 lng).


It is no problem to load the downloadable shapefile directly into QGIS.

The data is in EPSG:3081, you better leave it that way. Google API expects latlong values, so the target CRS should be EPSG:4326.

Just rightclick on the layer -> Save As... to choose file type GeoJSON, a different file name, and EPSG:4326 as new CRS. You can add the result to the canvas to see that they align (On-the-fly-reprojectionselected).

  • any way to "save as" with multiple layers? – chrismarx Feb 4 '16 at 21:16
  • No, every file needs a different destination file name. You can use ogr2ogr on the command line for batch processing. – AndreJ Feb 5 '16 at 6:37
  • seems like maybe the batch processing support, which supports things like sensible defaults for automatic file naming could be employed to just send the resulting files to a folder – chrismarx Feb 5 '16 at 16:02

Here is the convert tool for shapefile to geojson via web browser without server-side code and supporting non-english encoding, just need to upload the zip file and set the encoding for the correctly text.


If you use this library with Google Map api v3, you can skip EPSG code field because the ZIP archive(PlanS172.zip) download form the State of Texas Senate Districts website contain the .prj file.

    url: '/shp/PlanS172.zip', // path or your upload file
    encoding: 'big5' // default utf-8
}, function(geojson) {
    // geojson returned

enter image description here


Via Command line:

ogr2ogr -f GeoJSON -t_srs crs:84 output.geojson input.shp

I guess this is what the web client from this answer uses.

  • Just tested. Behaves way better than QGIS when it comes to the RAM consumption! – Ikar Pohorský Aug 22 '19 at 10:26

This should help you if you only need to do a few shapefiles


  • thats pretty nice, I was about to send a link with ogr2ogr example – geomajor56 Apr 3 '14 at 0:00

GeoJSON is based on JavaScript Object Notation. Here in this post you can explore different methods to convert the shapefiles online, or offline or with the help of API which you can make use of. So check out this post to convert shapefiles into GeoJSON files for using in the google map.

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

  • 2
    Links to external resources are encouraged, but please add context around the link so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline. – ArMoraer Apr 24 '18 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.