|
POST
|
OK hang on....dang it I had my geometry service in there....commented out and using the below var geometryService = new GeometryService("https://sampleserver5.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer"); I now get this error: undefined
... View more
02-08-2017
08:59 AM
|
0
|
4
|
1699
|
|
POST
|
Error says: localhost says: Error: Error executing fromGeoCoordinateString
... View more
02-08-2017
08:53 AM
|
0
|
5
|
1699
|
|
POST
|
I made that change and NO errors...but nothing alerted to me... alert(result.coordinates); Need to get the result into a variable...REALLY appreciate your help with this.
... View more
02-08-2017
08:36 AM
|
0
|
7
|
1699
|
|
POST
|
I added the conversionMode as it looks like its required. var params = { conversionMode: "mgrsDefault", conversionType: "DMS", sr: new SpatialReference({ wkid:4326}), strings: [GPSPoint] };
... View more
02-08-2017
08:30 AM
|
0
|
0
|
1699
|
|
POST
|
I put that in there and seems to blow up on this...if I comment out the code runs unfortunately not giving me the new coordinates var XYConvert.fromGeoCoordinateString(params, function(result){
alert(result.coordinates);
});
... View more
02-08-2017
08:22 AM
|
0
|
10
|
1699
|
|
POST
|
Think I am butchering this....but trying....how far off am I ???? Think I am destroying the "fromGeoCoordinateString" Grabbing XY from 2 input boxes var XValue2 = document.getElementsByName('XCoord')[0].value var YValue2 = document.getElementsByName('YCoord')[0].value var GPSPoint = YValue2 + "," + XValue2 var XYConvert.fromGeoCoordinateString(mgrsDefault, DMS, new SpatialReference({ wkid:4326}), GPSPoint); alert(XYConvert);
... View more
02-08-2017
07:54 AM
|
0
|
12
|
1699
|
|
POST
|
Thanks for ALL YOUR HELP ROBERT !!!! OK this is what I have... The user selects a Coordinate System Based on this selection it chooses the correct output Spatial reference in the query to do the XY comparison It then calls the getPoints function to compare the user XY against the geometry from the query using "polygon.contains" In this case it simply updates some text in the webpage saying whether or not its inside the polygon Any questions please ask <!DOCTYPE html>
<html>
<head>
<title>Verify XY Coordinates</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<link rel="stylesheet" href="http://js.arcgis.com/3.19/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.19/esri/css/esri.css">
<script src="http://js.arcgis.com/3.19/"></script>
<script>
require([
"esri/map", "esri/geometry/Point", "dojo/ready", "dojo/parser", "esri/tasks/GeometryService", "esri/tasks/query",
"esri/SpatialReference", "esri/tasks/QueryTask", "dojo/dom", "dojo/on", "dojo/domReady!"],
function (
Map, Point, ready, parser, GeometryService, Query, SpatialReference, QueryTask, dom, on) {
ready(function(){
parser.parse();
//ESRI Geometry Service
var geometryService = new GeometryService("https://sampleserver5.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer");
function execute () {
// DEFINE A NEW QUERY
var query = new Query();
var queryTask = new QueryTask("https://xxxx.gov/arcgis/rest/services/Public/Boundary/MapServer/0");
if(document.getElementById('UTM17N').checked) {
document.getElementById("p3").innerHTML = "UTM Zone 17N was selected";
query.outSpatialReference = {wkid:26917};
}else if(document.getElementById('UTM18N').checked) {
document.getElementById("p3").innerHTML = "UTM Zone 18N was selected";
query.outSpatialReference = {wkid:26918};
}else if(document.getElementById('DD').checked) {
document.getElementById("p3").innerHTML = "Decimal Degrees was selected";
query.outSpatialReference = {wkid:4326};
}
// FINISH THE QUERY PARAMETERS AND CALL THE FUNCTION TO TEST
query.where = "1=1";
query.outFields = ["*"];
query.returnGeometry = true;
queryTask.execute(query, getPoints);
}
on(dom.byId("runQuery"), "click", execute);
function getPoints(results) {
var polygon = results.features[0].geometry;
var XValue = document.getElementsByName('XCoord')[0].value
var YValue = document.getElementsByName('YCoord')[0].value
var TextBoxpnt = new Point((XValue), (YValue));
if (polygon.contains(TextBoxpnt)){
document.getElementById("p2").innerHTML = (TextBox);
}else{
document.getElementById("p2").innerHTML = (TextBox);
}
}
});
});
</script>
</head>
<body class="claro">
<form action="">
<input type="radio" name="Coordinate" checked="checked" id="UTM17N" value="UTM17N"> UTM Zone 17N - (742833.345, 4176911.91)<br>
<input type="radio" name="Coordinate" id="UTM18N" value="UTM18N"> UTM Zone 18N - (742833.345, 4176911.91)<br>
<input type="radio" name="Coordinate" id="DD" value="DD"> Decimal Degrees - (-76.015778, 36.8631)<br>
</form>
<p id="p3"></p>
X Coordinate: <input id="XCoord" type="text" name="XCoord"><br>
Y Coordinate: <input id="YCoord" type="text" name="YCoord"><br>
<input type="button" value="Verify XY" id="runQuery" />
<p id="p1">Click button to verify XY location in regards to VA Border</p>
<p id="p2"></p>
</body>
... View more
02-08-2017
07:34 AM
|
0
|
1
|
1827
|
|
POST
|
Last question...I am trying to test if inside my state. UTM and Lat Long work great...but now looking at DMS and DMM I can test on the DD fine...but it breaks when I try the other 2. All locations below are in my state DDD° MM' SS.S" 36° 51' 47.3" N 76° 0' 56.8" W Degrees, Minutes and Seconds DDD° MM.MMM' 36° 51.7884' N 76° 0.94668' W Degrees and Decimal Minutes DDD.DDDDD° 36.863140, -76.015778 Decimal Degrees I try and type in the DMS and DMM in the format below but it fails everytime....BUT I can enter the DD fine and it works. I enter them into 2 textboxes on my webpage as such DMS 36 51 47.3 76 0 56.8 DMM 36 51.7884 76 0.94668 Any thoughts? function execute () {
var query = new Query();
var queryTask = new QueryTask("https://xxxx.gov/arcgis/rest/services/Public/Boundary/MapServer/0");
if(document.getElementById('UTM17N').checked) {
query.outSpatialReference = {wkid:26917};
}else if(document.getElementById('DD').checked) {
query.outSpatialReference = {wkid:4326};
}else if(document.getElementById('DMS').checked) {
query.outSpatialReference = {wkid:4326};
}else if(document.getElementById('DDM').checked) {
query.outSpatialReference = {wkid:4326};
}
// FINISH THE QUERY PARAMETERS AND CALL THE FUNCTION TO TEST
query.where = "1=1";
query.outFields = ["*"];
query.returnGeometry = true;
queryTask.execute(query, getPoints);
}
on(dom.byId("runQuery"), "click", execute);
function getPoints(results) {
var polygon = results.features[0].geometry;
var XValue = document.getElementsByName('XCoord')[0].value
var YValue = document.getElementsByName('YCoord')[0].value
var TextBoxpnt = new Point((XValue), (YValue));
if (polygon.contains(TextBoxpnt)){
document.getElementById("p1").innerHTML = "point is inside polygon";
}else{
document.getElementById("p1").innerHTML = "point is NOT inside polygon";
}
}
... View more
02-08-2017
07:15 AM
|
0
|
14
|
2052
|
|
POST
|
Will do just finalizing my code to post here and make sure everything works...Cheers
... View more
02-08-2017
06:26 AM
|
0
|
15
|
2052
|
|
POST
|
Think I have UTM correct?/???? UTM Zone 17N = 26917 UTM Zone 18N = 26918
... View more
02-08-2017
06:19 AM
|
0
|
1
|
2830
|
|
POST
|
I need the wkid numbers for a couple Spatial references and cant find them and/or not sure what to look for... query.outSpatialReference = {wkid:26917}; I need: Degrees Minutes Seconds (DMS) Decimal Degrees (DD) Degree, Decimal Degrees Anyone know them or guide me to a location to find them and what to look for? Can I use the EPSG number in the code above?
... View more
02-08-2017
06:10 AM
|
0
|
4
|
3714
|
|
POST
|
Think I got it....As you mentioned earlier I was missing Requires....Once I get this working will post all code....Thanks for your help and guidance Robert
... View more
02-08-2017
04:59 AM
|
0
|
21
|
2053
|
|
POST
|
OK maybe you can see something.... I get my map and I get my button. I click the button and it ALERTS me "your in" SO that had to have passed through the execute Function and then into the getPoints Function Seems to be blowing up in the If Else Statement.....Thoughts? I dont get any of the alerts from the If Else statement <!DOCTYPE html>
<html>
<head>
<title>Advanced Draw</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<link rel="stylesheet" href="http://js.arcgis.com/3.19/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.19/esri/css/esri.css">
<script src="http://js.arcgis.com/3.19/"></script>
<script>
require([
"esri/map", "dojo/ready", "dojo/parser", "esri/tasks/GeometryService", "esri/tasks/query", "esri/tasks/QueryTask",
"dojo/dom", "dojo/on", "dojo/domReady!"],
function (
Map, ready, parser, GeometryService, Query, QueryTask, dom, on) {
ready(function(){
parser.parse();
//Geometry Service
var geometryService = new GeometryService("https://sampleserver5.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer");
//Add the Map/////////////////////////////////////////////////
map = new Map("map", {
basemap: "topo",
center: [-80.734, 28.297],
zoom: 10
});
function execute () {
var query = new Query();
var queryTask = new QueryTask("https://xxxxxx/arcgis/rest/services/Public/VirginiaBoundary/MapServer/0");
query.outSpatialReference = {wkid:26917};
query.where = "1=1";
query.returnGeometry = true;
queryTask.execute(query, getPoints);
}
function getPoints(results) {
alert("your in");
var polygon = results.features[0].geometry;
var pnt = new Point(4147263, 646445.066, new SpatialReference({ wkid:26917}));
if (polygon.contains(pnt)){
console.info("point is inside polygon");
alert("point is inside polygon");
}else{
console.info("point is NOT inside polygon");
alert("point is NOT inside polygon");
}
}
//write "Get Details" button's click event
on(dom.byId("runQuery"), "click", execute);
});
});
</script>
</head>
<body class="claro">
<input type="button" value="Verify XY" id="runQuery" />
<div id="map" style="width:600px; height:600px; border:1px solid #000;"></div>
</body>
</html>
... View more
02-07-2017
11:27 AM
|
1
|
22
|
2053
|
|
POST
|
Can I use something like below to get the polygon...there will only be 1 query.where = 1=1;
... View more
02-07-2017
10:16 AM
|
0
|
24
|
2053
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-20-2018 11:09 AM | |
| 1 | 09-10-2018 06:26 AM | |
| 1 | 09-15-2022 11:02 AM | |
| 1 | 05-21-2021 07:35 AM | |
| 1 | 08-09-2022 12:39 PM |
| Online Status |
Offline
|
| Date Last Visited |
09-19-2022
09:23 PM
|