|
POST
|
That was it....I was still trying to use the Toggle inside a function which was screwing me up... The IF ELSE statement does just fine.... THANKS....again....
... View more
08-06-2014
06:37 AM
|
0
|
1
|
1385
|
|
POST
|
I have an image working to fire some code and a button as well....I want to change the BUTTON below to something liek this and cant figure it out. HTML: <td align="center" id="DrawGraphics" class="tdHeader"> <img alt="Settings" src="imagesApp/PencilBlue.png" class="imgOptions" title="Draw" style="cursor: pointer" /> </td> JAVASCRIPT on(dojo.byId('DrawGraphics'), "click", DrawGraphics); function DrawGraphics() { if (action2 != undefined) { action2.pause(); } } I WANT TO CHANGE THE BELOW TO fire with an image and not a big button.... any thoughts on this..can I get this toggle to run from an image click instead of a button.... HTML <td align="left" id="Imagery" class="tdHeader"> <button id="programmatic"></button> </td> JAVASCRIPT base1 = new ArcGISTiledMapServiceLayer("https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer", { id: "baseTopo", visible: true }); base2 = new ArcGISTiledMapServiceLayer("https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer", { id: "baseImagery", visible: false }); app.map.addLayers([base1, base2]); new ToggleButton({ showLabel: true, checked: false, onChange: function (val) { base1.setVisibility(!val); base2.setVisibility(val); } },"programmatic");
... View more
08-05-2014
12:41 PM
|
0
|
4
|
1760
|
|
POST
|
I am using this example... DataGrid with zoom button | ArcGIS API for JavaScript I replaced the reference of the polygon Map Service with my own and it works FINE. I then try it with a Point Feature and it breaks... Is there something I am doing wrong for the Point feature...I replaced the SELECTION symbol for that of a point Looking to modify this for both a point and line feature.... var StatesGrid = declare([Grid, Selection]); var columns = [{ label: "", //wasn't able to inject an HTML <div> with image here field: "OBJECTID", formatter: makeZoomButton },{ label: "unknown", field: "SITENAME" }]; //restrict sorting to the state name field for (var i = 0; i < columns.length; i++) { if (i == 1) { columns.sortable = true; } else { columns.sortable = false; } } grid = new StatesGrid({ bufferRows: Infinity, columns: columns }, "grid"); //add the states demographic data var statesLayer = new FeatureLayer("https://fwisweb1.dgif.virginia.gov/arcgis/rest/services/Public/DGIF_Public/FeatureServer/1", { mode: FeatureLayer.MODE_SELECTION, outFields: ["OBJECTID", "SITENAME"] }); //define a selection symbol var GridSelectsymbol = new SimpleMarkerSymbol( SimpleMarkerSymbol.STYLE_CIRCLE, 12, new SimpleLineSymbol( SimpleLineSymbol.STYLE_SOLID, new Color([0, 0, 255, 0.5]), 6 ), new Color([0, 0, 255]) ); statesLayer.setSelectionSymbol(GridSelectsymbol); statesLayer.on("load", function(evt) { var query = new Query(); query.where = "1=1"; evt.layer.queryFeatures(query, function(featureSet) { var items = array.map(featureSet.features, function(feature) { return feature.attributes; }); //idProperty must be set manually if value is something other than 'id' var memStore1 = new Memory({ data: items, idProperty: "OBJECTID" }); window.grid.set("store", memStore1); window.grid.set("sort", "SITENAME"); grid.on(".field-OBJECTID:click", function(e) { //retrieve the ObjectId when someone clicks on the magnifying glass if (e.target.alt) { zoomRow(e.target.alt); } }); }); }); app.map.addLayers([statesLayer]); function makeZoomButton(id) { //set the feature 'id' as the alt value for the image so that it can be used to query below var zBtn = "<div data-dojo-type='dijit/form/Button'><img src='images/ArrowUp.png' alt='" + id + "'"; zBtn = zBtn + " width='18' height='18'></div>"; return zBtn; } function zoomRow(id) { statesLayer.clearSelection(); var query1 = new Query(); query1.objectIds = [id]; statesLayer.selectFeatures(query1, FeatureLayer.SELECTION_NEW, function(features) { //zoom to the selected feature var stateExtent = features[0].geometry.getExtent().expand(2.0); app.map.setExtent(stateExtent); }); }
... View more
08-05-2014
07:13 AM
|
0
|
5
|
3942
|
|
POST
|
Think I got it with the below.....thanks for all your help..... var graphicExtent = graphic1._extent.getExtent(); app.map.centerAndZoom(evt.address.location,15);
... View more
08-04-2014
01:43 PM
|
0
|
0
|
488
|
|
POST
|
THink I got it....I was not moving my map...I moved my map and ran it and it centered on the graphic being created.....my next and last question ....how do I zoom to it...can I do this var graphicExtent = graphic1._extent.getExtent().zoomin; Something similar to the map : zoom: 7, Tried this and no go var graphicExtent = graphic._extent.getExtent(); app.map.centerAndZoom(graphicExtent,7);
... View more
08-04-2014
01:20 PM
|
0
|
1
|
3100
|
|
POST
|
I do this and nothing happens.. Also tried getting rid of the _ in your example and still no zooming var graphicExtent = graphic._extent.getExtent(); Trying this way var graphicExtent = graphic.extent.getExtent(); Error TypeError {stack: (...), message: "Cannot read property 'getExtent' of undefined" } locator.on("location-to-address-complete", function(evt) { if (evt.address.address) { var address = evt.address.address; var location = webMercatorUtils.geographicToWebMercator(evt.address.location); //this service returns geocoding results in geographic - convert to web mercator to display on map // var location = webMercatorUtils.geographicToWebMercator(evt.location); var graphic = new Graphic(location, ReverseGeocodesymbol, address, infoTemplateRG); app.map.graphics.add(graphic); app.map.infoWindow.setTitle(graphic.getTitle()); app.map.infoWindow.setContent(graphic.getContent()); //display the info window with the address information var screenPnt = app.map.toScreen(location); app.map.infoWindow.resize(200,100); app.map.infoWindow.show(screenPnt, app.map.getInfoWindowAnchor(screenPnt)); var graphicExtent = graphic._extent.getExtent(); app.map.setExtent(graphicExtent); } });
... View more
08-04-2014
01:14 PM
|
0
|
2
|
3100
|
|
POST
|
How would I zoom to it? Would like to zoom to the Graphic being created below locator.on("location-to-address-complete", function(evt) { if (evt.address.address) { var address = evt.address.address; var location = webMercatorUtils.geographicToWebMercator(evt.address.location); //this service returns geocoding results in geographic - convert to web mercator to display on map // var location = webMercatorUtils.geographicToWebMercator(evt.location); var graphic = new Graphic(location, ReverseGeocodesymbol, address, infoTemplateRG); app.map.graphics.add(graphic); app.map.infoWindow.setTitle(graphic.getTitle()); app.map.infoWindow.setContent(graphic.getContent()); //display the info window with the address information var screenPnt = app.map.toScreen(location); app.map.infoWindow.resize(200,100); app.map.infoWindow.show(screenPnt, app.map.getInfoWindowAnchor(screenPnt)); var stateExtent = location [0].geometry.getExtent().expand(5.0); map.setExtent(stateExtent); } });
... View more
08-04-2014
12:43 PM
|
0
|
4
|
3100
|
|
POST
|
Worked great Tim....thanks... And thats Jeff....will be revisiting this once I figure out what their preference is.....so if the do degrees minutes seconds...I test for this? Then grab the values from the textboxes and convert them pass to the locator?
... View more
08-04-2014
12:08 PM
|
0
|
1
|
3100
|
|
POST
|
Any examples out there of allowing the user to type in a lat long and creating a point at that location and/or zooming to it,,,, Much like the below but with XY not address Geocode an address | ArcGIS API for JavaScript
... View more
08-04-2014
06:36 AM
|
0
|
10
|
5954
|
|
POST
|
This is the code... Geocoder Then Draw Buffer around Gocoded Result Then Query 1 Features and return their respective Geometry // GEOCODER START ================================================================= var x = ""; var y = ""; var geocoder = new Geocoder({ arcgisGeocoder: { placeholder: "Dallas, Texas" }, autoComplete: true, map: app.map, }, dom.byId("search")); geocoder.startup(); geocoder.on("select", showLocation); geocoder.on("clear", removeSpotlight); function showLocation(evt) { //app.map.graphics.clear(); var point = evt.result.feature.geometry; var pointGC = evt.result.feature.geometry; x = point.x y = point.y var symbol = new SimpleMarkerSymbol().setStyle( SimpleMarkerSymbol.STYLE_circle).setColor( new Color([255,0,0,0.5]) ); var graphic = new Graphic(point, symbol); app.map.graphics.add(graphic); //app.map.infoWindow.setTitle("Search Result"); //app.map.infoWindow.setContent(evt.result.name); //app.map.infoWindow.show(evt.result.feature.geometry); var symbol_historicArchitectureGC = new SimpleFillSymbol( "solid", new SimpleLineSymbol("solid", new Color([0,76,153]), 2), new Color([0,128,255,0.5]) ); flVAFWIS_historicArchitecture.setSelectionSymbol(symbol_historicArchitectureGC); // Add the Feature Layer To Map app.map.addLayer(flVAFWIS_historicArchitecture); var paramsGC = new BufferParameters(); paramsGC.geometries = [ pointGC ]; paramsGC.distances = [ .5 ]; //paramsGC.bufferSpatialReference = new SpatialReference({wkid: 26917}); paramsGC.outSpatialReference = app.map.spatialReference; paramsGC.unit = GeometryService.UNIT_STATUTE_MILE; // geometry service that will be used to perform the buffer var geometryServiceGC = new GeometryService("https://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); geometryServiceGC.buffer(paramsGC); geometryServiceGC.on("buffer-complete", function(result){ // draw the buffer geometry on the map as a map graphic var symbol22 = new SimpleFillSymbol( SimpleFillSymbol.STYLE_NULL, new SimpleLineSymbol( SimpleLineSymbol.STYLE_SOLID, new Color([247,5,38]), 2 ),new Color([255,255,0,0.25]) ); var bufferGeometryGC = result.geometries[0] var graphicGC = new Graphic(bufferGeometryGC, symbol22); app.map.graphics.add(graphicGC); var query_historicArchitectureGC = new Query(); query_historicArchitectureGC.geometry = bufferGeometryGC; // Select the Points within the Buffer and show them flVAFWIS_historicArchitecture.selectFeatures(query_historicArchitectureGC, FeatureLayer.SELECTION_NEW, function(results){ }); }); } // End function showLocation(evt) { // GEOCODER END =====================================================================
... View more
08-01-2014
01:13 PM
|
0
|
0
|
1507
|
|
POST
|
Think I got it... forgot the [ ] paramsGC.geometries = [ point ];
... View more
08-01-2014
12:14 PM
|
0
|
1
|
1507
|
|
POST
|
I tried to use the variable Point as well but nothing var point = evt.result.feature.geometry; var paramsGC = new BufferParameters(); paramsGC.geometries = point; paramsGC.distances = [ .5 ];
... View more
08-01-2014
12:05 PM
|
0
|
3
|
1507
|
|
POST
|
I am trying to Geocode an Address then Buffer that address....from there I want to use that buffered graphic for further queries... I can get the Geocode to work but stuck on getting the Buffer code to create the buffered graphic of which I need to use its geometry to run further queries.. Am I way off here? // GEOCODER START=========================================================================================== var x = ""; var y = ""; var geocoder = new Geocoder({ arcgisGeocoder: { placeholder: "4010 West Broad St, RIchmond, Virginia" }, autoComplete: true, map: app.map, }, dom.byId("search")); geocoder.startup(); geocoder.on("select", showLocation); geocoder.on("clear", removeSpotlight); function showLocation(evt) { //app.map.graphics.clear(); var point = evt.result.feature.geometry; x = point.x y = point.y var symbol = new SimpleMarkerSymbol().setStyle( SimpleMarkerSymbol.STYLE_circle).setColor( new Color([255,0,0,0.5]) ); var graphic = new Graphic(point, symbol); app.map.graphics.add(graphic); // ATTAMPT TO BUFFER THE RETURNED LOCATION //---------------------------------------------------------------------------------------- var paramsGC = new BufferParameters(); paramsGC.geometries = graphic; paramsGC.distances = [ .5 ]; //paramsGC.bufferSpatialReference = new SpatialReference({wkid: 26917}); paramsGC.outSpatialReference = app.map.spatialReference; paramsGC.unit = GeometryService.UNIT_STATUTE_MILE; // geometry service that will be used to perform the buffer var geometryServiceGC = new GeometryService("https://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); geometryServiceGC.buffer(paramsGC); geometryServiceGC.on("buffer-complete", function(result){ app.map.graphics.clear(); // draw the buffer geometry on the map as a map graphic var symbol2 = new SimpleFillSymbol( SimpleFillSymbol.STYLE_NULL, new SimpleLineSymbol( SimpleLineSymbol.STYLE_SOLID, new Color([105,105,105]), 2 ),new Color([255,255,0,0.25]) ); var bufferGeometryGC = result.geometries[0] var graphicGC = new Graphic(bufferGeometryGC, symbol2); app.map.graphics.add(graphicGC); }); //----------------------------------------------------------------------------------------- // GEOCODER END===================================================================================================
... View more
08-01-2014
11:58 AM
|
0
|
4
|
2043
|
|
POST
|
Thanks Ken....was able to see that now...very useful....
... View more
08-01-2014
06:18 AM
|
0
|
0
|
2083
|
| 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
|