配置了 Geoserver 和 PostGIS DB 的 Openshift……现在怎么办?

Openshift with Geoserver and PostGIS DB configured...now what?

我已经在 openshift 上设置了地理服务器和 POSTGIS 数据库。我可以确认我在数据库中有数据,因为我可以使用 QGIS 连接到它并添加图层....现在我正在尝试创建一个具有一层的简单地图但找不到任何关于此的教程......下面代码与本地数据实例一起创建一个简单的地图...我在 openshift 上创建的图层使用什么 url?我好像找不到他们。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OGR2Layers</title>
<style>
 #map{width:400px;height:400px;}
</style>
<script src="http://www.openlayers.org/api/2.13/OpenLayers.js"></script>
<script type="text/javascript">
var map, selectsControls
function init(){
    var option = {
        projection: new OpenLayers.Projection("EPSG:900913"),
        displayProjection: new OpenLayers.Projection("EPSG:4326")
    };
    map = new OpenLayers.Map('map', option);
    var attribution = {attribution:"&copy; <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors"};
    olmapnik = new OpenLayers.Layer.OSM("OpenStreetMap Mapnik", "http://tile.openstreetmap.org/${z}/${x}/${y}.png", attribution);
    map.addLayer(olmapnik);
    map.setBaseLayer(olmapnik);
    var ls= new OpenLayers.Control.LayerSwitcher(); 
    map.addControl(ls); 
    ls.maximizeControl(); 
    map.addControl(new OpenLayers.Control.MousePosition());
    map.addControl(new OpenLayers.Control.Navigation());
    var block = new OpenLayers.Layer.Vector("block GeoJSON", {
        protocol: new OpenLayers.Protocol.HTTP({
            url: "block.GeoJSON",
            format: new OpenLayers.Format.GeoJSON()
        }),
        strategies: [
            new OpenLayers.Strategy.Fixed()
        ]
    });
    map.addLayer(block);
    extent = new OpenLayers.Bounds(-97.640446,21.693337,-80.768595,32.375889).transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
    map.zoomToExtent(extent);
};
</script>
</head>
<body onload="init()">
<h1>this is a test</h1>
<div id="map"></div>
</body>
</html>

基于此 example,我认为您需要将 http://demo.boundlessgeo.com/geoserver 更改为您为 openshift 实例提供的域:

// format used to parse WFS GetFeature responses
var geojsonFormat = new ol.format.GeoJSON();

var vectorSource = new ol.source.Vector({
  loader: function(extent, resolution, projection) {
    var url = 'http://demo.boundlessgeo.com/geoserver/wfs?service=WFS&' +
        'version=1.1.0&request=GetFeature&typename=osm:water_areas&' +
        'outputFormat=text/javascript&format_options=callback:loadFeatures' +
        '&srsname=EPSG:3857&bbox=' + extent.join(',') + ',EPSG:3857';
    // use jsonp: false to prevent jQuery from adding the "callback"
    // parameter to the URL
    $.ajax({url: url, dataType: 'jsonp', jsonp: false});
  },
  strategy: ol.loadingstrategy.tile(ol.tilegrid.createXYZ({
    maxZoom: 19
  }))
});