data marker

580
4
05-10-2011 11:59 AM
JulieRecker
New Contributor
i am currently rewriting a google maps (API v.2) viewer in arcgis for javascript. i have several points that i query a database for and display on the map, with associated info window on click. in google maps, you use the GMarker. what is the best way using arcgis for javascript. map.graphics? a feature layer?
0 Kudos
4 Replies
StephenLead
Regular Contributor III
have several points that i query a database for and display on the map, with associated info window on click


Hi Julie,

You'd probably want to use graphic objects to replicate this. See the sample at http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/graphics_multi... to get started.

Good luck,
Steve
0 Kudos
JulieRecker
New Contributor
thanks for the response. what i'm trying to do is pull x,y coordinates from a database, and put them as point markers on the map. with an info window, of course. so, i'm not querying layers?
0 Kudos
KellyHutchins
Esri Frequent Contributor
The sample Steve pointed you to (Multiple Graphics Layers) is a good one for getting started. In that sample the graphics are generated as the results of a query - so you'll need to modify the code to loop through your database results and add a graphic for each point.

An alternate approach might be to use a feature layer. I've attached an example that gets geo-tagged photos from Flickr and displays them on a map. To view the attachment, rename the file extension to .html.
0 Kudos
JulieRecker
New Contributor
thanks for the example kelly. i was trying to create an object esri.geometry.point, while using lat./long. instead of x,y. the following made all the difference:

var geometry = esri.geometry.geographicToWebMercator(new esri.geometry.Point(item.longitude, item.latitude));


this is exactly what i needed. thanks guys!
0 Kudos