[OpenLayers-Users] Incremental Retrieval of points from a database-OL

Michael mdm at yachtpc.com
Wed Mar 23 15:14:32 EDT 2011


I have done this.  It is doable.

My system stores latlon in a mySQL database.
A PHP script inserts the values, and a separate PHP script extracts the 
values, optionally reduces irrelevant points using a Douglas-Peukert 
algorithm, and creates a usable file for OL.

The usable file I created is a javascript file.  I chose to go that way 
because
     (a) XML creates a very bulky file with lots of points
     (b) I could not figure how to make JSON work and
     (c) the javascript file was really short by comparison and has the 
benefit of avoiding any cross-site issues.

You can see the completed page with some other features like mouseover 
and animation at http://pacificcup.org/OpenLayers/tracker.php

The code is very rough, as I have not cleaned it up, but if there is 
interest, I can share it.

Michael

On 3/23/2011 12:05 PM, Vikash Talanki wrote:
> Hi frnds....
>
>         I have a new task now:
>               The user will input the lat-lon values in a html Form and when
> an INSERT button is clicked these values should be stored the DB. Now when a
> submit button is clicked the markers of all the lat-lon values stored in a
> table in DB should be visible on the map. This is fairly not a tough task,
> but... when the user provides next value of a point, this should be stored
> in the same table and this particular point marker should be added to the
> map(the map already contains markers of previous points).......... that is,
> instead of reading the whole data(including the new point) from the DB and
> projecting on the map, since before adding new point to the DB we have
> already pointed the markers of previous values, now only the new point
> marker should be added to the map.
>
> For better understanding here is the example....
>             I already have 999 points in my DB and these are pointed on the
> map. Now the user gives 1000th point values and this will be stored in the
> DB. now if we reload(click on submit button) the page , instead of reading
> all the 1000 points from DB and create markers, it should only read the new
> point and add this to already existing map with 999 markers.
>
> I have a simple logic for this, table1 in DB contains all the values and
> table2 only the new value. whenever the user insert a points it is
> simultaneously added in both the tables and when the user submits the only
> value from table2 is deleted(so that next new value can be stored). so
> reading just from table2 works here, but how to add this point to the
> already existing map is the main task.
>
>   I don't have any idea whether  this can be done  in OL or not, so please
> help me how to do this
>
> Hope my intention is understandable.
>
> Till now I have not worked with databases in OL, so  please sugggest me
> which DB(like mysql,etc..) suits better for this task.... and any other
> suggestions on storing/retrieving to/from DB
>
> Thanks alot in advance
>
> --
> View this message in context: http://osgeo-org.1803224.n2.nabble.com/Incremental-Retrieval-of-points-from-a-database-OL-tp6201550p6201550.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users


More information about the Users mailing list