Pre-projected geometries

Was trying to use the D3 Choropleth and found it did not return anything using the GeoJSON I provided. I think the cause was the geometry was not “pre-projected”, which it seems like the example geometry for the notebook is. Is there a way to tell if GeoJSON is pre-projected? What does that mean?


By convention, one would consider that a GeoJSON is “not projected” if the coordinates of a point represent its longitude and latitude in degrees—often denoted WGS84.

If that is the case, you will usually apply a projection (such as orthographic or mercator) to transform these coordinates to screen coordinates in pixels.

However, sometimes you receive geographic information that has already been projected to a given coordinate system.

For example official shape files in France are often projected with the Lambert93 projection. In this case the number you get are positions on a plane. Sometimes they are pixels and you can use them without reprojecting, as in your notebook.

However it also often happens that these coordinates are planar, but not pixels: they might even be meters or kilometers. In that case, you might need to use a planar transform to map these coordinates to pixel values. Usually it will be something like d3.geoIdentity (or most probably d3.geoIdentity().reflectY(true).fitSize([960, 500], shape)).

There is no real way to tell, but if you look at the numbers in the first feature, and see something like [603.3004584730799, 478.09085703236184], it’s probably projected to pixel values. If it’s [-132, 25], probably “not projected”. And if [50000, 40000], probably projected to meter values.

1 Like

Cool, appreciate it. Digging into the features, looking at the points, that makes sense. Thanks for the explanation.