Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

a) I am running a PostGIS database, and I want to display a Table with a about 500 Points of Interest. The POIs have the projection EPSG 4326.

b) Geoserver is installed, running and connected to my PostGIS database, all fine so far. No errors.

c) I want to display my POIs from my database on a google base map through openlayers and geoserver. - The base map appears, fine so far, but my POI connection to Geoserver just does not work. I have tried all different kind of solutions but unfortunately it just doesn't want to connect to the Geoserver, I guess. - Both, loading my html file with the javascript/html/openlayers commands into my HTDOCS XAMPP folder doesn't work (http://localhost/example.html) and also starting the file through Geoserver "C:\Program Files\GeoServer 2.1.4\data_dir\www" (http://localhost:8080/geoserver/www/example.html) doesn't work either. Both ways, I only see the basemap but no POIs.

Any help is greatly appreciated. Cheers, Tim

My code is the following:

<html>
  <head>
    <title>OpenLayers: Google Layer Example</title>
    <link rel="stylesheet" href="http://openlayers.org/api/theme/default/style.css" type="text/css" />
    <link rel="stylesheet" href="http://openlayers.org/dev/examples/style.css" type="text/css" />
    <script src="http://maps.google.com/maps/api/js?v=3.3&amp;sensor=false" type="text/javascript"></script>
    <script src="http://openlayers.org/api/OpenLayers.js"></script>
    <script type="text/javascript">
      var map;

      function init() {

        var options = {
                        projection: new OpenLayers.Projection("EPSG:4326"),
                        displayProjection: new OpenLayers.Projection("EPSG:4326"),
                        units: 'm'
                        };

        map = new OpenLayers.Map('map', options);

        var gmap = new OpenLayers.Layer.Google(
            "Google Streets",
            {numZoomLevels: 20}
        );
        map.addLayer(gmap);

        var wfsLayer = new OpenLayers.Layer.Vector("WFS", {
            strategies: [new OpenLayers.Strategy.BBOX()],
            protocol: new OpenLayers.Protocol.WFS({
                        url:  "http://localhost:8080/geoserver/wfs",
                        featureType: "bochumtest2",
                        featureNS: "http://postgis.org",
                        geometryName: "the_geom",
                        srsName: "EPSG:4326",
                        version: "1.1.0"                    
                })
        });
        map.addLayer(wfsLayer);

      }
    </script>
  </head>

  <body onload="init()">
    <div id="map" class="smallmap"></div>
  </body>
</html>
share|improve this question
    
what does firebug say? –  iant Aug 12 '12 at 13:26
1  
Are you sure that your featureNS: "http://postgis.org", correct? –  Kliver Max Aug 13 '12 at 6:26
    
I managed to fix the problem.. my POIs were imported with the incorrect SRID into my postgis database and not correctly transformed to 90013. Thanks for your help anyway guys. –  TimothyDalton Aug 13 '12 at 18:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.