3

To me, ArcGIS Help and Online Resources is always full of unneccessay information and missing some important points. For example there are lots of samples for drawing but I couldn't find any thing for steps post drawing like saving on Database or Map!

By the way, I am trying to Save some user inputs (Points or Multipoints) on the Map to MySQL database. I have a Table in database as :

create table Points ( 
name VARCHAR(20) PRIMARY KEY, 
location Point NOT NULL, 
description VARCHAR(200), 
SPATIAL INDEX(location) 
); 

Now, I would like to save Geometry of the drawing point(s) in to this table. Can you please point me to an sample, tutorial or give me an idea how to get this information from the drawing classes?

4

When you're using the draw tools, use the draw-end event to get to the geometry that was just created. This is shown in a couple of samples: Add graphics to a map and Drawing tools. If you need your geometry in geographic coordinates (AKA wgs84 AKA lat/long), listen to the draw-complete event as the object your callback gets will have a geographicGeometry property so you won't have to do the conversion.

Once you have your geometry, you can get it to your web service that will write to your DB however you like. Since you're already using the Esri JS API, you could use esri/request to do a POST. More info on using request.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.