In this article I will show you how to easily store such hand drawings in a database table, then display them on the map at a later time just as easily.
The mains steps are:
1. Create a database table with a SDO_GEOMETRY column (to store the geometries). Also create spatial index on it so we can query and display the table contents on our map later on.
2. Create a very simple JSP page that will handle the task of storing a single geometry. It will take an geometry in a simple string format, then store it in the table using JDBC.
3. Create a simple HTML-based Oracle Maps demo page, where user can create a shape on the map using a Redline tool. After getting hold of the Redline geometry, the page will issue an AJAX request to the JSP page, passing various aspects of the geometry (such as its type, SRID, and coordinates) as URL parameters.
4. Display the table as a dynamic theme in the same HTML page.
For more details, please download the zip file that includes the following 3 files:
readme.txt: Instructions for running this demo.
store.jsp: The JSP page that handles geometry storage.
store.html: The main demo page that lets you draw things and display stored geometries.
The complete instructions are in the readme.txt file.
If you have the built-in Oracle Maps tutorials running, this demo should be very easy to set up and run. To run the dmeo, simply open the store.html page in your browser. Post your comments below if you run into any issues. The following is a screenshot of the demo:
Finally, note that you can easily expand the demo to store more fields besides the geometry itself. It is also trivial to display these fields as attributes in the info-tip window when user clicks on any geometry displayed on the map.