Find places of interest near a location or within a specific area.

Use case
When getting directions or looking for nearby places, users may only know what the place has (“food”), the type of place (“gym”), or the generic place name (“Starbucks”), rather than the specific address. You can get suggestions and locations for these places of interest (POIs) using a natural language query. Additionally, you can filter the results to a specific area.
How to use the sample
Choose a place of interest to enter in the first field and an area to search within in the second field. Click the magnifying glass or hit enter to search and show the results of the query on the map from your current extent. Click on a result pin to show its name and address. If you pan away from the result area, a “Redo search in this area” button will appear. Click it to query again for the currently viewed area on the map.
How it works
- Create a
LocatorTaskusing a URL to a locator service. - Find the location for an address (or city name) to build an envelope to search within:
- Create
GeocodeParameters. - Add return fields to the parameters’
resultAttributeNamescollection. Only add a single ”*” option to return all fields. - Call
locatorTask::geocodeWithParametersAsync(locationQueryString, geocodeParameters)to get a list ofGeocodeResults. - Use the
displayLocationfrom one of the results to build anEnvelopeto search within.
- Create
- Get place of interest (POI) suggestions based on a place name query:
- Create
SuggestParameters. - Add “POI” to the parameters’
categoriescollection. - Call
locatorTask::suggestions()to get a list ofSuggestResults. - The
SuggestResultwill have alabelto display in the search suggestions list.
- Create
- Use one of the suggestions or a user-written query to find the locations of POIs:
- Create
GeocodeParameters. - Set the parameters’
searchAreato the envelope. - Call
locatorTask::geocodeWithParametersAsync(suggestionLabelOrPlaceQueryString, geocodeParameters)to get a list ofGeocodeResults. - Display the places of interest using the results’
displayLocations.
- Create
Relevant API
- GeocodeParameters
- GeocodeResult
- LocatorTask
- SuggestParameters
- SuggestResult
About the data
This sample uses the World Geocoding Service.
Tags
businesses, geocode, locations, locator, places of interest, POI, point of interest, search, suggestions
Sample Code
// [WriteFile Name=FindPlace, Category=Search]// [Legal]// Copyright 2017 Esri.//// Licensed under the Apache License, Version 2.0 (the "License");// you may not use this file except in compliance with the License.// You may obtain a copy of the License at// http://www.apache.org/licenses/LICENSE-2.0//// Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.// See the License for the specific language governing permissions and// limitations under the License.// [Legal]
#ifdef PCH_BUILD#include "pch.hpp"#endif // PCH_BUILD
// sample headers#include "FindPlace.h"
// ArcGIS Maps SDK headers#include "AttributeListModel.h"#include "CalloutData.h"#include "GeoElement.h"#include "GeocodeResult.h"#include "GeometryEngine.h"#include "Graphic.h"#include "GraphicListModel.h"#include "GraphicsOverlay.h"#include "GraphicsOverlayListModel.h"#include "IdentifyGraphicsOverlayResult.h"#include "Location.h"#include "LocationDisplay.h"#include "LocatorTask.h"#include "Map.h"#include "MapQuickView.h"#include "MapTypes.h"#include "MapViewTypes.h"#include "PictureMarkerSymbol.h"#include "Point.h"#include "SimpleRenderer.h"#include "SpatialReference.h"#include "SuggestListModel.h"#include "SuggestParameters.h"#include "Viewpoint.h"
// Qt headers#include <QFuture>#include <QMetaObject>#include <QPermissions>#include <QUrl>#include <QUuid>
using namespace Esri::ArcGISRuntime;
FindPlace::FindPlace(QQuickItem* parent /* = nullptr */): QQuickItem(parent){}
FindPlace::~FindPlace(){ m_mapView->locationDisplay()->stop();}
void FindPlace::init(){ // Register the map view for QML qmlRegisterType<MapQuickView>("Esri.Samples", 1, 0, "MapView"); qmlRegisterType<FindPlace>("Esri.Samples", 1, 0, "FindPlaceSample"); qmlRegisterUncreatableType<CalloutData>("Esri.Samples", 1, 0, "CalloutData", "CalloutData is an uncreatable type"); qmlRegisterUncreatableType<QAbstractListModel>("Esri.Samples", 1, 0, "AbstractListModel", "AbstractListModel is uncreateable");}
void FindPlace::componentComplete(){ QQuickItem::componentComplete();
// find QML MapView component m_mapView = findChild<MapQuickView*>("mapView");
// Create a map using the topographic basemap m_map = new Map(BasemapStyle::ArcGISTopographic, this);
// Set map to map view m_mapView->setMap(m_map);
// create the locator createLocator();
// add the graphics overlay addGraphicsOverlay();
// initialize callout m_mapView->calloutData()->setVisible(false); m_calloutData = m_mapView->calloutData();
connectSignals();
// workaround for https://bugreports.qt.io/browse/QTBUG-134211 // do not request permissions from componentComplete QMetaObject::invokeMethod(this, [this](){ initiateLocation(); }, Qt::QueuedConnection);}
void FindPlace::connectSignals(){ connect(m_mapView, &MapQuickView::mousePressed, this, [this](QMouseEvent& /*event*/) { emit hideSuggestionView(); });
connect(m_mapView, &MapQuickView::viewpointChanged, this, [this]() { emit hideSuggestionView(); if (m_graphicsOverlay->graphics()->size() > 0) emit showExtentButton(); });
// perform an identify operation on mouse clicked connect(m_mapView, &MapQuickView::mouseClicked, this, [this](QMouseEvent& e) { emit hideCallout(); m_mapView->identifyGraphicsOverlayAsync(m_graphicsOverlay, e.position(), 5, false, 1).then(this, [this] (IdentifyGraphicsOverlayResult* result) { if (result->graphics().length() == 0) return;
// display the callout with the identify result Graphic* graphic = result->graphics().at(0); m_calloutData->setGeoElement(graphic); m_calloutData->setTitle(graphic->attributes()->attributeValue("ShortLabel").toString()); m_calloutData->setDetail(graphic->attributes()->attributeValue("Place_addr").toString()); emit showCallout(); }); });}
void FindPlace::initiateLocation(){ QLocationPermission locationPermission{}; locationPermission.setAccuracy(QLocationPermission::Accuracy::Precise); locationPermission.setAvailability(QLocationPermission::Availability::WhenInUse);
switch (qApp->checkPermission(locationPermission)) { case Qt::PermissionStatus::Undetermined: qApp->requestPermission(locationPermission, this, &FindPlace::initiateLocation); return; case Qt::PermissionStatus::Denied: emit locationPermissionDenied(); return; case Qt::PermissionStatus::Granted: m_mapView->locationDisplay()->setAutoPanMode(LocationDisplayAutoPanMode::Recenter); m_mapView->locationDisplay()->start(); return; }}
void FindPlace::addGraphicsOverlay(){ // add a graphics overlay to the mapview m_graphicsOverlay = new GraphicsOverlay(this); m_mapView->graphicsOverlays()->append(m_graphicsOverlay);
// create a renderer for graphics representing geocode results PictureMarkerSymbol* pinSymbol = new PictureMarkerSymbol(QUrl("qrc:/Samples/Search/FindPlace/red_pin.png"), this); pinSymbol->setHeight(36); pinSymbol->setWidth(19); pinSymbol->setOffsetY(pinSymbol->height() / 2); SimpleRenderer* simpleRenderer = new SimpleRenderer(pinSymbol, this); m_graphicsOverlay->setRenderer(simpleRenderer);}
void FindPlace::createLocator(){ // create a locator task that uses the world geocoding service m_locatorTask = new LocatorTask(QUrl("https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer"), this);
// set the suggestions Q_PROPERTY m_suggestListModel = m_locatorTask->suggestions(); emit suggestionsChanged();}
void FindPlace::onGeocodingCompleted_(const QList<GeocodeResult>& results){ // if we are converting the location string to a Point, re-geocode with that information, // and don't add any graphics to the map if (m_isSearchingLocation) { m_isSearchingLocation = false; if (results.length() == 0) return;
GeocodeResult topLocation = results.at(0); geocodePOIs(m_poiSearchText, topLocation.displayLocation()); return; }
// create graphics for each geocode result if (results.length() == 0) return;
m_graphicsOverlay->graphics()->clear();
// delete parent if it exists if (m_graphicParent) { delete m_graphicParent; m_graphicParent = nullptr; } m_graphicParent = new QObject(this);
Geometry bbox; for (const GeocodeResult& result : results) { Graphic* graphic = new Graphic(result.displayLocation(), result.attributes(), m_graphicParent); m_graphicsOverlay->graphics()->append(graphic); // create bounding box so we can set the viewpoint at the end if (bbox.isEmpty()) bbox = graphic->geometry(); else bbox = GeometryEngine::unionOf(bbox, graphic->geometry()); } // zoom to the bounding box m_mapView->setViewpointGeometryAsync(bbox, 40);}
void FindPlace::setPoiTextHasFocus(bool hasFocus){ if (m_poiTextHasFocus == hasFocus) return;
m_poiTextHasFocus = hasFocus;
// create and update the suggestion parameters SuggestParameters suggestParams; // the Points of Interest suggestions should use the POI category, and the location // suggestions should use the Populated Place category as filters QStringList categories; m_poiTextHasFocus ? categories << "POI" : categories << "Populated Place"; suggestParams.setCategories(categories); suggestParams.setMaxResults(5); if (m_locatorTask) m_locatorTask->suggestions()->setSuggestParameters(suggestParams); emit poiTextHasFocusChanged();}
// set the suggestion search text to fetch suggestionsvoid FindPlace::setSuggestionsText(const QString& searchText){ if (!m_suggestListModel) return;
SuggestListModel* suggestListModel = dynamic_cast<SuggestListModel*>(m_suggestListModel); if (!suggestListModel) return;
suggestListModel->setSearchText(searchText);}
// geocode without any spatial filtervoid FindPlace::geocodePOIs(const QString& poi){ m_poiSearchText = poi; GeocodeParameters params = createParameters(); m_locatorTask->geocodeWithParametersAsync(poi, params).then(this, [this](const QList<GeocodeResult>& results) { onGeocodingCompleted_(results); });}
// use extent to filter the geocode resultsvoid FindPlace::geocodePOIs(const QString& poi, SearchMode mode){ m_poiSearchText = poi;
GeocodeParameters params = createParameters();
// If the Mode is CurrentLocation, use the Location Display as preferred search location if (mode == SearchMode::CurrentLocation) { params.setPreferredSearchLocation(m_mapView->locationDisplay()->location().position()); params.setOutputSpatialReference(m_mapView->locationDisplay()->location().position().spatialReference());
m_locatorTask->geocodeWithParametersAsync(m_poiSearchText, params).then(this, [this](const QList<GeocodeResult>& results) { onGeocodingCompleted_(results); }); } // If the Mode is BoundingGeometry, use the MapView's current viewpoint as the search area else { GeocodeParameters params = createParameters(); Geometry extent = m_mapView->currentViewpoint(ViewpointType::BoundingGeometry).targetGeometry(); params.setSearchArea(extent); params.setOutputSpatialReference(extent.spatialReference());
m_locatorTask->geocodeWithParametersAsync(m_poiSearchText, params).then(this, [this](const QList<GeocodeResult>& results) { onGeocodingCompleted_(results); }); }}
// use a point as a preferred search location for the geocode resultsvoid FindPlace::geocodePOIs(const QString& poi, const Point& location){ m_poiSearchText = poi;
GeocodeParameters params = createParameters(); params.setPreferredSearchLocation(location); params.setOutputSpatialReference(location.spatialReference());
m_locatorTask->geocodeWithParametersAsync(m_poiSearchText, params).then(this, [this](const QList<GeocodeResult>& results) { onGeocodingCompleted_(results); });}
// use a location string as a preferred search location for the geocode resultsvoid FindPlace::geocodePOIs(const QString& poi, const QString& location){ if (location == m_currentLocationText) { geocodePOIs(poi, SearchMode::CurrentLocation); return; } m_poiSearchText = poi; GeocodeParameters params = createParameters();
m_isSearchingLocation = true; m_locatorTask->geocodeWithParametersAsync(location, params).then(this, [this](const QList<GeocodeResult>& results) { onGeocodingCompleted_(results); });}
// create base geocode parametersGeocodeParameters FindPlace::createParameters(){ GeocodeParameters params; params.setResultAttributeNames(QStringList{"*"}); params.setMaxResults(50); params.setMinScore(75.0); return params;}// [WriteFile Name=FindPlace, Category=Search]// [Legal]// Copyright 2017 Esri.//// Licensed under the Apache License, Version 2.0 (the "License");// you may not use this file except in compliance with the License.// You may obtain a copy of the License at// http://www.apache.org/licenses/LICENSE-2.0//// Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.// See the License for the specific language governing permissions and// limitations under the License.// [Legal]
#ifndef FINDPLACE_H#define FINDPLACE_H
// ArcGIS Maps SDK headers#include "Envelope.h"#include "GeocodeParameters.h"#include "Point.h"
// Qt headers#include <QAbstractListModel>#include <QQuickItem>
namespace Esri::ArcGISRuntime{ class CalloutData; class Map; class MapQuickView; class GraphicsOverlay; class LocatorTask; class GeocodeResult;}
class FindPlace : public QQuickItem{ Q_OBJECT
Q_PROPERTY(QAbstractListModel* suggestions MEMBER m_suggestListModel NOTIFY suggestionsChanged) Q_PROPERTY(bool poiTextHasFocus READ poiTextHasFocus WRITE setPoiTextHasFocus NOTIFY poiTextHasFocusChanged)
public: explicit FindPlace(QQuickItem* parent = nullptr); ~FindPlace() override;
enum class SearchMode { CurrentLocation, MapExtent }; Q_ENUM(SearchMode)
void componentComplete() override; static void init(); Q_INVOKABLE void setSuggestionsText(const QString& searchText); Q_INVOKABLE void geocodePOIs(const QString& poi, const QString& location); Q_INVOKABLE void geocodePOIs(const QString& poi, const Esri::ArcGISRuntime::Point& location); Q_INVOKABLE void geocodePOIs(const QString& poi, FindPlace::SearchMode mode); Q_INVOKABLE void geocodePOIs(const QString& poi);
signals: void suggestionsChanged(); void poiTextHasFocusChanged(); void hideSuggestionView(); void hideCallout(); void showCallout(); void showExtentButton(); void locationPermissionDenied();
private: void addGraphicsOverlay(); void createLocator(); void connectSignals(); bool poiTextHasFocus() const { return m_poiTextHasFocus; } void setPoiTextHasFocus(bool hasFocus); Esri::ArcGISRuntime::GeocodeParameters createParameters(); void onGeocodingCompleted_(const QList<Esri::ArcGISRuntime::GeocodeResult>& results); void initiateLocation();
private: Esri::ArcGISRuntime::Map* m_map = nullptr; Esri::ArcGISRuntime::MapQuickView* m_mapView = nullptr; Esri::ArcGISRuntime::GraphicsOverlay* m_graphicsOverlay = nullptr; Esri::ArcGISRuntime::CalloutData* m_calloutData = nullptr; Esri::ArcGISRuntime::LocatorTask* m_locatorTask = nullptr; QAbstractListModel* m_suggestListModel = nullptr; bool m_poiTextHasFocus = true; bool m_isSearchingLocation = false; QString m_poiSearchText; QString m_currentLocationText = QStringLiteral("Current Location"); QObject* m_graphicParent = nullptr;};
#endif // FINDPLACE_H// [WriteFile Name=FindPlace, Category=Search]// [Legal]// Copyright 2017 Esri.//// Licensed under the Apache License, Version 2.0 (the "License");// you may not use this file except in compliance with the License.// You may obtain a copy of the License at// http://www.apache.org/licenses/LICENSE-2.0//// Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.// See the License for the specific language governing permissions and// limitations under the License.// [Legal]
import QtQuickimport QtQuick.Controlsimport QtPositioningimport Esri.ArcGISRuntime.Toolkitimport Esri.Samplesimport QtQuick.Dialogs
FindPlaceSample { id: findPlaceSample clip: true width: 800 height: 600
property bool isSearchingLocation: false property bool searchByExtent: false
onHideSuggestionView: suggestionView.visible = false onHideCallout: callout.dismiss(); onShowCallout: callout.showCallout(); onShowExtentButton: searchExtentButton.visible = true;
// add a mapView component MapView { id: mapView anchors.fill: parent objectName: "mapView"
Component.onCompleted: { // Set the focus on MapView to initially enable keyboard navigation forceActiveFocus(); }
// declare a Callout Callout { id: callout leaderPosition: Callout.LeaderPosition.Automatic calloutData: mapView.calloutData accessoryButtonVisible: false screenOffsetY: -19 } }
Rectangle { anchors { fill: searchColumn margins: -5 } color: "white" }
Column { id: searchColumn anchors { left: parent.left right: parent.right top: parent.top margins: 10 } spacing: 3
// create a text field for the POI search SearchBox { id: poiTextField imageUrl: "qrc:/Samples/Search/FindPlace/find.png" placeholderText: "Point of interest (e.g. Movie Theater)" onTextChanged: { if (text.length > 0 && suggestionView) suggestionView.visible = true; findPlaceSample.setSuggestionsText(text); } onFocusChanged: if (focus) { poiTextHasFocus = true; } onAccepted: { geocodePOIs(poiTextField.text, locationTextField.text); suggestionView.visible = false; callout.dismiss(); } onImageClicked: { geocodePOIs(poiTextField.text, locationTextField.text); suggestionView.visible = false; callout.dismiss(); } }
// create a text field for the location search SearchBox { id: locationTextField imageUrl: "qrc:/Samples/Search/FindPlace/location.png" placeholderText: "In proximity of" text: "Current Location" onTextChanged: { if (text.length > 0 && suggestionView) suggestionView.visible = true; findPlaceSample.setSuggestionsText(text); } onFocusChanged: if (focus) { poiTextHasFocus = false; } onAccepted: { geocodePOIs(poiTextField.text, locationTextField.text); suggestionView.visible = false; } onImageClicked: { locationTextField.text = "Current Location"; geocodePOIs(poiTextField.text, FindPlaceSample.CurrentLocation); suggestionView.visible = false; } }
// create a list view for the suggestion results SuggestionView { id: suggestionView width: parent.width height: 20 * suggestionView.count onSuggestionClicked: label => { // change the text label poiTextField.focus ? (poiTextField.text = label) : (locationTextField.text = label);
// geocode geocodePOIs(poiTextField.text, locationTextField.text);
// dismiss suggestions suggestionView.visible = false; } } }
// create a button that allows the user to re-search the current map extent SearchButton { id: searchExtentButton anchors { horizontalCenter: parent.horizontalCenter bottom: parent.bottom bottomMargin: 23 } visible: searchByExtent onButtonClicked: { geocodePOIs(poiTextField.text, FindPlaceSample.MapExtent); callout.dismiss(); } }
Connections { target: findPlaceSample function onLocationPermissionDenied() { permissionDeniedDialog.open() } }
Dialog { id: permissionDeniedDialog title: "Location Permission Denied" modal: true standardButtons: Dialog.Ok x: (parent.width - width) / 2 y: (parent.height - height) / 2
Text { text: "This application requires location permissions." color: "white" } }}// [WriteFile Name=FindPlace, Category=Search]// [Legal]// Copyright 2017 Esri.//// Licensed under the Apache License, Version 2.0 (the "License");// you may not use this file except in compliance with the License.// You may obtain a copy of the License at// http://www.apache.org/licenses/LICENSE-2.0//// Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.// See the License for the specific language governing permissions and// limitations under the License.// [Legal]
import QtQuickimport QtQuick.Controls
TextField { width: parent.width selectByMouse: true
property url imageUrl signal imageClicked
Rectangle { anchors { verticalCenter: parent.verticalCenter right: parent.right margins: 5 } height: 22 width: height
Image { anchors { fill: parent margins: 2 } source: imageUrl
MouseArea { anchors.fill: parent onClicked: imageClicked() } } }}// [WriteFile Name=FindPlace, Category=Search]// [Legal]// Copyright 2017 Esri.//// Licensed under the Apache License, Version 2.0 (the "License");// you may not use this file except in compliance with the License.// You may obtain a copy of the License at// http://www.apache.org/licenses/LICENSE-2.0//// Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.// See the License for the specific language governing permissions and// limitations under the License.// [Legal]
import QtQuick
Rectangle { property bool pressed: false signal buttonClicked()
width: 175 height: 35 color: pressed ? "#959595" : "#D6D6D6" radius: 5 border { color: "#585858" width: 1 }
Text { anchors.centerIn: parent text: "Redo search in this area" font.pixelSize: 14 color: "#474747" }
MouseArea { anchors.fill: parent onPressed: searchExtentButton.pressed = true onReleased: searchExtentButton.pressed = false onClicked: { buttonClicked(); } }}// [WriteFile Name=FindPlace, Category=Search]// [Legal]// Copyright 2017 Esri.//// Licensed under the Apache License, Version 2.0 (the "License");// you may not use this file except in compliance with the License.// You may obtain a copy of the License at// http://www.apache.org/licenses/LICENSE-2.0//// Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.// See the License for the specific language governing permissions and// limitations under the License.// [Legal]
import QtQuick
Rectangle { color: "#f7f8fa" opacity: 0.85
signal suggestionClicked(var label) property int count: suggestView.count
ListView { id: suggestView model: findPlaceSample.suggestions height: parent.height delegate: Component {
Rectangle { width: poiTextField.width height: 20 color: "#f7f8fa" border.color: "darkgray"
Text { anchors { verticalCenter: parent.verticalCenter leftMargin: 5 rightMargin: 5 }
font { weight: Font.Black pixelSize: 12 }
width: parent.width text: label elide: Text.ElideRight leftPadding: 5 color: "black" }
MouseArea { anchors.fill: parent onClicked: { suggestionClicked(label) } } } } }}// [Legal]// Copyright 2017 Esri.//// Licensed under the Apache License, Version 2.0 (the "License");// you may not use this file except in compliance with the License.// You may obtain a copy of the License at// http://www.apache.org/licenses/LICENSE-2.0//// Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.// See the License for the specific language governing permissions and// limitations under the License.// [Legal]
// sample headers#include "FindPlace.h"
// ArcGIS Maps SDK headers#include "ArcGISRuntimeEnvironment.h"
// Qt headers#include <QCommandLineParser>#include <QDir>#include <QGuiApplication>#include <QQmlEngine>#include <QQuickView>
// Other headers#include "Esri/ArcGISRuntime/Toolkit/register.h"
// Platform specific headers#ifdef Q_OS_WIN#include <Windows.h>#endif
#define STRINGIZE(x) #x#define QUOTE(x) STRINGIZE(x)
int main(int argc, char *argv[]){ Esri::ArcGISRuntime::ArcGISRuntimeEnvironment::setUseLegacyAuthentication(false); QGuiApplication app(argc, argv); app.setApplicationName(QString("FindPlace"));
// Use of ArcGIS location services, such as basemap styles, geocoding, and routing services, // requires an access token. For more information see // https://links.esri.com/arcgis-runtime-security-auth.
// The following methods grant an access token:
// 1. User authentication: Grants a temporary access token associated with a user's ArcGIS account. // To generate a token, a user logs in to the app with an ArcGIS account that is part of an // organization in ArcGIS Online or ArcGIS Enterprise.
// 2. API key authentication: Get a long-lived access token that gives your application access to // ArcGIS location services. Go to the tutorial at https://links.esri.com/create-an-api-key. // Copy the API Key access token.
const QString accessToken = QString("");
if (accessToken.isEmpty()) { qWarning() << "Use of ArcGIS location services, such as the basemap styles service, requires" << "you to authenticate with an ArcGIS account or set the API Key property."; } else { Esri::ArcGISRuntime::ArcGISRuntimeEnvironment::setApiKey(accessToken); }
// Initialize the sample FindPlace::init();
// Initialize application view QQuickView view; view.setResizeMode(QQuickView::SizeRootObjectToView);
QString arcGISRuntimeImportPath = QUOTE(ARCGIS_RUNTIME_IMPORT_PATH);
#if defined(LINUX_PLATFORM_REPLACEMENT) // on some linux platforms the string 'linux' is replaced with 1 // fix the replacement paths which were created QString replaceString = QUOTE(LINUX_PLATFORM_REPLACEMENT); arcGISRuntimeImportPath = arcGISRuntimeImportPath.replace(replaceString, "linux", Qt::CaseSensitive);#endif
// Add the import Path view.engine()->addImportPath(QDir(QCoreApplication::applicationDirPath()).filePath("qml")); // Add the Runtime and Extras path view.engine()->addImportPath(arcGISRuntimeImportPath);
Esri::ArcGISRuntime::Toolkit::registerComponents(*(view.engine()));
// Set the source view.setSource(QUrl("qrc:/Samples/Search/FindPlace/FindPlace.qml"));
view.show();
return app.exec();}