Beginner Issues

1091
7
10-07-2013 07:42 PM
HelenRoulston_SelwynDC
New Contributor II
Hello,

I've just begun the tutorial on ArcGIS API for Javascript.  I want to know two things:

1. Must I have a basemap when I create a new Map object? It says the only required parameter in the constructor is the divid, and the rest is optional.  The thing is, nothing loads when I load my index.html file unless I specify a basemap.  I would thought without a basemap specified the widgets and everthing else would load. At the moment my JS is just inbetween some script tags, not stored in another JS file.

2. I have shapefiles stored locally in a folder.  Is it possible to reference these locally and add them to the map? I'm guessing not since JS doesn't have access to the file system if I'm correct? (sorry, I only know the basics of JS, my strength is mostly in python)

My overall goal is to have a offline local arcgis viewer on a tablet, which references shapefiles stored on the tablet since we cannot afford the licences of ArcPad.  Our users don't like using Arcmap on the tablets because of the small icons and cluttered interface, hence the reason I'm trying to build a minimal web app with the JS API.

Cheers
0 Kudos
7 Replies
SunilPalkar
Occasional Contributor
Welcome to ESRI JSAPI forum.

According to your question you are newbie to JSAPI for that first go through this book for ESRI JSAPI (its uses old API version but you will get idea regarding the JSAPI )

-You can create map without base map and with base map (it depends on your requirement/objective)
-You can not use shape file directly in JSAPI. You need to publish it on ArcGIS Server  then you can use in your application.
-You can use ready made viewer for JSAPI. ( Please check this link)
-Please go through the API help +Try some example & then customize it using your own way..

Hope this will help you...

thanks..

-Sunil Palkar



Hello,

I've just begun the tutorial on ArcGIS API for Javascript.  I want to know two things:

1. Must I have a basemap when I create a new Map object? It says the only required parameter in the constructor is the divid, and the rest is optional.  The thing is, nothing loads when I load my index.html file unless I specify a basemap.  I would thought without a basemap specified the widgets and everthing else would load. At the moment my JS is just inbetween some script tags, not stored in another JS file.

2. I have shapefiles stored locally in a folder.  Is it possible to reference these locally and add them to the map? I'm guessing not since JS doesn't have access to the file system if I'm correct? (sorry, I only know the basics of JS, my strength is mostly in python)

My overall goal is to have a offline local arcgis viewer on a tablet, which references shapefiles stored on the tablet since we cannot afford the licences of ArcPad.  Our users don't like using Arcmap on the tablets because of the small icons and cluttered interface, hence the reason I'm trying to build a minimal web app with the JS API.

Cheers
0 Kudos
TracySchloss
Frequent Contributor
You mention both 'offline' and 'local shape files', both of which are basically deal breakers for using the web based APIs.  Perhaps you would have more luck with something like ArcExplorer.
0 Kudos
KenBurcham
Occasional Contributor
Good morning!

1. Yes you can have a basemap-less map in the JSAPI (since 3.3, I think).  If you open the developer console on the browser, is it giving you an error?  Also, obviously, if you don't provide a basemap and aren't providing any layers then there won't be anything to see.  🙂

2. The Javascript API is geared for living in a connected browser consuming REST services from an ArcGIS Server and while someone has probably whipped up a REST server for local shapefiles, that probably isn't the best way to go.  Because the JSAPI is based on Dojo that supports disconnected Stores, another possible solution might be for your javascript application to connect to and locally store the data from your ArcGIS Server services. 

But probably a better way to have a disconnected tablet app is to use the Android or IOS sdk and build one that directly connects to your shapefiles.  You might explore some of the samples linked to from the appropriate tablet OS you'd be targeting: https://developers.arcgis.com/en/documentation/

Good luck!

ken.
0 Kudos
HelenRoulston_SelwynDC
New Contributor II
Thank you for all the replies.

I guess using the Web-APIs is not going to work.  These tablets have full blown windows on them but we can possibly switch to a cheap android tablet.

The question is, does the Official Android App from ESRI allow me to configure it to browse shape files locally? or do I have to write my own android app get this functionality?

It says here under the android SDK page:

ArcGIS Runtime SDK for Android allows you to add ArcGIS capabilities to your Android apps. It allows you to build applications that can connect to ArcGIS Online and ArcGIS Server. You can also add, to your maps, cached basemaps, which are stored locally on your device.

All I can find is that you can only add local cached basemaps. 

All data that I need users to be able to view is shape files.  They need to be dynamic layers so users can query the data which can't be done with cached basemaps.

The reason it needs to be purely offline, is because we have many places out in the field where it's not possible to be connected (except satellite, but that is way too slow for loading maps and expensive to implement)
0 Kudos
TracySchloss
Frequent Contributor
I don't know how many people who watch this forum also use the Android SDK.  I'd suggest you search for a forum that covers that instead of the Javascript API.
0 Kudos
HelenRoulston_SelwynDC
New Contributor II
You mention both 'offline' and 'local shape files', both of which are basically deal breakers for using the web based APIs.  Perhaps you would have more luck with something like ArcExplorer.


Awesome thank you for mentioning ArcExplorer, I've never used it before.

The UI uses the familiar ribbon in MS Office, the buttons are fairly large and it's a very clean interface and most of all: I can add local files.

I think I should be able to convince users to use this.
0 Kudos
HelenRoulston_SelwynDC
New Contributor II
Hmm, It seems I can't really use ArcGIS Explorer either.  It's lacking something real basic: A magnifying glass to zoom where you want.

You can use shift+drag with mouse and kb, but you can't use shift+drag with a stylus on a tablet.

Seems I'll be stuck with ArcMap for this.

ArcPad is probably the best product to use, but the licencing cost is prohibitive.
0 Kudos