Google Maps API Polygons
512568Jul 30 2008 — edited Oct 22 2009I have an Apex application where I want to display polygons stored in a database on a map using the Google Maps API.
I'm seeking some advice on the best way to (a) store data about the polygon and (b) pass the polygon data from the database to the Javascript that renders the map.
The polygons are currently stored in the database as a set of individual records in a table with each record containing the polygon id, region number, vertex index, lat and long.
Data is passed to the Javascript to render the map by a page process that encodes the points, creates a string that contains the data required to render the polygon and populates a page item with the resultant string. To encode the points, I've put together a PL/SQL package as per the algortim at http://code.google.com/apis/maps/documentation/polylinealgorithm.html.
Javascript on the page then parses the string in the relevant page item, creates the polygon objects and renders the map.
I'm seeking some advice as described above because the time taken to create the required string is excessive (>1 min) even for polygons with <20 points.
I've considered the following;
(a) Store the polygon points in an SDO_GEOMETRY type columns in the database (I think I still need to create the string to send to JS)
(b) Create a region with editable text boxes containing the points and get JS to read the value out of the text boxes.
(c) Read database directily from JS (I have no knowledge on how to do this)
The above works in the sense that I can get the maps to display as expected, its just very slow.
In addition, I've also put together another package that will import a MapInfo MIF/MID files containing data about the polygons and populate the relevant table.
We're running Apex 2.2 here. When I get a chance, if it helps, I'll endeavour to create a dummy app demonstrating the above on the Oracle hosted environment.
Damian