Hi all, I am trying to create my first WMS application using the snippet of code below.
Geoserver is running on port 8081 and I have a web site on port 8080, both in the same server. When I try http://192.168.1.113:8080/ I get only the div and a place holder for the image. Any help will be very much appreciated. TIA. JJ. <html> <head> <title>OpenLayers Example</title> <script src="http://openlayers.org/api/OpenLayers.js"></script> </head> <body> <div style="width:100%; height:100%" id="map"></div> <script defer="defer" type="text/javascript"> var map = new OpenLayers.Map('map'); var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", "localhost:8081/geoserver/wms", {layers: 'Img_Sample'} ); map.addLayer(wms); map.zoomToMaxExtent(); </script> </body> </html> -----Original Message----- From: Ben Caradoc-Davies [mailto:[email protected]] Sent: 22-Jul-15 8:00 PM To: Jair Santos <[email protected]> Cc: [email protected] Subject: Re: [Geoserver-users] Broken links in thread [Please keep discussions on-list] Jair, delivery of the web content is not configured in GeoServer; it is configured on your web site. GeoServer will respond to requests from the client browser generated using, for example, OpenLayers JavaScript. GeoServer is the server, and OpenLayers JavaScript is the client. On the server that hosts www.example.com, there should be a directory that stores your web content. For example, it might be /var/www or /home/username/public_html. It likely has an index.html in it. If you add an HTML file demo.html in this directory you should be able to access it as http://www.example.com/demo.html . Place the content of this example in your demo.html and change the ImageWMS url and params to reference your WMS: http://openlayers.org/en/v3.7.0/examples/wms-image.html Here is the catch: GeoServer must be somewhere external users can access it. For example: http://services.example.com/geoserver and perhaps your WMS service endpoint is http://services.example.com/geoserver/wms , but it is also fine for them to be on the same server. You might have something like this in OpenLayers: url: 'http://services.example.com/geoserver/wms', params: {'LAYERS': 'ns:layername'}, where ns:layername is your layer name. When a web user loads http://www.example.com/demo.html their browser loads the JavaScript which then makes requests to http://services.example.com/geoserver/wms to get the rendered images on demand, with new requests as they pan and zoom. There are many excellent examples for OpenLayers: http://openlayers.org/en/v3.7.0/examples/ Kind regards, Ben. On 23/07/15 14:37, Jair Santos wrote: > Yes, I realized that Ben. I created the data store, opened the layer > and saw the data. > > I don't know how to setup in the Geoserver the web site that will > display the data. > > Let's say that I have the site www.example.com, where do I enter this > information in Geoserver and how to set it up? > > Thank you. > > JJ. > > -----Original Message----- > From: Ben Caradoc-Davies [mailto:[email protected]] > Sent: 22-Jul-15 7:19 PM > To: Jair Santos; GeoServer Mailing List List > Subject: Re: [Geoserver-users] Broken links in thread > > Jair, > > you already have PostGIS installed so all you need to do is connect > GeoServer. See this quick-start guide: > http://docs.geoserver.org/latest/en/user/gettingstarted/postgis-quicks > tart/i > ndex.html#create-a-data-store > > Each table or view in PostGIS can be published as a layer. You can > then render these using WMS (see the OpenLayers preview). Now create a > web page that uses OpenLayers configured to display your new WMS service: > http://openlayers.org/ > http://openlayers.org/en/v3.7.0/examples/wms-image.html > (although it looks like the demo WMS is down; try using your new WMS!) > > More PostGIS detail: > http://docs.geoserver.org/latest/en/user/data/database/postgis.html > > Kind regards, > Ben. > > On 23/07/15 12:42, Jair Santos wrote: >> Thank you Ben. >> >> Actually I've just installed Geoserver and I have some PostGis data >> that I want to make available in the web. Reading the manuals I found >> out that I need to use WMS, and I am trying to understand how it >> works. I saw the description of several commands or functions such as >> GetCapabilities , GetFeatureInfo, etc.. >> >> I thought that to make the map available in the web I needed only to >> adjust settings in Geoserver pretty much like a normal web server. Am >> I > wrong? >> >> If you can point me to information about how to do that I will >> appreciate very much. >> >> Best regards. >> >> JJ >> >> -----Original Message----- >> From: Ben Caradoc-Davies [mailto:[email protected]] >> Sent: 22-Jul-15 5:31 PM >> To: Jair Santos; GeoServer Mailing List List >> Subject: Re: [Geoserver-users] Broken links in thread >> >> Jair, >> >> those links are from 2006! The nearest I can think of is the Styling >> section in the User Manual: >> http://docs.geoserver.org/latest/en/user/styling/index.html >> >> The User Manual also has a Tutorials section, but you might start at >> the top level as a quick way of finding all the getting started, >> reference, and tutorial documentation: >> http://docs.geoserver.org/latest/en/user/ >> >> Are you looking for something in particular? >> >> Kind regards, >> Ben. >> >> On 23/07/15 11:32, Jair Santos wrote: >>> Hello Everyone >>> >>> >>> >>> In this thread there are two links that I am interested in: >>> >>> >>> >>> http://sourceforge.net/p/geoserver/mailman/message/11250960/ >>> >>> >>> >>> >>> >>> Both links were served by CODEHAUS which services are terminated. >>> >>> >>> >>> Does anybody know where the documents can pointed out by these links are? >>> >>> >>> >>> Thanks >>> >>> >>> >>> JJ >>> >>> >>> >>> >>> -------------------------------------------------------------------- >>> - >>> - >>> -------- >>> >>> >>> >>> _______________________________________________ >>> Geoserver-users mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/geoserver-users >>> >> >> -- >> Ben Caradoc-Davies <[email protected]> Director Transient Software >> Limited <http://transient.nz/> New Zealand >> >> --------------------------------------------------------------------- >> - >> ------ >> -- >> _______________________________________________ >> Geoserver-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/geoserver-users >> >> >> --------------------------------------------------------------------- >> - >> -------- _______________________________________________ >> Geoserver-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/geoserver-users >> > > -- > Ben Caradoc-Davies <[email protected]> > Director > Transient Software Limited <http://transient.nz/> New Zealand > > ---------------------------------------------------------------------- > ------ > -- > _______________________________________________ > Geoserver-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geoserver-users > > > -- Ben Caradoc-Davies <[email protected]> Director Transient Software Limited <http://transient.nz/> New Zealand ---------------------------------------------------------------------------- -- _______________________________________________ Geoserver-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geoserver-users ------------------------------------------------------------------------------ _______________________________________________ Geoserver-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geoserver-users
