I'm trying to get data for map of Poland. I found WFS service that provides GML files. It is located under:


I'm able to all provinces of Poland using this request:


My problem is that data from this server is in EPSG:4326 projection, when d3js is using U.S.-centric (d3.geo.albersUsa). I can convert GML to shapefile (using QGIS) and then to TopoJSON or GeoJSON (using http://www.mapshaper.org/), but I need to know what projection I must use to display my map correctly.

  • intresting library, while i was googling found this github.com/d3/d3-geo-projection (extension) and this github.com/mbostock/d3/wiki/Geo-Projections. This one gives impression that d3 understand Wgs84 smartjava.org/content/using-d3js-visualize-gis keyword: d3.geo.mercator() , that should be projection for incoming data, after that you do transformation to desired projection and show data (disclaimer: newer used d3 , and i dont do js) Commented Jan 8, 2014 at 14:17
  • @simplexio thanks for tip :) I'm more js guy than GIS, so this whole projection is new to me. I can use ogr2ogr to convert projections, but I don't know which one would be best for Poland
    – Misiu
    Commented Jan 8, 2014 at 14:27
  • Using srid:3857 (google) or 4326 (wgs84) are easy because most of data will be in one of those. If you want to calculate length in meters use 3857 if that is not important use 4326. If you want to be really accurate measurements use some local polish(?) system. i don't know any good one. One thing about projections is that every projection has its own perks, some of them distorts angle or distance or area, so you need choose one depending your use. only data visualization you can use pretty much anything you want Commented Jan 8, 2014 at 14:41

1 Answer 1


I would suggest Albers equal-area conic as in this example for the UK and adjust the parameters for Poland.

First generate your topojson from the GML file with the following two commands (note that the the geographic coordinates in gml are swapped, so we need to tell ogr2ogr swap them back with the --config options):

ogr2ogr -f "GeoJSON" --config GML_INVERT_AXIS_ORDER_IF_LAT_LONG YES --config GML_CONSIDER_EPSG_AS_URN YES poland.json poland.gml
topojson -o pl.json poland.json

For Poland you want to set the standard parallels to something like 48°N and 56°N, rotate longitude by -19° and set the center to 0°W 52°N.

The complete code is:

<!DOCTYPE html>
<meta charset="utf-8">
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>

var width = 600,
    height = 600;

var projection = d3.geo.albers()
    .center([0, 52])
    .rotate([-19, 0])
    .parallels([48, 56])
    .translate([width / 2, height / 2]);

var path = d3.geo.path()

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

d3.json("pl.json", function(error, pl) {
      .datum(topojson.feature(pl, pl.objects.poland))
      .attr("d", path)
      .attr("fill", "#eee");

enter image description here

  • this is exactly what I created :) But I didn't have to swap coordinates. I did simple conversion to TopoJSON and used mapshaper.org to simpify and minimize my files. Thanks for correct coordinates, I was trying to figure them out, but Yours are perfect :)
    – Misiu
    Commented Jan 11, 2014 at 10:16

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.