ArcGIS Javascript API #esrijs 4.x- 18 – Offline


what’s up y’all this is Hussein Nasser from
IGeometry and today we will discuss how can we as programmers how can we work
with our joy is JavaScript API in an offline environment I know some of you
are really interested in to that because you guys send me an email says hey cuz
they’ve been doing like 16 or 17 episode it’s walking hitting the aqueous gesture
dock you guys dock to comb the API server some of us don’t have like we
don’t have access to that or we want to work on like an internal environment or
network or a private network and we don’t want Jax is the ESRI server so how
can we do this offline so the answer is of course you can do that it’s it’s
simple it’s quite simple so bear with me here and I’m actually considering to
just to even our series JavaScript for a choice JavaScript API to move it to an
offline environment so those of you who had been using github to pull the latest
code you have to be careful to change some thing now previously you were just
getting away with just downloading I’ll run it that will work because we’re
heading the same server right now I’m gonna change the script to point to my
server so it’ll be this is just a caveat but yeah all right so how do we do this
how can I work offline it’s quite simple so the first thing you have to do is to
download the entire API set into your machine right to do that you’ll have to
go to this website I’m gonna put it into the description below I just disappeared
for a second there alright I’m back so you’ll have to download this API I’ll
put it in the description so you can just click that you have to sign in you
can just subscribe for free and fortunately I think 60 days or but it’s
it’s ok you don’t need to have like a full account to actually download these
things this is cool stuff yeah so just down
and go to the API download API you want I’m using I’m gonna use 4.5 currently
we’re using four four so again we’re gonna take two birds with one stone here
we’re gonna do offline and we’re gonna also move to the 4.5 okay disadvantages
for this well upgrade and obviously is a pain because you’ll have to download the
new version yourself you have to maintain it yourself and you’re right
you have to do it all everything yourself but if you’re heading the
public you just literally change which API you you’re pointing to and you’re
done right yeah well notice advantage and disadvantage
for alright but we’re going offline so let’s do this alright oh you’re gonna do
that download the API Oh that’ll be a zip
file actually went ahead and download that just to save a little bit of time
next step you most of you to work with Java and JavaScript API obviously you’ll
have to have a web server right in this episode I’m gonna you I’m using node.js
you can go back to the first episode and watch us how to actually I got actually
link in here how to actually sit up and no js’ server it’s a very simple thing
to do but for those of you using windows it is actually simpler because windows
comes with iis it’s just built-in stuff it’s fairly simple to configure so once
you enable oh yes you’ll go to see / : /i on it there’s a slash or backslash
that’s a slash right yeah that’s a /r @ / i on it Bob I’m not sure man
I’m Bob the village a village Road and then you will copy that zip file into
there right so my eyelet Bob directory or my root
web server directory is actually under this long folder right so
HTTP and then our choice GS 45 then I copy there and there is a file called IG
HTML here so I’m gonna go ahead and open the IG HTML so I can show you something
real quick here so my current code is pointing to the online servers as we can
see right or we’re using the the online servers so we want to do is we’re going
to change that but we still don’t have the API loaded right locally so what do
you do what should we do sir okay so once you download that you’re
gonna extract it and beauty of mat just double the click and it got extracted
so I got a I gotta say it took me a while to figure it out because you’re
really using – I’m using I’m used to Windows right where you right click and
do stuff everything has to do like we have to do multiple clicks to get it all
right once you extract that there are some folders you have to read here legal
stuff there are joist jsapi there is a folder called library and
this is what we were actually interested in 4.5 right so let’s go ahead and copy
that 4.5 and then put that in our routes instead because oh that is actually
jargon well we don’t care about it right there’s a lot of subfolders and gonna
make our life harder so let’s go ahead and do that ok 4.5 now if I go to my
machine I’d say HTTP Husain Mac 8080 ah and I say 4.5 and then there is actually
a folder here or a GS 4 code any digest right let’s make sure what should it
works right I can load that file that’s the first step you have to do make sure
your your point to the in it is actually working nice we got ourselves walking
correctly beautiful what do we do next we
fix the the URLs what does that mean right because if you download that there
are two places then you need to change in the configuration to make it point to
your local server right because everything is just pointing to the
public stuff now so the first thing is actually in it digest right just double
click that with your favorite edit or I’m gonna disappear in a minute oh and
then find hostname and path do JA a zap ha ha and then like that we’re gonna
find the HTTP right and and there is a reason I’m replacing the whole thing up
to here right copy band diced and then replace I think that’s how you do it so
find HTTP colon slash slash I host name the whole thing and then what is your
new path to the energies what was it it was HTTP in my case I do not have a
secure server sir so I’m gonna use HTTP so so the
documentation clearly say just replace that right if you just read the public
documents there that because they are assuming you have an HTTP server if you
do that’ll be great do you don’t you just replace it with
the same s right if you don’t like in my case I just have HTTP and will should
work just fine right HTTP you did it into there and then you do the same Act
that’s my machine and that’s my port and then it slash very important four point
five that’s the path to the library and there is a very important test last year
because if you’re gonna replace it that will lead to the full path to the dojo
folder right go ahead and do I’m feeling lucky here so I’m gonna do replace all
right so that’s the path look at that look at that done right save what’s the
next folder to change there is them one more thing we need to do too
more things we need to do I’m sorry go to dojo go to dojo Doge is the book like
that again die and then find the same puppy replace find replace and then
replace it with HTTP HTTP Hussain Mac again maybe you do not have this 8080
maybe you just running on port early good for you right you just do that
right so whatever is your path you put the actual path here and then you do 4.5
and then don’t forget a slash and then then save close all right you just
configured you just configured the library sir you’ve done justice go home
that’s it you’re done all right now your actual code need to point to
this light but it’ll really wee-wee sir let’s do that okay so how do we point a
little to the library HTTP digest rock GRS calm so this is bye bye right I’m
not gonna point to their public stuff so I’m gonna point to mine which is for
saying Mac I till I die and then for five but there’s a caveat here we’ll
have to add we’ll check I’m not sure but we’ll have to add amid the GS manually
right in adage ass okay so that’s the smallest damages we have to point to the
Anita tute jas file right and here we’ll replace that puppy with HTTP or same Mac
eighty eighty four point five flashes right so let’s make sure can we actually
open that main dot CSS does that open sir yes it does open okay so this guy
has it stuff this guy has this stuff I think our application will just run
fine what do you think guys what do you think so how do we are on
our application very simple that’s our application right below man
what are you doing sir okay we’re saying how can I tell that
you’re not lying that actually you’re heading the public distance as well well
first of all you can’t all right look at that look at that
what where’s my stuff okay Oh dramas done clothes done okay
all right that’s I always do this you know always click I was a click lift and
right now this is done this is done for it this is JEP yep
it’s done it’s done it’s done yeah let’s do it again
oh saying mark ITA all right so what do we do we said do more tools developer
tools and there we do consul sources what’s my cut dude
there you go there you go it’s pointing to man do you believe me now do you
believe me all right believe I can’t believe that cruel what
are you doing chrome all right that’s the last time I’m not gonna do it
are there any more I think chrome needs to be updated or something yeah so if
you tried going offline now your replica yeah well technically our application
won’t work offline at all because we’re still hitting something else right yeah
although this is offline but we’re still using the public service that other
public service this stuff is solid I never saw this going down at all so
we’re fine we’re fine but yeah yeah what do you think guys tell me what do you
think do you prefer our work
online or offline so told me in the comments below and let’s see if I was
like I should actually work oh man look at that dates and stuff
Oh beauty beauty and the paste beautiful all right guys
alright looks like we have ourselves actually faster yeah because we don’t
have to look at that obviously the base map is online right so he’s tolling it
entering for that but well if you don’t want to use a base maybe you don’t have
to so your stuff should work but we’ll continue that but that’s how you go
offline guys that’s how you go offline with the API stuff alright if you like
this video give it a like and I’m gonna see you in the next one don’t forget to
subscribe see you bye bye

5 Comments

Add a Comment

Your email address will not be published. Required fields are marked *