├── README.md ├── add-shapefile.png ├── css ├── app.css └── fileupload.css ├── index.html └── license.txt /README.md: -------------------------------------------------------------------------------- 1 | # add-shapefile-js 2 | 3 | This ArcGIS JavaScript sample let's you navigate to a local .zip file add a shapefile to your web map. It uses the Portal API REST Generate method to create features that can be loaded into a web map application. Learn more [here](http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/portal_addshapefile.html). 4 | 5 | [View live here](http://help.arcgis.com/en/webapi/javascript/arcgis/samples/portal_addshapefile/index.html) 6 | 7 | ![App](https://raw.github.com/Esri/add-shapefile-js/master/add-shapefile.png) 8 | 9 | ## Features 10 | * ArcGIS Javascript and Portal API 11 | * Uses REST Generate operation to create a feature collection from the zipped shapefile 12 | * Applies symbols 13 | * Adds features to map 14 | 15 | ## Instructions 16 | 17 | 1. Download and unzip the .zip file or clone the repo. 18 | 2. Web-enable the directory or copy/paste the source to your own .html file. 19 | 3. Access the .html page. 20 | 21 | [New to Github? Get started here.](https://github.com/) 22 | 23 | ## Requirements 24 | 25 | * Notepad or HTML editor 26 | * A little background with Javascript 27 | * Experience with the [ArcGIS Javascript API](http://www.esri.com/) would help. 28 | 29 | ## Resources 30 | 31 | * [ArcGIS for JavaScript API Resource Center](http://help.arcgis.com/en/webapi/javascript/arcgis/index.html) 32 | * [ArcGIS Blog](http://blogs.esri.com/esri/arcgis/) 33 | * [twitter@esri](http://twitter.com/esri) 34 | 35 | ## Issues 36 | 37 | Find a bug or want to request a new feature? Please let us know by submitting an issue. 38 | 39 | ## Contributing 40 | 41 | Anyone and everyone is welcome to contribute. 42 | 43 | ## Licensing 44 | Copyright 2012 Esri 45 | 46 | Licensed under the Apache License, Version 2.0 (the "License"); 47 | you may not use this file except in compliance with the License. 48 | You may obtain a copy of the License at 49 | 50 | http://www.apache.org/licenses/LICENSE-2.0 51 | 52 | Unless required by applicable law or agreed to in writing, software 53 | distributed under the License is distributed on an "AS IS" BASIS, 54 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 55 | See the License for the specific language governing permissions and 56 | limitations under the License. 57 | 58 | A copy of the license is available in the repository's [license.txt]( https://raw.github.com/Esri/switch-basemaps-js/master/license.txt) file. 59 | 60 | [](Esri Tags: ArcGIS Shapefile Map Web Display) 61 | [](Esri Language: JavaScript) 62 | -------------------------------------------------------------------------------- /add-shapefile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/add-shapefile-js/698aa361aedc8928d913994646c6951919af4b07/add-shapefile.png -------------------------------------------------------------------------------- /css/app.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | height: 98%; 3 | margin: 10px 10px 5px; 4 | padding: 0; 5 | width: 98%; 6 | } 7 | body { 8 | background-color: #FFFFFF; 9 | color: #333333; 10 | font-family:"Helvetica Neue", Helvetica, "Trebuchet MS", Arial, sans-serif; 11 | font-size: 14px; 12 | overflow: hidden; 13 | } 14 | a { 15 | color: #336699; 16 | } 17 | 18 | h1{ 19 | color: #222; 20 | text-shadow: 0px 2px 3px #555; 21 | } 22 | 23 | #rightPane { 24 | background-color: #FCFFF5; 25 | border-bottom-right-radius: 4px; 26 | 27 | border-top-right-radius:4px; 28 | border:1px solid #222; 29 | border-left:none; 30 | margin: 0; 31 | padding: 0; 32 | width: 250px; 33 | } 34 | #mapCanvas { 35 | border:1px solid #222; 36 | border-top-left-radius:4px; 37 | border-bottom-left-radius: 4px; 38 | margin: 0; 39 | padding: 0; 40 | } 41 | .file-upload span { 42 | display:none; 43 | } 44 | .file-upload-status { 45 | vertical-align: middle; 46 | padding: 5px 11px; 47 | font-size: 12px; 48 | color: #888; 49 | background: #F8F8F8; 50 | } -------------------------------------------------------------------------------- /css/fileupload.css: -------------------------------------------------------------------------------- 1 | 2 | #rightPane { 3 | width: 170px; 4 | } 5 | /*File upload form styling */ 6 | .field { 7 | padding:4px 4px; 8 | } 9 | .file-upload { 10 | overflow: hidden; 11 | display: inline-block; 12 | position: relative; 13 | vertical-align: middle; 14 | text-align: center; 15 | border: 2px solid #666666; 16 | background: #444444; 17 | -moz-border-radius: 6px; 18 | -webkit-border-radius: 6px; 19 | border-radius: 6px; 20 | color: #fff; 21 | text-shadow: 0px 2px 3px #555; 22 | cursor:pointer; 23 | } 24 | 25 | .file-upload:hover { 26 | background-color: #454545; 27 | } 28 | 29 | 30 | .file-upload input { 31 | position: absolute; 32 | top: 0; 33 | left: 0; 34 | margin: 0; 35 | font-size: 70px; 36 | opacity: 0; 37 | filter: alpha(opacity=0); 38 | z-index:2; 39 | } 40 | 41 | .file-upload strong { 42 | font: normal 1.75em arial,sans-serif; 43 | } 44 | 45 | .file-upload span { 46 | position: absolute; 47 | top: 0; 48 | left: 0; 49 | display: inline-block; 50 | 51 | padding-top: .45em; 52 | } 53 | 54 | .file-upload { height: 3em; } 55 | .file-upload, 56 | .file-upload span { width: 10em; } 57 | 58 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Add Shapefile 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 21 | 24 | 195 | 196 | 197 | 198 |
199 |
200 |
201 |

202 | Add a zipped shapefile to the map.

Visit the 203 | About Shapefiles help topic for information and limitations.

204 |
205 |
206 | 210 |
211 |
212 | 213 |
 
214 |
215 |
216 |
217 |
218 | 219 | 220 | 221 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/add-shapefile-js/698aa361aedc8928d913994646c6951919af4b07/license.txt --------------------------------------------------------------------------------