|
POST
|
I've been having trouble trying to load a map in a spatial reference wkid of 26915. I've tried a couple of different ways. I load a map without any basemaps and then add an ImageService that has a wkid of 26915. require([ 'esri/map', 'esri/layers/ArcGISImageServiceLayer' ], function(Map, ArcGISImageServiceLayer) { var map = new Map('map', { autoResize: true, center: [762120.3983057996, 4286928.371310163], scale: 2888.131627324678 }), imgurl = 'http://moimagery.missouri.edu/arcgis/rest/services/LGov/EWGateway2012_6inch/ImageServer'; map.addLayers([new ArcGISImageServiceLayer(imgurl)]); map.on('click', function() { console.debug('MAP CENTER: ', map.extent.getCenter()); console.debug('MAP SCALE: ', map.getScale()); }); }); I get a console message like so: Map: Geometry (wkid: 4326) cannot be converted to spatial reference of the map (wkid: 26915) But my map is not where it should be. If you open the debug console of your browser and click on the map, you can see the center and scale are not as expected. I even tried explicitly defining the spatial reference of the map in the map options. require([ 'esri/map', 'esri/layers/ArcGISImageServiceLayer', 'esri/SpatialReference' ], function(Map, ArcGISImageServiceLayer, SR) { var map = new Map('map', { autoResize: true, spatialReference: new SR({wkid:26915}), center: [762120.3983057996, 4286928.371310163], scale: 2888.131627324678 }), imgurl = 'http://moimagery.missouri.edu/arcgis/rest/services/LGov/EWGateway2012_6inch/ImageServer'; map.addLayers([new ArcGISImageServiceLayer(imgurl)]); map.on('click', function() { console.debug('MAP CENTER: ', map.extent.getCenter()); console.debug('MAP SCALE: ', map.getScale()); }); }); You can run a sample of this here; http://plnkr.co/edit/lUXpEIfdpMToCYGzMK4R Again, checking the console, these numbers don't match. If I don't set the scale, it will just default to the full extent of the service. This does work if I explicitly define an extent like this: require([ 'esri/map', 'esri/layers/ArcGISImageServiceLayer', 'esri/SpatialReference', 'esri/geometry/Extent' ], function(Map, ArcGISImageServiceLayer, SpatialReference, Extent) { var ext = new Extent(689690.1735286616, 4231176.807089917, 739306.7413302765, 4256822.370572377, new SpatialReference({wkid: 26915})), map = new Map('map', { autoResize: true, extent: ext }), imgurl = 'http://moimagery.missouri.edu/arcgis/rest/services/LGov/EWGateway2012_6inch/ImageServer'; map.addLayers([new ArcGISImageServiceLayer(imgurl)]); }); http://plnkr.co/edit/LqpDulsrKhGYEH3QRS3H?p=preview So the map is using the SpatialReference of the extent to set itself up properly, but doesn't seem to like having a SpatialReference set and use the center option like I was trying to do above. Am I missing something? The map reference for the center option doesn't say it has to be in wkid: 4326. http://developers.arcgis.com/en/javascript/jsapi/map-amd.html#map1 edit, because it does say array containing longitude and latitude in the docs, so yeah, that implies I can only use the center option if using a web mercator map that it could convert the lat/longs from. That kinda blows, I'll just have to go with extents in this case.
... View more
06-05-2013
08:47 AM
|
0
|
2
|
6188
|
|
POST
|
Are you trying to find the center coordinates to use in your map constructor, similar to how the apps you link show the extent? I've been using this to get my map centers. http://teczno.com/squares I could have sworn I saw someone had hosted a modified version of the extenthelper to show the center coordinates, but don't know link. The link above works fine for me.
... View more
05-30-2013
02:36 PM
|
0
|
0
|
782
|
|
POST
|
What kind of error are you getting? A multiple define or a a "require has no method on" error? According to this ticket, it should be doable with latest API 3.5 as it's based on Dojo 1.8.3, but I have not tried mixing the two https://bugs.dojotoolkit.org/ticket/15616
... View more
05-28-2013
02:38 PM
|
0
|
0
|
1584
|
|
POST
|
I would definitely be interested. I made an attempt at this, but I think my math was off as my map just jumped around all over the place. Thanks.
... View more
05-14-2013
11:10 AM
|
0
|
0
|
2235
|
|
POST
|
I think if a field value is numeric, you can eliminate the single quotes, could be an issue. Tough to diagnose without looking at the data. How about if you do one query a time, without trying to combine them?
... View more
05-14-2013
06:12 AM
|
0
|
0
|
2027
|
|
POST
|
Is that your exact query? This query.where= "field1='"+value1+"'" && "field2='"+value2+"'" is a boolean expression, true or false. Is this the exact code you are using? It should be formed as query.where = "field1='" + value1 + "' AND field2='" + value2 + "'" Try to test it via the Query REST page and see if it works as expected.
... View more
05-14-2013
05:31 AM
|
0
|
0
|
2027
|
|
POST
|
I never really thought about it, but the paging is set up by the number of features associated with the popup. http://developers.arcgis.com/en/javascript/jsapi/popup.html#setFeatures When setFeatures is used the title area displays the number of features and the index of the currently selected feature and ignores the title defined in the info template. If you want to display title text you will need to specify it as part of the info window content. Think like on an Identify function; you grab multiple features and set their infoTemplate content and stuff those features into a popup via setFeatures, then use show() to display it somewhere.
... View more
05-07-2013
07:23 AM
|
0
|
0
|
2930
|
|
POST
|
No kidding. Haha, that helps me out a lot. I've been going back and forth with the Server admin tweaking stuff to figure out why all our queries seem to cap out at 1000. For crying out loud. We were able to work around this by tweaking our queries to look like ID IN (1, 2, ..., 999) OR ID IN (1000, 1001, ..., n) It worked in my case.
... View more
05-02-2013
02:28 PM
|
0
|
0
|
2878
|
|
POST
|
The way I use it is either on a "onClick" event of a GraphicsLayer or FeatureLayer or an IdentifyTool. You would iterate over your results or FeatureSet so something like define(['dojo/_base/array', 'helpers/templateBuilder'], function(array, templateBuilder) {
// do something on a click or identify
array.forEach(featureSet, function(feat) {
feat = templateBuilder.buildInfoTemplate(feat);
});
// do something for results
}); This piece here is where all the work is done.
var content = [],
urlField = options ? options.urlField : '', // you can include url info in options
urlPrefix = options ? options.urlPrefix : ''; // you can include url info in options
// get the dom element for my infotemplate as a string
content[content.length] = '<table cellspacing="0" class="table table-striped table-condensed attr-info">';
if (feature.layerName) {
content[content.length] = '<tr><td class="fieldName">SOURCE: </td><td class="fieldName">' + feature.layerName + '</td></tr>';
}
/**
* Iterate over attributes to get field names.
* Ignore certain fields not needing to be displayed
* Order matters, so loop forward over keys.
**/
var keys = Object.keys(feature.attributes),
i = 0,
len = keys.length;
// This is where al the real work is done.
for (; i < len; i++) {
var _key = keys.toLowerCase(),
name;
// add any other values you want to ignore into this if statment || _key === 'objectid2' for example
if (!(_key.indexOf('shape') > -1 || _key === 'layername'|| _key === 'objectid' || _key === 'fid')) {
name = keys;
if (name.toLowerCase() !== urlField) {
content[content.length]= '<tr><td class="fieldName">' + name + '</td><td>${' + name + '}</td></tr>';
} else {
content[content.length] = '<tr><td class="fieldName">' + name + '</td><td><a href="' + urlPrefix + '${' + name + '}">${' + name + '}</a></td></tr>';
}
}
}
content[content.length] = '</table>';
I don't have a sample on hand, but if you wanted to use this to assign to an InfoTemplate to the whole FeatureLayer, you need the fields info from a FeatureLayer http://developers.arcgis.com/en/javascript/jsapi/featurelayer.html#fields Tweak the code to iterate over the field values. Now that I think about it, I like that idea better... I'll probably refactor this to handle an array of fields and make it useable in varying scenarios... But I hope that helps a little bit.
... View more
04-30-2013
09:00 AM
|
0
|
0
|
3212
|
|
POST
|
I put this little helper module a while ago and use it regularly to filter build my InfoTemplates. You might find it useful. https://github.com/odoe/agsnode-dev/blob/master/public/javascripts/helpers/templateBuilder.js Actually, looking at that, I updated it with updates I made to accept options for a URL field.
... View more
04-26-2013
05:52 AM
|
0
|
0
|
3212
|
|
POST
|
The Map::centerAndZoom method behaves differently based on your basemap data. http://help.arcgis.com/EN/webapi/javascript/arcgis/jsapi/map.html#centerAndZoom So in reference to the second argument in that function: When using an ArcGISTiledMapServiceLayer, the map is zoomed to the level specified. When using a DynamicMapServiceLayer, the map is zoomed in or out by the specified factor. For example, use 0.5 to zoom in twice as far and 2.0 to zoom out twice as far. So when you have a Tiled basemap and you use map.centerAndZoom(point, 9), it will zoom to the 9th level of your maps level of details. When you have a dynamic basemap and use map.centerAndZoom(point, 9), you are zooming out by a factor of 9, that's global status. So you'll want to adjust how you use it based on your basemap.
... View more
04-25-2013
07:10 AM
|
0
|
0
|
1493
|
|
POST
|
dojo/domReady! only waits for the dom to load before returning. This is fine in most situations, but if you have dijits and other items that need to be loaded, it doesn't care if your dependencies are ready. If that is an issue, try using dojo/ready to wait for other dependencies to load. dojo/domReady http://dojotoolkit.org/reference-guide/1.8/dojo/domReady.html dojo/ready http://dojotoolkit.org/reference-guide/1.8/dojo/ready.html So with a brief, but clear explanation http://stackoverflow.com/a/13144258
... View more
04-24-2013
09:13 AM
|
0
|
0
|
2547
|
|
POST
|
This is what is set in the map service page for my basemap. Format: JPEG
Compression Quality: 55.0
Origin: X: -1.76271E7
Y: 1.97986E7
Spatial Reference: 102696 (102696) All my other map services have Spatial Reference: 102696 (102696) If I remove the extent values, I still get the error. I tried changing to a web mercator basemap, same error.
... View more
04-24-2013
04:03 AM
|
0
|
0
|
3118
|
|
POST
|
I forgot to mention these are all secured services if it matters. Credentials manually added to the IdentityManager.
... View more
04-23-2013
08:55 PM
|
0
|
0
|
3118
|
|
POST
|
Using AGS SL API 3.1 I'm at a loss on this one. My map has a TileMapServiceLayer, couple of Dynamic Layers and a couple of FeatureLayers. The FeatureLayers URL sources are set before the map loads All layers are from the same server and have the same spatial reference. I set the URLs of the FeatureLayers via a resource, and load Dynamic layers when the app starts. I manually set my extent to be safe. <esri:Map x:Name="Map" Background="{StaticResource BaseColor}">
<esri:Map.Extent>
<esri:Envelope XMin="number" YMin="number" XMax="number" YMax="number" >
<esri:Envelope.SpatialReference>
<esri:SpatialReference WKID="102696"/>
</esri:Envelope.SpatialReference>
</esri:Envelope>
</esri:Map.Extent>
... Even if I just slightly pan the map, I get the attached error. [ATTACH=CONFIG]23734[/ATTACH] I'm lost on how to handle this. It says to clear the map layers. What? If I could even figure out where to handle the error, I'd attempt to catch it and see if I could ignore it. I stripped everything down to just a single TiledMapServiceLayer and the error still persists. Any help would be greatly appreciated, thanks.
... View more
04-23-2013
08:35 PM
|
0
|
10
|
8907
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 05-19-2026 02:12 PM | |
| 1 | 04-24-2026 11:01 AM | |
| 2 | 04-21-2026 07:06 AM | |
| 1 | 02-27-2026 06:31 AM | |
| 1 | 01-13-2026 02:15 PM |
| Online Status |
Offline
|
| Date Last Visited |
yesterday
|