|
POST
|
OK. That seems to be working. At least I am past all of the errors now. Still not getting the expected result, but at least I am closer. See below for final code and what I am seeing. Not sure why the Lat/Long is 'undefined'. view.on("click", function (event) {
event.stopPropagation(); // overwrite default click-for-popup behavior
// Get the coordinates of the click on the view
var northing = event.mapPoint.y;
var easting = event.mapPoint.x;
var geomSer = new GeometryService("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer");
var params = new ProjectParameters();
params.geometries = [event.mapPoint];
var id = new SpatialReference();
id.wkid = 4326;
params.outSpatialReference = id;
geomSer.project(params).then(function(projectedPoint){
view.popup.open({
//Set the popup's title to the coordinates of the location
title: "Latitude: " + projectedPoint.y + ", Longitude: " + projectedPoint.x,
content: "Northing: " + northing + ", Easting: " + easting,
location: event.mapPoint // Set the location of the popup to the clicked location
});
}, function(error) {
console.error(error)
});
... View more
02-27-2018
11:16 AM
|
0
|
1
|
443
|
|
POST
|
Sorry, I didn't see Ken's second post there. But....I have made his changes to the order, so now I get past the URL issue, but now another error is coming up relating to the outSpatialReference:
... View more
02-27-2018
11:00 AM
|
0
|
3
|
2461
|
|
POST
|
Thanks Robert. Yes, that was a problem, but not the ultimate issue. It seems like in debug mode the code stops at this line: var geomSer = new GeometryService("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer/project"); Do I have that URL right? With (or without) the /project does not seem to matter. I get a GeometryService is not a constructor error.
... View more
02-27-2018
10:44 AM
|
0
|
5
|
2461
|
|
POST
|
Hi Ken, Robert, Yes, I've looked more into the Promise and how the .then is working, so it makes more sense now. Still not quite working. No error messages, just no response on the click event. Can you see where things might be going wrong?? Here is my entire code. Basically I'm just using the samples and messing with them. <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>Manhole WebMap - 4.6</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
#info {
background-color: black;
opacity: 0.75;
color: orange;
font-size: 18pt;
padding: 8px;
visibility: visible;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.6/esri/css/main.css">
<script src="https://js.arcgis.com/4.6/"></script>
<script>
require([
"esri/views/MapView",
"esri/WebMap",
"dojo/domReady!",
"esri/tasks/GeometryService",
"esri/tasks/support/ProjectParameters"
], function (
MapView, WebMap, GeometryService, ProjectParameters
) {
/************************************************************
* Creates a new WebMap instance. A WebMap must reference
* a PortalItem ID that represents a WebMap saved to
* arcgis.com or an on-premise portal.
*
* To load a WebMap from an on-premise portal, set the portal
* url with esriConfig.portalUrl.
************************************************************/
var webmap = new WebMap({
portalItem: { // autocasts as new PortalItem()
id: "465bae21a7f44abf85b4523817aea604"
}
});
/************************************************************
* Set the WebMap instance to the map property in a MapView.
************************************************************/
var view = new MapView({
map: webmap,
container: "viewDiv"
});
view.ui.add("info", "bottom-right");
view.on("click", function (event) {
event.stopPropagation(); // overwrite default click-for-popup behavior
// Get the coordinates of the click on the view
var northing = event.mapPoint.y;
var easting = event.mapPoint.x;
var geomSer = new GeometryService("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer");
var params = new ProjectParameters();
params.geometries = [event];
params.outSpatialReference = 4326;
geomSer.project(params).then(function(projectedPoint){
view.popup.open({
//Set the popup's title to the coordinates of the location
title: "Latitude: " + projectedPoint.y + ", Longitude: " + projectedPoint.x,
content: "Northing: " + northing + ", Easting: " + easting,
location: event.mapPoint // Set the location of the popup to the clicked location
});
}, function(error) {
console.error(error)
});
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
<div id="info">
<span id="name"></span>
</div>
</body>
</html> I'm doing all this in an HTML file. I'm relatively new to web programming. What is the best way to debug this? Can I do it in Visual Studio like I would with an ArcPro C# project??
... View more
02-27-2018
10:10 AM
|
0
|
1
|
2461
|
|
POST
|
Hi, I'm trying to emulate the screen cap below into some JS. In the SDK for Project there is no parameter specified for the Input Spatial Reference like there in the above screen cap of the Geometry Service I am using, so I'm not quite sure how I specify that in my JS. Here is what I have so far: view.on("click", function (event) {
event.stopPropagation(); // overwrite default click-for-popup behavior
// Get the coordinates of the click on the view
var northing = event.mapPoint.y;
var easting = event.mapPoint.x;
var geomSer = new GeometryService("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer");
var params = new ProjectParameters();
params.geometries = [event];
params.outSpatialReference = 4326;
var newPoint = geomSer.project(params);
view.popup.open({
// Set the popup's title to the coordinates of the location
title: "Latitiude: " + newPoint.y + ", Longitude: " + newPoint.x,
content: "Northing: " + northing + ", Easting: " + easting,
location: event.mapPoint // Set the location of the popup to the clicked location
});
}); Any guidance is appreciated.
... View more
02-27-2018
08:15 AM
|
0
|
11
|
3220
|
|
POST
|
Nice....yes, Robert seems to be the one to answer questions on here and has helped me in the past. Thanks Robert!! On that note rscheitlin , will you be at the Dev Conference in March?? I might need to track you down to pick your brain on some ArcPad apps I want to convert into a WebApp.
... View more
02-23-2018
01:23 PM
|
0
|
1
|
1799
|
|
POST
|
Hi Derek, Thanks for responding. I'm realizing that I definitely know nothing about web programming, but I think I figured out my problem to the above question is that the index.html file is really just controlling the loading page for the map. I guess what I need to figure out is what one (of the hundreds) of files in the WebApp contains the code for adjusting say the 'click' event of a layer. For now, all I want to do is show an alert("Hello World"); message when a certain layer gets clicked. Can you give any guidance on where this is happening within the file structure the WAB creates??
... View more
02-23-2018
01:04 PM
|
0
|
5
|
1799
|
|
POST
|
Hi Rickey, Thanks for those links. I will definitely look through those. I did manage to pull the site I created in WAB 2.7 into Visual Studio. It seems like using the 'Download' as apposed to just copy/paste all the folders/files works more efficiently. When I run the site in debug mode in VS2012, I can get the site to show up in Chrome. What I notice though is that once I add the JS reference to the index.html (ie. I add <link rel="stylesheet" href="https://js.arcgis.com/3.23/esri/css/esri.css">
<script src="https://js.arcgis.com/3.23/"></script> between the <head> tags, then my site stalls when loading (see image below) and just sits with the default 'loading' bars flashing on the screen. I've been going through this document as a guide (step #2): Build your first application | Guide | ArcGIS API for JavaScript 3.23 Any ideas as to what I am doing wrong??
... View more
02-23-2018
11:34 AM
|
0
|
0
|
1799
|
|
POST
|
Hi, I want to take a Web App that I create using WAB 2.7 and customize it. What I want to do is create a custom form that opens up when a user clicks on a feature in the map (ie. a Manhole) and then collect information on the form which would then be stored in a related table to the feature. Yes, I know there is already a Collector app, but we do not want to use that. I do some ArcPro tool development in Visual Studio, so I was hoping I could use that to help with this, but I literally have zero knowledge of web development, so I'm not really sure of where to start with this. Any assistance is appreciated. Thanks!
... View more
02-23-2018
08:10 AM
|
0
|
9
|
2188
|
|
POST
|
No. I am using a single field with the street address and the city name. It is a custom geocoder based on address points that are local to us. I would expect to get a 100% match since the addresses I am trying to geocode are exactly the same as those the geocoder is based on.
... View more
02-22-2018
12:42 PM
|
0
|
0
|
1810
|
|
POST
|
Hi Shana, The table is just a table (.xls to be exact), so there is no 'Shape' field. The screenshot below shows you my settings for the Geocoder. After tweaking the settings I was able to get a much better match score, but there were always a few that would never match. I have circled one of the addresses that would never match. As you can see in the next screenshot, the address that won't geocode through the 'Geocode Addresses' tool can be found when using the 'Locate', both using the same geocoder.
... View more
02-22-2018
12:34 PM
|
0
|
9
|
1810
|
|
POST
|
Hi, Just looking for some clarification on how geocoding works in Pro. I have created a Geocoder based on a point layer of address points. It seems to be working as desired when I type addresses into the 'Locate' window. But when I use the same locator in the Geocode Addresses Geoprocessing tool, the exact same address that I type in the Locate window comes up as 'U' - unmatched. All of my settings in the Geocoder are set to default. All I did was specify which fields to use for Number, Road Type, etc. Also, the list of addresses I am geocoding is actually the table of addresses that make up the point layer the geocoder is based on. So I would think I would get a 100% match rate, but I am not. Any advice on how to tweak my geocoder is appreciated. Thanks!
... View more
02-16-2018
01:05 PM
|
0
|
14
|
3110
|
|
POST
|
Hi Thomas. I was kind of wondering how things got loaded up, and if the order might be a problem, but it has always worked thus far. I guess I was just getting lucky, and today my luck ran out! Thanks for the tip! That worked perfectly.
... View more
02-14-2018
08:52 AM
|
0
|
1
|
3952
|
|
POST
|
Hi, I use the following to create a custom Ribbon. Initially it has 3 groups as well as places a couple of tools (the Streetview tools) in the proper place: <modules>
<insertModule id="StreetView_ArcPro_Module" className="Module1" autoLoad="false" caption="Module1">
<tabGroups>
<!--The new Tab Group is created here-->
<tabGroup caption="DSM Custom Tools" id="DSM_Tools_tabGroup">
<color A="255" R="238" G="170" B="90" />
<borderColor A="0" R="251" G="226" B="195" />
</tabGroup>
</tabGroups>
<!-- uncomment to have the control hosted on a separate tab-->
<tabs>
<tab id="Digitizing_Tools_tab" caption="Digitizing Tools" tabGroupID="DSM_Tools_tabGroup" keytip="T1">
<group refID="Google_Streetview_group" />
<group refID="Map_Tools_group" />
<group refID="Editing_Tools_group" />
</tab>
</tabs>
<groups>
<!-- comment this out if you have no controls on the Addin tab to avoid
an empty group-->
<group id="Google_Streetview_group" caption="Google Street View" keytip="G1">
<!-- host controls within groups -->
<button refID="StreetView_ArcPro_Dockpane_ShowButton" size="large" />
<tool refID="StreetView_ArcPro_StreetView_Tool" size="large" />
</group>
<group id="Map_Tools_group" caption="Map Tools" keytip="G1">
<!-- host controls within groups -->
</group>
<group id="Editing_Tools_group" caption="Editing Tools" keytip="G3">
<!-- host controls within groups -->
</group>
</groups>
<controls>
<!-- add your controls here -->
<tool id="StreetView_ArcPro_StreetView_Tool" caption="Google Street View" className="StreetView_Tool" loadOnClick="true" smallImage="Images\Google-Earth-icon 16.png" largeImage="Images\Google-Earth-icon 32.png" condition="esri_mapping_mapPane" keytip="B1">
<tooltip heading="Google Street View Tool">Click on map to show Google Street View location in side panel.<disabledText /></tooltip>
</tool>
<button id="StreetView_ArcPro_Dockpane_ShowButton" caption="Open Street View Pane" className="Dockpane_ShowButton" loadOnClick="true" smallImage="Images\open_in_new_window.png" largeImage="Images\open_in_new_window.png" keytip="B2">
<tooltip heading="Show Side Panel">Click to open/activate Google Street View side panel.<disabledText /></tooltip>
</button>
</controls>
<dockPanes>
<dockPane id="StreetView_ArcPro_Dockpane" caption="Google Street View" className="DockpaneViewModel" dock="group" dockWith="esri_core_contentsDockPane">
<content className="DockpaneView" />
</dockPane>
</dockPanes>
</insertModule>
</modules> As I create more tools, I place them into the proper Group on the same ribbon, like below for the Attribute Update tool: <modules>
<insertModule id="AttributeUpdate_ArcPro_Module" className="Module1" autoLoad="false" caption="Module1">
<controls>
<!-- add your controls here -->
<button id="AttributeUpdate_ArcPro_AttributeUpdate_Button" caption="Update Multiple Attributes" className="AttributeUpdate_Button" loadOnClick="true" smallImage="Images\AttributeUpdate_16.png" largeImage="Images\AttributeUpdate_32.png">
<tooltip heading="Atribute Update Tool">Updates multiple attributes from all of the selected features in the map.<disabledText /></tooltip>
</button>
</controls>
</insertModule>
<updateModule refID="StreetView_ArcPro_Module">
<groups>
<updateGroup refID="Editing_Tools_group">
<insertButton refID="AttributeUpdate_ArcPro_AttributeUpdate_Button"></insertButton>
</updateGroup>
</groups>
</updateModule> For some reason, I cannot place this tool (Facility ID Tool) on the toolbar using this: <modules>
<insertModule id="FacilityID_ArcPro_Module" className="Module1" autoLoad="false" caption="Module1">
<controls>
<!-- add your controls here -->
<button id="FacilityID_ArcPro_FacilityID_Button" caption="Create Facility ID" className="FacilityID_Button" loadOnClick="true" smallImage="Images\ID.png" largeImage="Images\ID.png" keytip="btnFacID">
<tooltip heading="Facility ID Tool">After selecting features, use this button to create new Facility IDs with selected features.<disabledText /></tooltip>
</button>
</controls>
</insertModule>
<updateModule refID="StreetView_ArcPro_Module">
<groups>
<updateGroup refID="Map_Tools_group">
<insertButton refID="FacilityID_ArcPro_FacilityID_Button"></insertButton>
</updateGroup>
</groups>
</updateModule>
</modules> I've looked at this a million times and don't see anything wrong with it. Can anybody see where I am going wrong?? Thanks,
... View more
02-14-2018
08:16 AM
|
0
|
7
|
4325
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 08-18-2023 08:57 AM | |
| 1 | 04-19-2018 05:53 AM | |
| 1 | 04-13-2018 10:07 AM | |
| 1 | 04-13-2018 10:04 AM | |
| 1 | 04-13-2018 05:56 AM |
| Online Status |
Offline
|
| Date Last Visited |
02-20-2025
03:53 PM
|