Archive for December, 2007

YM4R and GeoKit Rock

Sunday, December 23rd, 2007

So far YM4R and GeoKit are working out aside from a few oddities. GeoKit install and geocoding was flawless, but I’ve yet to use the advanced finders for distance. At the moment the user/gamer/player (haven’t decided what to call it as of yet) doesn’t have an address associated with it for mapping functionality. Should be easy enough to compute according to tutorials.

YM4R makes the simple things even easier, but due to the very small amount of documentation its been a bit difficult to find examples. It’s probably time to start digging through the plugin code for clarification. YM4R is used for creating your Google Map markers in Ruby code, storing them to single variable and then being able to generate the header javascript, as well as the div/span/whatever the map will be created in. It’s easy enough to wrap some code in a content tag from within a view for a specific map.

<% content_for(:header) do %>
<%= GMap.header %>
<%= javascript_include_tag("markerGroup") %>
<%= @map.to_html %>
<% end %>

The @map variable was created within the controller with all points that will be created, as well as any map settings — like zoom level, lat/long to center in on, as well as managing groups, clusters and anything else. When generating a map with a group of points, it’s possible to have ym4r decide where to zoom in on, as well as what zoom level. This is as easy as a few lines:

sorted_latitudes = @arcades.collect(&:address).collect(&:lat).compact.sort
sorted_longitudes = @arcades.collect(&:address).collect(&:lng).compact.sort
@map.center_zoom_on_bounds_init([ [sorted_latitudes.first, sorted_longitudes.first],
[sorted_latitudes.last, sorted_longitudes.last]])

I’m still working on some of the basics of mapping that aren’t quite as well documented. Things like having a marker point popup on start, or having a link on the page outside of the map that opens a map marker. These kinds of things are simple when you step into javascript, and heavily documented, but not quite as much so with wrapper plugins. I’ll probably mess around with it a bit more, before deciding if straight javascript or ruby is the way to go.

As far as javascript goes, one solution that looks interesting is Mapstraction. There is actually a YM4R wrapper for it as well, although it appears out of date (and undownloadable). The idea is that you can switch which mapping engine you use. Always a plus to give users the ability to decide which mapping engine they prefer, but I imagine it’s at the cost of some features. Google, for instance has quite a few different ways of grouping points so the browser doesn’t crash to a halt. For instance, if you use clustering (which the ym4r gm plugin supports), markers that indistinguishable at far out zoom level will be shown as a single point. This keeps the map clean so that you won’t have a collection of points all on top of each other. We’ll see how it goes with the remaining tasks!

Mapping Goodness!

Tuesday, December 18th, 2007

I’ve been a longtime fan of mapping applications — making that one of the most fun aspects of ArcadeFly. It’s a feature I’m not going to wimp out on in any way, so long as I have more ideas on what to do. To start out, I’m using GeoKit to obtain latitude/longitude for addresses, which has been the easiest geocoding I’ve ever had the opportunity to work with. Basically you just add a callback in your model, add in a lat/lng column to wherever your address is, update your environment file with your API key and you’re good. Worked on the first try actually, which is rare. One of the bonus features of is that it can use multiple mapping servers to lookup an address until it finds one that works. Pretty slick feature and that much more I don’t have to worry about. I’m working on displaying the results now, which I’m thinking about using YM4R. We’ll see how that goes.

Off to a good start!

Saturday, December 15th, 2007

ArcadeFly is a project I’ve wanted to do for a while. It’s one of those ideas that you just assume there’d be a comparable service for somewhere, but it’s just never been filled — and in the time meantime I’ve witnessed a drop in Arcades all around. It’s a shame to see so many great hangouts disappear, but hopefully those that do survive will adapt to service more people — the way the Wii has. It seems like Gameworks, Dave and Busters as well as mall arcades (of course) are doing well, but still I wish for more variety. So ArcadeFly is out there to help people with the same interest in finding new places. If you’re here you probably already know the basics of the (somewhat simplistic) site.

As for this blog, it’s mostly going to be a journal for the development progress to begin with. ArcadeFly is being developed by one guy (me), while learning Ruby On Rails, which it’s built on. I don’t see myself going into full blown tutorials on what I’m using, but more for design decisions, what plugins I’m using and where the site is at now. If you have any questions or comments, feel free to drop me a line.