5

is there any way to determine which type of area you are in from a MKMapView? I.e. if the centre of the map is in the ocean we can tell the user: the centre of the map is above the ocean, or if the map is centred above a green area: the centre of the map is above parkland...

The only way I can think of to do this is to create a screenshot of the visible screen and analyse the colour of each bit by using some method such as this: iOS -- detect the color of a pixel?

However I would be interested to know if there is an easier way that anyone can think of!

EDIT

To make it more clear what I'm looking for, I'm basically looking for a way to turn a section of a map into a top down level for a game, with different areas determined by the areas of the map...

Community
  • 1
  • 1
simonthumper
  • 1,834
  • 2
  • 22
  • 44

2 Answers2

3

A CLPlacemark has a couple of properties: inlandWater and ocean which tell you when the placemark is in water. I think you can get a placemark from the geocoder.

It also has areasOfInterest which will give you parks and landmarks.

nevan king
  • 112,709
  • 45
  • 203
  • 241
  • Any idea the sort of accuracy on this? – simonthumper Mar 17 '13 at 16:38
  • I haven't used it extensively. I used it a couple of times and it worked. The `areasOfInterest` wasn't that complete, but water seemed fine. – nevan king Mar 17 '13 at 16:40
  • ok that's great cheers... I'll have a wait and see if anyone has any better idea's but if not I'll mark you correct :) – simonthumper Mar 17 '13 at 16:41
  • Not sure whether we're going to get any other answers... I'll mark you as correct in an hour or so, but I'll post if I find a better way myself whilst I'm mucking about with the api :) – simonthumper Mar 18 '13 at 14:07
  • I have accomplished this by taking a screenshot of the entire screen and then determining the colour of the centre pixel, this gives me extremely accurate results, however I have the problem that I want to do this every 0.04 seconds and taking a screenshot programatically is not a nippy process ;) – simonthumper Mar 23 '13 at 16:49
0

there is no foolproof way BUT CLGeocoder can reverse geocode a coordinate to an address and that would give you stuff like:

0/0 = ...., ocean 51/10 = ..., germany -90/10 = ..... , united states

and so on

Daij-Djan
  • 49,552
  • 17
  • 113
  • 135
  • note the numbers are amade up -- I cant geocode in my head :D – Daij-Djan Mar 17 '13 at 16:23
  • Thanks for that, but I'm looking for a bit more of an accurate method i.e. determining whether a point is above a road or whether it is on the buildings beside the road.. e.t.c :/ but thanks for the tip! – simonthumper Mar 17 '13 at 16:25