Question

My question is the following: How can I grab 'blocks' in a city for use in a game? (And then display them shaded in a certain color?)

My general idea is to use real blocks of your city in a game, that you can own/sell.

I want to display the areas you own as polygon overlays in google maps.

Are google maps the way forward, or are other APIs like OpenStreetMap, etc, more useful for this?

Any pointers would be appreciated, like general algorithms of what data to grab and how to construct 'blocks' out of it, or API calls that could return a block/house level polygon for me.

Was it helpful?

Solution

Sounds hard, mostly because you'll have a hard time consistently defining what a block is -- one side of one street, or the rectangle enclosed by four streets? What if it's not a rectangle? Etc.

OpenStreetMap data is probably your best bet, because you can actually download the data -- via OSM Export or Cloudmade extract by region.

You might consider another approach (i.e. letting users define their own polygons) or letting users own streets (which would be easier to do with OSM data).

There are also commercially available parcel datasets which will give you a property-level view of a city. These can be very expensive.

OTHER TIPS

I recently had to deal with this issue. I ended up creating a library in objective-c which basically analyzes a combination of OSM street data and OSM building footprint data to figure out the concept of a "block", where the notion is, a "block" is a polygonal region that has buildings within it and which has a polygon of intersecting streets encompassing it. It doesn't work for all situations (like blocks with no buildings footprint data), but for cities, it works nicely in determining blocks.

Another approach, but not supported by OSM to my knowledge, is to get block polygon data directly from the city government, but that's not particularly scalable unless your requirement is only for a few given locales. And some cities don't publish that data.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top