1

I've been following the "Let's Make a Map" tutorial by mbostock about converting files for use for d3.js. I have been able to get things working with files from Natural Earth, but when trying to convert the shapefiles from the MBTA website (http://www.mass.gov/anf/research-and-tech/it-serv-and-support/application-serv/office-of-geographic-information-massgis/datalayers/trains.html), which stores lineshapes with cartesian coordinates and arcs (with topojson -t_srs EPSG:4326...), I get an error:

/usr/local/lib/node_modules/topojson/bin/topojson:303
  var i = file.indexOf("=");
               ^
TypeError: Object true has no method 'indexOf'

I get this even trying different values for EPSG such as 26986. How can I represent these files in d3 (alongside other topojson files that use lat/lon), or convert the coordinates to lat/lon?

1
  • Looks like a bug in topojson to me. file is being set to the wrong type.
    – Nathan W
    Commented Dec 14, 2013 at 22:21

1 Answer 1

3

The topojson command has no parameter -t_srs, it is ogr2ogr what you want to use:

ogr2ogr -f GeoJSON trainsGeoJSON.json TRAINS_RTE_TRAIN.shp -s_srs EPSG:26986 -t_srs EPSG:4326

Then convert to topojson format (as described here):

topojson -o trainsTopojson.json trainsGeoJSON.json 
1
  • Thank you! I had tried using -t_srs with ogr2ogr but had not specified the source with s_srs.
    – arilaan
    Commented Dec 15, 2013 at 6:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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