Request a Ajax with GET to remove one or more geometries in OpenLayersProblems with features, popups and...

Finding a logistic regression model which can achieve zero error on a training set training data for a binary classification problem with two features

Is it a fallacy if someone claims they need an explanation for every word of your argument to the point where they don't understand common terms?

Is there a weight limit to Feather Fall?

What are the exceptions to Natural Selection?

What would the chemical name be for C13H8Cl3NO

What is the difference between rolling more dice versus fewer dice?

When can a QA tester start his job?

How can my powered armor quickly replace its ceramic plates?

Convert exam marks to overall grade

Gear reduction on large turbofans

Is it possible to grant users sftp access without shell access? If yes, how is it implemented?

How much mayhem could I cause as a sentient fish?

Odd 74HCT1G125 behaviour

Making him into a bully (how to show mild violence)

Sci-fi book: two college kids witness man's first landing on Mars with a wormhole/travel machine they invented; they're ultra rich and nigh-immortal

Cat is tipping over bed-side lamps during the night

Eww, those bytes are gross

Calculate the number of points of an elliptic curve in medium Weierstrass form over finite field

Do theoretical physics suggest that gravity is the exchange of gravitons or deformation/bending of spacetime?

Increment each digit in a number to form a new number

Salesforce package error error “You can't specify version for namespace sf_com_apps because this namespace is not installed to your organization.”

use of 4/2 chord more compelling than root position?

Consequences of lack of rigour

Why zero tolerance on nudity in space?



Request a Ajax with GET to remove one or more geometries in OpenLayers


Problems with features, popups and strategy with OpenLayersOpenLayers2: Showing WKT data via JSON from MVCOpenlayers 3, jquery Ajax initialising in Jquery.success()Request JSONP from Geoserver using AJAX request in Openlayers 3Save JSON from Openlayers using AJAXMarkerCluster don't work with geojson layer in leafletOpenLayers 4 server data not displaying but same file data displaysError loading geoJSON into map using OpenLayers v4.2.0Get GeoJSON from a database by the AJAX method for OpenLayersWhy is this happening? I show GeoJSON some coordinates with OpenLayers by request Ajax













0















I have a html selection of the form:



<table class="table">
<tr>
<td>
<label>Afiseaza:</label><br />
<select id="layer" onchange="search()" class="form-control">
<option value="Green Area">Teren</option>
<option value="Building">Constructii</option>

</select>
</td>
</tr>
</table>


Here we have a function in js which on an onchange event calls for the following:



function search(){


var layer = $('#layer').val();

console.log(layer);

proj4.defs('EPSG:31700','+proj=sterea +lat_0=46 +lon_0=25 +k=0.99975 +x_0=500000 +y_0=500000 +ellps=krass +towgs84=28,-121,-77,0,0,0,0 +units=m +no_defs');
ol.proj.proj4.register(proj4);

//var geojson = $.getJSON('json/geojson.json', function(data) { return data });
//var geojson1 = {"type":"FeatureCollection","features":[{"type":"Feature","id":"2","geometry":{"type":"LineString","coordinates":[[698282.236,377375.758],[698289.591,377372.136],[698183.88,377182.298],[698182.72,377197.045],[698282.236,377375.758]]},"crs":{"type":"EPSG","properties":{"code":"31700"}},"geometry_name":"wkb_geometry","properties":{"ogc_fid":"2","area_id":"2","building_id":"2","type":"test","area":"test","owner":"test","description":"test","administration":"test","address":"test","property":"test","layer":"Green Area","extendedentity":null,"linetype":"test","entityhandle":null,"text":"test","wkb_geometry":"01020000000500000000FED478544F2541002731087F081741408D972E634F25418195438B70081741295C8FC28F4E254181E92631790517410AD7A3708D4E2541027B142EB405174100FED478544F2541002731087F081741"}}]}



//in cazul in care dorim direct din GeoJson
//$.getJSON('json/geojson.json', processGeoJSON );

//console.log(geojson);

if (ol.proj.proj4 && ol.proj.proj4.register) { ol.proj.proj4.register(proj4); }

var features;


$.ajax({
type: "GET",
url: "get_geojson.php?layer="+layer,
dataType: 'json',
async: false,
success: function (response) {
//console.log(response);
//console.log(b);
features = new ol.format.GeoJSON().readFeatures(response);
}
});


var extent = ol.extent.createEmpty();
features.forEach(function(feature){
feature.setId(undefined);
feature.getGeometry().transform('EPSG:31700', 'EPSG:3857');
ol.extent.extend(extent, feature.getGeometry().getExtent());
});

var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM(),
}),
new ol.layer.Vector({
source: new ol.source.Vector({
features: features
})
})
],
target: 'map',
controls: ol.control.defaults({
attributionOptions:
({
collapsible: false
})
}).extend([
new ol.control.OverviewMap(),
new ol.control.FullScreen(),
new ol.control.ScaleLine()

]),
interactions: [
new ol.interaction.DragRotateAndZoom(),
new ol.interaction.MouseWheelZoom(),
new ol.interaction.DragPan(),
new ol.interaction.DoubleClickZoom()
],
view: new ol.View()
});

map.getView().fit(extent);

}


Which would normally have to refresh the map with new geometries ...



This does not happen does anyone know why this phenomenon is happening?



In the console there is no error, just when the page load is executing the function but when I give the onchange do not ...









share



























    0















    I have a html selection of the form:



    <table class="table">
    <tr>
    <td>
    <label>Afiseaza:</label><br />
    <select id="layer" onchange="search()" class="form-control">
    <option value="Green Area">Teren</option>
    <option value="Building">Constructii</option>

    </select>
    </td>
    </tr>
    </table>


    Here we have a function in js which on an onchange event calls for the following:



    function search(){


    var layer = $('#layer').val();

    console.log(layer);

    proj4.defs('EPSG:31700','+proj=sterea +lat_0=46 +lon_0=25 +k=0.99975 +x_0=500000 +y_0=500000 +ellps=krass +towgs84=28,-121,-77,0,0,0,0 +units=m +no_defs');
    ol.proj.proj4.register(proj4);

    //var geojson = $.getJSON('json/geojson.json', function(data) { return data });
    //var geojson1 = {"type":"FeatureCollection","features":[{"type":"Feature","id":"2","geometry":{"type":"LineString","coordinates":[[698282.236,377375.758],[698289.591,377372.136],[698183.88,377182.298],[698182.72,377197.045],[698282.236,377375.758]]},"crs":{"type":"EPSG","properties":{"code":"31700"}},"geometry_name":"wkb_geometry","properties":{"ogc_fid":"2","area_id":"2","building_id":"2","type":"test","area":"test","owner":"test","description":"test","administration":"test","address":"test","property":"test","layer":"Green Area","extendedentity":null,"linetype":"test","entityhandle":null,"text":"test","wkb_geometry":"01020000000500000000FED478544F2541002731087F081741408D972E634F25418195438B70081741295C8FC28F4E254181E92631790517410AD7A3708D4E2541027B142EB405174100FED478544F2541002731087F081741"}}]}



    //in cazul in care dorim direct din GeoJson
    //$.getJSON('json/geojson.json', processGeoJSON );

    //console.log(geojson);

    if (ol.proj.proj4 && ol.proj.proj4.register) { ol.proj.proj4.register(proj4); }

    var features;


    $.ajax({
    type: "GET",
    url: "get_geojson.php?layer="+layer,
    dataType: 'json',
    async: false,
    success: function (response) {
    //console.log(response);
    //console.log(b);
    features = new ol.format.GeoJSON().readFeatures(response);
    }
    });


    var extent = ol.extent.createEmpty();
    features.forEach(function(feature){
    feature.setId(undefined);
    feature.getGeometry().transform('EPSG:31700', 'EPSG:3857');
    ol.extent.extend(extent, feature.getGeometry().getExtent());
    });

    var map = new ol.Map({
    layers: [
    new ol.layer.Tile({
    source: new ol.source.OSM(),
    }),
    new ol.layer.Vector({
    source: new ol.source.Vector({
    features: features
    })
    })
    ],
    target: 'map',
    controls: ol.control.defaults({
    attributionOptions:
    ({
    collapsible: false
    })
    }).extend([
    new ol.control.OverviewMap(),
    new ol.control.FullScreen(),
    new ol.control.ScaleLine()

    ]),
    interactions: [
    new ol.interaction.DragRotateAndZoom(),
    new ol.interaction.MouseWheelZoom(),
    new ol.interaction.DragPan(),
    new ol.interaction.DoubleClickZoom()
    ],
    view: new ol.View()
    });

    map.getView().fit(extent);

    }


    Which would normally have to refresh the map with new geometries ...



    This does not happen does anyone know why this phenomenon is happening?



    In the console there is no error, just when the page load is executing the function but when I give the onchange do not ...









    share

























      0












      0








      0








      I have a html selection of the form:



      <table class="table">
      <tr>
      <td>
      <label>Afiseaza:</label><br />
      <select id="layer" onchange="search()" class="form-control">
      <option value="Green Area">Teren</option>
      <option value="Building">Constructii</option>

      </select>
      </td>
      </tr>
      </table>


      Here we have a function in js which on an onchange event calls for the following:



      function search(){


      var layer = $('#layer').val();

      console.log(layer);

      proj4.defs('EPSG:31700','+proj=sterea +lat_0=46 +lon_0=25 +k=0.99975 +x_0=500000 +y_0=500000 +ellps=krass +towgs84=28,-121,-77,0,0,0,0 +units=m +no_defs');
      ol.proj.proj4.register(proj4);

      //var geojson = $.getJSON('json/geojson.json', function(data) { return data });
      //var geojson1 = {"type":"FeatureCollection","features":[{"type":"Feature","id":"2","geometry":{"type":"LineString","coordinates":[[698282.236,377375.758],[698289.591,377372.136],[698183.88,377182.298],[698182.72,377197.045],[698282.236,377375.758]]},"crs":{"type":"EPSG","properties":{"code":"31700"}},"geometry_name":"wkb_geometry","properties":{"ogc_fid":"2","area_id":"2","building_id":"2","type":"test","area":"test","owner":"test","description":"test","administration":"test","address":"test","property":"test","layer":"Green Area","extendedentity":null,"linetype":"test","entityhandle":null,"text":"test","wkb_geometry":"01020000000500000000FED478544F2541002731087F081741408D972E634F25418195438B70081741295C8FC28F4E254181E92631790517410AD7A3708D4E2541027B142EB405174100FED478544F2541002731087F081741"}}]}



      //in cazul in care dorim direct din GeoJson
      //$.getJSON('json/geojson.json', processGeoJSON );

      //console.log(geojson);

      if (ol.proj.proj4 && ol.proj.proj4.register) { ol.proj.proj4.register(proj4); }

      var features;


      $.ajax({
      type: "GET",
      url: "get_geojson.php?layer="+layer,
      dataType: 'json',
      async: false,
      success: function (response) {
      //console.log(response);
      //console.log(b);
      features = new ol.format.GeoJSON().readFeatures(response);
      }
      });


      var extent = ol.extent.createEmpty();
      features.forEach(function(feature){
      feature.setId(undefined);
      feature.getGeometry().transform('EPSG:31700', 'EPSG:3857');
      ol.extent.extend(extent, feature.getGeometry().getExtent());
      });

      var map = new ol.Map({
      layers: [
      new ol.layer.Tile({
      source: new ol.source.OSM(),
      }),
      new ol.layer.Vector({
      source: new ol.source.Vector({
      features: features
      })
      })
      ],
      target: 'map',
      controls: ol.control.defaults({
      attributionOptions:
      ({
      collapsible: false
      })
      }).extend([
      new ol.control.OverviewMap(),
      new ol.control.FullScreen(),
      new ol.control.ScaleLine()

      ]),
      interactions: [
      new ol.interaction.DragRotateAndZoom(),
      new ol.interaction.MouseWheelZoom(),
      new ol.interaction.DragPan(),
      new ol.interaction.DoubleClickZoom()
      ],
      view: new ol.View()
      });

      map.getView().fit(extent);

      }


      Which would normally have to refresh the map with new geometries ...



      This does not happen does anyone know why this phenomenon is happening?



      In the console there is no error, just when the page load is executing the function but when I give the onchange do not ...









      share














      I have a html selection of the form:



      <table class="table">
      <tr>
      <td>
      <label>Afiseaza:</label><br />
      <select id="layer" onchange="search()" class="form-control">
      <option value="Green Area">Teren</option>
      <option value="Building">Constructii</option>

      </select>
      </td>
      </tr>
      </table>


      Here we have a function in js which on an onchange event calls for the following:



      function search(){


      var layer = $('#layer').val();

      console.log(layer);

      proj4.defs('EPSG:31700','+proj=sterea +lat_0=46 +lon_0=25 +k=0.99975 +x_0=500000 +y_0=500000 +ellps=krass +towgs84=28,-121,-77,0,0,0,0 +units=m +no_defs');
      ol.proj.proj4.register(proj4);

      //var geojson = $.getJSON('json/geojson.json', function(data) { return data });
      //var geojson1 = {"type":"FeatureCollection","features":[{"type":"Feature","id":"2","geometry":{"type":"LineString","coordinates":[[698282.236,377375.758],[698289.591,377372.136],[698183.88,377182.298],[698182.72,377197.045],[698282.236,377375.758]]},"crs":{"type":"EPSG","properties":{"code":"31700"}},"geometry_name":"wkb_geometry","properties":{"ogc_fid":"2","area_id":"2","building_id":"2","type":"test","area":"test","owner":"test","description":"test","administration":"test","address":"test","property":"test","layer":"Green Area","extendedentity":null,"linetype":"test","entityhandle":null,"text":"test","wkb_geometry":"01020000000500000000FED478544F2541002731087F081741408D972E634F25418195438B70081741295C8FC28F4E254181E92631790517410AD7A3708D4E2541027B142EB405174100FED478544F2541002731087F081741"}}]}



      //in cazul in care dorim direct din GeoJson
      //$.getJSON('json/geojson.json', processGeoJSON );

      //console.log(geojson);

      if (ol.proj.proj4 && ol.proj.proj4.register) { ol.proj.proj4.register(proj4); }

      var features;


      $.ajax({
      type: "GET",
      url: "get_geojson.php?layer="+layer,
      dataType: 'json',
      async: false,
      success: function (response) {
      //console.log(response);
      //console.log(b);
      features = new ol.format.GeoJSON().readFeatures(response);
      }
      });


      var extent = ol.extent.createEmpty();
      features.forEach(function(feature){
      feature.setId(undefined);
      feature.getGeometry().transform('EPSG:31700', 'EPSG:3857');
      ol.extent.extend(extent, feature.getGeometry().getExtent());
      });

      var map = new ol.Map({
      layers: [
      new ol.layer.Tile({
      source: new ol.source.OSM(),
      }),
      new ol.layer.Vector({
      source: new ol.source.Vector({
      features: features
      })
      })
      ],
      target: 'map',
      controls: ol.control.defaults({
      attributionOptions:
      ({
      collapsible: false
      })
      }).extend([
      new ol.control.OverviewMap(),
      new ol.control.FullScreen(),
      new ol.control.ScaleLine()

      ]),
      interactions: [
      new ol.interaction.DragRotateAndZoom(),
      new ol.interaction.MouseWheelZoom(),
      new ol.interaction.DragPan(),
      new ol.interaction.DoubleClickZoom()
      ],
      view: new ol.View()
      });

      map.getView().fit(extent);

      }


      Which would normally have to refresh the map with new geometries ...



      This does not happen does anyone know why this phenomenon is happening?



      In the console there is no error, just when the page load is executing the function but when I give the onchange do not ...







      postgis openlayers-2 geojson ajax





      share












      share










      share



      share










      asked 3 mins ago









      CoderCoder42CoderCoder42

      194




      194






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "79"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f313846%2frequest-a-ajax-with-get-to-remove-one-or-more-geometries-in-openlayers%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f313846%2frequest-a-ajax-with-get-to-remove-one-or-more-geometries-in-openlayers%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Щит и меч (фильм) Содержание Названия серий | Сюжет |...

          Венесуэла на летних Олимпийских играх 2000 Содержание Состав...

          Meter-Bus Содержание Параметры шины | Стандартизация |...