0

I have a list of corner coords for study areas in a sharepoint list. I used 'calculated field' to generate a url that launches our internal webmap in a new window and sets the extents as the coordinate corners. Client has asked for a bounding box to be drawn on launch.

As I understand it there would need to be some Javascript written in custom webmap/app that will decode the corner coords from the url parameter, create a markerfillobject and display it on the map. I am not a Javascripter.

I can change the structure of the url if required, but here is the current one - just using default parameters - http://www.arcgis.com/home/webmap/viewer.html?extent=121,-25,122,-24&mapOnly=true

The extent values are what should be shown as the polygon.

Can anyone assist?

We are not able to integrate the ESRI Maps for Sharepoint Web Part, (which I believe only does points anyway) - so please view sharepoint as only the method of generating the concatenated URL - not as the platform for development.

So it looks like a combination of a URL constructed to apply specific parameters for each corner point,

then,

use ESRI urlToObject to extract the values

then,

create polygon graphic using the values from above

??

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Jan 20, 2016 at 23:26

2 Answers 2

1

One idea:

1.Collect the bounding coordinates using this.location.href and splitting (startExtent in code below).

2.Generate the map extent as min and max values taken from the list of values after splitting.

  1. Generate a polygon using points also generated from the list of values.

  2. Make a new map with basemap and apply the map extent generated in 2.

  3. On load, create and add a graphic based on the polygon generated in 3.

The code, with bits pulled from other examples and no doubt some redundant code, looks something like this:

 require(["esri/map","esri/geometry/extent","esri/SpatialReference","esri/geometry/Polygon","esri/graphic","esri/symbols/SimpleFillSymbol"
,"esri/symbols/SimpleLineSymbol","esri/Color","esri/layers/GraphicsLayer","dojo/on","dojo/domReady!"], 
function(Map,extent,SpatialReference,Polygon,Graphic,SimpleFillSymbol,SimpleLineSymbol,Color,on) {
var arrayOfCoordinates = [[URLExtent[0],URLExtent[1]],[URLExtent[2],URLExtent[1]],[URLExtent[2],URLExtent[3]],[URLExtent[0],URLExtent[3]],[URLExtent[0],URLExtent[1]]]; 
var spatialRef = new esri.SpatialReference({wkid:4326});
var startExtent = new esri.geometry.Extent(URLExtent[0],URLExtent[1],URLExtent[2],URLExtent[3]);
startExtent.spatialReference = spatialRef; 
map = new Map("mapDiv", {
 basemap: "streets"
});
map.setExtent(startExtent,true);
var box = new esri.geometry.Polygon(arrayOfCoordinates);
var sfs = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,
 new SimpleLineSymbol(SimpleLineSymbol.STYLE_DASHDOT,
 new Color([255,0,0]), 2),new Color([255,255,255,0.25])
);
map.on("load",function(){
 var graphic = new Graphic(box,sfs);
 map.graphics.add(graphic);
 map.setZoom(map.getZoom()-1);
}); 

});

answered Feb 2, 2016 at 3:16
0

Just a brainstorm idea I came up with this morning:

You can use these tools to determine the bounding box and extent for your study areas:

Minimum Bounding Geometry: creates a new feature class with the the feature captured into individual rectangles which.

Add Geometry Attributes: Adds and populates x-min,y-min,y-max,y-max fields to the new feature class created in the above step.

Then when you construct the URL if you do all of this in web merc for example include the projected coordinate system in the URL.

I did a sample run on lakes in California where they have a complex geometry, run the first tool and generate the polygons, then the second tool to get the extent coordinates, then generate a URL from these attributes.

http://www.arcgis.com/home/webmap/viewer.html?extent=-13418052.4304,5123451.39,-13392724.0401,5175788.2602,102100&mapOnly=true

answered Jan 25, 2016 at 16:33

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.