|
POST
|
Thanks Jason, that looks a bit more robust as it removes the external dependencies. If anyone from Esri is reading this, it would be nice if the map object could do this automatically - calling map.setExtent(non-web-mercator-extent) could conceivably handle this on-the-fly.
... View more
08-15-2013
01:35 AM
|
0
|
0
|
2984
|
|
POST
|
Thanks Jakub, This looks really promising. I'm a bit confused as to which file to include, though. I downloaded the package from https://github.com/proj4js/proj4js - I assumed that I should add dist/proj4.js or dist/proj4.min.js But when I use either file, the line new Proj4js.Proj is not recognised. The user guide at http://trac.osgeo.org/proj4js/wiki/UserGuide seems a bit older (possibly out of date), and references: // include the library <script src="lib/proj4js-combined.js"></script> but this file is no longer included in the package. The GitHub repo contains mention of grunt - is this a requirement? Thanks for any advice, Steve EDIT: nevermind, I used the legacy code from http://trac.osgeo.org/proj4js/wiki/Download and it seems to work better
... View more
08-14-2013
06:30 AM
|
0
|
0
|
2984
|
|
POST
|
Given an ArcGIS Server service which is stored in non-Web Mercator coordinates, how can I zoom to its extent when the map is using Web Mercator? There is a method geographicToWebMercator - but what if the original coordinates are not geographic? Below is some sample code to illustrate the problem. Thanks, Steve <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>Zoom to non-WM dynamic layer</title> <link rel="stylesheet" href="http://js.arcgis.com/3.6/js/esri/css/esri.css"/> <style> html,body,#mapDiv{ padding:0; margin:0; height:100%; } </style> <script src="http://js.arcgis.com/3.6/"></script> <script> dojo.require("esri.map"); var map; var url = "http://loczy.mfgi.hu/ArcGIS/rest/services/TJAM/surf_ujfalu_t/MapServer/" function init() { //Get the layer's extent from ArcGIS Server esri.request({ url: url, content: {f: "json"}, handleAs: "json", callbackParamName: "callback", load: function(response) { //Create the map. Since we're specifying the Gray basemap it'll use Web Mercator map = new esri.Map("mapDiv", {basemap: "gray"}); //Add the dynamic layer. Although it's not stored in Web Mercator, it's automatically //projected on-the-fly and displays in the correct location var dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer(url); map.addLayer(dynamicMapServiceLayer); //Zoom the map to the new layer's extent. This fails, since the extent doesn't use WM map.setExtent(response.initialExtent); }, error: function (error) { alert("Sorry, there was a problem zooming to the new layer"); } }); } dojo.ready(init); </script> </head> <body> <div id="mapDiv"></div>\ </body> </html>
... View more
08-14-2013
03:56 AM
|
0
|
12
|
4892
|
|
POST
|
No idea, sorry. You could try hitting up @derekswingley on Twitter, or hope that he sees this post....
... View more
08-12-2013
07:48 AM
|
0
|
0
|
2723
|
|
POST
|
I'm not sure about changing what happens with the zoom controls, but for the second part of your question, you should be able to override/bypass their default behaviour in favour of your own. You can switch off the zoom in/out buttons using isZoomSlider = false then add your own +/- buttons to manually set the scale to the desired value, using setScale. To disable the scroll wheel you can use isScrollWheelZoom = false, then listen for the mouse wheel event and set the scale as above. Steve
... View more
08-11-2013
01:49 AM
|
0
|
0
|
2723
|
|
POST
|
Hi Shane, A quick tip is to surround your code in CODE tags (the # icon) to avoid stripping off the formatting. I can get it to work in Javascript when the input data is set as a constant value or selected form the layer list. When I try to run it with user defined input (a Feature Set derived from a Feature Layer) the tool fails. I am at a complete loss! Try putting a breakpoint in this section and stepping through line-by-line:
parcelsFS.queryFeatures(query, function (features) {
var inputFeatures = new esri.tasks.FeatureSet();
inputFeatures = features.features;
var params= { "Table_Name":inputFeatures};
gpTask.submitJob(params, completeCallback , statusCallback,function(error){
//alert(error);
//esri.hide(loading);
});
});
and verify that what you're doing here makes sense in all instances. If you're sometimes inputting a featureLayer, and at other times a featureSet, you may find that this is causing the problem. Steve
... View more
08-11-2013
01:40 AM
|
0
|
0
|
656
|
|
POST
|
I would like to allow users to search for a polygon location from one layer, and use a second query to determine if a different layer intersects the graphic returned by that first query. Does the code below add the first query's graphic to the map then call the second query? I agree with Jason - this code fragment does what you're asking. If it's failing, it's probably because you haven't defined query or queryTaskTouches You also haven't verified that there are any results: firstGraphic = graphics.features[0]; this might be null if there are no returned graphics.
... View more
08-07-2013
03:28 PM
|
0
|
0
|
1368
|
|
POST
|
My points are lat/long based and being plotted manually via a function call (addPointToMap(lon, lat)). The function created an esri.geometry.Point using the lat/long information, creates a esi.symbol.SimpleMarkerSymbol, and then adds a new graphic to the map using the point and marker. Like this: [INDENT]var point = new esri.geometry.Point(lon, lat, map.spatialReference);[/INDENT] [INDENT]var marker = new esri.symbol.SimpleMarkerSymbol();[/INDENT] [INDENT]marker.setColor(new dojo.Color([255, 0, 0, 0.5]));[/INDENT] [INDENT]map.graphics.add(new esri.Graphic(point,marker))[/INDENT] I think you'll need to add your points to a featureLayer based on a featureCollection, then set the time definition for the layer. After that, the layer will be time-aware and you can use the time-slider. If that doesn't work, try adding the points to a new layer inside ArcMap, set the time definition there, and publish the layer to ArcGIS Server or ArcGIS Online. Steve
... View more
08-02-2013
02:41 AM
|
0
|
0
|
785
|
|
POST
|
Hi everyone, I've been working on a new user interface to the GeoPortal Server, and I'm looking for people interested in testing it out. The new product is called GeoPortal Genie and it aims to reduce the complexity of the standard GeoPortal Server interface, by providing a streamlined application which helps users to find spatial data quickly and easily. Because the user interface has been de-coupled from the functionality, it's very easy to customize and incorporate into your site. If you're interested in testing, please head to http://geoportalgenie.com/beta and fill in your details. Thanks, Steve
... View more
07-29-2013
05:39 AM
|
0
|
0
|
2190
|
|
POST
|
Hi guys, In instances where a dataset has no bounding box, the GeoPortal doesn't show the Zoom To option in the Search results: [ATTACH=CONFIG]25995[/ATTACH] However, the JSON output for these dataset shows a bounding box covering the whole globe: "bbox" : [-180.0, -90.0, 180.0, 90.0], Is this a bug? IMO the bbox should be null if it doesn't exist for the data. Any workarounds you can suggest? Thanks, Steve -- GeoPortal Genie | a modern front-end to Esri GeoPortal Server
... View more
07-17-2013
12:09 AM
|
0
|
1
|
3957
|
|
POST
|
I'm loading a bunch of points from JSON when my map loads. I create a graphic for each from a lat/lon pair. When a user clicks a point, I'd like to fire off a query based on a custom ID attribute I store with the graphic. I'd like to make a JSON request to the same server and pull back another JSON object to populate the infoWindow. My problem comes in because due to the async nature of Javascript, my "details" JSON object isn't ready while creating the initial info Template. I can't find an event to latch onto to fire off the query. An option could be to reorganise your points into a featureLayer based on a featureCollection, as explained at http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/featurelayer.html#featurelayer2 If you were able to load the "details" object from the original JSON at the same time, there'd be no need to make a second request for this information. Alternatively, you'd at least have a better mechanism for tying the original point to the second JSON request, based on a common ID.
... View more
05-28-2013
04:47 AM
|
0
|
0
|
1392
|
|
POST
|
Is there a way to take the segments of a polygon as they are being drawn and display their measurement? I know that the measurement widget exists, however that's its own entity and separate from drawing a polygon. And so far I've been unable to find a method in which I can capture the current drawing object to run the geometry service against. Any suggestions or hints would be appreciated. If there was an event listener that could be attached which returned the current drawing object, I could then get the segment length from that I don't have a full answer, but to address some of the issues above you could try using the Draw toolbar rather than the measurement widget, as this may give more fine-grained control. The draw toolbar fires an onDrawComplete event, which you may be able to use to calculate the segment lengths. You may need to do some trickery around creating a series of 2-point lines (so you can calculate their length) then aggregating these into a more complex feature. Another option may be to run a geoprocessing script on the completed feature to calculate the segment lengths.
... View more
05-18-2013
05:03 AM
|
0
|
0
|
873
|
|
POST
|
Note: if you add a dojo.connect statement to the layer, the statement ceases to exist when you delete the layer; when the layer is re-created and added to the map, you also have to re-create the connect statement. You could attach the connect statement to a variable, so that you could disconnect it explicitly when the layer failed:
var listener = dojo.connect(layerName, "onError", removeLayer);
function removeLayer() {
//disconnect the listener
dojo.disconnect(listener);
//code to remove the layer
}
my URL switch code didn't work when more than one URL was invalid. A more pressing question might be why so many of your URLs are failing. Is that something you can solve? It's pretty unusual to need to resort to this layer replacement. Good luck, Steve
... View more
05-11-2013
05:05 PM
|
0
|
0
|
1125
|
|
POST
|
Do I have to remove the layer from the map, re-create the layer with the next URL, and add the layer back to the map? I believe that this is the case.
... View more
05-08-2013
01:19 PM
|
0
|
0
|
1125
|
|
POST
|
Ray, if the sample code linked above doesn't help, what about moving the popup completely outside of the map frame? Here is an example showing similar charts to yours - this isn't using the popup or infoWindow, but that might be a viable approach for your site too. Alternatively, I haven't tried this yet, but the What's New in 3.4 doc says: Additional changes to the popup include: easier to place the popup in a container outside the map Good luck, Steve
... View more
05-08-2013
01:17 PM
|
0
|
0
|
734
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-17-2014 08:45 PM | |
| 1 | 03-15-2011 04:23 PM | |
| 1 | 10-18-2019 12:50 AM | |
| 3 | 01-22-2019 02:33 PM | |
| 1 | 09-26-2011 10:36 PM |
| Online Status |
Offline
|
| Date Last Visited |
10-20-2022
12:19 AM
|