|
BLOG
|
Each of our Example Apps is designed to provide some inspiration for your own. If you’re interested in building your own custom app because one of our off-the-shelf apps isn’t quite right for you, then the Example Apps are a great place to start. With the Maps App for iOS, we show how you might build the foundation of your own ArcGIS Runtime mapping app using Swift. The open source app (which you can download and build from GitHub) highlights fundamental Runtime functionality and showcases some approaches to coding against asynchronous services. It includes a robust internal framework and a modern, decoupled UI. In later posts, we’ll take a look at the UI/UX and what it took to put the app together, but for now let’s take a look at using the app. Search & Geocode To search, simply start typing into the Search Bar at the top of the screen. As you type, you’ll see suggestions appear, and you can either pick a suggestion or search for the text you’ve typed. By default, you can search for places or addresses using the ArcGIS World Geocoder, and the suggestions will prioritize matches close to the center of the map. Reverse Geocode If you tap and hold on the map, you’ll see a magnifier. Use this to pick a point on the map and when you’re done, you’ll get the address of that point. Turn-by-turn Directions Whether you’ve searched or reverse-geocoded, the results panel includes a “Directions” button. Tap this to calculate directions from your current location to the search result. At the top of the screen you’ll see an overview of the entire route, and at the bottom you can see turn-by-turn directions. Just swipe through them and the map will update to display the current step. If you ever want to go back to the entire route, simply tap the route summary at the top of the screen. Note: Since the routing service consumes ArcGIS credits, you'll need to log in to get directions. The ArcGIS Runtime includes a Credentials Cache and by default, if you've already logged in, the Runtime is able to intelligently make use of cached credentials to avoid prompting you for a login. Switch Basemaps The application also allows you to pick from a set of basemaps. If you are logged in to an ArcGIS Organization or to an ArcGIS Portal, then the list of basemaps will reflect those configured for your account. If not, then you'll get to pick from the default ArcGIS basemaps. Browse your Web Maps The last bit of functionality the app provides is the ability to browse and open your Web Maps. When logged in to ArcGIS the Maps App makes use of the Runtime Portal API to query your content and present you with a list of Web Maps. Simply tap one to open it in the app. What did we learn building this functionality? There are some interesting points to consider from all this. Authentication In the case of getting directions and browsing Web Maps, the user must log in. But how should your app behave when the user isn't logged in? When not logged in, we decided to allow the user to search and geocode using the ArcGIS World Geocoding Service (which is free to use, as long as you're not storing the results). But once the user is logged in, the Maps App uses the Portal API to determine which Geocoding Service and Routing Service to use and, as mentioned above, which basemaps to list. Your ArcGIS Organization's Administrator can configure these settings, so it's important that your app reads and honors that configuration. Lastly, consider how a user should be prompted to log in. For the Maps App we opted to make use of the ArcGIS Runtime's integration with OAuth 2.0, which made implementing login really straightforward. iOS Location Permissions It's also important for an iOS app to behave properly if the user hasn't enabled Location Services or has explicitly denied the app access to their location. When possible, asking for directions will get directions from the current location, but if that's not available then the app will get directions from the center of the current map view.
... View more
10-19-2017
07:45 PM
|
0
|
8
|
2751
|
|
POST
|
Hi Chirag, To center the map on the marker, yes, you should use the setViewpointCenter:completion:() method on AGSMapView and display the callout in the completion block to the above method. Since this is a point graphic, you can pass in the graphic's geometry. That'll animate the map view to put the marker in the center. Could you provide more information on the callout display glitch please? Does it happen on both the simulator and the device? I'll try it out here to see if it's something obvious but would be helpful to get more details. Cheers, Nick.
... View more
10-09-2017
07:39 PM
|
1
|
0
|
804
|
|
POST
|
Probably best to post a question like that over on the ArcGIS API for JavaScript space. But if your previous require statement worked, this will work too. Since you're getting started with the APIs, perhaps take a look at the Develop sections of the DevLabs and Hackerlabs (including the 3.x labs).
... View more
06-14-2017
06:14 AM
|
0
|
0
|
1426
|
|
POST
|
There is a free Geometry Service, but in many cases now you do not need it since the 3.x geometryEngine and 4.x geometryEngine can do much of the work in the browser. It's quicker that way and doesn't require a network request. If you still need functionality of the GeometryService, you can find a reference to a hosted GeometryService in the documentation for the GeometryService task (3.x, 4.x). However, I recommend using the geometryEngine where possible. P.S. I'll see if we can get this thread moved to the JS API forum.
... View more
06-14-2017
06:04 AM
|
1
|
0
|
1845
|
|
POST
|
No problem . The following should get you the radius in meters: var radius = geometryEngine.distance(geometry.getCentroid(),geometry.getPoint(0,0),"meters");
... View more
06-14-2017
05:59 AM
|
0
|
0
|
1426
|
|
POST
|
Ah. That's a very different question. You should use Polygon.getCentroid() to get the centerpoint of the circle. Then use Polygon.getPoint(0,0) to get a Point from the circle and use geometryEngine.distance() between the two points to determine the radius. That assumes you used the Draw.CIRCLE type when you call draw.activate(). Please note that you appear to be using the draw-end event and it seems that is deprecated in favor of the draw-complete event.
... View more
06-14-2017
05:44 AM
|
0
|
0
|
1426
|
|
POST
|
You can do the same thing. Use the JavaScript GeometryEngine. See geometryEngine GeodesicBuffer which will give you a circular polygon back around the center point, and you can then use Graphic and GraphicsLayer to add these to your MapView.
... View more
06-13-2017
10:04 PM
|
0
|
2
|
3772
|
|
BLOG
|
Hey Nicole, Sorry for the slow reply. Not sure how to do that off the top of my head, because I'm not familiar with Web App Builder but if it's the developer edition then you should be able to include custom JS in the app header and use something like the code here to parse the URL and then window.open() to open a fresh URL passing appropriate parameters. I'm assuming you want to open the different app in a new window, but I think this should help. If you got it figured out, please let me know how you did it. Also, it might be worth posting the question in https://community.esri.com/community/gis/web-gis/web-appbuilder's GeoNet space. Cheers, Nick.
... View more
05-26-2017
01:42 PM
|
0
|
0
|
757
|
|
POST
|
Yep. I agree. Keeping a reference is usually the right approach. In very rare cases I've found the need to pass AGSGraphicsOverlay objects around and not necessarily know where they came from or who they belonged to but still know a little about them. In that case you could extend the AGSGraphicsOverlay class something like this: extension AGSGraphicsOverlay {
fileprivate struct AssociatedKeys {
static var referenceNameKey = "geodev_referenceName"
}
var referenceName:String? {
get {
return objc_getAssociatedObject(self, &AssociatedKeys.referenceNameKey) as? String
}
set {
objc_setAssociatedObject(self, &AssociatedKeys.referenceNameKey, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
}
}
For more info on associated objects and Swift, see here.
... View more
05-05-2017
01:00 PM
|
1
|
1
|
1032
|
|
POST
|
Impossible to say without more information, but I can take a guess. It sounds like you might be creating a desktop locator rather than a Runtime locator, depending on your Python code, but I don't know if you can't open it or you can't call it. If I were you I would generate an MMPK as I outline above (you can of course use Python to do that). That will include your locator ready for runtime use which you can access off the LocatorTask property of the MMPK. It'll also include the VTPK. A benefit there is that the basemap and locator will packaged together and you don't have to worry about deploying them both. But really this is beyond the scope of this thread. You should contact support who can walk you through figuring out the issue.
... View more
04-20-2017
11:05 AM
|
0
|
2
|
1845
|
|
POST
|
Hi Kamal, I would open a support ticket, or ask in the ArcGIS Pro forum. It'll be a balance for the time being. Once we support taking a Vector Tile Service offline from ArcGIS Online, you will be well served by the ArcGIS Online basemap and features approach. However, given the size of the TPKs if you include levels up to level 20 (which may be related to the error you are seeing in 1), if I were you I would use a side-loaded Vector Tile Package on the device. Of course, as you say, locator will still need to be generated in ArcGIS Pro. Yes, when you create an MMPK or export data, you will have options to clip to a given area. That might be the visible map area or some other area you define. That should allow you to export only the area you need. I will check whether the same is true for the locator and will update this answer. [UPDATE: Yes, the locator and network model are clipped appropriately, see the post script below]. Cheers, Nick. P.S. Here are instructions for exporting just the part you need to an MMPK (assuming you've already got the source MMPK open in Pro - I used the USA Northeast Region, but more instructions are here and here😞 Open the Analysis Tab. Pick “Tools” to show the GP Tool browser on the right. Find and select the “Create Mobile Map Package” tool. Specify an output MMPK. This is what you will use in the Runtime app. Specify a locator. USA comes with the source MMPK and will be clipped with the data. Check the “Clip Features” box to exclude data outside of the extent we’ll set up. Set up the extent. The drop-down has convenient options. Here I’ve zoomed the map display to what I want and I pick “Current Display Extent”. Click Run. As long as you’re properly licensed to use StreetMap Pro (your Org Admin must enable this), in a bit you’ll have an MMPK (see step 4) that includes Routing and Geocoding.
... View more
04-13-2017
12:28 PM
|
1
|
5
|
1845
|
|
POST
|
Hi Kamal, A reply of yours (which you now seem to have replaced with this one) said you have licensed Streetmap Premium North America. That leads me to wonder why you are using ArcGIS Online at all. You have the source data to generate MMPKs (including geocoder and network model) of just the area you need, so I don't see that publishing to ArcGIS Online and then taking the data offline buys you anything. In that reply you also asked about TPKs vs VTPKs. Since you have the source data, and you want to go offline, I would go for VTPKs if at all possible. These are much smaller, take a much shorter time to create, and are rendered at the best resolution your device can manage. This code will get you roughly to Manhattan. Play with the scale and lat/long to start exactly where you want: self.map.initialViewpoint = AGSViewpoint(latitude: 40.7128, longitude: -74.0059, scale: 200000) Also take a look at the Bookmarklets here. Add the "Get Map Info" bookmarklet to your browser's favorites bar, then open the ArcGIS Online map viewer and navigate to the map area you want. Click the bookmarklet favorite and you'll get a display of some map info. Cheers, Nick. P.S. A couple of observations: you seem to be deleting and replacing replies (e.g. the one that mentioned StreetMap Premium and asked about TPKs vs VTPKs), and this topic has strayed to other topics that would be better discussed in another forum, DM, or by opening a support ticket (especially the case of "Staging failed" which we'll need much more log info to diagnose). Keeping discussions in the right place improves the chance that other people can benefit from them.
... View more
04-07-2017
12:23 PM
|
2
|
8
|
1816
|
|
POST
|
Absolutely. So far we've been talking about taking existing data that you've obtained elsewhere as a CSV or Shapefile, but it sounds like you actually might simply want an empty FeatureService+Layer for redlining (or perhaps one for points, one for lines, and one for polygons). You can do this at the developer portal (log in with your org credentials). This will give you a lot of control over attribute names and types that go with each record. This DevLab explains how to do that: Create a new dataset Once you create a layer through the developer portal you will see it in the main ArcGIS Online My Content browser. But there is another option that might work for you. You can create a Feature Layer directly in the My Content browser from a Template. Select Create->Feature Layer, and look at the From Template tab. There's a Road Closures template that could work for you. Here's a blog post about that functionality. [Update: Here's the documentation on that too] Nick P.S. I recommend you take a look at all the DevLabs, but in particular the Data section sounds like it could be useful to you.
... View more
04-04-2017
11:56 AM
|
0
|
11
|
1816
|
|
POST
|
Hi Kamal, If the layers are based off CSVs, that's correct. If they're based off Shapefiles, my above description will get you a single Service with multiple Layers without using ArcMap or ArcGIS Pro. But I'm not sure I understand "customize shapefile at own level". Perhaps you mean modifying shapefiles (changing data, adding or removing fields)? If so, there is some limited stuff you can do in the browser. You can of course edit data and then you can export a FeatureLayer as a Shapefile using the Extract Data analysis tool. In fact, you might be able to use this workflow to upload multiple CSVs, extract them as multiple Shapefiles which you would then put into one folder locally before zipping and uploading that to create a single Service with multiple Layers. It's convoluted, but it should work. You're also able to add and delete fields from a Feature Layer if you own it. This is done from the Table View in the ArcGIS Online Map Viewer. In general, the Desktop tools significantly simplify many of these workflows. With Desktop you have good ways to script these workflows too with arcpy, although the new ArcGIS API for Python might be worth looking at for scripting some of this ArcGIS Online administration without a need for Desktop. Hope that helps, Nick
... View more
04-04-2017
07:51 AM
|
0
|
13
|
1816
|
|
POST
|
Hey Kamal, Services with Multiple Layers For creating multiple layers within one service from CSVs, as Yue mentions you currently have to use the Desktop tools. There are plans for an enhancement to enable this without Desktop tools but I don't have a timeline. If you had Shapefiles instead of CSVs, you could combine the Shapefiles for each layer you want in a single folder, zip up that folder, and upload it. The zip file name will determine the Service name and each Shapefile will become a Layer within that Service (note: a "Shapefile" is made up many constituent parts - you would combine all those parts from all the Shapefiles in one flat folder, zip that up and upload it). I did that here (here is the REST endpoint). Additionally, if you uploaded a File Geodatabase, that can be published as a Service with many Layers. REST Actions to Create Replica When you use the Runtime's AGSGeodatabaseSyncTask, it's using the REST Create Replica endpoint behind the scenes. Since you're using the Runtime you don't have to worry about this as it wraps all that up for you. Yue was just referring to that. I would add to Yue's response below that you don't need to dig into the REST APIs if you're OK with the Runtime SDK samples, but if you really want to get into the weeds, use the REST docs as reference. Incidentally, you might find these two videos from the recent Developer Summit useful if you want to find out more about your options for working offline with the Runtime: ArcGIS Runtime: Working with Maps Online and Offline and ArcGIS Runtime: Editing Your Data Online and Offline Cheers, Nick.
... View more
04-03-2017
07:49 PM
|
0
|
15
|
1816
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | yesterday | |
| 2 | 2 weeks ago | |
| 4 | 3 weeks ago | |
| 1 | 01-29-2026 09:39 AM | |
| 1 | 12-17-2025 10:12 AM |