I am building a WebGIS website and I faced with some problems. First of all I have an HTML file, where I use LeafLet map-visualizer. Every time when an user "pan" on the map, the boundary of the map should be sent to a PHP file, where I query the new informations from the Postgresql-PostGIS database server then generate XML file from them. After this procedure I would like to use the XML file to visualize the datas on my HTML file using Leaflet. Therefore I would like to know what kind of strategy would you advise me in this situation.
So far I have successfully done the following things:
I have a index.html file, where I have put the Leaflet map. With some Leaflet function I could get the datas of the boundary box, so the only thing what I need is to send it to the PHP file which is called dbAccessAndXmlGenerator.php . Shall I use AJAX here?
At the beginning of the project I successfully implemented to get the datas from the XML file and visualize it on the map. I used this implementation:
$(document).ready(function()
{
$.ajax({
type: "GET",
url: "xmlRes.xml",
dataType: "xml",
success: parseXml
});
Then there is a parseXML javascript function, where I can use the datas from the xml file:
function parseXml(xml){...}
- The query and the xml generation in the dbAccessAndXmlGenerator.php works properly.
In the html file there is a javascript function called onMapChange(e) which can produce thes data of the boundary box of the map every time when an user panning or moving on the map. So my task would be to send these variables to the PHP file, where I would make the query using these variables, then the PHP file would generate an XML which would be used by the HTML and javascript again.
I hope I was understandable. I am still beginner of using all of these languages together, so sorry for it. Thanks in advance!
Best wishes
Daniel
No comments:
Post a Comment