[OpenLayers-Users] Basic GeoServer OpenLayers map

Sarah Schuessler sarah_flip at yahoo.de
Mon Apr 26 07:44:20 EDT 2010


Hi Steven,

perhaps this:
http://trac.openlayers.org/wiki/FrequentlyAskedQuestions#ProxyHost
could help you a little bit.
At examples page of OL you can find a proxy.cgi scipt for reference.

best regards
Sarah




________________________________
Von: Steven Venter <scventer43 at telkomsa.net>
An: Frank Broniewski <brfr at metrico.lu>; users at openlayers.org
Gesendet: Montag, den 26. April 2010, 13:20:42 Uhr
Betreff: Re: [OpenLayers-Users] Basic GeoServer OpenLayers map

Hi Frank

Still no luck.

After clearing the browser cache firebug indicates that the file is loaded
but no image is generated on the map. The content of the file is correctly
displayed in firebug.

My code is based on the openlayers-2.8/examples/markersTextLayer.html.

My text file looks like this:
point title description image
-77.39929,39.40225 title somemarker icons/accident.png

I have tried icon as a column header but that did not help. Also i specified
the complete url for the image path but again that did not help.

If I use the OpenLayers.Layer.Vector() function I get the symbol and text
displayed. I feel that the OpenLayers.Layer.Text() function if more flexible
and would like to get it working.

I noticed that the examples have this line of code
OpenLayers.ProxyHost="/proxy/?url="; but can’t find a reference of it in the
API docs. Can some one please explain it?

Steven

-----Original Message-----
From: Frank Broniewski [mailto:brfr at metrico.lu] 
Sent: 26 April 2010 09:26 AM
To: Steven Venter; users at openlayers.org
Subject: Re: [OpenLayers-Users] Basic GeoServer OpenLayers map

Hello Steven,

if the text layer is at the same level as the HTML page try {location: 
"txtfile.txt"} . I don't think your relative path gets well translated

Frank


Am 26.04.2010 09:00, schrieb Steven Venter:
> Hi Frank
>
> Thanks for your help. (this message was also sent to the mailing list -
> sorry about that.)
>
> I managed to solve the problem over the weekend. I used addLayers with a
> single layer supplied. I changed this to addLayer and my map displayed. I
> also added options to the map (maxResolution, maxExtent and projection).
>
> Lesson, don't follow tutorials blindly.
>
> But I still have a problem displaying a text layer.
>
> var txtLayer = new OpenLayers.Layer.Text("text", {location:
> "./txtfile.txt"});
> map.addLayer(txtLayer);
>
> When I view the Net tab in firebug FF is just sitting there trying to load
> the file.
> firebug net output: GET http://localhost/test/txtfile.txt
>
> My txtfile.txt is tab separated.
>
> Any suggestions?
>
> Steven
>
> -----Original Message-----
> From: Frank Broniewski [mailto:brfr at metrico.lu]
> Sent: 26 April 2010 08:37 AM
> To: Steven Venter; users at openlayers.org
> Subject: Re: [OpenLayers-Users] Basic GeoServer OpenLayers map
>
> Please reply also to the OpenLayers list!
>
> If the WMS request works in your browser there should'nt be a problem
> with the geoserver setup. I suspect the problem in your OL
> configuration. Usually I define a maxetent and a resolutions/or scale
> array for the map and then do a setCenter() at the end of the config ...
>
> Please show us a minimal example. Without that it is impossible for us
> to locate your problem.
>
> Frank
>
> Am 24.04.2010 08:38, schrieb Steven Venter:
>> Hi Frank
>>
>> If I put
>>
>
http://localhost:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap
>>
>
&layers=topp:states$styles=&bbox=-124.7314220000001,24.955967,-66.969849,49.
>> 371735&width=708&height=330&srs=EPSG:4326&format=image/png in to my
> browsers
>> adders bar I get a png generate image of most of the USA states.
>>
>> I also debugged my script to see what the request to the server looks
> like.
>> As far as I can tell it all seems right.
>>
>> Under the DEFAULT_PARAMS variable I have this:
>> Exceptions "application/vnd.ogc.se_inimage
>> Format "image/jpeg"
>> Request "GetMap"
>> Service "WMS"
>> Style " "
>> Version "1.1.1"
>>
>> Under the params section I get the same but for the following:
>> FORMAT "image/png" -- as i requested
>> LAYERS "[topp:states]"
>>
>> The url variable contain this:
>> http://localhost:8080/geoserver/wms
>>
>> But I still can’t get the image displayed. I get the navigation items the
>> css border displayed, and in firebug the bounds is null error.
>>
>> The layers that I use are standard geogerver layers that are
> pre-installed.
>> I’m using these until I can get the basics right.
>>
>> 1. Do you have to specify the bounds? From the OL examples it doesn’t
seem
>> so.
>> 2. Could this be a server problem?
>> 3. What else could I check?
>> 4. Any other suggestions.
>>
>> Thanks for you help.
>> Steven
>>
>> -----Original Message-----
>> From: Frank Broniewski [mailto:brfr at metrico.lu]
>> Sent: 23 April 2010 02:37 PM
>> To: Steven Venter; users at openlayers.org
>> Subject: Re: [OpenLayers-Users] Basic GeoServer OpenLayers map
>>
>> Hello Steven,
>>
>> unfortunately I have no experience with geoserver, but request URLs from
>> Openlayers WMS are conform to the OGC standards and if geoserver is also
>> conform there should'nt be a problem. A OL generated request from my
>> application:
>>
>>
>
http://www.gis-hosting.lu/ogc/service/osm?LAYERS=label&STYLES=,,,&FORMAT=ima
>>
>
ge%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fv
>>
>
nd.ogc.se_inimage&SRS=EPSG%3A2169&BBOX=67416.666666,70311.458332975,88583.33
>> 3334,81688.541667025&WIDTH=1200&HEIGHT=645
>>
>> It is in the Net tab from firebug. Something like GET osm?LAYERS= ...
>>
>> If you suspect the problem with geoserver you could try the WMS requests
>> in your browser so you can be sure that they are working. If you think
>> its a OL configuration problem please show your layer config code so
>> that we can search there ...
>>
>>
>> A OL WMS Layer example:
>>
>> new OpenLayers.Layer.WMS(
>>                    'WMS',
>>                    'http://www.gis-hosting.lu/ogc/service/osm',
>>                    {
>>                        layers: ['base','traffic','place-label'],
>>                        styles: ['','','',''], format: 'image/png'
>>                    },
>>                    {
>>                        isBaseLayer: true,
>>                        singleTile: true
>>                    }
>>                );
>>
>> Frank
>>
>>
>> Am 23.04.2010 14:11, schrieb Steven Venter:
>>> Hi Frank
>>>
>>> Thanks for replying.
>>>
>>> I used firebug to look at the requests being sent to the server. The css
>>> stuff and the navigation items are requested but no request to fetch the
>>> image from the server.
>>>
>>> I used geoserver functionality to display the image in a page. I then
cut
>>> and pasted that in to the code. I read on a tutorial site
>>> (http://vasir.net/blog/openlayers/openlayers-tutorial-part2-layers/)
that
>>> some of the info for the request will be generated by openlayer, this
> site
>>> deals with MapServer so I tried to adapt that to geoserver.
>>>
>>> I will try what you suggested, but I’m not sure which parts of the
> request
>>> are auto generated.
>>>
>>> Steven
>>>
>>> -----Original Message-----
>>> From: Frank Broniewski [mailto:brfr at metrico.lu]
>>> Sent: 23 April 2010 08:17 AM
>>> To: ZAMap
>>> Subject: Re: [OpenLayers-Users] Basic GeoServer OpenLayers map
>>>
>>> Hi,
>>>
>>> did you already try to put the requested URL from the OpenLayers request
>>> in the address field of your browser and examine the response? I use
>>> Firebug for that and this already helps me alot for debugging WMS
>> requests.
>>>
>>> Frank
>>>
>>> Am 22.04.2010 20:03, schrieb ZAMap:
>>>>
>>>> Hi all
>>>>
>>>> I'm trying to get a basic map displayed but keep getting bounds is null
>>>> error.
>>>>
>>>> None of the suggestions (allOverlays: true) that I found works, most
>>>> probably because of other issues with my code/setup.
>>>>
>>>> Code:
>>>>
>>>> function init() {
>>>>       var map = new OpenLayers.Map('map');
>>>>
>>>>       var layers = new OpenLayers.Layers.WMS(
>>>>         "basic",
>>>>         "http://localhost:8080/geoserver/wms",
>>>>         {layers: 'topp:states'}
>>>>
>>>>       map.addLayers(layers);
>>>>       map.zoomToMaxExtent();
>>>> }
>>>>
>>>> My geoserver is working, I can request the map and other data from the
>>>> server. Any pointers to good tutorials are welcome.
>>>>
>>>> Setup:
>>>> Ubuntu 9.10
>>>> GeoServer 2.0.1
>>>> Openlayers 2.8
>>>>
>>>> I would appreciate any help.
>>>
>>>
>>
>>
>
>


-- 
Frank BRONIEWSKI

METRICO s.à r.l.
géomètres
technologies d'information géographique
rue des Romains 36
L-5433 NIEDERDONVEN

tél.: +352 26 74 94 - 28
fax.: +352 26 74 94 99
http://www.metrico.lu

_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100426/99c21340/attachment.html


More information about the Users mailing list