POST
|
Nick: Yes - this answered my question. Thanks for the help. Haven't started to update Android version yet, but assume there is a similar approach to identify the marker by the attribute and update the lat/long? Steve
... View more
12-05-2019
09:48 AM
|
0
|
2
|
3272
|
POST
|
Nick - Answer on StackOverflow was exactly what I was looking for. Updated the code and it works fine. Posted there and in GIS forum on StackExchange as well. Just for reference where is this documented? I tried to find in docs but must have missed it.
... View more
12-04-2019
10:58 AM
|
1
|
1
|
3272
|
POST
|
I'm using the ArcGIS 100.6 iOS SDK and am populating the map with markers on a Graphics Overlay Layer whose locations are stored in a database common to all users of my application. Each marker is stored in a unique record and each record contains the Latitude & Longitude of the marker. When the App is launched it reads the location of all markers in the database and adds each one to the Graphics Overlay as shown below: let areaMarker = AGSPictureMarkerSymbol(image: UIImage(named: "CustomMarker")!) let areaMarkerLocation = AGSPointMakeWGS84(y ?? 0.0, x ?? 0.0) let markerKey = AGSGraphic(geometry: areaMarkerLocation, symbol: areaMarker, attributes: ["marker": markerKey]) self.overlay.graphics.add(markerKey) As shown above, each marker is assigned an attribute "marker:markerKey" that is the unique database record number (key) where the marker location information is stored and serves as the marker ID. Once the initial markers are added to the Overlay, the App "Listens" to the database for the following events: A new marker is added An existing marker is moved to a new location An existing marker is deleted When a marker is moved or deleted the database listener is notified and passed the record number (key) of the marker that was moved (or deleted). If the marker was moved, the record will then contain the new Latitude & Longitude information. I have experimented with reading the graphics overlay and determined that it is a Collection contained in a NSMutable Array. I can read all attributes as follows: let graphicsCollection = self.overlay.graphics.mutableArrayValue(forKey: "attributes") print(graphicsCollection) The result is: ( { marker = "-KlRW2_rba1zBrDPpxSl"; }, { marker = "-Lu915xF3zQp4dIYnsP_"; } ) I can do the same for "geometry" and get the array of AGSPoints: let graphicsCollection = self.overlay.graphics.mutableArrayValue(forKey: "geometry") print(graphicsCollection) The result is: ( "AGSPoint: (-117.826127, 44.781139), sr: 4326", "AGSPoint: (-112.056906, 33.629829), sr: 4326" ) I have been unable to determine how to get the "index" of the attribute array (e.g. marker "-KlRW2_rba1zBrDPpxSl" above should have an index of [0]) so I can then use that "index" to access the appropriate AGSPoint and update the Latitude & Longitude or remove the marker. Thanks in advance for the help.
... View more
11-22-2019
04:23 PM
|
0
|
6
|
3790
|
POST
|
Thanks, Nick. Just as a follow-up since my app only uses Lat/Long can I set the target geometry for my maps so that all map operations are in Lat/Long and not have to change spatial references?
... View more
11-15-2019
04:30 PM
|
0
|
1
|
3781
|
POST
|
I am using the ArcGIS 100.6 iOS SDK and am trying to determine the current center of the map view in lat/long coordinates and the view area. I also want to invoke a listener to detect when a user pans of zooms the map to get the new center and view area. I am need this information to create and update queries to Firebase/GeoFire so that I can place the appropriate markers on the map based on the viewable area. As the user zooms out more markers should become visible. Google maps has a simple way to do this: center = map.getCenter. I cannot find a simple answer to this in the SDK documentation. I have tried setting currentCenter = mapView.center, but the result is in screen coordinates and there is no concise documentation as to how to convert this point to lat/long. Thanks, Steve
... View more
11-13-2019
01:05 PM
|
0
|
4
|
4448
|
POST
|
I actually just solved this. Here is the updated code that works: viewMap.map = AGSMap(basemapType: .navigationVector, latitude: currentLocation.latitude, longitude: currentLocation.longitude, levelOfDetail: zoomLevel) viewMap.graphicsOverlays.add(overlay) viewMap.touchDelegate = self I removed: let AGSMapView(frame: .zero) as this prevented the map from being displayed in MapView. Also, by not setting a view (thus using the default view controller "view") all siblings are available for display and can be controlled via "isHidden."
... View more
09-18-2019
01:04 PM
|
0
|
0
|
440
|
POST
|
I'm using iOS 100.6 and am trying to place a UIbutton on top of AGSMapView. In the View Controller MapView and the UIButton are under "View". The UIbutton is not a subview of MapView. How do I get other UI element in my view to be visible on top of the map. I have three other elements that I hide and unhide using "isHidden = true/false" and these cannot be displayed either. Code in Swift 4.2. Here is the view: Here is the code snippet: let viewMap = AGSMapView(frame: .zero) viewMap.map = AGSMap(basemapType: .navigationVector, latitude: currentLocation.latitude, longitude: currentLocation.longitude, levelOfDetail: zoomLevel) viewMap.graphicsOverlays.add(overlay) viewMap.touchDelegate = self view = viewMap view.bringSubviewToFront(btnSatelliteToggle)
... View more
09-17-2019
08:24 PM
|
0
|
1
|
501
|
Title | Kudos | Posted |
---|---|---|
1 | 12-04-2019 10:58 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|