Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can show wms png format my map but i didnt render jeojson and gml format by the way my url is correct service. İn additonal i used same code in my local and i can render local geoserver . plz show some way ??? some code in comment line . Why firebug say openlayers protocols undefined .But when i use my local geoserver and i can edit options and url i can show map gml and geojson format in my local .But when i add service url i didnt render .But again i can render wms format . İ didnt use proxy when i work in servcice url dont remember.Thanks for advice ???? My enviroment Openlayers , Geoserver

       <!DOCTYPE html>
             <script src=""       type="text/javascript">

 <!--<script src="">   </script>-->
   <style type="text/css">

      /* General settings */

        body {
            font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
            font-size: small;
        /* Toolbar styles */

            #toolbar {
            position: relative;
            padding-bottom: 0.5em;
            display: none;

           #toolbar ul {
            list-style: none;
            padding: 0;
            margin: 0;

        #toolbar ul li {
            float: left;
            padding-right: 1em;
            padding-bottom: 0.5em;

        #toolbar ul li a {
            font-weight: bold;
            font-size: smaller;
            vertical-align: middle;
            color: black;
            text-decoration: none;

        #toolbar ul li a:hover {
            text-decoration: underline;

        #toolbar ul li * {
            vertical-align: middle;

        /* The map and the location bar */
        #map {
            clear: both;
            position: relative;
            width: 778px;
            height: 330px;
            border: 1px solid black;

        #wrapper {
            width: 778px;

        #location {
            float: right;

        #options {
            position: absolute;
            left: 13px;
            top: 7px;
            z-index: 3000;

        /* Styles used by the default GetFeatureInfo output, added to make IE happy */
        table.featureInfo, table.featureInfo td, table.featureInfo th {
            border: 1px solid #ddd;
            border-collapse: collapse;
            margin: 0;
            padding: 0;
            font-size: 90%;
            padding: .2em .1em;

        table.featureInfo th {
            padding: .2em .2em;
            text-transform: uppercase;
            font-weight: bold;
            background: #eee;

        table.featureInfo td {
            background: #fff;

        table.featureInfo tr.odd td {
            background: #eee;

        table.featureInfo caption {
            text-align: left;
            font-size: 100%;
            font-weight: bold;
            text-transform: uppercase;
            padding: .2em .2em;

  <script defer="defer" type="text/javascript">

OpenLayers.ProxyHost = "/gt/proxy.cgi?url=";
     var lon = 5;
    var lat = 44;
    var zoom = 5;
    var map, layer;

    function init(){
        var bounds = new OpenLayers.Bounds(

             var options = {
                controls: [],
                maxExtent: bounds,
                projection: "EPSG:4326",
                units: 'm'

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

            map.addControl(new OpenLayers.Control.PanZoomBar({
                position: new OpenLayers.Pixel(2, 15)
            map.addControl(new OpenLayers.Control.Navigation());
            map.addControl(new OpenLayers.Control.Scale($('scale')));
            map.addControl(new OpenLayers.Control.MousePosition({element: $('location')}));

                    //Gml geliyor kardes 
            map.addLayer(new OpenLayers.Layer.Vector("GML", {
            isBaseLayer: true , 
            //styleMap: myStyles,

            protocol: new OpenLayers.Protocol.HTTP({
                url: "",
                format: new OpenLayers.Format.GML()

            strategies: [new OpenLayers.Strategy.Fixed()]

         /*var geojson_format = new OpenLayers.Format.GeoJSON();
        var vl2 = new OpenLayers.Layer.Vector("",{isBaseLayer: true});

        var selectCtrl = new OpenLayers.Control.SelectFeature(vl2,
            clickout: true, onSelect:onFeatureSelect }
        var hoverCtrl = new OpenLayers.Control.SelectFeature(vl2,
            {highlightOnly: true}



        function onFeatureSelect(evt) {
            map.zoomToExtent(evt.geometry.bounds, closest=true);

        //"featureselected", v12, selected);

        //var controlu = new OpenLayers.Control.SelectFeature(v12);

        //var bounds = new OpenLayers.Control.Navigation({
        //defaultDblClick: function(event) { return; }


        var report = function(e) {

       function handler(request) {


      var request = OpenLayers.Request.GET({
callback: handler

share|improve this question
Here is an OpenLayers GeoJSON example: – Martin Dec 24 '12 at 12:21
Thx martin for ur answer i know this example . – Rusty Dec 24 '12 at 12:25
I solve my problem about again proxy . Dont remember guys openlayers use two proxy type one of them "/gt/proxy.cgi?url="; the other one is php proxy . İn my local i use proxy.cgi but when i use service i need php proxy .. But i dont know why :)))) – Rusty Dec 25 '12 at 15:37
Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. – Simon Dec 26 '12 at 3:11

Well OpenLayers.Protocol undefined means that by some reason the OpenLayers library could not be downloaded into client or was not available at time it was used.

Replace your local OpenLayers copy by the site available copy during tests. After you sure all things working replace by your local version.

You have configure a proxy server also. Disable it during tests.

Remove the css part of your comments it is not relevant for solution for now. Also I could not see the tag with a call to the init function.

Did you checked for browser security blocking requests to server? Current browsers implements the CORS policy ( ) for requests.

share|improve this answer
Thx for answer but nothing changed thx for advice i try other browser but nothing changed – Rusty Dec 24 '12 at 20:25
Could you add the missing html body tag? Also looks like you using a jQuery( $ function ) library. Try a Firefox with Firebug. I guess it is the easiest to use javascript debuger. – cavila Dec 24 '12 at 20:36
yes cavila . I use js library no jquery . My html tag also correct – Rusty Dec 24 '12 at 20:41

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.