arcpy in Visual Studio 2015

I wanted to switch from PyCharm to Visual Studio for my Python (more specific: arcpy) development, since we do a lot of developing in VS and I figured it would be nice to have a single development environment. I was pleasantly suprised that Python was available out-of-the-box after installing VS. But would it recognize my arcpy sitepackage (which was already present in my C:\Python27\ArcGISx6410.3 directory, since ArcGIS for Desktop is installed on my system).

Guess what? No, it didn’t.

But then I came across this blogpost. And it totally was applicable to my situation. So, if you think VS doesn’t understand arcpy, wait a few minutes after your first try… Thank you, Cindy Williams, for saving me a lot of frustration.

Look Ma, no squiggly lines!

Some more reading on arcpy in Visual Studio can be found here.

Tip: ArcGIS API for JavaScript Web Optimizer

If you’re building custom ArcGIS API for Javascript web applications, you might want to check out the Web Optimizer provided by Esri. It helps you by packaging your code and the required modules in one single, optimized package. The resulting code is quicker to download because it is smaller in size and it reduces the number of http requests, which is also beneficial for application loading times and performance.

There are some prerequisites:

  • All code must use AMD-style require and define to load and create modules. Code that uses global references to Esri and/or Dojo modules is not supported.
  • ArcGIS Online organization or ArcGIS for Developers account.
  • JS API version 3.4 or later.
  • Custom modules should define a package.json file that, at minimum, defines name and version properties.

More info here:

Access the Web Optimizer here:

ArcGIS javascript: graphicsUtils.graphicsExtent with one point feature

This applies to javascript developers using the ArcGIS Javascript API. If you’re using the graphicsUtils to get the extent of a set of graphics, you can use graphicsUtils.graphicsExtent. But if your set of features contains a single point, the extent returned is null. Which makes sense, but it took me a little while to figure this out. So check for the number of points (and whether they actually have a different location) before trusting this graphicsExtent function to operate correctly.

It’s a small thing, but hey, it might save you some time.