Select to view content in your preferred language

Can someone point me to complete working code (HTML and Javascript) that shows how to place predefined icons ( symbols) at a lat long?

1034
5
11-06-2016 10:25 AM
artHeyman
Deactivated User

Can someone point me to complete working code (HTML and Javascript) that shows how to place predefined icons ( symbols) at a lat long? 

I see code pieces that purport to do this, but without being inside  working examples they are of little use to me. 

We are trying to do a few things at once:

1) create simple icons with embedded text. The text will reflect data. In other words a circle, say, that has date and time info from a DB

2) Place these icons at specific known point; in this case an intersection of roads. We'll know the lat long at the start.

What I hope to get working is the creation of a small library of icons. Logic in the code will choose one or another, then do a DB lookup and place info in the icons , then place them on the map.

As it stands I have working code to draw circles :

], function(
Map, Point, SimpleMarkerSymbol, Graphic, GraphicsLayer
) {
map = new Map("map", {
basemap: "streets",
center: [-73.380801,40.80561],
zoom: 10
});
map.on("load", function() {
var gl = new GraphicsLayer();
var p = new Point(-73.180801, 40.80560);
var p2 = new Point(-73.190801, 40.80560);
var s = new SimpleMarkerSymbol().setSize(60);

var g2 = new Graphic(p2, s);
var g = new Graphic(p, s);


gl.add(g2);
gl.add(g);
map.addLayer(gl);
});
});

but how to take this further? Seems like the next step is to pull from a library of symbols. How?

0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus

Art,

    You are not always going to find a sample that fits your every need, you will have to learn how to combine samples to achieve your needs (as you probably knew already). So there are things that you are asking that are confusing (probably just the terminology you are using).

  1. Place predefined icons. Seems like the next step is to pull from a library of symbols. Sounds like maybe you want to have a handful of predefined marker or picturemarker symbols in your code have the use choose one by name to use. Is that correct?
  2. Create simple icons with embedded text. The text will reflect data. In other words a circle, say, that has date and time info from a DB. Embeded text?.. Do you mean a graphic that has attributes associated with it so when you click on it in the map the map popup window shows those attributes? Date and time info from a DB? What do you mean by DB? Are you talking about doing a query of a map service layer to get this info? JS does not have the ability to work with a DB without using a REST end point of a map service.
0 Kudos
artHeyman
Deactivated User

Robert:

Many thanks for the reply.

  On point #1. Yes, we need pre defined symbols, but not have the user choose them; rather they must be pulled and displayed on a map depending on data in a SQL Server record.  

As to #2, we need to pull data from a record in a SQL Server table and display it on a map, and print the map/report.

In other words:we have an almost completed program using ESRI ArcGIS and SQL Server data. User chooses location on map. Lat/Long is saved and user then enters data about incident that happened at that location. Primary challenge is printing data from specific records to text on a map, as well as to graphic icons that also show data. In other words; the printed report must have map graphics and text data.
These icons will be simple geometric forms with embedded text.
So the reporting process is: user picks one record from thousands, in the process choosing a location in lat/long. We then need:
enlargement/zoom of map showing the location, about 200 feet on a side.
In the center of simple graphic of map will be icons with data from the chosen record: date, time, weather conditions, and icons representing other aspects of the record.
There may be multiple incidents needed to be represented.

I've seen this done, but I'm told report needs ESRI Server to do it. Can something like this not be done with web services?.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Art,


  The SQL part can not be done unless you are a .net web developer and can create a RESTful web service that the Js API can call using esriRequest.

0 Kudos
artHeyman
Deactivated User

Robert:

 Again, thanks. It's a large environment and learning it in full would likely be the work of - a considerable amount of time.
I'm told that we would need, for the report " ... with specific format and layout .... you have to write custom print functionality in ArcGIS Desktop and publish it via ArcGIS Server."

 it would help me greatly to verify this. Is there any other method?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

That is definitely one route. I have taken that route and the .Net RESTfull web service route.

0 Kudos