|
POST
|
It's easy for me to say "mySQL and PHP" and you to say "SDE and feature service", but it's going to require some work server and client side either way. I know he wants to save graphics, but not his overall goal, e.g. is it spatial information or just user markup? I've been saving graphics, maps, bookmarks, etc this way before the api had feature layers and native editing support. I will continue a use and advocate this approach as it fits my needs and is in my view the most expedient. This isn't the first time I've seen questions about this sort of thing on the forums and in reality it's hard to give an quality answer to such a question. So I'm going to create a example for the code gallery where user graphics can be saved and retrieved using mySQL and PHP with all the code for download. Expect it by the end of October. I'll post in forum when finished. @geos_rfleet If you're up for a little friendly competition do the same with feature layers and editor. 😉
... View more
08-29-2012
11:18 AM
|
0
|
0
|
2633
|
|
POST
|
I'd like to save these selections in the database, if possible. MySQl and PHP is an easy way to save graphics, maps, bookmarks, notes and more. I've tried SQL and .net, but it seemed like 10x the work with poorer results. The api is great because it allows you to create json from DOM objects, e.g. all the graphics on a specific graphics layer. For saving maps I create my own DOM object with all the map params, layer states, etc, and save it as plain text in MySQL via PHP. As a side note, my apps require the user to be logged in as to identify what belongs to who. An admin account can view everything. ------------------------------------ app.map._layers.gl_measure.add(app.map._layers.gl_identify.graphics[0]) This is an easy way to copy a graphic to another gl. I did this on console's command line to copy the first graphic in my identify layer to my measure layer. You have to refresh the map to get it to display or it will show up after next zoom or pan.
... View more
08-28-2012
01:01 PM
|
0
|
0
|
2633
|
|
POST
|
Yep it's there in 3.1. First thought was v was set to 3.0 but it is 3.1. Not sure why I was having issues the other day.
... View more
08-28-2012
08:41 AM
|
0
|
0
|
1594
|
|
POST
|
@btfou - I think you misunderstood - I'm not wanting to hack/steal their code. I simply want to extend it (fairly common for Silverlight API). I am also not opposed to writing my own - which maybe where I end up - I just need something quick and would prefer to stick with OOTB functionality. I have been down the custom road before and been burned too many times. I wasn't suggesting that you would. And maybe it's perfectly legit to copy an esri widget's code and rewrite as your own. I personally don't see it that way. It seems that my experience has been the opposite of yours in that I've had more success creating my own and getting exactly the functionality and result I want.
... View more
08-28-2012
08:29 AM
|
0
|
0
|
2001
|
|
POST
|
I'm not going to be able to help on that too much. I've never used the out-of-the-box measure widget. I wrote my own before the api came with one. It's hard to alter the behavior of any dojo based widget without editing the code. The problem with the esri namespace is all js files start with: /*
COPYRIGHT 2009 ESRI
TRADE SECRETS: ESRI PROPRIETARY AND CONFIDENTIAL
Unpublished material - all rights reserved under the
Copyright Laws of the United States and applicable international
laws, treaties, and conventions.
For additional information, contact:
Environmental Systems Research Institute, Inc.
Attn: Contracts and Legal Services Department
380 New York Street
Redlands, California, 92373
USA
email: contracts@esri.com
*/ I've certainly studied a good portion of the esri namespace code to better understand the api, but I've been reluctant to copy their code or edit widgets, except to fix a few minor bugs in real time. Do on to others...right? It's much more satisfying to write your own anyway. I hope you figure it out and if you decide to write your own good luck!
... View more
08-27-2012
12:54 PM
|
0
|
0
|
2001
|
|
POST
|
1. Use the FireBug plugin for Firefox to inspect the element, and use css to override the default style. 2. To reproject geometry you'll need to use an ArcGIS Server GeometryServer's Project operation. I don't know if you can do that with the out-of-box measure widget. Sounds like you need to write your own widget to meet your specific needs.
... View more
08-24-2012
10:47 AM
|
0
|
0
|
2001
|
|
POST
|
app.map.addLayer(layer); layer.url = l.url; if (l.legend == true) { app.mapParams.legendLayers.push({ layer: layer, title: l.name }) } I add the layer to the map; then set the LAYER.url string back to the token free url; finally push the layer to the legend. This doesn't affect the layer's ability to retrieve images for the map because those request urls use the LAYER._getToken() function to add the token as a content pair for future requests.
... View more
08-24-2012
10:38 AM
|
0
|
0
|
1882
|
|
POST
|
I figured it out. When adding a dynamic layer to the legend the code in 2.8 doesn't check to see if the LAYER.url string has a token, nor does it run LAYER._getToken(). It assumes that if it is a valid secured service a token will be present. In 3.0 a small change was made, which runs LAYER._getToken() and if it returns true it adds a token querystring to the url. The problem is, it doesn't check to see if a token querystring is already present in the url and adds another regardless. The result is a failed request. This was a small oversight on the recode. This could easily be fixed in a local API install, but the JSAPI Team needs to look at this. I assume they look through the forum for this kind of thing. I'll repost for them if they don't acknowledge this in a day or two. Thanks in advance guys. Keep up the good work! Thanks for your input too Jeff. Here's v2.8 _legendRequestServer: function(_27) {
var url = _27.url;
var pos = url.indexOf("?");
if (pos > -1) {
url = url.substring(0, pos) + "/legend" + url.substring(pos);
} else {
url += "/legend";
}
var _28 = _4.hitch(this, "_processLegendResponse");
var _29 = {};
_29.f = "json";
if (_27._params.dynamicLayers) {
_29.dynamicLayers = _27._params.dynamicLayers;
if (_29.dynamicLayers === "[{}]") {
_29.dynamicLayers = "[]";
}
}
var _2a = esri.request({
url: url,
content: _29,
callbackParamName: "callback",
load: function(_2b, _2c) {
_28(_27, _2b, _2c);
},
error: esriConfig.defaults.io.errorHandler
});
return _2a;
} and 3.0+ _legendRequestServer: function(_24) {
var url = _24.url;
var pos = url.indexOf("?");
if (pos > -1) {
url = url.substring(0, pos) + "/legend" + url.substring(pos);
} else {
url += "/legend";
}
var _25 = _24._getToken();
if (_25) {
url += "?token=" + _25;
}
var _26 = _2.hitch(this, "_processLegendResponse");
var _27 = {};
_27.f = "json";
if (_24._params.dynamicLayers) {
_27.dynamicLayers = _24._params.dynamicLayers;
if (_27.dynamicLayers === "[{}]") {
_27.dynamicLayers = "[]";
}
}
var _28 = esri.request({
url: url,
content: _27,
callbackParamName: "callback",
load: function(_29, _2a) {
_26(_24, _29, _2a);
},
error: esriConfig.defaults.io.errorHandler
});
return _28;
}
... View more
08-24-2012
09:57 AM
|
0
|
0
|
1882
|
|
POST
|
Your first issue is that you call dojo.addonload(init); it should be dojo.addOnLoad(init). Dojo classes are case sensitive. So are esri classes. map.infowindow.resize(200,125) should be map.infoWindow.resize(200,125). After I fixed addOnLoad and ran it, more errors popped up. If you don't have the FireBug plugin for Firefox get it. It's dang near impossible to develop in the JSAPI without it (even simple maps).
... View more
08-24-2012
07:34 AM
|
0
|
0
|
620
|
|
POST
|
Right under getExtent(). [ATTACH=CONFIG]17219[/ATTACH] The ref for getScale() is under "esri.geometry Namespace Methods". It's been around since v1.4. I suspect it was the proper place for it back when the map object was quite a bit simpler than it is now. Never stop learning, right?
... View more
08-24-2012
07:22 AM
|
0
|
0
|
1594
|
|
POST
|
Here's the pertinent parts of function that adds a dynamic layer. Same concept for feature layers. var url;
if (l.token == true) {
url = l.url + '?token=' + config.token
} else {
url = l.url
}
var layer = new esri.layers.ArcGISDynamicMapServiceLayer(url, {
id: l.id,
visible: l.visible,
opacity: l.opacity
});
layer.setImageFormat(l.imageFormat);
layer.setDPI(l.dpi);
if (l.legend == true) {
app.mapParams.legendLayers.push({
layer: layer,
title: l.name
})
}
app.map.addLayer(layer); As you can see I'm manually appending the token. When the page loads the first javascript file is php that returns "var token = THE_TOKEN;" based on the referrer or I include the token in my config object as above. It's a little archaic, but that's how I've done it since the beginning. I can see where this going; probably time to get acquainted with IdentityManagerBase.
... View more
08-24-2012
06:46 AM
|
0
|
0
|
1882
|
|
POST
|
Do you mean esri.geometry.getScale? esri.geometry.getScale(MAP_OBJECT) works, which is not a map object method, yet the api ref says it is.
... View more
08-24-2012
05:24 AM
|
0
|
0
|
1594
|
|
POST
|
I add dynamic and feature layers when the application loads by iterating through an object literal like such: var config = { token: SOME_TOKEN, layers: [ { type: 'dynamic', url: 'http://MY_URL/ArcGIS/rest/services/Slope/MapServer', token: true, name: 'Slope', id: 'slope', visible: false, opacity: 0.5, imageFormat: 'png32', dpi: 96, legend: true, parcelLabelControl: false, subLayerControl: false, info: true, infoHtml: 'This layer displays slopes.' }, { type: 'feature', url: 'http://MY_URL/ArcGIS/rest/services/Fire_Hydrants/MapServer/0', token: true, name: 'Fire Hydrants', id: 'firehydrants', visible: false, opacity: 1, imageFormat: 'png32', dpi: 96, legend: true, itTitle: 'Fire Hydrant', itContentType: 'function', itContentText: '', itContentFunction: 'config.featureFunctions.hydrants.infoTemplate' } ] } If a token is required it's added to the url when the layer object is created. Layers are pushed to the legend when legend is set to true. Through 2.8 this worked fine, but not in 3.0+. I did some digging and discovered that in 2.8 the legend widget makes calls to the map service's legend REST like so: http://MY_URL/ArcGIS/rest/services/Slope/MapServer/legend?token=SOME_TOKEN&f=json&callback=dojo.io.script.jsonp_dojoIoScript23._jsonpCallback In 3.0+ the call is: http://MY_URL/ArcGIS/rest/services/Slope/MapServer/legend?token=SOME_TOKEN?token=SOME_TOKEN&f=json&callback=dojo.io.script.jsonp_dojoIoScript23._jsonpCallback Notice the token query string is represented twice with two ?. AGS returns a 'invalid token' error. Seems to me there's an error forming the url for the legend REST call. Perhaps getting the service's base url from SOME_LAYER.url instead of SOME_LAYER._url.path. Any help would be appreciated as this is a roadblock as I migrate to 3.0+. Thanks.
... View more
08-24-2012
04:41 AM
|
0
|
6
|
2980
|
|
POST
|
I noticed the getScale() method has been added to the api reference, but is doesn't exist in a loaded DOM. Is it unimplemented at this point or is there an issue? I use .__LOD.scale. Which is easy enough, but a working getScale() method would be nice.
... View more
08-24-2012
02:34 AM
|
0
|
6
|
2266
|
|
POST
|
@John What aspect are you interested in? Saving user info or creating an AGS equivalent in php/mysql? If it's the former I could put together a sample like saving a map, bookmarks or graphics, and add it to the code gallery. It's fairly easy. I'm trying to ease up on my hermit ways. As part of that I'm putting together some samples for the code gallery. I added my first one the other day. If it's the latter, I cannot help. I met someone a few years ago through a friend, while he was in graduate school, who was trying to develop an open source substitute for AGS. I did some testing for him at the time, but then he finished school and moved to China or somewhere over there, and that was the end of that.
... View more
06-07-2012
09:26 AM
|
0
|
0
|
1736
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-18-2013 06:56 AM | |
| 1 | 06-30-2015 09:17 AM | |
| 1 | 10-12-2013 07:14 AM | |
| 1 | 02-05-2014 11:05 AM | |
| 1 | 05-28-2015 11:41 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|