|
POST
|
I want to customize the default map slider that comes with the JSAPI Compact Build but I can't seem to find any information on this. I've tried using esri.config.defaults.map.slider but the only thing I can do with this is to set the width which only turns the slider horizontal. What I'm looking to do is to physically change its position on the map. I have a toolbar across the top of my map and some users are finding it difficult to tap the + to zoom in on the map with mobile devices because the slider is too close to the toolbar and they inadvertently tap a button on the toolbar instead. So I would like to move the slider down some so it's not so close to the toolbar. How do I do this? Have you thought about developing you own dojo.form.slider and tied slider value, minimn, maxium to zoom levels?
... View more
04-18-2012
10:07 AM
|
0
|
0
|
2072
|
|
POST
|
As the title says, I have a feature layer, which is based on a feature class where several fields are constrained to be NOT NULL. I'm hoping to use this to provide the back-end to a volunteered geographic information type map. Likewise I am hoping to use the template picker and attribute inspector to create the features. The default workflow in the samples is for the feature to be created using applyEdits with the clicked geometry and null attributes when the map click or draw end event fires, then to display the attribute inspector on this feature to update them. But as far as I can tell I can't take this approach as I can't create the feature with null attributes due to the feature class constraints. The workflow that seems to be sensible is for a map onclick event to create a new feature as a graphic, and then display the attribute inspector on it in an infowindow, with a submit button. When the fields are populated (and validated), pressing the submit button will be what calls applyEdits on the feature layer, which can now be done as all attributes are present. This is pretty much what seems to be done by the Citizen Request Sample template app which "rolls its own" content for the info window to populate the fields. But i'd rather use the template picker and the attribute inspector to do the attribute editing, particularly because of the ease of styling, working with coded value domains etc, and so that the app isn't totally tied to the schema of the feature class like it is with that template. But the attribute inspector seems to be inherently tied to feature layers rather than graphics. What am i missing? Any suggestions as to a better way to accomplish this? The main point is that I don't want to get features submitted that don't have all the attributes I need, hence the use of the constraints when I set up the feature class. Thanks! Harry When you create a feature (graphic), you could input a default value such as "" for those non-null field.
var Attributes = {
field1: "",
field2: "",
.....
};
var newFeature = new esri.Graphic(geometry, null, Attributes);
// then apply attributerSepctor, so when you apply featureLayer.applyEdits (newFeature, null, null)...
... View more
04-18-2012
10:01 AM
|
0
|
0
|
1403
|
|
POST
|
So I am trying to do something very simple - return the points for the USGS Steam Flow Station layer (http://rmgsc.cr.usgs.gov/ArcGIS/rest/services/nhss_usdata/MapServer/0) that fall within the District of Columbia. There should be 3. First I construct a QueryTask to get the District of Columbia layer var queryTask = new esri.tasks.QueryTask(districtURL);
var query = new esri.tasks.Query();
query.returnGeometry = true;
query.outFields = ["*"];
query.where = "CITY_NAME = 'Washington'"
query.outSpatialReference = map.spatialReference;
queryTask.execute(query, queryResults, errorCall); I've verified that this works - one feature is returned. However, when I try to query the points in Steam Flow Station layer against this result, I get an error since null results are returned! function queryResults(featureSet){
console.log(featureSet.spatialReference);
console.log(map.spatialReference);
var queryTaskWithin = new esri.tasks.QueryTask("http://rmgsc.cr.usgs.gov/ArcGIS/rest/services/nhss_usdata/MapServer/0");
var query = new esri.tasks.Query();
query.returnGeometry = true;
query.outFields = ["*"];
query.outSpatialReference = map.spatialReference;
query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_WITHIN;
query.geometry = featureSet.features[0].geometry;
queryTaskWithin.execute(query)
dojo.connect(queryTaskWithin, "onComplete", function(fset) {
console.log(fset.features.length);
}, function(error){console.log("error" + error)});
} At one point I was getting 0 results and no error, but now I'm just getting an error. I thought this should be a simple task - any assistance would be of great help. Also, the spatial references of the district layer and the Steam Flow Station layer are seemingly different. One is 102100 and the other is 3857. But I think those are both web mercator so it shouldn't matter too much, right? Thanks! Jay I think the issue is your query.spatialRelationship. Comment it out, and see what happen.
... View more
04-17-2012
08:28 AM
|
0
|
0
|
1893
|
|
POST
|
I am not sure what I am doing wrong but when I only want to specify a county and state as the address locator - no results come back - can someone please provide me with some guidance on how to use this api correctly. my javascript so far: var address = { county: "Ocean", state: "NJ" }; this.locator.addressToLocations(address); It works fine when I use all the specific address variables like this: var address = { address : "", city: "", state: "", zZip: "" }; dojo.forEach(this.locatorFields, dojo.hitch(this, function(name) { address[name] = this.widgets[name].getValue(); })); Thanks for your continued help I think the better approach would be to create your own simple locator that has city and state as your address fields. You could easily grab a state and county layer and build and locator on it.
... View more
04-04-2012
01:09 PM
|
0
|
0
|
1999
|
|
POST
|
It can be done. It would be easier as json/geojson/csv, but it is doable. Here is a library that was written in js to do it: https://github.com/RandomEtc/shapefile-js. Basically, you are going to have to read it and make graphics from the data in the shapefile. It may run a little slowly and will probably cause issues in IE if it is not fast enough since the javascript engine does not have the performance of the other browsers. Hope this helps. I have done a POC for my potenial projects. I ran a GP to append a uploaded shape file to an existing feature layer in a map service where the GP layer is also located. You are looking similiar approach except you might have to truncate the featurelayer before upload the shape file.
... View more
04-04-2012
11:16 AM
|
0
|
2
|
982
|
|
POST
|
Hi Solid Smoke, Did you ever find a solution for adding shapefiles using javascript api?? Thanks, -Swapna One approach i would give a try is to develop a GP tool where you could upload the shape file to a featurelayer on a map service.
... View more
04-04-2012
06:39 AM
|
0
|
0
|
3095
|
|
POST
|
still stuck on this because I only want to pass in county & state - here's my code that pulls the data from the controls: var address = { county: "", state: "" }; dojo.forEach(this.locatorFields, dojo.hitch(this, function(name) { address[name] = this.widgets[name].getValue(); })); this.locator.addressToLocations(address); no results are coming back even though I know ocean, nj exists - any ideas? do I need a list of predefined counties in each state? Try this:
var address ={}; Then specify any address fields that have value. for example, if address and state has value (ocear, nj), then your code should be: address.address ="ocean"; address.state ="nj";
... View more
04-03-2012
12:10 PM
|
0
|
0
|
1999
|
|
POST
|
Still no joy in mudville. No response here either. combined function: function doRepManager(fset){ //draws the rep points, fires populateTable var infoTemplate = new esri.InfoTemplate("Sales Rep: ${NAME}", "${*}"); var symbol = new esri.symbol.SimpleMarkerSymbol(); symbol.style = esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE; symbol.setSize(6); symbol.setColor(new dojo.Color([219, 112, 147, 1])); var repResultFeatures = fset.features; for (var i = 0, il = repResultFeatures.length; i < il; i++) { var repGraphic = repResultFeatures; repGraphic.setSymbol(symbol); map.graphics.add(repGraphic); repGraphic.setInfoTemplate(infoTemplate); map.graphics.add(repGraphic); }; //create array of attributes console.log(fset.features) var items = dojo.map(fset,function(result){ var graphic = result.feature; graphic.setSymbol(symbol); map.graphics.add(graphic); return result.feature.attributes; }); //Create data object to be used in store var data = { identifier: "rep_no", //This field needs to have unique values label: "rep_no", //Name field for display. Not pertinent to a grid but may be used elsewhere. items: items }; //Create data store and bind to grid. store = new dojo.data.ItemFileReadStore({ data:data }); var grid = dijit.byId('grid'); grid.setStore(store); }; The following code ties the grid with the query results interactively. All you need to do is define a dojo datagrid in you markup. <table data-dojo-type="dojox.grid.DataGrid" data-dojo-id="grid" id="grid" data-dojo-props="rowSelector:'0px', autoWidth:'ture', autoHeight:'true'"> <thead> <tr><th field="OBJECTID" formatter="makeZoomButton" width="40px">View</th> <th field="ACREAGE" width="60px">Acreage</th> <th field="PIN" width="250px">Property PIN</th> <th field="OWNER" width ="250px">Property Owner</th> <th field="ADDR_1" width="200px">Property Address</th> <th field="CITY" width ="60px">City</th> <th field="STATE" width="50px">State</th> <th field="ZIP" width ="80px">Zip Code</th> <th field="LEGAL1" width="200px">Legal Notes</th> </tr> </thead> </table> Once you did that, run the codes similiar to the following to tie the grid data store to featureSet. features. queryTask.execute(query, function (featureSet) { //alert("number of parcels are found=" + featureSet.features.length); if (featureSet.features.length > 0) { var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new dojo.Color([100, 100, 100]), 1), new dojo.Color([255, 0, 0, 0.20])); var highlightSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0]), 3), new dojo.Color([255, 0, 0, 0.20])); var items = []; dojo.forEach(featureSet.features, function (feature) { var graphic = feature; graphic.setSymbol(symbol); map.graphics.add(graphic); items.push(feature.attributes); }); var data = { identifier: "OBJECTID", items: items }; store = new dojo.data.ItemFileReadStore({ data: data }); grid.setStore(store); //grid.selection.clear(); graphicHandler = dojo.connect(map.graphics, "onClick", function (evt) { var clickedGraphic = evt.graphic; dojo.forEach(map.graphics.graphics, function (graphic) { if (clickedGraphic === graphic) { graphic.setSymbol(highlightSymbol); //map.setExtent(graphic.geometry.getExtent()); } else { graphic.setSymbol(symbol); } }); grid.selection.clear(); //highlight the coorespondent row in datagrid. var item; for (var i = 0; i < grid.rowCount; i++) { item = grid.getItem(i); //item = grid._by_idx.item; if (clickedGraphic.attributes.OBJECTID == item.OBJECTID) { grid.selection.setSelected(i, true) //grid.focus.setFocusIndex(i, 0); //grid.selectedIndex = i; } } }); } else { alert("No parcel property is found"); } }); Let me know if you have any questions.
... View more
04-03-2012
11:56 AM
|
0
|
0
|
1448
|
|
POST
|
When the SimpleFillSymbol is created as seen below: var sfs = new esri.symbol.SimpleFillSymbol(style, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.SOLID, new dojo.Color("FFE01B6A"),2), new dojo.Color("FF1B1EE0")); The outline color remains set to black. It should be set to blue. The color can be set manually after the SimpleFillSymbol is created: sfs.outline.color = new dojo.Color("FF1B1EE0"); Is this a known issue? For dojo.Color construct, you either put RGB (or RGBA) -[R, G, B (, A)], or Hex string -#AABBCC, or Color Name -"White".
... View more
03-20-2012
11:06 AM
|
0
|
0
|
1729
|
|
POST
|
I am talking about using an .svg as the source. I want to be able to draw some complicated vector graphics that the ESRI point, line, polygons, etc. do not provide me. I would like to use svg's that I build via a symbol server that I have developed. I just cannot figure out how to plot an .svg directly to an arcgis web map (graphics layer) with the current ESRI javascript API. I did a POC a couple of weeks back where I upload a image file (through file input html element) as the source of picture marker symbol. I tried .svg file and it did not work. Maybe ESRI JSAPI team member could help us with this.
... View more
03-19-2012
01:28 PM
|
0
|
0
|
991
|
|
POST
|
Hi Heming, Your solution helped a little bit. The field is displayed properly but the dojoxGrid-master-header is still 46px high. I cannot change that anyway. Here dojoxGrid-header is contained within dojoxGrid-master-header. Please find attached the image of the table on the GIS application. I have tried giving values to this as well but has no effect. Additionally, I have encountered another major issue with this grid. I modified my application a little bit and created two tabs. I moved this grid to one of the tabs and it has stopped showing completely. The height of the grid shows up as 0px in JavaScript Console. I have not yet found a solution to make this grid visible. I'll really appreciate any help. Thanks Samir have you tried setting master header height to auto, and also setting header margin and padding to 0px?
... View more
03-19-2012
01:22 PM
|
0
|
0
|
1911
|
|
POST
|
I would like to draw my own custom SVG images to an ArcGIS based web map using the ESRI Javascript API. They are not embedded SVG's in HTML but are dynamically provided to me by a custom symbol server. I have tried plotting an SVG to a graphics layer using a PictureMarkerSymbol and also just using a Graphic but have been unable to get my custom SVG's to plot. ESRI's points, lines, polygons, etc. are great but are not the symbols that I need in this case. I have plotted other custom single point symbols to my web map using png's; but I would like to plot more complex symbols using SVG's. Any advice would be greatly appreciated. Are you talking about using .svg as the source of PictureMarkerSymbol or any allowed SVG vector graphics (png, jpg etc)?
... View more
03-19-2012
10:23 AM
|
0
|
0
|
991
|
|
POST
|
Hi Zhu, I added the code you suggested, still getting an error. I am trying to get a button at the top of the infoWindow. >>>>>>>>>>>>> map.infoWindow.setTitle("Identify Results"); map.infoWindow.setText(infoTemplate.content=="<input type='button' value='open newpage' onclick='window.open(http://www.google.co.uk)'/>" ); map.infoWindow.setContent(tc.domNode); map.infoWindow.resize(360, 200); >>>>>>>>>>>>>>>>>>>>>>> I don't think infoWindow has a setText method. I know it has setContent method.
... View more
03-15-2012
10:41 AM
|
0
|
0
|
2148
|
|
POST
|
Also tried this, does not work ... error In webpage >>>>>>>>>>>> map.infoWindow.setTitle("Identify Results"); map.infoWindow.setText(<a target='_blank' href=http://en.wikipedia.org/wiki/"+ +">Wikipedia Entry</a>"); map.infoWindow.setContent(tc.domNode); map.infoWindow.resize(360, 200); >>>>>>>>>>>> In infoWindow >>>>>>>>>>>> this._closeButton = dojo.create("div", { "class": "close", title: "Close" }, this.domNode); this._title = dojo.create("div", { "class": "title" }, this.domNode); this._setText = dojo.create("div", { "class": "text" }, this.domNode); this._content = dojo.create("div", { "class": "content" }, this.domNode); >>>>>>>>>>>> Should something like this:
infoTemplate.content="<input type='button' value='open newpage' onclick='window.open(...)'/>"
... View more
03-15-2012
06:28 AM
|
0
|
0
|
2148
|
|
POST
|
Hi, Is it possible to create a button in the infoWindow to launch a new window/web page?? Thanks, Clive Yes, you could customized infoWindow a lots of way you want. In your case you could write a HTML Markup for a button and attach a onclick handler to open a new web page, and then set your infoWindow content to that html markup. You can read this to get more info: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp/intro_formatinfowindow.htm
... View more
03-15-2012
05:24 AM
|
0
|
0
|
2148
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 04-11-2011 12:16 PM | |
| 1 | 05-25-2017 08:26 AM | |
| 1 | 06-02-2017 07:37 AM | |
| 1 | 06-28-2011 07:02 AM | |
| 1 | 06-12-2017 10:10 AM |
| Online Status |
Offline
|
| Date Last Visited |
10-01-2024
09:57 PM
|