I am working on a project using a MapView based on @jsbain "Map View Demo2.py" jsbain github
I am adding a set of anotations that I getting from Open Street Maps (OSM) and that requires that I first limit to a geographical range.
In order to do that, I need to know that lat/long range of the display.
'get_center_coordinate()' works great for "where" I am but to get limit the range I need to know the "span" of the mapview.
I thought that it would be easy to just copy the code from get_center_coordinate() to create get_region() (see below) but my code causes an error; "No method found for region"
The Apple documentation MKMapView shows that 'centerCoordinate' only differs from 'region' in the return type ('CLLocationCoordinate2D' vs 'MKCoordinateRegion'
My understanding of objective C is poor at best and so is nderstanding of the objc_util module.
Any help I can get whether it be a hint or actual working code would be appreciated.
*This method works great
def get_center_coordinate(self):
"""Return the current center coordinate as a (latitude, longitude) tuple"""
coordinate = self.mk_map_view.centerCoordinate(restype=CLLocationCoordinate2D, argtypes=[])
return coordinate.latitude, coordinate.longitude
This method errors: "No method found for region"
@on_main_thread
def get_region(self):
"""Return latitude /longitude of the view's center and the zoom level (specified implicitly as a latitude/longitude delta)"""
region = self.mk_map_view.region(restyle=MKCoordinateRegion,argtypes=[])
return region.center.latitude, region.center.longitude, region.span.d_lat, region.span.d_lon
'''