GithubHelp home page GithubHelp logo

esri / featureservice2trigger Goto Github PK

View Code? Open in Web Editor NEW
3.0 8.0 5.0 339 KB

Command line script to import an ArcGIS Feature Service to the Geotrigger Service

Home Page: https://developers.arcgis.com/en/geotrigger-service/guide/import-feature-service/

License: Apache License 2.0

JavaScript 100.00%

featureservice2trigger's Introduction

featureservice2trigger

A command line tool for creating Geotrigger Rules from an ArcGIS FeatureService.

Installation

Just install with NPM. You will need Node.js installed.

$ npm install -g featureservice2trigger

Usage

To print the full usage information just do...

$ featureservice2trigger

Here is an example of using featureservice2trigger to import a Feature Service of city parks.

$ featureservice2trigger --clientId=YOUR_CLIENT_ID --clientSecret=YOUR_CLIENT_SECRET --tag=parks --tag=portland --serviceUrl="http://services.arcgis.com/rOo16HdIMeOBI4Mb/arcgis/rest/services/Parks_pdx/FeatureServer/0" --notificationTemplate="Welcome to {{NAME}}"

Options

Many of these options refer to parameters in trigger/create method of the Geotrigger Service API. You should familiarize yourself with the parameters for trigger/create before using this script.

Options Description
clientId Required Application client id - http://developers.arcgis.com/en/applications/.
clientSecret Required Application client secret - http://developers.arcgis.com/en/applications/.
serviceUrl Required The URL of the Feature Layer you would like to import. You can find urls for your existing services at http://developers.arcgis.com/en/hosted-data/.
tag Required Tag or tags to apply to the triggers created in the Geotrigger API. You can define tag as many times as you like to apply multipile tags to each trigger. Tags can also be Mustache templates so a feature with {type: School}and a template like"type-{{type}}will turn intotype-school`.
buffer If you are importing point features, buffer them by this amount to create the trigger area. Defaults to 250 meters.
useFeatureIds Use the ids of the features as the id of the trigger.
callbackUrl When the triggers condition is satisfied a POST request will be sent to this URL
notificationTemplate A Mustache template for the push notification. Feature attributes will be passed into the template context. So a feature with attributes like {NAME: Mt. Tabor Park} and a template like "Welcome to {{NAME}} will turn into Welcome to Mt. Tabor Park.
trackingProfile Changes the devices tracking profile to this when the trigger is fired. Should be off, adaptive, fine, or rough
direction The direction the device shold be traveling to fire the trigger. Either enter or leave
authenticate If the feature service you are trying to use requires authentication you must pass this flag to enable authentication. Defaults to false
concurrency The number of concurrent requests that will run. Reduce if you see errors, increse to increse import speed. Defaults to 50

Notes

Feature Services should be hosted on arcgis.com or an on-premise ArcGIS Server 10.1 or higher. If you are using this with a feature service hosted on-premise the service must be publically accessible.

If you are using a feature service that is hosted on arcgis.com that is not shared publically you will need to pass --authenticate along with other options to authenticate and access the service.

Resources

Issues

Find a bug or want to request a new feature? Please let us know by submitting an issue.

Contributing

Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.

Licensing

Copyright 2013 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

A copy of the license is available in the repository's license.txt file.

[](Esri Tags: ArcGIS Geotrigger Service Tools Import FeatureLayer FeatureServer) [](Esri Language: JavaScript)

featureservice2trigger's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

featureservice2trigger's Issues

error during requesting features

we tried several times to import public features service but everytime it appear the following error (see the text from the shell)

Sorry we are novices but any help is appreciated.
thanx
enico & luca
....................
C:\temp>
C:\temp>
C:\temp>featureservice2trigger --clientId=1AtftFpnFgrW1ONi --clientSecret=19d290
6d9f58442f8f21b6e50beecb37 --tag=bacini --tag=idro --serviceUrl="http://webgis.a
rpa.piemonte.it/ags101free/rest/services/acqua/qualita_acque_balneazione_WM/Feat
ureServer/0" --buffer=300 --notificationTemplate="Welcome to {{DESCRIZION}}"
Getting metadata for http://webgis.arpa.piemonte.it/ags101free/rest/services/acq
ua/qualita_acque_balneazione_WM/FeatureServer/0
Success! Got metadata for http://webgis.arpa.piemonte.it/ags101free/rest/service
s/acqua/qualita_acque_balneazione_WM/FeatureServer/0

Requesting Features...

stream.js:94
throw er; // Unhandled stream error in pipe.
^
Error: Unexpected "!" at position 1 in state START
at Parser.proto.charError (C:\Users\enribona\AppData\Roaming\npm\node_module
s\featureservice2trigger\node_modules\JSONStream\node_modules\jsonparse\jsonpars
e.js:84:16)
at Parser.proto.write (C:\Users\enribona\AppData\Roaming\npm\node_modules\fe
atureservice2trigger\node_modules\JSONStream\node_modules\jsonparse\jsonparse.js
:112:23)
at Stream. (C:\Users\enribona\AppData\Roaming\npm\node_modules\fe
atureservice2trigger\node_modules\JSONStream\index.js:27:12)
at Stream.stream.write (C:\Users\enribona\AppData\Roaming\npm\node_modules\f
eatureservice2trigger\node_modules\JSONStream\node_modules\through\index.js:26:1
1)
at Request.ondata (stream.js:51:26)
at Request.EventEmitter.emit (events.js:95:17)
at IncomingMessage. (C:\Users\enribona\AppData\Roaming\npm\node_m
odules\featureservice2trigger\node_modules\request\request.js:820:12)
at IncomingMessage.EventEmitter.emit (events.js:95:17)
at IncomingMessage. (_stream_readable.js:746:14)
at IncomingMessage.EventEmitter.emit (events.js:92:17)

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.