Categories
Thoughts

GeoJSON Ballparks as JSON

In a way it is good that Sean Gillies doesn’t follow me anymore. Because I can hear his voice in my head as I was trying to do something really stupid with the project. But Sheldon helps frame what I should be doing with what I was doing:

Exactly! What the hell? Why was I trying to do something so stupid when the while point of this project is baseball ballparks in GeoJSON. Here is the problem in a nutshell and how I solved it. First off, let us simply the problem down to just one ballpark. Salt River Fields at Talking Stick is the Spring Training facility for both the Arizona Diamondbacks and the Colorado Rockies. Not only that, but there are Fall League and Rookie League teams playing there. Probably even more that I still haven’t researched. Anyway, GeoJSON Ballparks looks like this today when you just want to see that one stadium.

Let’s just say I backed myself in this corner by starting by only having MLB ballparks, none of which at the time of the project were shared between teams.

It’s a mess right? Overlapping points, so many opportunities to screw up names. So my old school thought was just create a one-to-many relationship between the GeoJSON points and some external table. Madness! Seriously, what was I thinking? Sheldon is right, I should be doing a JSON array for the teams. Look how much nicer it all looks when I do this!

Look how nice that all is? So easy to read and it keeps the focus on the ballparks.

As I said in the earlier blog post.

The problem now is so many teams, especially in spring training, minor leagues and fall ball, share stadiums, that in GeoJSON-Ballparks, you end up with multiple dots on top of each other. No one-to-many relationship that should happen.”

The project had pivoted in a way I hadn’t anticipated back in 2014 and it was a sure a mess to maintain. So now I can focus on fixing the project with the Minor League Baseball realignment that went on this year and get an updated dataset in Github very soon.

One outcome of doing this nested array is that many GIS tools don’t understand how to display the data. Take a look at geojson.io:

geojson.io compresses the array into one big JSON-formatted string. QGIS and Github do this also. It’s an issue that I’m willing to live with. Bill Dollins shared the GeoJSON spec with me to prove the way I’m doing is correct:

3.2.  Feature Object
   A Feature object represents a spatially bounded thing.  Every Feature
   object is a GeoJSON object no matter where it occurs in a GeoJSON
   text.
   o  A Feature object has a "type" member with the value
      "Feature".
   o  A Feature object has a member with the name 
      "geometry".  The value of the geometry member SHALL
      be either a Geometry object as defined above or, in 
      the case that the Feature is unlocated, a JSON 
      null value.
   o  A Feature object has a member with the name 
      "properties".  The value of the properties member is
      an object (any JSON object or a JSON null value).

ANY JSON OBJECT! So formatting the files this way is correct and the way it should be done. I’m going to push forward on cleaning up GeoJSON Ballparks and let the GIS tools try and catch up.

Categories
Thoughts

GeoJSON Ballparks and MLB Minor League Realignment

**UPDATE** – See the plan.

Boy, where to start? First, for those who haven’t been following, this happened over the winter.

Major League Baseball announced on Friday (February 12, 2021) a new plan for affiliated baseball, with 120 Minor League clubs officially agreeing to join the new Professional Development League (PDL). A full list of Major League teams and their new affiliates, one for each level of full-season ball, along with a complex league (Gulf Coast and Arizona) team, can be found below.

Minor League Baseball

What does that mean? Well for GeoJSON Ballparks basically every minor league team is having a modification to it. At a minimum, the old minor league names have changed. Take the Pacific Coast League that existed for over 118 years is now part of Triple-A West which couldn’t be a more boring name. All up and down the minor leagues, the names now just reflect the level of minor league the teams are. And some teams have moved from AAA to Single A and all around.

I usually wait until Spring Training is just about over to update the minor league teams but this year it almost makes zero sense. I’ve sort of backed myself into a spatial problem, unintended when I started. Basically, the project initially was just MLB teams and their ballparks. The key to that is that the teams drove the dataset, not the ballparks even though the title of the project clearly said it was. As long as nobody shared a ballpark, this worked out great. The problem now is so many teams, especially in spring training, minor leagues and fall ball, share stadiums, that in GeoJSON-Ballparks, you end up with multiple dots on top of each other. No one-to-many relationship that should happen.

So, I’m going to use this minor league realignment to fix what I should have fixed years ago. There will be two files in this dataset moving forward. One GeoJSON file of the locations of a ballpark and then a CSV (or other format) file containing the teams. Then we’ll just do the old fashioned relate between the two and the world is better again.

I’m going to fork GeoJSON-Ballparks into a new project and right the wrongs I have done against good spatial data management. I’m finally ready to play centerfield!

Categories
Thoughts

Italian Baseball Stadiums in GeoJSON

I’ve been working at cleaning up all the GeoJSON-Ballparks records this past month. While the MLB stadiums and many of the AAA minor league teams have been updated, the international and small market teams have not. Some were out of data by almost 5 years. Long tail baseball stadiums are what they are and I’m working on automating much of this moving forward. The last two leagues that I’m updating are the Italian Baseball League and the German Bundesliga League. I hope to finish Germany tonight but I did post Italy yesterday.

Ballparks of the Italian Baseball League in GeoJSON

While Italy can’t go out and enjoy baseball just yet, at least their top tier baseball league has been mapped. If you’re looking for some live baseball, check out streaming Korean KBO League league (I’ve been watching the Giants of course). The next live stream will be on March 25th at approximately 7:40pm PDT.

Categories
Thoughts

Spring Cleaning During Spring Training

GeoJSON-Ballparks is my favorite data project I’ve been part of. Probably because not only is it the best sport ever, but it is great keeping track of all the changes at ballparks through the years. MLB teams have mostly stopped building new ball parks so the changes are generally just updates to their names. This year the only new name was Truist Park. Oakland Coliseum reverted back from RingCentral which it never was able to become because of shenanigans. We do bring on a new ballpark in Arlington which is named almost the same as the old ballpark (Globe Life Field vs the old Globe Life Park in Arlington). Apparently the old stadium has been renovated to XFL standards so we should probably not call it a ballpark anymore. I just removed the old one since it is no longer a baseball stadium. I did the same thing with Turner Field.

I plan to review all the Spring Training Facilities of the Cactus League and the Grapefruit League and then review the AAA stadiums. We’ll have to see what happens with the MLB/MiLB negotiations. While it doesn’t affect the actual stadium points (at least in the short term, some of the fields could go away because of lack of support), the alignment of teams in leagues could be changed. So stay tuned and if you want to help out with the AAA stadiums, just create a pull request, would be greatly appreciated!

Categories
Thoughts

Baseball Ballparks in GeoJSON

Update: Mexican League and Eastern League are done. That means we’ve got all the Majors, Triple-A and a third of the Double-A stadiums mapped.

I’ve been working on getting all the MLB and AAA baseball ballparks in GeoJSON on GitHub. MLB1 parks are done and I think I’ve got all the AAA parks thanks to Wikipedia but I’m still missing most of the Mexican League which is a AAA league. I’m also hoping to complete the AA and A ballparks as well. If you can help, just fork the repo and submit a pull request with the new ballpark.

  1. Ignoring the fact I had the Nationals still playing at RFK