I'm trying to do the following: I have 2 shapefiles, one containing all the public schools in NY, another one containing the hotspots in NY (both in points form).
Now what I'm trying to do is calculate the distance from the schools to their closest hotspot. So that, when I merge it to my "SchoolPoints" layer and import it in TileMill I can visualise for each school the distance from the closest hotspot (for example: coloring the schools close to hotspots green, the ones that are far from a hotspot red).

To do this I used the distance matrix tool, with following settings:
enter image description here

(Note: pid is just a unique column I added, containing just integers)

After that I linked the data to the "SchoolPoints" layer (with as mutual field InputID and pid).

That results in a column, with a distance to the closest hotspot for each school, as it should be.

Well, not exactly. The problem I'm facing is: when importing my "SchoolPoints" layer in TileMill and after writing a small piece of code to plot the color differently according to the distance. For example:

[AfstandA7_ < 141.030340279] {marker-fill:#02D722;}
[AfstandA7_ > 1250] {marker-fill:#008A14;}
[AfstandA7_ > 2500] {marker-fill:#D70537;}
[AfstandA7_ > 3750] {marker-fill:#FF1F55;}
[AfstandA7_ >   5096.78247742] {marker-fill:#8A0123;} ) 

It shows wrong results. Points close to a hotspot that should be green show up red, and points far from hotspots show up green. Some points appear to show a correct color, so the problem is not in my CSS code.

A friend suggested that it might be related to the projection system I'm using. I already used two, both of them giving wrong results:

EPSG:31300    Belge 1972 / Belge Lambert 72
EPSG:2155     American Samoa 1962 / American Samoa Lambert (deprecated) 

Now my question is:

What projection system should I use for NY? And also: might that solve my wrong distance values issue?

Here's a link with the shapefiles I used if you'd like to check it out yourself.


My first thought, regarding reversed red and green labeling, was that you simply have an ordering problem -- something requiring a minor code fix. That may still be the case.

However, the two CRSs you list (EPSGs 31300 & 2155) are optimized for Belgium and American Samoa, not New York! http://spatialreference.org/ref/epsg/31300/ http://spatialreference.org/ref/epsg/2155/

For New York:

NAD 83 / New York Long Island (ft US) (EPSG 2263): The State Plane zone that covers Long Island and New York City is used by all NYC agencies that produce GIS data. Many city and state agencies produce data in their specific state plane zone. An alternate projection, EPSG 32118, represents the same zone but uses meters instead of feet.


| improve this answer | |

Because of the units, you must be sure that your shapefiles stand in the same Coordinate Reference System. So, you choose one CRS (the one for New York) and, if necessary, convert your two shapefiles in this CRS.

| improve this answer | |

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.