POST
|
Keeping with the time honored traditions, i stumbled upon the answer to my question about 15 minutes after posting. I was missing the 'StylusButtonDown' event. As soon as i added that event to button's code, the behavior was as expected.
... View more
10-07-2015
01:38 PM
|
0
|
0
|
352
|
POST
|
Hi All, I have noticed some unexpected behavior regarding the touch/stylus events that I think should be raised when using a MapOverlay with a UI control inside of the overlay. In general, if I put a button inside of a MapOverlay and attach a listener to the button's click event, the event handler is called when using a mouse, but the equivalent touch/stylus events are not raised when using a stylus or finger. Instead of raising a click event for the button, a collection of MapView events are raised, e.g. stylus down, touch down, stylus up, and so on. I see this behavior with the 10.2.4 and 10.2.6 .NET Runtimes on a Panasonic FZ-M1 running Windows 7 and on a Dell touchscreen laptop running Windows 8. Is this the expected behavior or a bug? Am I doing something wrong? Thank you. You can see this behavior by adapting the MapView_Overlays example code in the Runtime .NET SDK (Windows Desktop) Code Examples section. Below is what i did. When i click the 'CloseTooltip' button with the mouse, the expected handler is called, But when i click the button with a touch or stylus, none of the event handlers are called. XAML <esri:MapView.Overlays>
<esri:OverlayItemsControl>
<Border Margin="5" Background="#ffffffff"
VerticalAlignment="Top" Width="175" BorderBrush="Black" BorderThickness="1" x:Name="MyOverlay">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="3,3,0,0" >
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="60"/>
</Grid.ColumnDefinitions>
<Button Grid.Column="1" Content="X" Margin="5" Name="CloseTooltip" Click="CloseTooltip_Click"></Button>
<TextBlock Grid.Column="0" Text="{Binding [areaname]}" FontWeight="Bold" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center"/>
</Grid>
</Border>
</esri:OverlayItemsControl>
</esri:MapView.Overlays> C# private void CloseTooltip_Click(object sender, RoutedEventArgs e)
{
AddToEventsList("CLOSE Tooltip button clicked with MOUSE.");
ClearMapOverlays();
}
private void CloseTooltip_Click(object sender, StylusButtonEventArgs e)
{
AddToEventsList("CLOSE Tooltip button clicked with STYLUS.");
ClearMapOverlays();
}
private void CloseTooltip_Click(object sender, TouchEventArgs e)
{
AddToEventsList("CLOSE Tooltip button clicked with TOUCH.");
ClearMapOverlays();
}
private void CloseTooltip_Click(object sender, MapViewInputEventArgs e)
{
AddToEventsList("CLOSE Tooltip button clicked with Map View Events.");
ClearMapOverlays();
}
private void ClearMapOverlays()
{
MapView.SetViewOverlayAnchor(MyOverlay, null);
_FeatureLayer.ClearSelection();
}
... View more
10-07-2015
09:50 AM
|
0
|
1
|
2538
|
POST
|
Hi John. You are correct. If i densify the line with a high enough value for maxSegmentLengh, the line is drawn across the International date line without the need to make a call out to the Geometry Server. Thank you.
... View more
02-26-2015
11:53 AM
|
0
|
0
|
1736
|
POST
|
lHi Robert. It seems that I was not thorough in my testing of the 'normalizeUtils' functionality. The line that i am trying to create still will not pass through the international date time zone. When i use my browser developer tools, i can't even see that a call is made to the geometry service. And when doing the step-thru debugging, there is no delay at all going to the '.then' function. If i add an error callback, that callback function is not invoked. Any thoughts on what's going on, what i might be doing wrong, and how to get that line to cross the international date line? My code is below as is a snapshot of the resulting line. Thank you. var wmas = new SpatialReference({ "wkid": 102100, "latestWkid": 3857 }); var honolulu = new Point(webMercatorUtils.lngLatToXY(-157.8167, 21.3000), wmas); var sanFran = new Point(webMercatorUtils.lngLatToXY(-122.4167, 37.7833), wmas); var fiji = new Point(webMercatorUtils.lngLatToXY(179.0000, -18.0000), wmas); var sydney = new Point(webMercatorUtils.lngLatToXY(151.2094, -33.8600), wmas); var polyline = new Polyline([[sanFran.x, sanFran.y], [honolulu.x, honolulu.y], [fiji.x, fiji.y], [sydney.x, sydney.y]]); polyline.setSpatialReference(wmas); var lineSymbol = new SimpleLineSymbol(); var request = normalizeUtils.normalizeCentralMeridian([polyline], new GeometryService("http://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer")); request.then(function (geoms) { var lineGraphic = new Graphic(geoms[0], lineSymbol); map.graphics.add(lineGraphic); });
... View more
02-25-2015
09:08 PM
|
0
|
3
|
1736
|
POST
|
Hey Robert. I had not looked into the normalizeUtils before your message. But I have now, and it works like magic. Thank you
... View more
02-20-2015
10:51 AM
|
0
|
0
|
1736
|
POST
|
Hello. I am working with the 3.12 version of the JavaScript API, and my map is using WMAS as the spatial reference. When i use the Draw toolbar to create a polyline from San Francisco to Sydney, AU, the line is drawn such that it crosses the international date line. However, when i programmatically create a polyline that uses coordinates created by converting Lat.Lon to WMAS with the web mercator utilities, the line does not cross the international time. Instead, it goes off in an Eastward direction to get to Sydney. No matter how many points i put between San Francisco and Sydney, the line always approaches the international date line, then heads eastward all the way around the globe to Sydney. When i compare the 'paths' of the line created by the Draw toolbar and the polyline i created by programmtically adding points, i see that locations like Sydney have different values for X and Y. Two different coordinate sets represent the same place on Earth, even though both coordinate pairs are using the same Spatial Reference My question is, I suppose, how do i convert values generated by the web mercator utilities into values that will cross the international date line? In other words, how can i get the same values as those created by the draw toolbar? Thank you. Coords for approximately Sydney when the point is created by the Draw Toolbar [ -23223191, -4049281] Coords for approximately Sydney when the point is created by converting from Lat/Lon using the web mercator utilities [16832553, -4010018] Both pairs have spatial reference: { "wkid": 102100, "latestWkid": 3857}
... View more
02-20-2015
09:57 AM
|
0
|
6
|
6224
|
POST
|
Hello. I am using v 3.11 of the Javascript API and executing the PrintTask to generate a printable pdf. The map has a couple of Dynamic Map Service Layers that are dynamically rendered, i.e. the user can control the layer symbology based on various inputs. When I execute the PrintTask, the dynamically rendered layers do appear on the printed map. But, I can't get a legend for those dynamic layers to appear on the printed map. I have tried a couple different approaches: 1) I have excluded the legendLayer array from the 'layoutOptions' object. I was hoping that would automatically generate a legend for all layers on the map, as suggested by the documentation. A legend does appear with he non-dynamic operational layers present, but not the dynamically rendered layers 2) I have created a legendLayer object specific to the dynamically rendered layers, like the code below, but still the layer doesn't appear in the legend.
var printTemplate = new PrintTemplate();
var legendLayers = [];
var legendLayer = new LegendLayer();
legendLayer.layerId = "dynLayer_0";
legendLayer.subLayerIds = [0];
legendLayers.push(legendLayer);
printTemplate.layoutOptions = { "titleText": title, "scalebarUnit": this._localMap.getAppConfig().printing.scalebarUnit, "legendLayers": legendLayers};
Any suggestions on how i can get my dynamically rendered layers to appear in the map legend? Thank you.
... View more
11-19-2014
10:41 AM
|
1
|
8
|
5526
|
POST
|
Hello, I have created a python tool which 1) creates a new file geodatabase 2) extracts data from a Map Service via a REST call 3) creates a feature class in the fGDB created in step 1 via the JSONtoFeatures tool. The tool works as expected when running ArcCatalog or ArcMap. I can publish the tool as a geoprocessing service with no problems, and then make calls against the GP service with no errors. If I publish the service as a synchronous process and then use the Services Directory browser to execute a task, I get a bunch of messages saying that everything was processed without error. However, the fGDB is not returned. If i publish the service as an asynch process and then submit the job, the "completed job" response gives me a URL, but when i browse to the URL, the response back is 'Invalid URL'. In both cases (synch and asych), i can get on the server hosting the Service and see that the fGDB was created at the location i set for the arcpy,env.workspace (set as part of the execute method). If i don't set arcpy.env.workspace, the script wont run as tool. What step(s) or settings(s) am I missing to have the GP service return the file geodatabase? Thank you. parameter definition def getParameterInfo(self): """Define parameter definitions""" # Output Type param0 = arcpy.Parameter( displayName="Output type", name="output_type", datatype="GPString", parameterType="Required", direction="Input") param0.filter.type = "ValueList" param0.filter.list = ['fGDB', 'pGDB'] param1 = arcpy.Parameter( displayName="Test Service Layer URL", name="test_service_layer_url", datatype="GPString", parameterType="Required", direction="Input") param1.value = "http://xx.xx.xx.xx/arcgis/rest/services/testservice/MapServer/0" param2 = arcpy.Parameter( displayName="Code", name="code", datatype="GPString", parameterType="Required", direction="Input") param2.value = "07040008" param3 = arcpy.Parameter( displayName="Source Field", name="source_field", datatype="GPString", parameterType="Required", direction="Input") param3.value = "data_field_1" param4 = arcpy.Parameter( displayName="Output File", name="outFile", datatype="DEFile", parameterType="Derived", direction = "Output") params = [param0, param1, param2, param3, param4] return params and the execute definition: def execute(self, parameters, messages): try: out_type = parameters[0].valueAsText.lower() service_url = parameters[1].valueAsText o = urlparse(service_url) if not re.search(r"/\d+$", o.path): raise InputParameterError("Missing expected layer index at the end of the input parameter 'Test Service Layer URL'.") query_url = service_url + "/query" Code = parameters[2].valueAsText where_clause = "data_field_2 = '" + huc8Code + "'" data_field = parameters[3].valueAsText outfields = [] outfields.append(data_field ) arcpy.env.workspace = r"C:\arcgisserver\directories\arcgisjobs\exportdata_gpserver" out_folder_path = arcpy.env.workspace messages.addMessage("output folder: " + out_folder_path) out_name = "" json_out_folder_path = arcpy.env.workspace json_out_name = prependTimeStamp("output.json") out_fcName = data_field messages.addMessage("output FC name: " + out_fcName) messages.addMessage("output JSON name: " + json_out_name) if out_type == 'pgdb': out_name = prependTimeStamp("testPGDB.mdb") arcpy.CreatePersonalGDB_management(out_folder_path, out_name) elif out_type == 'fgdb': out_name = prependTimeStamp("testFGDB.gdb") arcpy.CreateFileGDB_management(out_folder_path, out_name) payload = {'where': where_clause, 'outfields': ', '.join(outfields), 'f':'pjson'} with open(os.path.join(json_out_folder_path,json_out_name), 'wb') as handle: response = requests.get(query_url, params=payload, stream=True) print (response.status_code) for block in response.iter_content(1024): if not block: break handle.write(block) arcpy.JSONToFeatures_conversion(json_out_name, os.path.join(out_name,out_fcName)) arcpy.SetParameter(4, os.path.join(out_folder_path, out_name)) except Exception as e: arcpy.AddError(e) return
... View more
11-04-2014
02:26 PM
|
1
|
0
|
3929
|
POST
|
Hi Jeff. You can 'value add' a 'mapPoint' and/or 'screenPoint' objects to the click event. I think 'mapPoint' might be the object you are looking for. I have done something like this (I am pretty sure that i am not doing 'screenPoint' correctly - that's why i am using mapPoint): var scrPt = new Point(-122, 45.6); var mpPt = new Point(-122, 45.6); map.emit("click", { bubbles: true, cancelable: true, screenPoint: scrPt, mapPoint: mpPt });
... View more
08-11-2014
10:48 AM
|
4
|
2
|
4080
|
POST
|
I was able to figure this out. It turns out that dojo adds an 'emit' function to javascript objects. Instead of using 'on.emit()' I just called 'object.emit()' The old, not working code: var testEvent = on.emit(this.map, "click", { bubbles: true, cancelable: true }); The new, working code: this.map.emit("click", { bubbles: true, cancelable: true });
... View more
07-24-2014
12:28 PM
|
3
|
6
|
4080
|
POST
|
Hi Stephen. Thanks again for the tip. I tried both approaches described in the Stack Overflow question you linked to......without any good luck for either one. I suspect the challenge is to know which piece of the 'overall map' is emitting the click event in the real world - is it the container, one of the layers, etc. Once i figure that out, i can have that particular element programmatically trigger the event? I'll keep poking around.
... View more
07-24-2014
10:04 AM
|
0
|
7
|
4080
|
POST
|
Thanks Stephen. I did a quick peek at Selenium and that might get me down the right path with its functionality to record user interactions. I will post back and let you know. I am still hoping that there is some way, outside of a testing framework, to programmatically trigger a map click event (or any other map event i suppose). Thanks again. Tom
... View more
07-23-2014
08:57 AM
|
0
|
9
|
4080
|
POST
|
Hello, I am using the Esri's Javascript API 3.9. I have created functionality that allows a user to add a graphic to the map by clicking on the map. The type of graphic added depends on some previous selection that user has made. For example, selecting one option (say Option A) adds a circle graphic whereas selecting a different option (say Option B) adds a square graphic. My need for the programmatic map 'click' event is with the automated unit tests I am creating (I am using Jasmine for my unit tests). My hope is to write a unit test which selects programmatically Option A, programmatically triggers a click on the map, and verifies that the correct 'map click' event handler was called (the one that handles the map clicks when Option A is selected). I have tried using dojo's emit function. The code seems to execute with no errors, i.e. the function call returns an 'event' object, but no map click event handler is ever called. I am pretty sure the event is hooked up correctly because if I follow those same steps manually, the correct event handler is called. As part of my testing, i have tried passing the 'emit' function both the map object and the div which contains the map object. Neither way seems to work, i.e. the click event handler is not called. Its not critical to my testing that a 'correct' argument is passed to the event handler; i just want to know that the correct handler is called. So, my question is how can i programmatically fire/trigger a map's click event? Thank you. //relevant code this.map = new Map(divId, { basemap: "streets", center: [-122, 45.6], zoom: 5, smartNavigation: false }); //passing the div which contains the map var theMapDiv = dom.byId(divId); var testEvent = on.emit(theMapDiv, "click", { bubbles: true, cancelable: true }); //passing the map var testEvent = on.emit(this.map, "click", { bubbles: true, cancelable: true });
... View more
07-22-2014
02:49 PM
|
3
|
12
|
15920
|
POST
|
Thank you for the suggestion. I will give that a try and let you know how it goes. That's a nice little trick; why isn't it documented or 'supported'?
... View more
01-14-2014
07:11 AM
|
0
|
0
|
889
|
Title | Kudos | Posted |
---|---|---|
1 | 09-27-2016 05:37 PM | |
46 | 12-02-2016 11:30 AM | |
1 | 11-19-2014 10:41 AM | |
3 | 07-22-2014 02:49 PM | |
4 | 08-11-2014 10:48 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|