ArcGIS API for JavaScript Part 1: Our First Web Map
Skills:
Tool Use & Function Calling70%
Key Takeaways
This video tutorial covers creating a basic web map using the ArcGIS API for JavaScript, including setting up a development environment, referencing the API, and creating a map container.
Full Transcript
hey what's going on everybody this is going to be part one in a series of working with the arjs API for JavaScript in this tutorial we're going to create our first web map it's going to be very basic but we're going to hook up their API with our HTML files we're going to set up an external Javascript file an external CSS file um so with that let's go ahead and get started uh I'm already over here at the developers. arcgis.com uh website it is a a website where if you're going to be working with this API a lot then you should definitely bookmark it it has tutorials uh the API references some samples a lot of good stuff so let's go ahead and go over to tutorials and we will click on the link here that says build your first web application okay so uh they say right here before you begin uh that you need to set up a development environment so you need to set up a a web server and have a text editor or an IDE uh to write your code in I'm not going to walk through how to set up a web server uh if you need to do that then you can click on this link here and they have a lot of good recommendations uh as far as the text editor goes uh I'm in I'm doing the coding over here in Sublime Text uh I highly recommend it it's very popular it has a ton of features um and I have a video on uh setting up development environment deir environment in Sublime Text if you would like to take a look at that I'll put the link in the description uh so let's go ahead and get started with our map here okay so right now if I go over to my tab here on Local Host I have a very basic website running that says this is a demo page and this is the HTML for that web page so you can see here uh this is a demo so pretty much starting from scratch and we're g to use their walkthrough here to get our web map up and running so the first thing is they say to take this HTML and we'll go ahead and paste that in ours that save it okay and now we need to uh reference their API and to reference their API we just take this code here and we paste this into the head of our HTML file and what we just pasted in there was this is a link to their stylesheet and so that will style their map and their map container and things like that and this is their actual Javascript file that's going to give us access to uh to their whole API um so if we keep scrolling down here they also have some other styles that you can add in but we're going to skip that right now so loading modules here um so on you'll see this a lot on their samples uh that they just put these script tags directly into the HTML and that's fine with the samples because they're all small documents but if you're going to be making uh if you're going to be making large applications then it gets too hard to manage all of your HTML and all of your JavaScript in one file so instead of doing what they do here and putting a script tag let's go ahead and make a body of our HTML and put that script tag in there so in instead of putting the script tag in here like they do we are going to take that out and we are going to link to our uh external Javascript file right here and it's in the same folder as our HTML file so all we need to do is Source equals script.js and now in script.js which I have open in this tab right here now we can add in any of the JavaScript code that that uh that they provide for us um so we're actually let's not add this in right now because they give a more complete version down here at the bottom okay let's take this one here and the code that we just added in uh requires the modules that we're going to need for our application so uh this is the path to the module the ezri map and this Dojo Dom ready uh pretty much just make sure that the website is ready to go before we load up our code so that we're not referencing anything that doesn't exist yet um and then this map here that we pass into the function that's just an alias for this ezri map here so we can actually call this whatever we want but you know uh just keep it something that you're going to know what it is so map I think is fine so let's go ahead and move down here to step five create the map so let's take this Global variable from map and paste that in there and then they give some code for the actual map itself copy and we'll paste that right in here where they put their comment and clean up that indentation okay let's scroll down and the last thing that we need to do before this will show up on our web page is to drop this div into our HTML with the ID of mapd and in our JavaScript you can see here um this doesn't have to be named map div in your HTML it's that's just the name that we assigned to it in our JavaScript so we can change that to whatever we want I'm going to STI go ahead and stick with mapd so go back over to our HTML file here and then within our body above the script tag uh put that div ID with the ID of map div and go ahead and save that and let's reload up our web page and see if we see anything okay so we have our our first map working now so um but you can see that it doesn't take up the entire web page uh that's because we haven't added any style or anything to it yet it's just uh extremely basic so let's go ahead and go back to their tutorial and you can see the uh bottom link here is uh style the page and just like I said before with their JavaScript they will also usually drop in uh these end line Styles into the HTML file but just like with the JavaScript we want to uh make that CSS file and external file so that we can manage all that stuff separate from the HTML we don't want to mix and match our HTML and JavaScript and CSS we want all those to be separate so that it's easy to maintain so instead of we don't need this style tag here all we need to do is in the head of our document at the very bottom underneath uh their screen script and stylesheet we can put in our own stylesheet so link with a rail stylesheet and the href is just the styles.css file and save that okay so now we can copy their Styles here without the style tags and paste that directly into our styles.css file and save that and as you can see all that does is gives zero padding zero margin and uh height 100% to our HTML body and the map div and okay now that's uh now we have a full screen map in our web browser and you know zoom in and if we go back you can already start messing with this if you want if we go back to our Javascript file you know this uh uh new map right here had a few options that it already added in so uh for base maps you can change this they have a few different base maps you can use uh but if we change that to Gray and then reload our map over here now we have the gray base map uh you can change the starting Zoom point to five you can change your center location to uh you know a different latitude and longitude and just kind of experiment with it and and see what it does so that's where we're going to end it for part one in the next video we will add some more styles to this map We'll add in a top menu bar here with some buttons so that we can add in some functionality uh put in some more modules so that we can do some more cool stuff with the map so uh definitely check that out and hopefully this was useful for you guys and thanks for watching
Original Description
In this walkthrough, we will create a very basic web-map using the ArcGIS API for Javascript.
For help setting up a development environment in sublime text, you can watch my tutorial video here: http://youtu.be/uOMk8MlE_v4
✅ Support My Channel Through Patreon:
https://www.patreon.com/coreyms
✅ Become a Channel Member:
https://www.youtube.com/channel/UCCezIgC97PvUuR4_gbFUs5g/join
✅ One-Time Contribution Through PayPal:
https://goo.gl/649HFY
✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot
✅ Corey's Public Amazon Wishlist
http://a.co/inIyro1
✅ Equipment I Use and Books I Recommend:
https://www.amazon.com/shop/coreyschafer
▶️ You Can Find Me On:
My Website - http://coreyms.com/
My Second Channel - https://www.youtube.com/c/coreymschafer
Facebook - https://www.facebook.com/CoreyMSchafer
Twitter - https://twitter.com/CoreyMSchafer
Instagram - https://www.instagram.com/coreymschafer/
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Corey Schafer · Corey Schafer · 4 of 60
1
2
3
▶
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Web fonts using CSS Font Face
Corey Schafer
Using Font Awesome in Desktop Applications (OS X)
Corey Schafer
Sublime Text 2: Setup, Package Control, and Settings
Corey Schafer
ArcGIS API for JavaScript Part 1: Our First Web Map
Corey Schafer
Mac Tip: Windows' Snapping Feature on Mac with HyperDock
Corey Schafer
Linux/Mac Terminal Tutorial: Creating Aliases for Commands
Corey Schafer
ArcGIS API for JavaScript Part 2: Starting Templates
Corey Schafer
Paver Patio Time Lapse
Corey Schafer
Mac Tip: Ways to perform Screen Capturing and Screenshots
Corey Schafer
WordPress Plugins: Imsanity
Corey Schafer
WordPress Tips: Test your theme with Theme Unit Test and Monster Widget
Corey Schafer
Sublime Text 3: Setup, Package Control, and Settings
Corey Schafer
Understanding Binary, Hexadecimal, Decimal (Base-10), and more
Corey Schafer
Mac Tip: Adding Folder Stacks to the Dock
Corey Schafer
CSS Tips and Tricks: Add External URLs to Print Stylesheets
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 7 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 1 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 5 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 4 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 3 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 2 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 6 of 7)
Corey Schafer
Python Tutorial: if __name__ == '__main__'
Corey Schafer
Sublime Text Quick Tip: "Go To Definition" Click Shortcut
Corey Schafer
How to quickly create favicons for the desktop, Apple/Android devices, tablets, and more
Corey Schafer
Easily Resize Multiple Images Using Picasa
Corey Schafer
Easily Resize Multiple Images Using the Mac Terminal
Corey Schafer
Python Tutorial: virtualenv and why you should use virtual environments
Corey Schafer
Python Tutorial: pip - An in-depth look at the package management system
Corey Schafer
Git Tutorial: Using the Stash Command
Corey Schafer
How Software Engineers, Developers, and Designers can volunteer their skills
Corey Schafer
Git Tutorial: Diff and Merge Tools
Corey Schafer
Git Tutorial: Change DiffMerge Font-Size on Mac OSX
Corey Schafer
Sublime Text Quick Tip: Launch Sublime Text from the Terminal
Corey Schafer
Python Tutorial: str() vs repr()
Corey Schafer
Programming Terms: DRY (Don't Repeat Yourself)
Corey Schafer
Programming Terms: String Interpolation
Corey Schafer
Programming Terms: Idempotence
Corey Schafer
Python Tutorial: Namedtuple - When and why should you use namedtuples?
Corey Schafer
Programming Terms: Mutable vs Immutable
Corey Schafer
Python Tutorial: Else Clauses on Loops
Corey Schafer
Overview of Online Learning Resources
Corey Schafer
Mac OS X Terminal Tutorial: Time-Saving Keyboard Shortcuts
Corey Schafer
Git Tutorial for Beginners: Command-Line Fundamentals
Corey Schafer
Quickest and Easiest Way to Run a Local Web-Server
Corey Schafer
Python Tutorial: Generators - How to use them and the benefits you receive
Corey Schafer
Python Tutorial: Comprehensions - How they work and why you should be using them
Corey Schafer
Chrome Quick Tip: Quickly Bookmark Open Tabs for Later Viewing
Corey Schafer
Programming Terms: Combinations and Permutations
Corey Schafer
Git Tutorial: Difference between "add -A", "add -u", "add .", and "add *"
Corey Schafer
Preparing for a Python Interview: 10 Things You Should Know
Corey Schafer
SQL Tutorial for Beginners 1: Installing PostgreSQL and Creating Your First Database
Corey Schafer
SQL Tutorial for Beginners 2: Creating Your First Table
Corey Schafer
SQL Tutorial for Beginners 3: INSERT - Adding Records to Your Database
Corey Schafer
Linux/Mac Terminal Tutorial: Navigating your Filesystem
Corey Schafer
Python: Ex Machina Easter Egg - Hidden Message within the Code
Corey Schafer
Mac Tip: New Split Screen Feature in El Capitan
Corey Schafer
Setting up a Python Development Environment in Eclipse
Corey Schafer
Git Tutorial: Fixing Common Mistakes and Undoing Bad Commits
Corey Schafer
SQL Tutorial for Beginners 4: SELECT - Retrieving Records from Your Database
Corey Schafer
More on: Tool Use & Function Calling
View skill →Related AI Lessons
⚡
⚡
⚡
⚡
I Built a Free AI-Powered YouTube SEO Toolkit With Zero Budget. Here’s What Actually Happened.
Medium · Startup
How to Create a Second Version of Yourself Inside Obsidian Using AI (Step-by-Step Guide)
Medium · ChatGPT
How to prepare for Spain civil service TIC exam using AI in 2026
Dev.to · David García
Going Viral! How I Created AI Kissing Videos Step by Step Easily Using AIAI.com
Medium · AI
🎓
Tutor Explanation
DeepCamp AI