|
BLOG
|
target="_self">Inleiding Data en services van Esri Nederland Toelichting Broncode Inleiding In deze serie oefeningen verkennen we de mogelijkheden van de ArcGIS API for JavaScript met behulp van data en diensten die door Esri Nederland via ArcGIS Online aangeboden worden. Reverse geocoding is het ophalen van een adres aan de hand van een tweetal coördinaten, in dit geval door ergens op de kaart te klikken. Data en services van Esri Nederland Basiskaart: De Topo RD basiskaart is een Web Map van Esri Nederland met als id 7aea6fa913a94176a1074edb40690318. Deze kaart gebruiken we als basemap Geocoder: De BAG Geocoder is een Locator van Esri Nederland, gebaseerd op de officiële Basisregistratie Adressen en Gebouwen (BAG). In onze web applicatie roepen we deze aan via de volgende url: https://services.arcgisonline.nl/arcgis/rest/services/Geocoder_BAG_RD/GeocodeServer Toelichting De volleidge broncode van de web applicatie staat hieronder. Deze kun je naar een text editor kopiëren (bijvoorbeeld Notepad++) en naar eigen behoefte aanpassen. Links naar achtergrondinformatie over de verschillende onderdelen die gebruikt worden in het script: het opzetten van de Locator het aanmaken van de Map het definiëren van de MapView (en een Point om de coördinaten van het center van de kaart in RD-coördinaten op te kunnen geven) Als al deze elementen op hun plek staan is er een functie die de muisklikken in de kaart afvangt om het adres op te halen. Hierbij wordt gebruik gemaakt van zogeheten promises, één van de Programming patterns die in de ArcGIS API for JavaScript wordt gebruikt. Klik hier om de applicatie in actie te zien. Broncode <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Aan de slag met ArcGIS JavaScript - Reverse geocoding</title>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
#instruction {
padding: 15px;
background: white;
color: black;
border: 5px solid gold;
font-family: sans-serif;
font-size: 1.2em;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.11/esri/css/main.css">
<script src="https://js.arcgis.com/4.11/"></script>
<script>
require([
"esri/tasks/Locator",
"esri/Map",
"esri/geometry/Point",
"esri/views/MapView"
], function(Locator, Map, Point, MapView) {
// Zet een locator op met de BAG Geocoder van Esri Nederland
var locatorTask = new Locator({
url:
"https://services.arcgisonline.nl/arcgis/rest/services/Geocoder_BAG_RD/GeocodeServer"
});
var map = new Map({
basemap: {
portalItem: {
id: "7aea6fa913a94176a1074edb40690318" // Basiskaart van Esri Nederland: Topo RD
}
}
});
var rdOrigin = new Point({
x: 155000,
y: 463000,
spatialReference: 28992
});
var view = new MapView({
spatialReference: 28992,
container: "viewDiv",
map: map,
center: rdOrigin,
zoom: 3
});
// Voeg de div met de instructie toe aan het kaartscherm
view.ui.add("instruction", "bottom-left");
/*******************************************************************************
* Door te klikken op de kaart wordt de popup die bij de view hoort ingesteld.
* Het aangeklikte punt wordt gebruikt als input voor de reverse geocoder.
* Het gevonden adres en de gevonden coördinaten worden in de popup getoond.
*******************************************************************************/
view.popup.autoOpenEnabled = false;
view.on("click", function(event) {
// Haal de coördinaten van het aangeklikte punt op
var rdx = Math.round(event.mapPoint.x);
var rdy = Math.round(event.mapPoint.y);
view.popup.open({
// Toon de gevonden RD coördinaten in de titel van de popup. De coördinaten worden
// afgerond op hele meters en er wordt een punt geplaatst tussen de duizendtallen
title: "RD Coördinaten: X = " + rdx.toLocaleString() + " / Y = " + rdy.toLocaleString(),
location: event.mapPoint // Plaats de popup op de aangeklikte locatie
});
// Toon de popup
// Voer reverse geocoding uit voor de aangeklikte locatie
locatorTask
.locationToAddress(event.mapPoint)
.then(function(response) {
// Toon het gevonden adres in de popup
view.popup.content = response.address;
})
.catch(function(error) {
// Toon een foutmelding als er geen adres gevonden wordt
view.popup.content = "Er is geen adres gevonden voor deze locatie";
});
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
<div id="instruction">
Klik ergens op de kaart om een adres op te halen
</div>
</body>
</html>
... View more
05-11-2019
10:07 AM
|
0
|
0
|
648
|
|
POST
|
Hi Kristen Thiebault, OK, "the data links are broken". So, the solution would be to make sure these data links will work on any computer. Can you please check in the map (an MXD file, I suppose. Or an APRX?) on computer A what the data link looks like? on computer B manually restore the data link and check what it looks like? I do not have any experience with Google Drive, but for a data link (pointing to an FGDB, I suppose) to work from any computer the actual path to the data on Google Drive should be exactly the same. (For example, when working with drive letters, if on computer A Google Drive is on the G:\-drive and on computer B it is on the M:\-drive your data links will not work...) Can you please investigate a little further and let us know your findings? Cheers, Egge-Jan
... View more
05-08-2019
07:00 AM
|
0
|
0
|
1639
|
|
POST
|
Hi Rudy Charlot, Can you please provide some additional information? What is your input? Can you describe your workflow and tell us in which step you get which error message? For someone in this forum to be able to help this is crucial information. Cheers, Egge-Jan
... View more
05-08-2019
05:51 AM
|
0
|
0
|
799
|
|
POST
|
Hi Hugo Bouckaert, Maybe a silly question, but why do you want to stick to a single web map? Why not two, i.e. one web map for group A and one for group B? If you create one 'base web map' with all the background layers that should be visible for all users, you can then create two copies with the relevant editable layers added, one for each group. This will definitely be the easiest way to make sure an editor from group A cannot see or edit the layer for group B and vice versa. Regarding your question about views: Yes, views do allow edits. No, I don't think this is a solution to your issue. A view limits access to the data in a hosted feature layer, but the view itself is also a layer which need to be added to the web map. See Create hosted feature layer views—ArcGIS Online Help | ArcGIS: When you create a feature layer view, a new hosted feature layer item is added to Content. This new layer is a view of the data in the hosted feature layer, which means updates made to the data appear in the hosted feature layer and all of its hosted feature layer views. However, since the view is a separate layer, you can change properties and settings on this item separately from the hosted feature layer from which it is created. For example, you can allow members of your organization to edit the hosted feature layer but share a read-only feature layer view with the public. Long story short: I think you will need to create 2 separate web maps. But maybe someone else has another solution? HTH, Egge-Jan
... View more
05-08-2019
05:01 AM
|
0
|
1
|
1222
|
|
POST
|
Hi Gino Van Nauw, Is this what you are looking for? Esri Web Style Symbols | ArcGIS API for JavaScript 4.11 There are examples on how to use them: Symbol playground | ArcGIS API for JavaScript 4.11 Visualize features with realistic WebStyleSymbols | ArcGIS API for JavaScript 4.11 HTH, Egge-Jan
... View more
05-07-2019
06:19 AM
|
4
|
0
|
11873
|
|
POST
|
Hi chitra M, Did you have a look at this webinar already? Integrating Deep Learning with ArcGIS using Python In this webinar several scenarios of applying the latest machine learning and deep learning techniques to geospatial data are covered, including semantic segmentation (such as land-cover classification and identifying roads and building footprints) using satellite imagery and models such as U-Net and Mask R-CNN. So this might be a starting point to design your workflow to compare two images using CNN (Convolutional Neural Networks). HTH, Egge-Jan
... View more
05-07-2019
05:29 AM
|
1
|
1
|
2373
|
|
POST
|
Hi Kelly Hutchins, Thanks for your answer. This was exactly what I was looking for: a value that will be localized to replace hard coded text. So, to get "Search" in stead of "Expand" I use: expandTooltip: searchWidget.label, // "Search" in stead of the default "Expand" for English locale and to get a localized placeholder in the expanded search box I use: placeholder: searchWidget.allPlaceholder // "Find address or place" for English locale Full code is below. Cheers, Egge-Jan <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Map of the Netherlands</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.11/esri/themes/light/main.css">
<script src="https://js.arcgis.com/4.11/"></script>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<script>
require([
"esri/Map", "esri/views/MapView", "esri/geometry/Point", "esri/widgets/Home", "esri/widgets/Search", "esri/tasks/Locator", "esri/widgets/Expand"
], function(Map, MapView, Point, Home, Search, Locator, Expand) {
var map = new Map({basemap: {portalItem: {id: "7aea6fa913a94176a1074edb40690318"}}}); <!-- Topo RD hosted by Esri Nederland -->
var rdOrigin = new Point({x: 155000, y: 463000, spatialReference: 28992});
var view = new MapView({spatialReference: 28992, map: map, container: "viewDiv", center: rdOrigin, zoom: 3});
var homeBtn = new Home({view: view});
view.ui.add(homeBtn, "top-left");
var searchWidget = new Search({
container: document.createElement("div"),
view: view,
includeDefaultSources: false
});
searchWidget.sources = [{
locator: new Locator({ url: "https://services.arcgisonline.nl/arcgis/rest/services/Geocoder_BAG_RD/GeocodeServer"}), // GeocodeServer for the Netherlands only (Esri Nederland)
singleLineFieldName: "SingleLine", // This allows to search on the combination of Postal Code and House number, e.g. 4181 AE 38
placeholder: searchWidget.allPlaceholder // "Find address or place" for English locale
}]
searchWidgetExpand = new Expand({
expandIconClass: "esri-icon-search", // see https://developers.arcgis.com/javascript/latest/guide/esri-icon-font/
expandTooltip: searchWidget.label, // "Search" in stead of the default "Expand" for English locale
view: view,
content: searchWidget.domNode,
group: "top-right"
});
view.ui.add([searchWidgetExpand], "top-right");
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>
... View more
05-07-2019
02:29 AM
|
0
|
0
|
1519
|
|
POST
|
Currently there is a notification on ArcGIS Online Health Dashboard - see screen capture below.
... View more
05-03-2019
06:45 AM
|
1
|
1
|
2499
|
|
POST
|
Hi all, I love this Localization in the JavaScript API, with the API automatically using the locale of the browser. So, in my case everything is showing in Dutch. Cool. Now I have a little issue: I like my widgets to be collapsed, so I have put my Search widget within an Expand widget - see screen captures and code below. The question is about localization when using the Expand widget: the expandTooltip defaults to "Expand" for English locale, whereas I want it to read "Search" or "Find address or place". I can modify the expandTooltip, but then I will loose the advantages of localization. So, is there a way to replace the hard coded "Find address or place" with a string that will be localized? expandTooltip: "Find address or place", // loss of localization :-( Thanks in advance for your help, Egge-Jan <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Map of the Netherlands</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.11/esri/themes/light/main.css">
<script src="https://js.arcgis.com/4.11/"></script>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<script>
require([
"esri/Map", "esri/views/MapView", "esri/geometry/Point", "esri/widgets/Home", "esri/widgets/Search", "esri/widgets/Expand"
], function(Map, MapView, Point, Home, Search, Expand) {
var map = new Map({basemap: {portalItem: {id: "7aea6fa913a94176a1074edb40690318"}}}); <!-- Topo RD hosted by Esri Nederland -->
var rdOrigin = new Point({x: 155000, y: 463000, spatialReference: 28992});
var view = new MapView({spatialReference: 28992, map: map, container: "viewDiv", center: rdOrigin, zoom: 3});
var homeBtn = new Home({view: view});
view.ui.add(homeBtn, "top-left");
var searchWidget = new Search({container: document.createElement("div"), view: view});
searchWidgetExpand = new Expand({
expandIconClass: "esri-icon-search", // see https://developers.arcgis.com/javascript/latest/guide/esri-icon-font/
expandTooltip: "Find address or place", // optional, defaults to "Expand" for English locale
view: view,
content: searchWidget.domNode,
group: "top-right"
});
view.ui.add([searchWidgetExpand], "top-right");
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>
... View more
05-02-2019
02:48 AM
|
0
|
2
|
1744
|
|
POST
|
Aha, ERROR 999999! Hmmm, something unexpected caused the tool to fail... As Esri states on this page 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Rep… : This error is considered a bug because there is missing exception handling in the tool. Fortunately you have found a good workaround by using ArcMap. And the good news is there will be continued support for ArcMap for at least a few years to come. And, according to this message2019-05-01 - ArcGIS Pro 2.4 by Jack Lukehart Esri staff in the Esri Headquarters in Redlands, CA will be busy manual testing of ArcGIS Pro 2.4 during the month of May.
... View more
04-30-2019
01:57 PM
|
0
|
6
|
3535
|
|
POST
|
About marking the syntax highlighting: edit your answer and select the python code use the option below to mark the syntax - sorry, my UI is in Dutch. in English it will read something like 'Mark syntax', I suppose.
... View more
04-30-2019
01:29 PM
|
0
|
3
|
2363
|
|
POST
|
Hi Devarsi Majumder, Two questions: You indicate that you are having 'some issues' with the Python script above, and you ask for help. Can you please indicate what the issues are? What error messages do you get? We might be able to help if you indicate where things go wrong... Can you please modify the question to mark your script as Python code (there is an option to do so under the three dots), as this will provide syntax highlighting and render the script more readable. Thanks in advance, Egge-Jan
... View more
04-30-2019
01:11 PM
|
0
|
5
|
2363
|
|
POST
|
Aha, apparently this is a known issue. On exactly the same page I mentioned above (Esri custom columns—Survey123 for ArcGIS | ArcGIS ) there is a little note: Full support for input masks is still in progress. You may observe issues when using delimiters or after entering a value. So, there is the answer to your question... 😞 Good to see you found an alternative solution. You might mark your question as being answered.
... View more
04-30-2019
08:28 AM
|
1
|
0
|
8736
|
|
POST
|
How come? The input mask 09.99 should allow values like 2.37, 8.19 and 1.07. But you say it doesn't? What error message do you get?
... View more
04-30-2019
08:10 AM
|
0
|
2
|
8736
|
|
POST
|
Hi Rene Aubut, Please have a look at this page: Esri custom columns—Survey123 for ArcGIS | ArcGIS, and scroll down to the section Input mask. It looks like your input mask should be set to 00.00 (instead of 90.00) or maybe even 09.99, because 9 ASCII digit required. 0 through 9. 0 ASCII digit permitted but not required. HTH, Egge-Jan
... View more
04-30-2019
07:59 AM
|
0
|
4
|
8736
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-30-2020 09:03 AM | |
| 2 | 12-12-2024 03:56 AM | |
| 2 | 04-15-2024 03:25 AM | |
| 2 | 03-25-2024 02:06 PM | |
| 1 | 01-17-2024 10:19 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-19-2025
02:25 AM
|