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?

Andre Silva
10.5k12 gold badges57 silver badges109 bronze badges
asked Apr 7, 2014 at 19:10

1 Answer 1

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.

answered Apr 7, 2014 at 22:24

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.