Select to view content in your preferred language

Drawing on ArcGIS map using Javascript

1277
6
05-17-2013 11:28 AM
RoufKhan
Emerging Contributor
Dear Techies:

I am a web developer with negligible knowledge of GIS. I have been assigned a task of developing a webpage where map from clients ArcGIS server will be displayed. User should be able to draw lines, arcs , circles , points and paths on it and later save it as an image.

For development purpose, I received some shape files from the task assigner which I published at ESRI by creating a Global Account. The same can be viewed at http://bit.ly/11KIfJd or http://www.arcgis.com/home/webmap/viewer.html?webmap=0e0a77165518468198248c5663dfe8ee&extent=49....



While browsing through the examples of http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/, I found javascript code example which can provide me all the required functionality. The examples show OpenStreetMaps. Now when I try to replace the code urls from OpenStreetmap urls to the above urls (http://bit.ly/11KIfJd or http://www.arcgis.com/home/webmap/viewer.html?webmap=0e0a77165518468198248c5663dfe8ee&extent=49....
),nothing is displayed.

If you can help me in this regard, that will be highly appreciated.

Regards
0 Kudos
6 Replies
JohnGravois
Deactivated User
if you need to support redline sketches that only need to be printed (not saved as GIS data), you should be able to get away with just using the printTask (which relies on ArcGIS Server 10.1)
0 Kudos
JohnGravois
Deactivated User
in re-reading your thread i think i understand now that you were attempting to substitute a webmap in a sample application that was previously relying on a map service.  those two things are not interchangeable.

the sample application i linked to above is still relevant, but if you would like to load in your content as a webmap (instead of using the urls of the services themselves), it might be handy to take a look at this example to see how a webmap can be loaded in a custom JS app using its ID.
0 Kudos
RoufKhan
Emerging Contributor
Thank you John for taking your time. You have reached the heart of my problem.

I uploaded my map at

http://www.arcgis.com/home/webmap/embedViewer.html?webmap=0e0a77165518468198248c5663dfe8ee&extent=49...

Looking at the url , it seems that the id of this map is 0e0a77165518468198248c5663dfe8ee

Now, going to the script you advised for

Replacing the line

  var mapDeferred = esri.arcgis.utils.createMap("4778fee6371d4e83a22786029f30c7e1", "map");

with

   var mapDeferred = esri.arcgis.utils.createMap("0e0a77165518468198248c5663dfe8ee", "map");

, I was expecting happy coding ahead, but it only kept the worries intact! Blank Screen! No output.

Your further kind help will be highly appreciated.

Regards
RAK
0 Kudos
VinayBansal
Frequent Contributor
ID of the webmap you are using is shared as Public or have restricted access to the user. If it has a restricted access then you need to supply the token.
http://help.arcgis.com/en/webapi/javascript/arcgis/jshelp/ags_secureservices.html
0 Kudos
RoufKhan
Emerging Contributor
Thanks for the reply

It is shared with Everyone(Public).
I created a public account on argcis.com and uploaded the shapefiles there.

Regards
0 Kudos
JianHuang
Deactivated User
Replacing the webmap ID on the sample should work. Make sure you have used the correct path for importing the css:
<link rel="stylesheet" href="css/layout.css">
0 Kudos