[OpenLayers-Users] Requesting data problem
Antonio Santiago
asantiagop at gmail.com
Sun Apr 18 04:30:36 EDT 2010
Thanks a lot.
On Sun, Apr 18, 2010 at 1:11 AM, Gabriel Nolasco <
nolasco_gabriel at yahoo.com.br> wrote:
> Hi,
>
> You must install a proxy script to retrieve information from remote domains
> via an XMLHttpRequest.
>
> http://trac.openlayers.org/wiki/FrequentlyAskedQuestions#ProxyHost
>
> Then you can use the class OpenLayers.Format.WMSCapabilities to parse the
> response like this:
>
> var capabilitiesRequest = OpenLayers.Request.GET({
>
> url: "
> http://labs.metacarta.com/wms/vmap0?request=GetCapabilities&service=WMS",
> success: parseWmsCapabilities,
> failure: function(response) {}
> });
>
> var parseWmsCapabilities = function(response) {
> var wmsParser = new OpenLayers.Format.WMSCapabilities();
> var wmsCapabilities = wmsParser.read(response.responseText);
> for(var i=0; i<wmsCapabilities.capability.layers.length; ++i) {
>
> alert(wmsCapabilities.capability.layers[i].name);
> }
> }
>
> Best regards,
> Gabriel Nolasco
>
> Hi all,
> I want to get WMSGetCapabilites from server. The URL is
> http://labs.metacarta.com/wms/vmap0?request=GetCapabilities&service=WMSand
> works fine.
>
> But when I "execute" the next code the request never ends or returns me a
> empty response.
>
> Anybody can help me clarifiying me how to get wms capabilities and later
> get
> the available layer names?
>
> Thanks in advance.
>
> <html>
> <head>
> <title></title>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
> <script type="text/javascript"
> src='./js/ol/OpenLayers.js'></script>
> <script type="text/javascript">
> request = OpenLayers.Request.GET({
> url: "
> http://labs.metacarta.com/wms/vmap0?request=GetCapabilities&service=WMS",
> success: function(request){
> alert(request.responseText);
> },
> failure: function(request){
> alert('BOOOOOO!');
> }
>
> });
> </script>
>
> </head>
> <body>
> the body content
> </body>
> </html>
>
>
>
--
|-----------------------------------------------------------
| http://www.astracanada.net
| http://acuriousanimal.orggeo.net
|-----------------------------------------------------------
| http://acuriousanimal.blogspot.com
| http://theballoonproject.blogspot.com
|-----------------------------------------------------------
| _ __
| /_| ( _ _/'_ _
|( |. __)(//)//(/(/()
| _/
|-----------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100418/618e6640/attachment.html
More information about the Users
mailing list