POST
|
I would suspect it would just be an url, so using a "file" url might work, but they do have to be formatted just so... This might help get you pointed in the right direction: http://stackoverflow.com/q/12711584/369843 cheers! ken.
... View more
04-17-2013
07:10 AM
|
0
|
0
|
267
|
POST
|
Oh, you mean pan the MAAAaaaaap! Yeah, that just shows the infowindow. I hadn't tried to get the pan the map thing working yet. I think there was a setExtent method that might do that. Arg, I'm a moron. Sorry! 🙂 ken.
... View more
03-20-2013
12:36 PM
|
0
|
0
|
425
|
POST
|
This is the line that does it: map.infoWindow.show(features[0].geometry);
So you might have to check the response you get back from the server and make sure "features[0]" has a populated response from the query. ken.
... View more
03-20-2013
10:39 AM
|
0
|
0
|
425
|
POST
|
Hi guys, I went about this slightly differently, but I'm happy with it and thought I'd share a full working example for others.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Dynamic layer template with datagrid test</title>
<link href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/dijit/themes/claro/claro.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/dojox/grid/resources/Grid.css"/>
<link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/esri/css/esri.css" />
<script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/" type="text/javascript"></script>
<script>var dojoConfig = { parseOnLoad: true };</script>
<script type="text/javascript">
//Ken Burcham - from many examples - 3/20/13
//CTUIR - GIS
dojo.require("dojo.parser");
dojo.require("esri.dijit.Popup");
dojo.require("esri.map");
dojo.require("esri.dijit.Scalebar");
dojo.require("esri.layers.FeatureLayer");
dojo.require("dijit.form.Button");
dojo.require("dijit.form.TextBox");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("dojox.grid.DataGrid");
dojo.require("dojo.data.ItemFileReadStore");
var map;
function init() {
//define custom popup options
var popupOptions =
{
markerSymbol: new esri.symbol.SimpleMarkerSymbol("circle", 32, null, new dojo.Color([0, 0, 0, 0.25])),
marginLeft: "20",
marginTop: "20"
};
//create a popup to replace the map's info window
var popup = new esri.dijit.Popup(popupOptions, dojo.create("div"));
//define a popup template
var popupTemplate = new esri.dijit.PopupTemplate({
title: "Study Site: {StudySiteID}",
fieldInfos: [
{ fieldName: "Description", visible: true, label: "Description" },
{ fieldName: "Latitude", visible: true, label: "Latitude" },
{ fieldName: "Longitude", visible: true, label: "Longitude" },
{ fieldName: "RiverName", visible: true, label: "River" }
], showAttachments: true
});
map = new esri.Map("map", {
sliderOrientation: "horizontal",
center: [-118.45, 45.56],
zoom: 10,
infoWindow: popup
});
//define my basemap
var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer");
map.addLayer(basemap);
//define our overlay layer of the reservation
var boundary = new esri.layers.ArcGISDynamicMapServiceLayer("http://restdata.umatilla.nsn.us/arcgis/rest/services/TribalLands/MapServer");
map.addLayer(boundary);
//define the feature layer which will be our water temp study sites
// api reference: http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/featurelayer.html
var featureLayer =
new esri.layers.FeatureLayer("http://restdata.umatilla.nsn.us/arcgis/rest/services/StudySites/MapServer/0",
{
mode: esri.layers.FeatureLayer.MODE_SNAPSHOT, //using this mode starts off showing all of the points
infoTemplate: popupTemplate,
outFields: ["StudySiteID", "Latitude", "Longitude", "Description", "RiverName"]
});
//clicking on the map should show the infowindow for that point
dojo.connect(featureLayer, "onClick", function (evt) {
map.infoWindow.setFeatures([evt.graphic]);
});
//populate our datagrid with all of the studysite data
dojo.connect(featureLayer, 'onLoad', function (layer) {
var query = new esri.tasks.Query();
query.where = "1=1";
layer.queryFeatures(query, function (featureSet) {
var items = dojo.map(featureSet.features, function (feature) {
return feature.attributes;
});
var data = {
identifier:"StudySiteID",
items: items
};
store = new dojo.data.ItemFileReadStore({ data:data });
try
{
var layout = [[
{ 'name': 'Study Site ID', 'field': 'StudySiteID', 'width': '100px' },
{ 'name': 'River Name', 'field': 'RiverName', 'width': '140px' },
{ 'name': 'Description', 'field': 'Description', 'width': '660px' }
]];
var grid = new dojox.grid.DataGrid({
id: 'grid',
store: store,
structure: layout,
rowSelector: '20px'
});
grid.placeAt("data"); //this is the div below that we want to fill
grid.startup();
//connect to the onRowClick event - clicking a row should show the studysite in the map
grid.onRowClick = function (e) { zoomRow(e.grid.getItem(e.rowIndex).StudySiteID); };
}
catch (err) {
console.dir(err);
}
});
});
map.addLayer(featureLayer);
//set our infowindow dimensions
dojo.connect(map, "onLoad", function (map) {
map.infoWindow.resize(270, 180);
});
//zoom in the map to this point (called when someone clicks a datagrid row)
//param: id = StudySiteID
function zoomRow(id) {
try
{
var query = new esri.tasks.Query();
query.objectIds = [id];
featureLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_ADD, function (features) {
//zoom to the selected feature and show the infowindow
map.infoWindow.setContent(features[0].getContent());
map.infoWindow.setTitle(features[0].getTitle());
map.infoWindow.show(features[0].geometry);
//map.infoWindow.resize(270, 180); //not necessary
});
} catch (err) {
console.dir(err);
}
}
var scalebar = new esri.dijit.Scalebar({
map: map,
attachTo: "top-left"
});
}
dojo.addOnLoad(init);
</script>
<style>
html,body,#mapDiv,.map.container
{
padding:0;
margin:0;
height:100%;
}
</style>
</head>
<body class="claro">
<div id="map" style="width:100%; height:80%; border:1px solid #000;"></div>
<div id="data" style="width:100%; height:20%"></div>
</body>
</html>
... View more
03-20-2013
08:49 AM
|
0
|
0
|
425
|
POST
|
I hate to *bump* this again... 🙂 but any more ideas out there?
... View more
02-27-2013
12:19 PM
|
0
|
0
|
499
|
POST
|
We're connecting to MS SQL Server 2012 using the native driver. For example, I can connect to our "FisheriesSurveyData" database (using sa user, just to rule out permissions) and drag in a table called "Redds". It adds the layer to my ArcMap called: "FisheriesSurveyData.DBO.%Redds" (not sure why it adds the % sign to the name...). When I go to the properties and click the source tab, here's the information: Data Type: Standalone Table Table Type: Query Table Server: GIS-SQL01 Client: sqlserver Connection Properties: GIS-SQL01 Database: FisheriesSurveyData User name: sa Has Object-ID Field: Yes It seems that "Standalone Table" should allow editing, yes? The ObjectID that I select for the unique id field is a Long Integer, not an ObjectID type... But I don't think that matters. When I right click the table layer and choose Edit Features -> Start Editing, I get this error: [ATTACH=CONFIG]21679[/ATTACH]
... View more
02-11-2013
08:18 AM
|
0
|
0
|
499
|
POST
|
Hi, We have a number of databases in addition to our sde geodatabase and we often create a connection to and pull in these non-sde tables and views and use the data as layers, etc. It seems that we're unable to edit these tables through ArcMap. When we try we get the error "no editable layers". These tables are editable by the same user using SQL tools, so permissions are fine. I guess my question is this: Can ArcMap edit non-SDE tables from other databases? It seems like it should be able to, but just isn't. Maybe there is something I'm missing? I've read docs and surfed the forums but coming up empty. Thanks! ken.
... View more
02-05-2013
12:36 PM
|
0
|
6
|
2656
|
POST
|
Well ok! So the dongle isn't doing anything anymore anyway? 🙂 Who knew? I guess we can just remove it on the next server reboot? And then virtualize away...? Thanks, ken.
... View more
01-31-2013
12:27 PM
|
0
|
0
|
300
|
POST
|
If your server has IIS running and you can access it via: http:\\SERVER-1 but when you try: http:\\SERVER-1:6080 that means that your desktop is able to resolve the name "SERVER-1" properly but just not connect to port 6080. (Think of "ports" like old-time CB channels or maybe TV channels). If that is the case then as others have said, it is almost certainly that there is a firewall (either on the server or between your desktop and the server) that is blocking port 6080. (Of course it is also possible that the service on the server isn't running! You might make sure you can still get to http://localhost:6080 while on the server console, just to be sure!). If you can't get to http:\\SERVER-1 or you can't do a "ping SERVER-1" from your command console, then there might be a problem resolving "SERVER-1" to the ip address of the server altogether. And then that's a WINS resolution problem. Lotsa fun. Good luck! ken.
... View more
01-31-2013
10:14 AM
|
0
|
0
|
678
|
POST
|
Hi, We are about to virtualize the Windows Server that runs our ArcGIS License Manager (among other things). Are there any issues having a virtualized license server and connecting to the hardware dongle? Or do we need to move that License Manager to a different stand-alone machine? I couldn't find any docs talking about this. Thanks! ken.
... View more
01-31-2013
09:50 AM
|
0
|
3
|
790
|
POST
|
Good morning! We wanted to show a photo in our buildings layer (added to the Tax Parcel Viewer in place of the demo "foreclosures" layer). I made the appropriate change to utils.js and thought I'd share it in case anyone else would like to do something similar. Here's a pic of how it looks finished: [ATTACH=CONFIG]21138[/ATTACH] Here is how I wanted my config.js to look. I wanted to just say "isPhoto: true" and have it make the img html tag for me: { DisplayText: "Photo:", FieldName: "${Photo}", DataType: "string", isPhoto: true }, And here's the code change in the QueryLayer function in utils.js (around line 1040). You just need to add another "if else" to deal with that "isPhoto=true" parameter: if (layerInfo.Fields[index].isDate) { var date = new js.date(); var utcMilliseconds = Number(dojo.string.substitute(layerInfo.Fields[index].FieldName, resultSet.attributes)); td1.innerHTML = dojo.date.locale.format(date.utcTimestampFromMs(utcMilliseconds), { datePattern: datePattern, selector: "date" }); } else if (layerInfo.Fields[index].DataType == "double") { var formattedValue = dojo.number.format(value, { pattern: "#,##0.##" }); td1.innerHTML = currency + " " + formattedValue; } else if (layerInfo.Fields[index].isPhoto) { //kb: here is our code to handle photos td1.innerHTML = "<a href='"+value+"' target=_blank><img height='140' src='" + value + "'/></a>"; } else { td1.innerHTML = dojo.string.substitute(layerInfo.Fields[index].FieldName, resultSet.attributes); } This will make the photo thumbnail link to the actual photo so that clicking on it will open the photo in a new window. Cheers! ken.
... View more
01-28-2013
09:50 AM
|
0
|
1
|
2054
|
POST
|
Ok, so clicking on my dynamic map layer ("Buildings" in my case) wouldn't show the little pop-up window and gave me an JSON error in the Response Body that said "Invalid Token"... It was posting to the proxy.ashx file, so I found that the request being generated by that file had two problems. 1) It was not passing along the token and 2) it didn't have the Http Referer set in the request. The latter was a problem because the token is tied to a referer. So I edited the proxy.ashx file around line 31:
// Get token, if applicable, and append to the request
string token = "SUPERSECRETTOKEN"; //getTokenFromConfigFile(uri); <-- this method didn't work so I hard coded it here for now.
if (!String.IsNullOrEmpty(token))
{
if (uri.Contains("?"))
uri += "&token=" + token;
else
uri += "?token=" + token;
}
System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(uri);
req.Referer="http://gisweb/TaxParcelViewerCTUIR/"; //kb:::added to make the token work!
Now it all seems to be working. Hope these notes help someone else in the future! ken.
... View more
01-24-2013
01:56 PM
|
0
|
0
|
322
|
POST
|
I figured it out. Had to hack on the CreateDYnamicServiceLayer in utils.js a bit. Here's the result. But when I click on the features they don't display their little window, so that's next!
function CreateDynamicServiceLayer(layerURL, layerIndex, layerId, isVisible, displayName) {
var imageParams = new esri.layers.ImageParameters();
var lastindex = layerURL.lastIndexOf('/');
imageParams.layerIds = [layerIndex];
imageParams.layerOption = esri.layers.ImageParameters.LAYER_OPTION_SHOW;
var dynamicLayer = layerURL.substring(0, lastindex);
var baseLayerURL = layerURL.substring(0,layerURL.lastIndexOf('?')); //kb - is without token.
var token = layerURL.substring(layerURL.lastIndexOf('?')+1, layerURL.length); //kb - is "token=abcxyz"
token = token.substring(token.lastIndexOf('=')+1,token.length);
dynamicLayer = dynamicLayer + "?token="+token;
var dynamicMapService = new esri.layers.ArcGISDynamicMapServiceLayer(dynamicLayer, {
id: layerId,
imageParameters: imageParams,
visible: isVisible
});
var querySeparator = layerURL.lastIndexOf('?') ? '&' : '?'; //kb
dojo.io.script.get({
url: layerURL + querySeparator + 'f=json', //kb updated
preventCache: true,
callbackParamName: "callback",
timeout: 10000,
load: function (data) {
layersCounter++;
if (layersCounter == layers.length) {
HideProgressIndicator();
}
var table = document.createElement("table");
var tbody = document.createElement("tbody");
table.appendChild(tbody);
var tr = document.createElement("tr");
tbody.appendChild(tr);
var td = document.createElement("td");
var checkbox = CreateCheckBox(layerId, layerIndex, false);
checkbox.onclick = function () {
if (this.getAttribute("state") == "check") {
this.src = "images/unchecked.png";
this.setAttribute("state", "uncheck");
dynamicMapService.hide();
map.infoWindow.hide();
}
else {
this.src = "images/checked.png";
this.setAttribute("state", "check");
ShowProgressIndicator();
dynamicMapService.show();
map.infoWindow.hide();
selectedGraphic = null;
map.getLayer(tempLayerId).clear();
map.getLayer(tempParcelLayerId).clear();
}
HideProgressIndicator();
};
td.appendChild(checkbox);
tr.appendChild(td);
td = document.createElement("td");
var img = document.createElement("img");
img.src = baseLayerURL + '/images/' + data.drawingInfo.renderer.symbol.url;
if (isMobileDevice) {
img.style.width = "44px";
img.style.height = "44px";
}
else {
img.style.width = "20px";
img.style.height = "20px";
}
td.appendChild(img);
tr.appendChild(td);
td = document.createElement("td");
td.appendChild(document.createTextNode(displayName));
tr.appendChild(td);
dojo.byId('divLayers').appendChild(table);
},
error: function (error) {
layersCounter++;
if (layersCounter == layers.length) {
HideProgressIndicator();
}
}
});
return dynamicMapService;
}
... View more
01-24-2013
01:30 PM
|
0
|
0
|
322
|
POST
|
Ok I spoke a little too soon. The basemap and the query services are working, but the layer service in the middle isn't. I've added a "Buildings" layer that I want to work like the "foreclosures" example. When I turn off security it works fine, but enabling security and adding the token on the url isn't working. When I look at the network tab in dev tools I can see that the request is being made but the token isn't accepted and so arcgis server returns a 302 redirect to the service login. Here's a picture of the request and I think the problem is that the code might be appending its other query params directly with a "?" to the url I give that includes a "?token=" already: [ATTACH=CONFIG]21037[/ATTACH] I would attach code too, but as I said, it works fine if I disable security on the service and remove the token from the url, so I think that's all setup properly. Any ideas? Or is this maybe a bug? I'll go dojo fishing next. 🙂 ken.
... View more
01-24-2013
09:28 AM
|
0
|
0
|
322
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|