Alexei Gannon ‘25 asks: … a slightly different question… and instead I ask what is the distribution of nearest-neighbor parish distances in the Archdiocese of New York?…

Conveniently, Cardinal Dolan made a list for us:

newYork = Import["https://archny.org/our-parishes/", "Plaintext"];

(comment 05 Feb 2025: *alternatively, one could use the Overpass API to perform queries on OpenStreetMap data )

Begin by processing the text. It is rather long, and we want to focus on the city of New York, so we will retain only lines that contain Bronx, New York (i.e., Manhattan), or Staten Island. (Recall that Queens and Brooklyn are in their own diocese.) We include some spaces after Bronx to kick out Bronxville (which is in Yonkers):

lines = StringRiffle[#, "\n"] &@
    Select[
     StringSplit[newYork, "\n"], 
     StringContainsQ[{"Bronx ", "Bronx,", "New York", "Staten Island"}]];

Then feed the result into the LLM to clean it up:

result = StringSplit[#, "\n"] &@
    LLMSynthesize["Extract only the addresses from the following text. Put each address on its own line. Write the address in the form: 123 Main Street, Anytown,  NY 12345. Do not include any other information, such as markdown.  Here is the text:\n" <> lines];

Run it through an interpreter to extract the points as GeoPosition items:

locations = Interpreter["StreetAddress"] /@ result;

The following results could not be parsed as addresses, although prima facie they seem to be reasonable addresses (spot checking a few of them on Google Maps shows a location). This is probably a failure of the OpenStreetMap database that is used behind the scenes:

TableForm@ Pick[result, FailureQ /@ locations]

174i8aambadst

We will just proceed without them. Where are these churches?

churches = DeleteCases[locations, Failure[__]];
GeoListPlot[churches]

15bwk0rmdf7oq

Uh oh! Remove the outliers and replot:

churches = DeleteAnomalies[churches];
GeoListPlot[churches]

00ol0unpjdwls

That looks better. Now compute the distance to the nearest (non-self) church. (By default, 2 gives us self and other, so we retain only the last part):

distances = Last /@ Nearest[churches -> "Distance", churches, 2]; 
 
Histogram[distances, 
   Frame -> True, 
   FrameLabel -> {"Nearest Neighbor Parish (Miles)", "Count"}] 
 
Median[distance]

1a9fmtghpf9m8

0o469bt4s8c9w

OK, maybe you prefer this in some other units:

UnitConvert[%, "Miles"]

04voiavfhxder

UnitConvert[%, "Kilometers"]

1k46h00c2b084

Mean[distance]

00ntfovi8q6wk

This is surprisingly closer than I would have expected.

Also in our discussion:

ToJekyll["How far away is another Catholic Church in NYC?", "nyc mathematica llm"]