GithubHelp home page GithubHelp logo

esri / feature-service-editor-js Goto Github PK

View Code? Open in Web Editor NEW
10.0 15.0 15.0 658 KB

SQL-like viewer for search, add, delete and editing any point-based ArcGIS feature service.

Home Page: http://esri.github.io/feature-service-editor-js/

License: Apache License 2.0

CSS 4.23% HTML 92.21% JavaScript 3.56%

feature-service-editor-js's Introduction

#feature-service-editor

DEPRECATED as of April, 2015 This editor has been replaced by esri/digit/FeatureTable.

This ready-to-go JavaScript prototype provides very basic SQL-like capabilities to add, delete, edit or search for data in "point" based feature services with or without a map. It is intended for reading any valid ArcGIS FeatureService.

Use this application as-is, embed it in your own application, extend or modify it to meet your needs. Basically have fun, and feedback or contributions are appreciated!

Instructions (Four easy steps)

  1. Copy-and-paste a FeatureService endpoint into the field labeled "Feature Service", or use the pulldown list and set up your own FeatureServices using the ComboBox.
    • IMPORTANT: The FeatureService must have an OBJECTID field.
  2. Click the "Load" button.
  3. Double click on any field to enable the edit mode. Edit the field. For that row the Save, Undo and Delete buttons should become visible and enabled.
  4. When you are done editing select "Save", "Undo" or "Delete".

To add a new row of data

Allows for the ability to add one new row of data at a time.

  1. After loading a feature service, select the "Add Record" button. This creates a new grid that you can use to enter the data. It should be highlighted with yellow cells.
  2. Enter your changes in the new grid.
  3. When you are done adding data select "Save" or "Undo".
  4. Or, if you want to delete your changes without saving them select the "Remove New Record" button.

Using Query String

Query String lets you set the SQL string for returning data. When left blank it will return all data. As an example, to data for record 115 would be to specify: objectId='115'.

To hook your map to grid events

In order to hook a map up to the datagrid events, tie your map code into the appropriate listener in the featureEditor.utils._setListeners function. As shown in the code snippet below, clicking on a row returns an Object containing all the data:

	featureEditor.dgridRowClickListener = featureEditor.grid.on(".dgrid-row:click",function(event){
    	var localFeature = featureEditor.grid.row(event);
        console.log(localFeature.data);        
    });

And, here is an example of the data contained in the localFeature Object. It has everything you need to extract the information and to either build a map Graphic on-the-fly, or to use a unique attribute (e.g. BSID in this example) to parse through a map's feature layer and activate the popup.

This is an example of localFeature.data:

data: Object
	BSID: "17178"
	DIR: "S"
	DISTANCE_F: "1125"
	LAT: "39.7926441"
	LNG: "-104.978336"
	LOCATION: "M"
	OBJECTID: "16"
	ROUTES: "12"
	STOPNAME: "Washington St & 55th Ave"
	X_COORD: "3146592.54170809"
	Y_COORD: "1714022.41966042"

Here's a view of the Object from the Chrome browser's console showing that you can extract the OBJECTID value using localFeature.id:

localFeature: y.postscript._Row
	data: Object
	element: div#grid-row-16.dgrid-row.dgrid-row-even.ui-state-default
	id: "16"

Main Editor Window

Add Record Window

![] (screenshot4.png)

Control Panel

Grid Legend Control Panel

Requirements

  • IMPORTANT: Requires a valid ArcGIS Feature Service that contains an OBJECTID field.
  • IMPORTANT: Always secure your services when allowing editing! For more information on securing your services go here.
  • Experience with JavaScript and some experience with the ArcGIS API for JavaScript.
  • Tested to work on Desktop versions of Chrome 26 & 27, Firefox 21, Internet Explorer 9. The current version has not been architected to work on a mobile device.

Resources

Issues

Find a bug or want to request a new feature? Please use the submit new Issue feature on this repo.

Contributing

Anyone and everyone is welcome to contribute.

Licensing

Copyright 2014 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: JavaScript Feature Service Editing) [](Esri Language: JavaScript)

feature-service-editor-js's People

Contributors

andygup avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

feature-service-editor-js's Issues

Not Editable

Andy,

I checked all my permissions and made sure to select all capabilities when publishing the feature service and I am still getting a not editable warning on my feature service. Here are the supported operations on my feature service:

Supported Operations: Query Apply Edits Add Features Update Features Delete Features Generate Renderer Return Updates

This is publishing to my own server. If I use it in a web app, I can see and edit it normally. If I publish it to AGOL I can add new points, but I cannot see the other existing points and the edits are not permanent, i.e. I cannot see the new records in ArcMap. Do you have any ideas? Thank you!

FeatueTable only reading?

I read that the FeatureTable | API Reference | ArcGIS API for JavaScript is not editable - read only? Is this true?

Date Fields and Domains

Andy,

Is there a way to show the domain value instead of the domain code? For example I have a field with Offices. The domain code is for example AU and the value is Austin. Is there a way to show Austin, instead of AU?
Also, for date fields, it is showing a large number. For example instead of showing a date in the format of 08/1/2013 it is showing 1375315200000. Is there a way to show the date in a date format?
Also, is it possible to hide some fields?
Thanks again!

Feature Service Editor does not show the records

When I add my feature layer, I just see a timer running, but no features appear on the table. I can see the correct number of total records, however it is in a loop forever trying to display the features. Any ideas why this is happening? Thank you so much for any help!!! These are the details of my feature service:

ArcGIS REST Services Directory Login | Get Token

Home > services > SARS_WILSON > Activitypoint2 (FeatureServer)
Help | API Reference

JSON | SOAP

SARS_WILSON/Activitypoint2 (FeatureServer)
View In: ArcGIS.com Map

View Footprint In: ArcGIS.com Map

Service Description:

Has Versioned Data: false

Has Versioned Data: false

MaxRecordCount: 1000

Supported Query Formats: JSON, AMF

Layers:
• ActivityPoint (0)
Description:

Copyright Text:

Spatial Reference: 3665 (3665)

Initial Extent:
XMin: -1.3894588728820004E7
YMin: 1.1699095156963052E7
XMax: 2.0748741844019994E7
YMax: 4.1034173464609824E7
Spatial Reference: 3665 (3665)
Full Extent:
XMin: -1.23198918846E7
YMin: 7306985.0719
XMax: 1.9174044999799997E7
YMax: 2.41932744889E7
Spatial Reference: 3665 (3665)
Units: esriMeters

Document Info:
Title:
Author:
Comments:
Subject:
Category:
Keywords:
AntialiasingMode: null
TextAntialiasingMode: null
Enable Z Defaults: false

Child Resources: Info Uploads

Supported Operations: Query Apply Edits Create Replica Synchronize Replica Unregister Replica

And:

ArcGIS REST Services Directory Login | Get Token

Home > services > SARS_WILSON > Activitypoint2 (FeatureServer) > ActivityPoint
Help | API Reference

JSON

Layer: ActivityPoint (ID: 0)
View In: ArcGIS.com Map

Name: ActivityPoint

Display Field: Office

Type: Feature Layer

Geometry Type: esriGeometryPoint

Description:

Definition Expression: N/A

Copyright Text:

Default Visibility: true

MaxRecordCount: 1000

Supported Query Formats: JSON, AMF

Min Scale: 0

Max Scale: 0

Supports Advanced Queries: true

Supports Statistics: true

Extent:
XMin: -1.23198918846E7
YMin: 7306985.0719
XMax: 1.9174044999799997E7
YMax: 2.41932744889E7
Spatial Reference: 3665 (3665)

Drawing Info:
Renderer:
Simple Renderer:
Symbol:
Style: esriSMSCircle
Color: [113, 128, 0, 255]
Size: 4.0
Angle: 0.0
XOffset: 0
YOffset: 0
Outline:
[0, 0, 0, 255] Width: 1
Label:
Description:
Transparency: 0
Labeling Info:

HasZ: false

HasM: false

Has Attachments: false

HTML Popup Type: esriServerHTMLPopupTypeAsHTMLText

Type ID Field:

Fields:
• OBJECTID ( type: esriFieldTypeOID , alias: OBJECTID , editable: false , nullable: false )
• Office ( type: esriFieldTypeString , alias: Forester , editable: true , nullable: true , length: 2 , Coded Values: [AL: Alpine] , [AU: Austin] , [CA: Carthage] , ...39 more... )
• Forester ( type: esriFieldTypeString , alias: Forester , editable: true , nullable: true , length: 25 , Coded Values: [bcompton: Brittany Compton] , [bpope: Brian Pope] , [brobinson: Buster Robinson] , ...27 more... )
• ActivityCode ( type: esriFieldTypeString , alias: ActivityCode , editable: true , nullable: true , length: 25 , Coded Values: [ATF: Tree Farm Program - Reinspections] , [ATN: Tree Farm Program - New Inspections] , [SLD: State Land Management (SF/GLO)] , ...4 more... )
• DateComplete ( type: esriFieldTypeDate , alias: DateComplete , editable: true , nullable: true , length: 36 )
• RecipientLast ( type: esriFieldTypeString , alias: Recipient - Last Name , editable: true , nullable: true , length: 50 )
• RecipientFirst ( type: esriFieldTypeString , alias: Recipient - First Name , editable: true , nullable: true , length: 30 )
• Acres ( type: esriFieldTypeDouble , alias: Acres , editable: true , nullable: true )
• Program ( type: esriFieldTypeString , alias: Program , editable: true , nullable: true , length: 10 )
• Underserved ( type: esriFieldTypeSmallInteger , alias: Underserved , editable: true , nullable: true , Coded Values: [0: No] , [1: Yes] )
• Creator ( type: esriFieldTypeString , alias: Creator , editable: false , nullable: true , length: 255 )
• CreationDate ( type: esriFieldTypeDate , alias: CreationDate , editable: false , nullable: true , length: 36 )
• LastEditor ( type: esriFieldTypeString , alias: LastEditor , editable: false , nullable: true , length: 255 )
• LastEditDate ( type: esriFieldTypeDate , alias: LastEditDate , editable: false , nullable: true , length: 36 )
Templates:
• Name: ActivityPoint
Description:
Prototype:
Underserved: null
Office: null
Forester: null
ActivityCode: null
DateComplete: null
RecipientLast: null
RecipientFirst: null
Acres: null
Program: null
Drawing Tool: esriFeatureEditToolPoint

Capabilities: Query,Create,Update,Delete,Uploads,Editing

Sync Can Return Changes: false

Is Data Versioned: false

Supports Rollback On Failure: true

Edit Fields Info:
• Creation Date Field: CreationDate
• Creator Field: Creator
• Edit Date Field: LastEditDate
• Editor Field: LastEditor

Supported Operations: Query Apply Edits Add Features Update Features Delete Features Generate Renderer Return Updates

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.