POST
|
We're trying to convert state plane coordinates to lat-long. We're also using the 4x API. We've looked at the API but could not find anything that converts state plane to lat-long.The best thing we figured out was to use our own geometry service. If there's some other way of doing it, I'm all ears.
... View more
04-14-2020
10:15 AM
|
0
|
1
|
2126
|
POST
|
I am trying to access the results of the following URL in my Javascript code. The result returned is a JSON, and I'm trying to get the x and y results of that JSON. Here is the URL: https://jcgis.jacksongov.org/arcgis/rest/services/Utilities/Geometry/GeometryServer/project?inSR=102698&outSR=4326&geometries=%7B%0D%0A++%22geometryType%22+%3A+%22esriGeometryPoint%22%2C%0D%0A++%22geometries%22+%3A+%5B%0D%0A+++++%7B%0D%0A+++++++%22x%22+%3A+2806540.74997300%2C+%0D%0A+++++++%22y%22+%3A+1036617.12483400%0D%0A+++++%7D%0D%0A++%5D%0D%0A%7D&transformation=&transformForward=true&vertical=false&f=html It would use GET which returns the following object: https://jcgis.jacksongov.org/arcgis/rest/services/Utilities/Geometry/GeometryServer/project?inSR=102698&outSR=4326&geometries=%7B%0D%0A++%22geometryType%22+%3A+%22esriGeometryPoint%22%2C%0D%0A++%22geometries%22+%3A+%5B%0D%0A+++++%7B%0D%0A+++++++%22x%22+%3A+2806540.74997300%2C++++++++%22y%22+%3A+1036617.12483400%0D%0A+++++%7D%0D%0A++%5D%0D%0A%7D&transformation=&transformForward=true&vertical=false&f=pjson I will actually have variables for the lat, long coordinates, but let's leave that hard-coded for the moment. I have tried all sorts of methods of trying to grab the x and y results but nothing's worked. Currently I have an ajax call like this: var lat, long, temp;
var url = "https://jcgis.jacksongov.org/arcgis/rest/services/Utilities/Geometry/GeometryServer/project?inSR=102698&outSR=4326&geometries=%7B%0D%0A++%22geometryType%22+%3A+%22esriGeometryPoint%22%2C%0D%0A++%22geometries%22+%3A+%5B%0D%0A+++++%7B%0D%0A+++++++%22x%22+%3A+2806540.74997300%2C++++++++%22y%22+%3A+1036617.12483400%0D%0A+++++%7D%0D%0A++%5D%0D%0A%7D&transformation=&transformForward=true&vertical=false&f=pjson";
$.ajax({
dataType: 'json',
type: "GET",
url: url,
success: function(jsonobject)
{
temp = JSON.parse(jsonobject);
lat = temp.geometries.x;
long = temp.geometries.y;
}
}); I am not sure I am using the parse correctly, but looking at examples in various places online I'm not sure how else it should be done. When I try to run the code the only result I get is "undefined." What am I missing?
... View more
04-14-2020
08:53 AM
|
0
|
5
|
2218
|
POST
|
Thanks, that was helpful. Setting up a watch function seems to work ... though it's tricky accessing my parcelnum variable outside of the watch function, which isn't ideal but I can probably work around that. My code is this: var parcelnum;
view.popup.watch("selectedFeature", function()
{
if (view.popup.selectedFeature != null)
{
parcelnum = view.popup.selectedFeature.attributes.Parcel_ID;
alert("Parcel num is: " + parcelnum);
}
});
... View more
01-02-2020
11:42 AM
|
0
|
0
|
1822
|
POST
|
I am new to the 4.xx API and am trying to figure out how to access an attribute of a feature that's being consumed by my popup. I'd been using the 3.xx API for many years. In the 3.xx API I did this all the time using IdentifyTask and IdentifyParameters with dojo.dom and dojo.on in my popups, with no problem. However, with the 4.xx API, since the popup is now part of the MapView and you don't need all the Identify-things and dom and on to create a popup, I'm trying to figure out how to grab the value of one of the items in my popupTemplate. I have a feature layer as thus: var parcelsLayer = new FeatureLayer({
url: "https://jcgis.jacksongov.org/arcgis/rest/services/Cadastral/TaxParcelsTest/MapServer/0",
outFields: ["Parcel_ID","SitusAddress","SitusCity","owner"],
popupTemplate: thepopup
}); And before that I have my popup template: var thepopup = {
title: "{SitusAddress}",
content: "<b>Parcel Num:</b> {Parcel_ID}<br><b>Address:</b> {SitusAddress}<br><b>City:</b> {SitusCity}<br><b>Owner:</b> {owner}"
} So that when I click on a parcel, those 4 items are loaded into the popup. What I want to do is grab the "{Parcel_ID}" and assign its value to a variable, like: var parcelnum = grab the {Parcel_ID} somehow I know that Popup has a selectedFeature property, which is a Graphic which has attributes, but it's not clear to me how to grab a particular attribute. As in something like: var parcelnum = view.popup.selectedFeature.attributes[1]; But of course that doesn't work that way. Am I going about this the right way? Or if I want to do what I want to do, do I need to do it the same way I did using the 3.xx API? Thanks.
... View more
01-02-2020
07:28 AM
|
0
|
2
|
1968
|
POST
|
Thanks. I seem to have come across a solution that does what I want it to do. I have: measurement.on("tool-change", disablepopup); function disablepopup() { handler.pause(); } And ... measurement.on("measure-end", enablepopup); function enablepopup() { measurement.setTool(measurement.activeTool, false); handler.resume(); } This makes it so that when the user clicks on one of the tools, the handler is paused. Then - and this is important - once they're done drawing the measurement, the tool is re-set and the handler is resumed. The reason I want this is because I'm assuming the typical user might want to immediately start selecting parcels again after they've made a measurement without having to press any other buttons. So the flow would be: 1. Click measure tool 2. Make measurment 3. OK to click on parcel If they want to make another measurement right after they made the first one, *then* they'll have to press one of the measure buttons again, but I don't consider that to be a big deal. Once the user sees the measure tool button not depressed anymore, they'll automatically go and re-press it if they want to. So the flow would be: 1. Click measure tool 2. Make measurement 3. Click measure tool 4. Make measurement 5. Etc., or OK to click on parcel, too The Clear Graphics button is basically the same thing as the "measure-end" handler, except that it also clears the graphics. I figured out you need to put ClearResult() before you re-set the tool, otherwise the ClearResult() doesn't work: function cleargraphics() { measurement.clearResult(); measurement.setTool(measurement.activeTool, false); handler.resume(); } I'm using IE 11. Your implementation worked on your host there, I don't know why it doesn't work on my computer, but I've been dealing with that sort of thing ever since I started this job, so I'm used to it. As I said, I think it might be a network security issue. This would explain why it worked when you hosted it but not when I tried to run your code on my local machine. I think our network folks have things set up in everybody's localhost pretty restrictively, or something. One thing that doesn't work with anything above 3.15 are my navigation tools and bookmarks. However, I like them the way I've got them there so I don't mind. There have been other things that don't work but I forget which ones off the top of my head.
... View more
11-03-2017
07:24 AM
|
0
|
1
|
3864
|
POST
|
Thanks ... except that I can barely get it to run. Most of it doesn't even show up, let alone work. In IE it just hangs there and never even shows up at all. One thing I noticed you did was change the Javascript API from 3.14 to 3.22. Unfortunately, that's a big no-no for me. Some of the things I'm using I can't get to work on anything above 3.14. Trust me, I've tried. Don't know why. It might have something to do with the security settings on my network, but I'm not sure. I plugged your "aspect.after..." function into my code. Didn't work. When I click on my map it still selects an underlying parcel. Your cleargraphics implementation was nice, but it only worked when I placed it outside the require function into a standard function like thus: function cleargraphics() { measurement.setTool(measurement.activeTool, false); measurement.clearResult(); handler.resume(); } It does a nice job of re-setting the tool, which is one of the things I was looking for. Thanks! All the other stuff that I put outside the require function I've put there because it doesn't work inside the require function. Trust me, I've been through all that.
... View more
11-03-2017
06:19 AM
|
0
|
3
|
1546
|
POST
|
Just running your code quickly, I noticed you don't have the parcel layer selectable. That's what's creating my problem, is the interaction between the clicking on a parcel and the clicking on the map to draw a measurement. Anyway I'll be back tomorrow. Run my code and you'll see my issue.
... View more
11-02-2017
02:38 PM
|
0
|
5
|
1546
|
POST
|
Here is my code. I'll have to get back to you tomorrow.
... View more
11-02-2017
02:33 PM
|
0
|
0
|
1546
|
POST
|
I don't know how to insert code, stuff I tried here before was a mess
... View more
11-02-2017
02:26 PM
|
0
|
0
|
1546
|
POST
|
Unfortunately, as far as I can tell there is no way to un-toggle one of the measurement buttons via code. Measurement | API Reference | ArcGIS API for JavaScript 3.22 Clicking on the buttons creates the problem I described above. Once the measurement is done drawing, I'd need to write some code like: distanceButton.Clicked = false in the "measure-end" handler. However I don't see anything like that in the API. In the code for my "tool-change" handler I tried: if(handler.pause()) handler.resume(); else handler.pause(); Unfortunately, pause and resume don't seem to return anything. Would be nice if they returned a boolean. Not making layers selectable and unselectable seems to be a major shortfall in the API.
... View more
11-02-2017
02:10 PM
|
0
|
3
|
1336
|
POST
|
Actually, I just figured out it doesn't really work after all. To clear a measurements graphic after you're done drawing it, you have to click on one of the measurement tools . Unfortunately, doing so pauses the pausable listener that I just created to prevent the popup from popping up. So, if you want to resume clicking on parcels and getting the popup, you're not allowed to clear the measurement graphic first. That's unrealistic to expect users to figure out. Basically I solved one problem but created another.
... View more
11-02-2017
01:50 PM
|
0
|
5
|
1336
|
POST
|
OK thanks for the link. Didn't know there were pausable listeners. So if I have: map.on("click", executeIdentifyTask); How would I change that to a pausible one? Would it be: var handler = on.pausible(map, "click", executeIdentifyTask); Not sure if I can use "map" where the code in your link says "button"??
... View more
11-02-2017
12:41 PM
|
0
|
7
|
1336
|
POST
|
No, this is a javascript web map. I'm making it in Visual Studio, with some C# code-behind (the latter of which is irrelevant to this particular issue). Yes, I'm doing a map.on('click', dosomething); Not sure what you mean by a pausable event listener??
... View more
11-02-2017
12:19 PM
|
0
|
9
|
1336
|
POST
|
I'm adding layers to code in my web map. This is a javascript map not an ArcGIS Online map. I'm using an IdentifyTask, not a standard popup template.
... View more
11-02-2017
11:58 AM
|
0
|
1
|
2318
|
Title | Kudos | Posted |
---|---|---|
1 | 04-08-2016 09:09 AM | |
1 | 12-19-2016 06:19 AM | |
1 | 09-01-2016 01:26 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|