No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 10 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 9 Answers
manpreet
Best Answer
2 years ago
I have been looking to see if it's possible to add WMS layers from a PHP script. I'd like to do this to move a lot of the code from the client side to the server.
Currently I load the layers in the initialize function with:
Is there a way to move the layer information and layer array population to PHP so the only code in the initialize function is the code to add the layers to the map?
** Edit **
More details as requested:
I have been asked to produce a site that contains an OpenLayers 2.1x map that utilises vector drawing, select, measure, geolocate, CQL filters and all mapping layers are stored in GeoServer 2.33 and are accessed using WMS. GeoServer is run on the web server.
I have completed all of this using JavaScript to populate the layer names (as indicated above) and sketchSymbolizer properties etc. I also use JavaScript to create any calculations and CQL filters.
The client who has asked for the site has expressed concerns with the ease of taking the JavaScript and replicating the site, plus he feels large calculation in JavaScript are affecting the performance of older smart phones.
I have moved calculations to PHP and got them running smoothly (if not a little slower for fast machines, but adding a loader and everyone is happy again), but there is still a want to move all of the OpenLayers initialize items into PHP as well. I can not get OpenLayers to initialize, I have used the code below to create an array, but feel I'm missing the point completely.