Code Monkey home page Code Monkey logo

ti.wfs's Introduction

Ti.WFS

Client for Web Feature Service (Open Geospatial) for Axway Titanium

With this module you can use WFS services.

Usage

var Wfs = require("ti.wfs").createWFS("https://geodienste.hamburg.de/HH_WFS_Strassenbaumkataster","2.0.0");

Wfs.getFeature({
   region : {
   	     latitude: 53.53,
   	     longitude: 10.0,
   	     latitudeDelta : 0.05,
   	     longitudeDelta: 0.05
   },
   typeNames : "app:Strassenbaumkataster"
}, function(e){
		 console.log(e.data)
});

And you will get:

{
  "wfs:FeatureCollection": {
    "-xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
    "-xmlns:wfs": "http://www.opengis.net/wfs/2.0",
    "-timeStamp": "2018-01-20T14:05:53Z",
    "-xmlns:gml": "http://www.opengis.net/gml/3.2",
    "-numberMatched": "unknown",
    "-numberReturned": "0",
    "wfs:member": [
      {
        "app:strassenbaumkataster": {
          "-xmlns:app": "http://www.deegree.org/app",
          "-gml:id": "APP_STRASSENBAUMKATASTER_2299",
          "app:baumid": "100374421",
          "app:gattung": "Tilia / Linde",
          "app:gattung_latein": "Tilia",
          "app:gattung_deutsch": "Linde",
          "app:art": "Tilia x europea / Kaiser-Linde",
          "app:art_latein": "Tilia x europea",
          "app:art_deutsch": "Kaiser-Linde",
          "app:sorte_latein": "Tilia x europea 'Pallida'",
          "app:sorte_deutsch": "Kaiser-Linde",
          "app:pflanzjahr": "2011",
          "app:kronendurchmesser": "2",
          "app:kronendmzahl": "2 m",
          "app:stammumfang": "20",
          "app:stammumfangzahl": "20 cm",
          "app:strasse": "Harburger Chaussee",
          "app:hausnummer": "g123",
          "app:stand_bearbeitung": "2017-01-01",
          "app:bezirk": "Hamburg-Mitte",
          "app:geom": {
            "gml:Point": {
              "-gml:id": "APP_STRASSENBAUMKATASTER_2299_APP_GEOM",
              "-srsName": "EPSG:25832",
              "gml:pos": "566545.620 5930635.407"
            }
          }
        }
      }]
    }  
}  
Wfs.getFeature(xml, function(e){
  console.log(e.data)
);

Filtering etc.

If you want filter the request you have to use XML. In this case the first parameter is a xml string:

var xml = "<?xml version='1.0' encoding='UTF-8'?>
<wfs:GetFeature service="WFS" version="1.1.0" resultType="hits" xmlns:app="http://www.deegree.org/app" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
    <wfs:Query typeName="app:strassenbaumkataster">
        <ogc:Filter>
            <ogc:And>
                <ogc:PropertyIsEqualTo>
                    <ogc:PropertyName>app:gattung</ogc:PropertyName>
                    <ogc:Literal>Taxus / Eibe</ogc:Literal>
                </ogc:PropertyIsEqualTo>
                <ogc:PropertyIsGreaterThanOrEqualTo>
                    <ogc:PropertyName>app:pflanzjahr</ogc:PropertyName>
                    <ogc:Literal>1920</ogc:Literal>
                </ogc:PropertyIsGreaterThanOrEqualTo>
                <ogc:PropertyIsLessThan>
                    <ogc:PropertyName>app:pflanzjahr</ogc:PropertyName>
                                       <ogc:Literal>0</ogc:Literal>
                </ogc:PropertyIsGreaterThanOrEqualTo>
                <ogc:PropertyIsLessThan>
                    <ogc:PropertyName>app:stammumfang</ogc:PropertyName>
                    <ogc:Literal>1001</ogc:Literal>
                </ogc:PropertyIsLessThan>
            </ogc:And>
        </ogc:Filter>
    </wfs:Query>
</wfs:GetFeature>";

Wfs.requestFeature(xml, function(e){
		 console.log(e.data)
);


Other methods

getCapabilities()

Generates a metadata document describing a WFS service provided by server as well as valid WFS operations and parameters

describeFeatureType()

Returns a description of feature types supported by a WFS service

Wfs.describeFeatureType()

Gives you:

{
  "schema": {
    "-xmlns": "http://www.w3.org/2001/XMLSchema",
    "-xmlns:gml": "http://www.opengis.net/gml/3.2",
    "import": {
      "-namespace": "http://www.opengis.net/gml/3.2",
      "-schemaLocation": "http://schemas.opengis.net/gml/3.2.1/gml.xsd"
    },
    "element": [
      {
        "-name": "strassenbaumkataster",
        "-substitutionGroup": "gml:AbstractFeature",
        "complexType": {
          "complexContent": {
            "extension": {
              "-base": "gml:AbstractFeatureType",
              "sequence": {
                "element": [
                  {
                    "-name": "baumid",
                    "-minOccurs": "0",
                    "-type": "integer"
                  },
                  {
                    "-name": "gattung",
                    "-minOccurs": "0",
                    "-type": "string"
                  },
                  {
                    "-name": "art_latein",
                    "-minOccurs": "0",
                    "-type": "string"
                  },
                  {
                    "-name": "art_deutsch",
                    "-minOccurs": "0",
                    "-type": "string"
                  },
                  {
                    "-name": "sorte",
                    "-minOccurs": "0",
                    "-type": "string"
                  },
                  {
                    "-name": "pflanzjahr",
                    "-minOccurs": "0",
                    "-type": "integer"
                  },
                  {
                    "-name": "kronendurchmesser",
                    "-minOccurs": "0",
                    "-type": "integer"
                  },
                  {
                    "-name": "kronendmzahl",
                    "-minOccurs": "0",
                    "-type": "string"
                  },
                  {
                    "-name": "stammumfang",
                    "-minOccurs": "0",
                    "-type": "integer"
                  },
                  {
                    "-name": "stammumfangzahl",
                    "-minOccurs": "0",
                    "-type": "string"
                  },
                  {
                    "-name": "strasse",
                    "-minOccurs": "0",
                    "-type": "string"
                  },
                  {
                    "-name": "hausnummer",
                    "-minOccurs": "0",
                    "-type": "string"
                  },
                  {
                    "-name": "stand_bearbeitung",
                    "-minOccurs": "0",
                    "-type": "date"
                  },
                  {
                    "-name": "bezirk",
                    "-minOccurs": "0",
                    "-type": "string"
                  },
                  {
                    "-name": "geom",
                    "-minOccurs": "0",
                    "-type": "gml:PointPropertyType"
                  }
                ]
              }
            }
          }
        }
       }
      ]
    ]
  }
}

Other WFS server

Using of google search you can find a lot of servers:

ti.wfs's People

Contributors

appwerft avatar

Stargazers

Konstantin Büschel avatar Hans Knöchel avatar

Watchers

James Cloos avatar  avatar

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.