I am polling an external website for XML data that will then update a hosted feature service with point data for stream gauges. One of the issues with the XML data is that the lat and long are in DMS as strings. To solve this I am using field calculators to extract the degrees, minutes, and second values, convert them to double type values, and perform simple math to convert them to decimal degrees. That all works well. The issue I am having is figuring out how to write those converted latitude and longitude values out to the hosted feature service as geometries. I am curious if the fact that the latitude and longitude values are being calculated on the fly, and so is the geometry, that when I go to build my geometry those calculated latitude and longitude values only exist in memory and are not available to the "toPoint()" function. I have even tried breaking out the latitude, longitude, and geometry calculations to their own field calculator processors, but no luck. It's really hard to explain what issue I am encountering, so I appreciate it if you have read this far, and maybe you have some suggestions?
Solved! Go to Solution.
Ok I worked it out.
I needed to set up my input definition to include the two new fields that I was going to convert my DMS values to DD values to. Then in the geo event service, set up my field calculators to convert the values from DMS to DD and store in those new fields. Finally map them out to my output. Screenshots below for each piece of the pie. Hopefully someone gets something from this in the future!
XML Feed:
https://hayscounty.wetec.us/WETMap/public/hayswlpublic.xml
Input Definition with new fields highlighted:
XML Input Connector:
Hosted feature service output connector, make sure Update only is "NO":
Output Definition, with geometry output:
Geoevent Service outputs to a hosted feature service, and sends email.
Example Field Calculator that converts the XML DMS string value to a double DD value.
In the field mapper, using the DD values for latitude and longitude to construct the geometry.
Data mapped to hosted feature service.
In the Field Calculator Add Mapping - Geometry and in the Arcade use the point() function.
Replacing my $feature fields with your calculated ones.
I'll give it a try. Should I just do all of my calculations within a field mapper? That is convert my laititude, longitude, and geometry all from one field mapper processor. Rather than trying to use seperate field calculators for each operation? I have pasted images of my setup below.
This is what ends up happening. My latitude and longitude correctly convert, but geometry is null.
Your arcade expression needs to be something more along the lines of --
Where you create two variables to contain the lat/lon in Degrees and then use them in the point() function.
You could sider using convertDirection() or just use the formula you have already locally.
That makes sense, but I am not sure how to write more than one line expressions in the field calculator or the field mapper.
I either Field Calc or Field Map, click on the Configure Arcade Expression. Be sure to test/run it after you have it built.
Ah man... I gues my version doesn't have that button. I am using 10.9.1 (build 28388).
From my screenshot you can see it is bare bones. What version do you have?
Sorry, the difference is geoEvent versus Velocity.
Maybe build the Arcade in NotePad++ and then pater it as a line into that.
I do not currently have a geoEvent I can access to get the corresponding action.
Yea, no dice. I built the expression in VS Code and pasted into the field mapper for the geometry, but it writes out a null value for geometry.
Logs are citing that I have invalid field mapping for both my Point function and my variables lat_DD and long_DD
Thanks for you help so far.