|
POST
|
Hi Ken, Yes this can be easily done. Basically, you need to check if the geodatabase exists. Since the app defines the geodatabase name. It needs to check for the same geodatabase. Infact you can also do just the sync if you would like so that app does a sync if are any changes between the local geodatabase copy and the online feature service. The workflow would be as soon as the application loads use serviceInfoTask.fetchFeatureServiceInfo(); And check if the geodatabse exists. If yes then you can directly add the layer else generate the geodatabase. // Property to check if sync needs to be performed automatically
property bool syncEnabledInApp:false
Component.onCompleted: {
statusText.text = "Getting service info";
// If online
// Check for the local version if not available download one
// If available perform sync if auto sync is enabled
if(isAppOnline)
serviceInfoTask.fetchFeatureServiceInfo();
// If offline use the local version only
}
FileInfo{
id:fileInfo
filePath: gdbPath
}
ServiceInfoTask {
id: serviceInfoTask
url: featuresUrl
onFeatureServiceInfoStatusChanged: {
if (featureServiceInfoStatus === Enums.FeatureServiceInfoStatusCompleted) {
if(!serviceInfoTask.featureServiceInfo.isSyncEnabled){
statusText.text = qsTr("Error- Feature Service doesn't have sync capability."); return;
}
if(!serviceInfoTask.featureServiceInfo.layers[layerId].hasAttachments){
console.log("has no attachments")
statusText.text = qsTr("Error- Feature Layer doesn't support attachments.");
return;
}
//TODO: get the correct layer ID-unique one
//Get the featureservice name to append to the geodatabase.
statusText.text = qsTr("Feature Service info received for ",serviceInfoTask.featureServiceInfo.layers[layerId].name);
gdbPath = dataPath + serviceInfoTask.featureServiceInfo.layers[layerId].name + ".geodatabase"
console.log(gdbPath)
if(fileInfo.exists){
// perform sync -' Download only '
gdb.syncGeodatabaseParameters.syncDirection = Enums.SyncDirectionDownload
console.log("GDB valid ",gdb.valid)
if(gdb.valid){
if(syncEnabledInApp){
console.log("performing sync")
geodatabaseSyncTask.syncGeodatabase(gdb.syncGeodatabaseParameters, gdb);
busyIndicator.visible = true;
statusText.text = qsTr("Checking for any updates to download..");
}else{
// Add Local feature layer
offLineLayer.featureTable = local
mainMap.addLayer(offLineLayer)
}
}
}
else{
// Generate Geodatabase
generateGeodatabaseParameters.initialize(serviceInfoTask.featureServiceInfo);
generateGeodatabaseParameters.extent = mainMap.extent;
generateGeodatabaseParameters.returnAttachments = true;
busyIndicator.visible = true;
geodatabaseSyncTask.generateGeodatabase(generateGeodatabaseParameters, gdbPath,false);
statusText.text = qsTr("Downloading features with attachments for offline use..please wait");
}
} else if (featureServiceInfoStatus === Enums.FeatureServiceInfoStatusErrored) {
statusText.text = "Error:" + errorString;
//cancelButton.text = "Start Over";
}
}
} Note:- It is up to app developer to provide a unique name for geodatabase in case everytime different feature service is being used. So that app knows which geodatabase corresponds to which feature service I hope this helps, Nakul
... View more
05-08-2017
09:26 AM
|
0
|
8
|
2264
|
|
POST
|
I just did a build for iOS and I didn't get any such error. Make sure you have updated your app (click upload before doing a build) in the cloud. -Nakul
... View more
05-05-2017
09:49 AM
|
0
|
0
|
2408
|
|
POST
|
This is currently a known issue at our end. And we are in a process of fixing it. The workaround is it log into your arcgis online account > My Content> My Apps. You should be able to download it this way. -Nakul
... View more
05-04-2017
02:22 PM
|
0
|
1
|
970
|
|
POST
|
Yes this is by design. Because the credentials (encrypted) get stored locally on the device in the settings file. And it continues to use the credentials once the token expires. In the next release we are adding the Logout functionality which will let user to clear the credentials on the client. In the current version 1.4 if you are using on desktop, if you would like you can go ahead and delete the cache folder and the settings file under settings folder. The settings file name is same as the app id. This should clear the credentials C:\Users\<user>\ArcGIS\AppStudio I hope this helps. Nakul
... View more
05-04-2017
01:56 PM
|
0
|
0
|
497
|
|
POST
|
Please change the line from map.addLayer(featureLayer); to map.insertLayer(featureLayer,1);
and this should fix the problem. It seems like Runtime is adding a layer but unable to index it correctly and hence crashing.
-Nakul
... View more
04-24-2017
05:36 PM
|
0
|
0
|
739
|
|
POST
|
You can have a secured Feature Layer from either an ArcGIS Org account or ArcGIS Server. If you are using website to create an application. There is no cost. If you are using App Studio Desktop, just make sure you have a standard license.
... View more
04-24-2017
08:14 AM
|
0
|
3
|
3280
|
|
POST
|
Sign in will only show for a secured feature layer. For instance if you try this secured featurelayer (id=0) it should show sign in dialog. http://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire_secure_ac/FeatureServer
... View more
04-21-2017
04:21 PM
|
1
|
5
|
3280
|
|
POST
|
If you create a new app (you need to sign in first) using QuickReport template from AppStudio for ArcGIS. It will be based on version 1.4. Alternatively, if you download the Appstudio desktop 1.4 AppStudio for ArcGIS | ArcGIS. You can create Quick Report app 1.4 using our template. -Nakul
... View more
04-21-2017
12:58 PM
|
1
|
7
|
3280
|
|
POST
|
That is expected as the single point geometry doesn't have an extent ( as min x,y and max x,y has same values). What you would have to do is to create a virtual extent around the point geometry and then zoom to that extent. Another way is to create a buffer geometry (invisible- don't add it as graphic) around that point and then zoom to that buffer geometry. Nakul
... View more
04-10-2017
08:29 AM
|
2
|
1
|
4415
|
|
POST
|
If you want only one address then you check for the score condition within the results and don't include if the score is not 100. I see based on your Geocode service I am getting lots of results with score >90. Hence I would recommend ( result.score <100) then it will include only one record. http://maps.dhalahore.org/ArcGIS/rest/services/DHAMAP/AddressLocator/GeocodeServer/findAddressCandidates?SingleKey=3+Z+1… else {
for (var i = 0; i < geocodeResults.length; i++) { var result = geocodeResults[i];
if (result.score <100)
return;
var graphic = locationGraphicGeocode.clone() graphic.geometry = result.location; graphicsLayerGeocode.addGraphic(graphic); } Hope this helps, Nakul
... View more
04-07-2017
08:30 AM
|
2
|
1
|
4415
|
|
POST
|
Hi there,
There are couple of issues here, directly related to your Geocoding service.
1) Your geocoding service is based on server 10.0 and hence only supports FindAddressCandidates. Therefore you should be using
locator.geocode() method to perform Geocoding. This method calls the FindAddressCandidates operation
2) Based on your service address field. It currently takes Single Address labelled as "SingleKey". Hence you should only use that as your Address field parameter.
I have added these suggestions in your code and pasted below for your reference.
I hope this helps.
Thank you.
Nakul App { id: app width: 800 height: 532 property double scaleFactor: AppFramework.displayScaleFactor property string errorMsg Map { id: mainMap anchors.fill: parent extent: usExtent focus: true ArcGISTiledMapServiceLayer { url: "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" } SimpleMarkerSymbol { id: simpleMarkerSymbolLocation color: "red" style: Enums.SimpleMarkerSymbolStyleCross size: 10 } SimpleMarkerSymbol { id: simpleMarkerSymbolReverseLocation color: "blue" style: Enums.SimpleMarkerSymbolStyleDiamond size: 10 } GraphicsLayer { id: graphicsLayerGeocode } GraphicsLayer { id: graphicsLayerReverse } Graphic { id: locationGraphicReverse symbol: simpleMarkerSymbolReverseLocation } Graphic { id: locationGraphicGeocode symbol: simpleMarkerSymbolLocation } Envelope { id: usExtent xMax: 8380686 yMax: 3594113 xMin: 8180686 yMin: 3794113 spatialReference: mainMap.spatialReference } onMouseClicked: { graphicsLayerReverse.removeAllGraphics(); var graphic1 = locationGraphicReverse.clone(); graphicsLayerReverse.addGraphic(graphic1); graphic1.geometry = mouse.mapPoint locator.reverseGeocode(mouse.mapPoint, 500, mainMap.spatialReference); } } ServiceLocator { id: locator url: "http://maps.dhalahore.org/ArcGIS/rest/services/DHAMAP/AddressLocator/GeocodeServer" onGeocodeStatusChanged: { console.log("geocode address found") if(geocodeStatus === Enums.GeocodeStatusCompleted){ progressBar.visible = false; if(geocodeResults.length < 1){ showError("No address Found"); } else { for (var i = 0; i < geocodeResults.length; i++) { var result = geocodeResults[i]; var graphic = locationGraphicGeocode.clone() graphic.geometry = result.location; graphicsLayerGeocode.addGraphic(graphic); } mainMap.zoomTo(graphic.geometry); } }else if (geocodeStatus === Enums.GeocodeStatusErrored) { progressBar.visible = false; showError(geocodeError.message + "\n No Address Found"); } } onReverseGeocodeStatusChanged: { if (reverseGeocodeStatus === Enums.ReverseGeocodeStatusCompleted) { searchBox.descriptionTextVisibility = true; searchBox.descriptionTextInput = "Address: " var address = reverseGeocodeResult.addressFields["SingleKey"]; } else if (reverseGeocodeStatus === Enums.ReverseGeocodeStatusErrored) { showError(reverseGeocodeError.message + "\nNo Address Found"); searchBox.descriptionTextVisibility = false; } } } /*----------------------------------------------------------------------------------------------------------------------- Search button / box ---------------------------------------------------------------------------------------------------------------------*/ SearchBox { id: searchBox anchors { left: parent.left top: parent.top margins: 20 * scaleFactor } onSearch: { graphicsLayerGeocode.removeAllGraphics(); var add = {"SingleKey": searchBox.searchTextInput} locator.geocode(add,"*",mainMap.spatialReference) progressBar.visible = true; } onClear: { mainMap.extent = usExtent; mainMap.mapRotation = 0; graphicsLayerGeocode.removeAllGraphics(); graphicsLayerReverse.removeAllGraphics(); searchBox.descriptionTextInput = ""; searchBox.searchTextInput.focus = true; searchBox.descriptionTextVisibility = false; searchBox.searchTextInput = ""; } Keys.onReturnPressed: { graphicsLayerGeocode.removeAllGraphics(); var add = {"SingleKey": searchBox.searchTextInput} locator.geocode(add,"*",mainMap.spatialReference) progressBar.visible = true; Qt.inputMethod.hide(); } } Row { anchors { horizontalCenter: parent.horizontalCenter bottom: mainMap.bottom bottomMargin: 5 * scaleFactor } ProgressBar { id: progressBar indeterminate: true visible: false } } MessageDialog { id: messageDialog title: "Error" icon: StandardIcon.Warning modality: Qt.WindowModal standardButtons: StandardButton.Ok text: errorMsg } Rectangle { id: rectangleBorder anchors.fill: parent color: "transparent" border { width: 0.5 * scaleFactor color: "black" } } function showError(errorString) { errorMsg = errorString; messageDialog.visible = true; } }
... View more
04-05-2017
10:32 AM
|
2
|
3
|
4415
|
|
POST
|
Hi there, When you are offline. It will use your device GPS to determine your current location. Yes, in offline mode Map won't be available but your location will be stored based on your device GPS. When you get back to area where you have the network. You can go back and check the draft location it should show the stored GPS location at the time of the point of interest collection. -Nakul
... View more
04-03-2017
08:10 AM
|
0
|
0
|
1357
|
|
POST
|
Great! The local notification is in works for the next release. Will have more updates as we come closer to release which is not until UC 2017. -Nakul
... View more
03-31-2017
08:27 AM
|
0
|
2
|
2823
|
|
POST
|
Please take a look at our Local Geocode sample which demonstrates how to license your app with the Standard ArcGIS Runtime license. Recommended way is to license your app at the "App" level before you make calls to the ArcGIS Runtime objects Component.onCompleted: { //ArcGISRuntime.license.setLicense("enter your licence string here to be able run this sample in player or as standalone app. Without this, the app can be run in AppStudio only in developer mode."); logLicenseLevel(); localLocator = ArcGISRuntime.createObject("LocalLocator", {path: copyLocalData()}); console.log(localLocator.json) } function logLicenseLevel() { if (ArcGISRuntime.license.licenseLevel === Enums.LicenseLevelBasic) { console.log("basic") licenceLevel.text = "Basic" } else if (ArcGISRuntime.license.licenseLevel === Enums.LicenseLevelStandard) { console.log("standard") licenceLevel.text = "standard" } else if (ArcGISRuntime.license.licenseLevel === Enums.LicenseLevelDeveloper) { console.log("developer") licenceLevel.text = "developer" } Hope this helps. Nakul
... View more
03-27-2017
08:56 AM
|
1
|
0
|
1129
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-30-2022 08:20 AM | |
| 1 | 06-06-2017 09:24 AM | |
| 1 | 11-19-2019 05:32 PM | |
| 1 | 09-29-2017 04:37 PM | |
| 1 | 12-20-2017 11:02 AM |
| Online Status |
Offline
|
| Date Last Visited |
01-29-2026
08:38 AM
|