[OpenLayers-Users] creating a layer based on sql queries

Pere Roca Ristol peroc79 at gmail.com
Sun May 10 11:02:15 EDT 2009



  hi André,
  I think you should pass the layers params to a server-side script that
creates the SQL sentence, execute it, update the postGIS table (or view) and
"echoes" the path to the new SLD file. All that using Ajax. Then you take
the result (path to SLD) and udpate the layer.params.SLD and redraw().

  At least that's the way I do. The other good thing of creating physically
the SLD is that can be used to create a legend (GetLegendGraphic WMS
request).
  Openlayers provides Ajax tools; in my case I use JQuery (because I use it
for many other actions) and would be like...
 
$.ajax({url:'my_url.php',type:'GET',dataType:'text',data:'data='+to_insert,success:function(result) 
{ //my php echoes SLD path
                                       my_Untiled_WMS.params.SLD=result;
				my_Untiled_WMS.redraw();
  })

salut
Pere Roca


Andremalms wrote:
> 
> 
> Greetings,
> 
> I am a cartography/GIS student, making a research about tools for spatial
> analysis in webmaps. I use Postgis/Geoserver/Openlayers. 
> 
> I have two simple questions, trying to get ideas to solve these little
> problems:
> 
> 1- I have a html form, the user selects two layers to make an intersect
> operation in postgis. This form generate a sql file. The question is: How
> can I, dinamically, display the result of this sql query in openlayers? 
> I think I will need a new html, but how it would be constructed to display
> this new layer since the user has a considerable number of possible
> combinations to intersect? Does someone has a piece of code to exemplify
> how it can be done to me?
> 
> 2- The other spatial analysis tool that I am evaluating is the measure
> tool. I am using an openlayers measure control and it´s working fine. The
> user can measure a distance to answer a simple question and send the 
> answer to me in a html form. 
> My question is: How can I know if this user has used the measure tool?
> Just like, when he/she activate the openlayers control, a hidden value
> must be added to his/her form. 
> 
> 
> I´m starting with openlayers and it´s a great tool. Thank you a lot, best
> regards from Brazil.
> 
> André Mendonça
> 
> 
> 
> _________________________________________________________________
> Descubra todas as novidades do novo Internet Explorer 8
> http://brasil.microsoft.com.br/IE8/mergulhe/?utm_source=MSN%3BHotmail&utm_medium=Tagline&utm_campaign=IE8
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://n2.nabble.com/creating-a-layer-based-on-sql-queries-tp2849852p2857285.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list