mesutaslan Member Licensed User Longtime User Aug 23, 2017 #1 How can i get Bounds locations from Code: Copy - (NSObject*)coordinateBoundsFromProjection:(GMSProjection*) p when i tried to access location via Code: Copy Dim bounds As NativeObject = gmapEx.GetVisibleBounds Dim ne As Location = bounds.GetField("northEast") ide says : Expected: CLLocation, object type: NSConcreteValue
How can i get Bounds locations from Code: Copy - (NSObject*)coordinateBoundsFromProjection:(GMSProjection*) p when i tried to access location via Code: Copy Dim bounds As NativeObject = gmapEx.GetVisibleBounds Dim ne As Location = bounds.GetField("northEast") ide says : Expected: CLLocation, object type: NSConcreteValue
mesutaslan Member Licensed User Longtime User Aug 23, 2017 #2 end also when i try to access northEast object in GMSCoordinateBounds to access latitude or longitude with Code: Copy Dim bounds As NativeObject = gmapEx.GetVisibleBounds Dim ne As NativeObject = bounds.GetField("northEast") Log(ne.GetField("latitude")) it says : [<NSConcreteValue 0x7d7b2ca0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key latitude. Upvote 0
end also when i try to access northEast object in GMSCoordinateBounds to access latitude or longitude with Code: Copy Dim bounds As NativeObject = gmapEx.GetVisibleBounds Dim ne As NativeObject = bounds.GetField("northEast") Log(ne.GetField("latitude")) it says : [<NSConcreteValue 0x7d7b2ca0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key latitude.
Erel B4X founder Staff member Licensed User Longtime User Aug 23, 2017 #3 Which line raises the error? What is the output of Log(bounds)? Upvote 0
mesutaslan Member Licensed User Longtime User Aug 23, 2017 #4 Code: Copy If gmap.IsInitialized Then Dim bounds As NativeObject = gmapEx.GetVisibleBounds Log(bounds) Dim ne As NativeObject = bounds.GetField("northEast") Log(ne.GetField("latitude")) End If ne object or ne.getfield raises error result of log(bounds) : <B4INativeObject: <GMSCoordinateBounds: 0x7aef43e0>> Upvote 0
Code: Copy If gmap.IsInitialized Then Dim bounds As NativeObject = gmapEx.GetVisibleBounds Log(bounds) Dim ne As NativeObject = bounds.GetField("northEast") Log(ne.GetField("latitude")) End If ne object or ne.getfield raises error result of log(bounds) : <B4INativeObject: <GMSCoordinateBounds: 0x7aef43e0>>
mesutaslan Member Licensed User Longtime User Aug 23, 2017 #5 also output of log(ne) is <B4INativeObject: <3218d388 05f93040 0000a0d8 7f154040>> I am using local builder and google maps lib version : Google Maps SDK for iOS version: 2.2.30010.0 Upvote 0
also output of log(ne) is <B4INativeObject: <3218d388 05f93040 0000a0d8 7f154040>> I am using local builder and google maps lib version : Google Maps SDK for iOS version: 2.2.30010.0
Erel B4X founder Staff member Licensed User Longtime User Aug 24, 2017 #6 CLLocationCoordinate2D is a struct. You must use OBJC code to extract it. Add this code to the OBJC section in GoogleMapExtra: Code: Copy - (void)getLatLngFromBounds:(GMSCoordinateBounds*) bounds :(B4ILatLng*) northEast :(B4ILatLng*) southWest { [northEast Initialize:bounds.northEast.latitude :bounds.northEast.longitude]; [southWest Initialize:bounds.southWest.latitude :bounds.southWest.longitude]; } Add this B4i code to the class: Code: Copy Public Sub GetBoundsNE_SW (bounds As Object) As LatLng() Dim ne, sw As LatLng no.RunMethod("getLatLngFromBounds:::", Array(bounds, ne, sw)) Return Array As LatLng(ne, sw) End Sub Call it like this: Code: Copy Sub gmap_Click (Point As LatLng) Dim bounds As Object = gextra.GetVisibleBounds Dim ne_sw() As LatLng = gextra.GetBoundsNE_SW(bounds) Log(ne_sw(0)) Log(ne_sw(1)) End Sub Upvote 0
CLLocationCoordinate2D is a struct. You must use OBJC code to extract it. Add this code to the OBJC section in GoogleMapExtra: Code: Copy - (void)getLatLngFromBounds:(GMSCoordinateBounds*) bounds :(B4ILatLng*) northEast :(B4ILatLng*) southWest { [northEast Initialize:bounds.northEast.latitude :bounds.northEast.longitude]; [southWest Initialize:bounds.southWest.latitude :bounds.southWest.longitude]; } Add this B4i code to the class: Code: Copy Public Sub GetBoundsNE_SW (bounds As Object) As LatLng() Dim ne, sw As LatLng no.RunMethod("getLatLngFromBounds:::", Array(bounds, ne, sw)) Return Array As LatLng(ne, sw) End Sub Call it like this: Code: Copy Sub gmap_Click (Point As LatLng) Dim bounds As Object = gextra.GetVisibleBounds Dim ne_sw() As LatLng = gextra.GetBoundsNE_SW(bounds) Log(ne_sw(0)) Log(ne_sw(1)) End Sub
mesutaslan Member Licensed User Longtime User Aug 24, 2017 #7 Erel said: CLLocationCoordinate2D is a struct. You must use OBJC code to extract it. Add this code to the OBJC section in GoogleMapExtra: Code: Copy - (void)getLatLngFromBounds:(GMSCoordinateBounds*) bounds :(B4ILatLng*) northEast :(B4ILatLng*) southWest { [northEast Initialize:bounds.northEast.latitude :bounds.northEast.longitude]; [southWest Initialize:bounds.southWest.latitude :bounds.southWest.longitude]; } Add this B4i code to the class: Code: Copy Public Sub GetBoundsNE_SW (bounds As Object) As LatLng() Dim ne, sw As LatLng no.RunMethod("getLatLngFromBounds:::", Array(bounds, ne, sw)) Return Array As LatLng(ne, sw) End Sub Call it like this: Code: Copy Sub gmap_Click (Point As LatLng) Dim bounds As Object = gextra.GetVisibleBounds Dim ne_sw() As LatLng = gextra.GetBoundsNE_SW(bounds) Log(ne_sw(0)) Log(ne_sw(1)) End Sub Click to expand... YOU ROCK !!! Upvote 0
Erel said: CLLocationCoordinate2D is a struct. You must use OBJC code to extract it. Add this code to the OBJC section in GoogleMapExtra: Code: Copy - (void)getLatLngFromBounds:(GMSCoordinateBounds*) bounds :(B4ILatLng*) northEast :(B4ILatLng*) southWest { [northEast Initialize:bounds.northEast.latitude :bounds.northEast.longitude]; [southWest Initialize:bounds.southWest.latitude :bounds.southWest.longitude]; } Add this B4i code to the class: Code: Copy Public Sub GetBoundsNE_SW (bounds As Object) As LatLng() Dim ne, sw As LatLng no.RunMethod("getLatLngFromBounds:::", Array(bounds, ne, sw)) Return Array As LatLng(ne, sw) End Sub Call it like this: Code: Copy Sub gmap_Click (Point As LatLng) Dim bounds As Object = gextra.GetVisibleBounds Dim ne_sw() As LatLng = gextra.GetBoundsNE_SW(bounds) Log(ne_sw(0)) Log(ne_sw(1)) End Sub Click to expand... YOU ROCK !!!