[OpenLayers-Users] Proper function to use to get XML file and wait

Pierre GIRAUD bluecarto at gmail.com
Tue Dec 4 03:40:34 EST 2007


I think that what you are looking for is way to request the server
synchronously.
As you correctly noticed, the loadUrl method build a new asynchronous request.

If you need it to be synchronous, you'll have to build it yourself.
It's not so difficult though.

This snipet of code should help you :

var request = new OpenLayers.Ajax.Request(url,
            {
                method: 'get',
                asynchronous: false,
                params: {/* some params */,
                onComplete: callbackFunction
             }
        );

Also note that you might face some minor problems (callbackFunction
called twice or so). A ticket is already open to update the Ajax
handler in OpenLayers. See http://trac.openlayers.org/ticket/1170.

Regards,
Pierre

On Dec 3, 2007 11:44 PM, Dejung Gewissler
<dejung.gewissler at oit.state.nj.us> wrote:
>
>  Hey Users:
>
>  I am trying to extend the functionality of the GeoRSS class so that the
> points rendered on the screen can be symbolized with different icons based
> on a tag value in the rss item feed and not all with the same icon as it is
> currently implemented. However, I don't want to store the icon, offset,
> size,etc. information in the rss feed itself -- data and symbolization are
> to live separately. Ideally I would like to store the symbolization scheme
> in a separate xml file and parse it upon the load of the GeoRSS layer.
>
>  So far I've got the points rendering differently with the symbolization
> info stored in the item of the rss feed. The problem that I've run into is
> separating this functionality into two methods. First it should get the
> symbolization definitions and then load the GeoRSS items (and symbolize them
> based on the predefined definitions). The only method I found to load XML
> files is OpenLayers.loadURL(location, null, this, function()). In the API
> documentation it says that this will "Background load a document". I wish to
> not background load the document and instead halt execution of the current
> function until the document is loaded. The purpose of that would be to use
> the values contained in the XML doc in the latter part of that current
> function. If I background load the document I am afraid the current function
> will finish too early.
>
>  Is there another loadURL,etc function that waits for a response before
> continuing?
>
>  Thanks in advance,
>  Dejung
>
> --
>  Dejung Gewissler
>  New Jersey Office of Information Technology
>  Office of Geographic Information Systems
>  200 Riverview Plaza
>  PO Box 212, Trenton, NJ 08625-0212
>
>  609.777.3754
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>



More information about the Users mailing list