Code Monkey home page Code Monkey logo

ol-wfst's People

Contributors

gastonzalba avatar laddish avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ol-wfst's Issues

[Need Help]I try to build the code but it shows lots of typeerror...

Describe the bug
First of all, thank you so much for creating this awesome lib.
When I using it ,and try to build packages, I met some problem, so I open this issue, hope it won't bother you.

Package Version
"name": "ol-wfst",
"version": "2.0.0",

To Reproduce
Steps to reproduce the behavior:
when I wirte code like

import {
  Fill,
  Stroke,
  Circle,
  Style
} from 'ol/style';
import Wfst from 'ol-wfst';
import Map from 'ol/Map';
import View from 'ol/View';

import {
  Tile as TileLayer,
} from 'ol/layer';

import OSM from 'ol/source/OSM';

const osmLayer= new TileLayer({
  source: new OSM()
});

const map = new Map({
  layers: [osmLayer],
  target: document.getElementById('map'),
  view: new View({
    center: [-27742148.67849364, 4013558.6683776584],
    maxZoom: 19,
    zoom: 6.528567822732854,
  }),
});

const wfst = new Wfst(map, {
  geoServerUrl: 'http://xxx.xx.xx.xx:8080/geoserver/ez/ows',
  layers: [{
      name: 'ez:LRRL',
      label: 'LRRL', 
      mode: 'wfs',
      wfsStrategy: 'bbox',
      zIndex: 99,
      style: new Style({
        image: new Circle({
          radius: 7,
          fill: new Fill({
            color: '#000000'
          }),
          stroke: new Stroke({
            color: [255, 0, 0],
            width: 2
          })
        })
      })
    }
  ],
  minZoom: 12,
  showUpload: true,
});

image

It shows Loading for a long long time,
and the feature layer doesn't show.

I check the internet.

I saw only two "/oms" request,
Snipaste_2022-02-10_15-34-36
GetCapabilities

and
image
DescribeFeatureType,

image

the response seems ok,

but why the layer didn't show.... and there is still loading?

I suppose it must will fetch 'GetFeature' to add a newWfsLayer, but i didn't see other request, So I want to see how the code or progress goes wrong...
i find the code most likely in here...

          yield this._getGeoserverLayersData(this.options.layers, this.options.geoServerUrl);

          this._createLayers(this.options.layers);
  /**
   * Connect to the GeoServer and retrieve metadata about the service (GetCapabilities).
   * Get each layer specs (DescribeFeatureType) and create the layers and map controls.
   *
   * @param layers
   * @param showControl
   * @param active
   * @private
   */


  _initAsyncOperations() {
    return __awaiter(this, void 0, void 0, function* () {
      try {
        this._createBaseControl();

        this._showLoading();

        yield this._connectToGeoServerAndGetCapabilities();

        if (this.options.layers) {
          yield this._getGeoserverLayersData(this.options.layers, this.options.geoServerUrl);

          this._createLayers(this.options.layers);
        }

        this._initMapElements(this.options.showControl, this.options.active);
      } catch (err) {
        this._hideLoading();

        this._showError(err.message);
      }
    });
  }

So I want to add some 'console.log' to check where is wrong,
I pull the whole code and run "yarn" or "npm i" to install all the dependences, it goes fine;
But when I run the scripts from the ‘package.json’ like "yarn build" to build packages,
I got lots of TypeError,
image

and I try to update the dependences "@types/ol" to "^6.5.3",
but it still show the same errors
image
I figure its typescript's problem, and i am a typescript beginner,
i'm wondering how to fix it or skip the typescript problem
but i dont know how to fix it,

So I'm wondering is there something wrong with my steps?
Does the code still work fine on your project?
Thanks again for your patient to read till here.

Expected behavior
I expect it build successfully.

Desktop (please complete the following information):

  • Browser : Google
  • Version: 97.0.4692.71

Additional context
Add any other context about the problem here.
when i use the original openlayers

import GeoJSON from 'ol/format/GeoJSON';
import {
  bbox as bboxStrategy
} from 'ol/loadingstrategy';
const vectorSource = new VectorSource({
  format: new GeoJSON(),
  url: function (extent) {
    return (
      'http://xxx.xx.xx.xx:8080/geoserver/ez/ows?service=WFS&' +
      'version=1.1.0&request=GetFeature&typename=ez:LRRL&' +
      'outputFormat=application/json&srsname=EPSG:3857&' +
      'bbox=' +
      extent.join(',') +
      ',EPSG:3857'
    );
  },
  strategy: bboxStrategy,
});

image

the geoserver and wfsserver works fine.

I notice your code use the 4326 to fetch the feature,
image
so i want to modify the code to build a new package.
but when i build i met above typeerror problem.

How to add feature to WFS manually?

Hi,

I want to create the new button called copyButton (i'm editing ol-wfst.js) to copy feature geometry from other source. My code is:

                const copyButton = document.createElement('button');
                copyButton.className =
                    'ol-wfst--tools-control-btn ol-wfst--tools-control-btn-copy';

                copyButton.type = 'button';

                copyButton.innerHTML = `<img src="./ol-wfst-main/ol-wfst-main/src/assets/images/copy-svgrepo-com.svg"/>`;

                copyButton.title = 'Skopiuj geometrię działki';

                copyButton.disabled = "disabled";

                copyButton.onclick = () => {
                        if (feature_to_copy) {
                            wfst.insertFeaturesTo(this._layerToInsertElements, [feature_to_copy]);
                            copyButton.disabled = "disabled";
                            feature_to_copy = null;
                        }
                };

How to add feature to WFS-T manually (using feature generated by other function, not by drawing)?

When i'm using wfst.insertFeaturesTo(this._layerToInsertElements, [feature_to_copy]); i receive several errors e.g.

Error: Cannot read properties of undefined (reading 'forEach')
ol-wfst.ts:1456 TypeError: Cannot read properties of undefined (reading 'forEach')

Despite of the received error transaction is done and feature is add.

How to avoid this error in popup?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.