More

How to preserve the order of fields when exporting a table from ArcMap?

How to preserve the order of fields when exporting a table from ArcMap?


ArcMap allows you to re-order fields in an attribute table, by dragging+dropping either within the layer's > Properties > Fields tab, or within the Table window.

However, the order of the fields doesn't seem to be honoured when exporting this table to a new table.

Is it possible to preserve the order of fields when exporting an attribute table?


I do not believe there is a tool or function that allows you to export a table with reordered fields. If anyone knows better please enlighten me! I've always felt it has been a bit of a limitation that the geo-processing tools do not honour the reordered fields. Especially the conversion tools .

In the past I had attempted to create a tool that did it. The following Python code can be used to re-order fields in a table by creating a new table with the fields re-ordered. In this example output (the new table) is sent to an IN_MEMORY workspace.

inputTable = "ABC" # This is a table loaded into ArcMap outputTable = "XYZ" # Get field mappings of Input Table fieldMappings = arcpy.FieldMappings() fieldMappings.addTable(inputTable) # Create an empty FieldMappings Object newFieldMappings = arcpy.FieldMappings() # Add fields in desired order. Note field index must be known newFieldMappings.addFieldMap(fieldMappings.getFieldMap(3)) newFieldMappings.addFieldMap(fieldMappings.getFieldMap(0)) newFieldMappings.addFieldMap(fieldMappings.getFieldMap(2)) newFieldMappings.addFieldMap(fieldMappings.getFieldMap(1)) # Create Table arcpy.TableToTable_conversion(inputTable, "IN_MEMORY", outputTable, None, newFieldMappings)

Dan Patterson recently created an interesting blog page on geonet showing how numpy can be used to do clever things with a FeatureClass. This could be another way one could alter the field order.

But ideally ESRI should make their tools aware of field order…


How to preserve line breaks when exporting MySQL data to a CSV file?

I need to export some data from mysql to a csv file. But one of the columns have line breaks and I need to export the data to a csv file saving break lines.

At this moment I am using the following sql query:

But that sql query doesn't save break lines in the csv file. I am not an expert with MySQL, if someone could help me I'd be grateful


Joining the attributes from a table

Typically, you'll join a table of data to a layer based on the value of a field that can be found in both tables. The name of the field does not have to be the same, but the data type has to be the same you join numbers to numbers, strings to strings, and so on. You can perform a join with either the Join Data dialog box, accessed by right-clicking a layer in ArcMap, or the Add Join tool.

Suppose you have obtained data that describes the percentage change in population by county and you want to generate some population growth maps based on this information. As long as the population data is stored in a table in your database and shares a common field with your layer, you can join it to your geographic features and use any of the additional fields to symbolize, label, query, or analyze the layer's features.

One-to-one and many-to-one relationships

When you join tables in ArcMap, you establish a one-to-one or many-to-one relationship between the layer's attribute table and the table containing the information you want to join. The example below illustrates a one-to-one relationship between each county and that county's population change data. In other words, there's one population change for each county.

Here's an example of a many-to-one relationship. Suppose you have a layer where each polygon is classified according to its land-use type. The layer's attribute table only stores a land-use code a separate table stores the full description of each land-use type. Joining these two tables establishes a many-to-one relationship because many records in the layer's attribute table join to the same record in the table of land-use descriptions. You might then use the more descriptive text when generating the legend for your map.

One-to-many and many-to-many relationships

When using data where a one-to-many or many-to-many relationship exists, you should use a relate or relationship class to establish the relationship between the datasets. However, it is possible to create a join under these circumstances. When you create a join in such a case, there are differences between how tools and other layer-specific settings work depending on the data source. If you are using geodatabase data to create the join, all matching records are returned. If you are using nondatabase data, like shapefiles or dBASE tables, to create the join, only the first matching record is returned.

This means that if you have created a 1:M or M:M join with geodatabase data and you generate a report, you see multiple records in the report, one for each corresponding match. The multiple matches are also seen when using a join field while symbolizing a joined layer, labeling, identifying features, generating a graph, and using either the Find or Hyperlink tool. If you are using the joined layer as input to a geoprocessing tool or in an export operation, the multiple matching records are used.

Caution:

In all cases of 1:M joins, only the first matching record is joined and displayed in the layer's attribute table.


Parameters

The input dataset whose records will be reordered based on the field values in the sort field or fields.

The output feature class or table.

Specifies the field or fields whose values will be used to reorder the input records and the direction the records will be sorted.

License:

Sorting by the Shape field or by multiple fields is only available with an Desktop Advanced license. Sorting by any single attribute field (excluding Shape ) is available at all license levels.

  • Ascending—Records are sorted from low value to high value.
  • Descending—Records are sorted from high value to low value.

Specifies how features are spatially sorted. The sort method is only enabled when the Shape field is selected as one of the sort fields.

  • Upper right — Sorting starts at the upper right corner. This is the default.
  • Upper left — Sorting starts at the upper left corner.
  • Lower right — Sorting starts at the lower right corner.
  • Lower left — Sorting starts at the lower left corner.
  • Peano curve — Sorting uses a space filling curve algorithm, also known as a Peano curve.

The input dataset whose records will be reordered based on the field values in the sort field or fields.

The output feature class or table.

Specifies the field or fields whose values will be used to reorder the input records and the direction the records will be sorted.

License:

Sorting by the Shape field or by multiple fields is only available with an Desktop Advanced license. Sorting by any single attribute field (excluding Shape ) is available at all license levels.

  • Ascending—Records are sorted from low value to high value.
  • Descending—Records are sorted from high value to low value.

Specifies how features are spatially sorted. The sort method is only enabled when the Shape field is selected as one of the sort fields.

  • UR — Sorting starts at the upper right corner. This is the default.
  • UL — Sorting starts at the upper left corner.
  • LR — Sorting starts at the lower right corner.
  • LL — Sorting starts at the lower left corner.
  • PEANO — Sorting uses a space filling curve algorithm, also known as a Peano curve.

Code sample

The following Python window script demonstrates how to use Sort to order features by the values of a field.

The following Python script demonstrates how to use Sort in a stand-alone script.


Required elements for Data Driven Pages

Four elements are required for the creation of Data Driven Pages. They are

Detail Data Frame

To create a series of Data Driven Pages, select a data frame from the Data Frame drop-down menu. The default Data Frame for Data Driven Pages is the active data frame. Only a single data frame can be selected as the main data frame. The map extent of the main data frame changes for each page in the Data Driven Pages series. These map extents are driven by the spatial extent of features within the index layer.

This drop-down menu displays a list of data frames in the current map document. The map document may contain a single data frame or a number of data frames. Only one data frame can be selected for Data Driven Pages. This is the Detail Data Frame. You can choose any data frame in your map as the Detail Data Frame (as long as there is at least one layer in it).

Index Layer

To create a series of Data Driven Pages, select the index layer from the Layer drop-down list. The default index layer is the topmost polygon layer of the active data frame. The index layer defines the geographic extent of the main data frame for each page in the Data Driven Pages series. Each feature in the index layer drives, or defines, each page in the Data Driven Pages series. The geographic extent of the feature helps define the map extent of the Detail Data Frame for the page (this extent can be further customized on the Extent tab). Attributes of the index layer provide values for other Data Driven Pages parameters.

This drop-down menu displays a list of layers from Detail Data Frame. You can choose any feature layer from the Detail Data Frame for the index layer, as long as there is at least one feature in the layer. You are not confined to using only polygon layers as the index layer. You can also use points and lines, as long as you use a feature layer. Nonfeature layers, such as raster layers, cannot be used for the index layer. There are two geoprocessing tools available from the Data Driven Pages toolset in the Cartography toolbox to help you create an index layer: Grid Index Features and Strip Map Index Features .

When using point features, if you want to use only one map scale for each page, choose the Center and Maintain Current Scale option. Then, after exiting the Setup Data Driven Pages dialog box, set the scale of the Detail Data Frame to the scale you want. If you want different scales for different point features, you need to use a field containing these values and select Data Driven Scale on the Extent tab and choose this field. You cannot use a layer from another data frame, another map document, or a stand-alone layer file (.lyr) as an index layer. The index layer must be a feature layer. You cannot use raster-based layers as the index layer.

You should see a message box when creating Data Driven Pages and the index layer has more than 2,000 features. You can still create the pages, but be aware that performance may be adversely affected when dealing with such a large number of pages.

You may want to label adjacent grids on your layout. In a map book, this would be the same as labeling adjacent, or neighboring, pages. Using dynamic text, you can navigate through the pages of your map book and have the labels identifying neighboring pages update automatically. You can use the geoprocessing Calculate Adjacent Fields tool to create the data you can use to label adjacent pages.

Name Field

Each page in the map series needs a name, and the names are taken from this field. As Data Driven Pages iterates through the features in the index layer and each page is defined, the attribute value for the chosen name field is used as the page name.

The page name can be displayed on the Data Driven Pages toolbar. This can also drive a dynamic text element in the layout. You can add dynamic text for the page name using the Page Text menu item on the Data Driven Pages toolbar. Use the Page Name option. Or, you can apply the formatting tag <dyn type="page" property="page name"/> to an existing text element.

Select the Name Field from the list in the Name Field drop-down menu. The default is the first field using the string "name" in the field name. If there is no field using "name" in the field name, Data Driven Pages will then use the first available valid field. You do not have to use the default. You can choose to use a different field by selecting it from the drop-down menu.

This drop-down menu displays a list of applicable fields from the index layer. This list includes fields from a table joined to the index layer. These include short integer, long integer, and string.

To avoid confusion when working with Data Driven Pages, you should choose a Name field in which all values are unique. However, this is not required, and Data Driven Pages will accept null and duplicate values for Page names.

Sort Field

Pages in the map series need to be sorted. There needs to be a first page, a last page, and all the pages in between. The sort field provides the sorting logic and index for the pages. The first page of the series, or page 1, is determined based on the values of this field and whether the sort is in ascending order or not. The index always starts with 1 and ends with the number of pages created. This index changes when you change the sort field or refresh the pages after editing the sort field values.

Since sort order is required for Data Driven Pages to work, a default field is chosen each time a new index layer is selected. The default is the first field using the string "PageNumber" in the field name. In many cases, you may want to apply your own page number values. Often, these values also match the order in which you want to sort your pages. Again, these values may or may not match the page index number. If there is no field using "PageNumber" in the field name, Data Driven Pages will then use FID or ObjectID.

You do not have to use the default. You can choose to use a different field by selecting from the drop-down menu. The drop-down menu displays a list of applicable fields from the index layer. This list includes fields from a table joined to the index layer. These include short integer, long integer, float, double, date, and string.

The page index can be displayed on the Data Driven Pages toolbar. For example, you might see "14 of 20". This means you are looking at the 14th page of 20 pages. This can also drive a dynamic text element in the layout. You can add dynamic text for the page index using the Page Text drop-down menu on the Data Driven Pages toolbar. Use the Page with Count option. Or, you can apply the formatting tag Page <dyn typePage Text="page" property="page index"/> or <dyn type="page" property="page count"/> to an existing text element.

Page index is also reflected in the export dialog box. When you export Data Driven Pages using a page range, you are exporting pages based on their location in the index. The page index may or may not be the same number as the page number. The page index is internally generated, always begins with 1, and ends with the total number of pages. Page numbers can be alphanumeric, begin after 1, and end with a number greater than the total number of pages (this might be done to account for inserted pages in the final product).

Data Driven Pages will accept null and duplicate values in the Sort field, but you should try to avoid this whenever possible.


How Join Features works

Equations

Standard deviation is calculated using the following equation:

Calculations

Statistics are calculated for only those features that meet the specified spatial or attribute relationship used in the Join one to one operation. You can only calculate statistics for numeric fields. When you add statistics, a Join Count field is added that lists the number of matching records summarized for each target feature. Using the table above, numeric statistics were calculated on the Occupants field and string statistics were calculated on the Building_Name field for the values of Apartments for the Type field.


Join data by location (spatially)

When the layers on your map don't share a common attribute field, you can join them using the Spatial Join geoprocessing tool, which joins the attributes of two layers based on the location of the features in the layers.

With a spatial join, you can complete any of the following common workflows:

Join by location, or spatial join, uses spatial associations between the layers involved to append fields from one layer to another. Depending on the type of association, you can append the attributes or an aggregate (minimum, maximum, mean, and so on) of numeric attributes, from a matched feature to the target features.

Spatial joins by default are different from attribute-driven joins, relates, and relationship classes, in that they are not dynamic and require you to save the results to a new output layer. If you use the Spatial Join tool in a script or model, you can improve performance using an in-memory workspace, instead of creating output. For example, to write to an in-memory workspace, the output path of the tool includes the workspace and the name of the output, such as in_memory/outputFeature.


How to preserve the order of fields when exporting a table from ArcMap? - Geographic Information Systems

All GIS software should contain routines for exporting data. For some GIS software, such as ArcInfo, which has a strong position as a data development application, data export routines have been an early and important component.

Other software products designed originally for query and display, such as ArcView 3.x, generally have limited export capabilities. These products have historically been more interested in getting data in than getting data out.

ArcGIS has numerous options for exporting data.

Converting feature layers to shapefiles

Feature layers can be "exported" to shapefiles. This means that an ArcInfo coverage, CAD drawing, an event layer, or even another shapefile, can be converted to a shapefile. In fact, any supported vector dataset (i.e., anything that appears in a view as points, lines, or polygons) can be converted to the shapefile format. Supported datasets are described in Getting Data into ArcGIS .

Converting other data sources to shapefiles can be handy when you need to create a feature data source to be moved across a file system or from one machine to another. If you have a shapefile, you can copy the component files across file systems or computers.

Contrast this to the ArcInfo data structure, in which a single feature layer source consists of data files spread across more than one directory, and it is impossible to manage the coverage with just the operating system.

When a new shapefile is created from an existing layer, ArcGIS will ask if you want to add this new shapefile as a layer to the current data frame. If you do not add the layer to the data frame, the shapefile will still exist on the disk, and can be used later.

Here, the original stands layer is an ArcInfo coverage dataset.

Here it will be converted to a shape file.

Note that a vector layer can be exported to one of three different data types (File and Personal Geodatabase feature class, Shapefile, or Spatial Database Engine feature class):

You can see that there are now two layers representing stands one is from a coverage data source, and the other is from a shapefile data source.

Converting selected features of a layer to a shapefile

Sometimes, you may wish to display only a subset of features of a given layer. One way to accomplish this is to apply a filter to the layer, so that only select features display. Another method is to create a new dataset based on a selection of features. When a set of (one or more) features is selected, and the layer is converted to a shapefile, only the selected set is written to the new shapefile.

Here, only the > 100 year old stands from the stands.shp shapefile are converted to a shapefile of their own:

The selected stands are highlighted in cyan.

This selected set is converted to a shapefile:

Note: if you want to create a shapefile consisting of all the features of a layer, make sure you have no active selection on the layer. Otherwise your new layer will consist of only selected features!

Converting feature layers to a geodatabase

It is possible to convert feature layers and selections of feature layers to geodatabase feature classes. In order to do this, you need to have an existing geodatabase. The only difference between exporting to shapefile and geodatabase feature class is that you select the geodatabase to export to, and give a name to the output feature class. In the following image, the personal geodatabase is proj_mgmt.mdb and the feature class is called stands. Creating geodatabases will be covered in the lesson on creating feature layers.

Converting feature layers to rasters

We will cover raster data and analysis later in the term, but it is possible, under certain constraints, to convert between feature layers and rasters. This is typically done only when you need to analyze point, line, and polygon data with other raster data, or if you have categorical raster data that can be converted to polygons for vector analysis.

Converting image layers to grids

Supported raster datasets, including images, can be converted to grid datasets. The output grids will have cell values identical to the pixel values in the input image. Multi-band images can be converted to grids, one output grid per input image band. While both image and grid data sources are rasters, grids are a special type of raster that can have attribute tables with several fields (whereas simple images only have a single value per pixel)

We will cover exporting grids later in the course. See the exercise on Remote Sensing for an example of converting a 7-band LandSat TM image to a series of 7 grids. Converting single-band images is performed in the same manner, except that only a single output grid is created.

Exporting grid layers to generic raster format

A selected grid layer can be converted to a generic raster file by using the File > Export Data Source menu choice. This allows a grid layer to be converted to a generic raster format.

The two supported output raster formats are ASCII and binary (IEEE format).

The generic ASCII raster file is a single file composed of 6 lines of header (descriptive and georeferencing) data, followed by lattice mesh point (grid cell) values.

The generic binary raster file format export routine creates two files, an ASCII header file and a binary file containing the actual grid data. When archiving or distributing binary generic raster files, make sure to include both the header file and the binary file.

Both of these export options create stand-alone files that can be moved across file systems or platforms. The files can be imported at any time, which recreates an ArcInfo format grid. Other GIS or image processing software can read these type of nonproprietary raster file formats.

Exporting feature layers to ArcInfo generate format

The ArcInfo generate format is an ASCII file that can be used to create an ArcInfo (vector) coverage. Because the structure of a generate file is simple, generate files are also used in many other applications that cannot handle proprietary GIS data formats.

A sample script exists in ArcGIS that will allow you to create generate files from shapefiles.

Generate files are formatted like these simple examples:

point generate file format

sample file

meaning (of each line)

id (of point), x, y
id, x, y
id, x, y
id, x, y
id, x, y
other points
end (of file)

line generate file format

sample file

meaning (of each line)

101
2,3
4,3
4,6
END
101
2,3
4,3
4,6
END
102
2,1
3,2
END
.
END
id (of line)
x, y (vertex)
x, y
x, y
end (of line)
id (of line)
x, y
x, y
x, y
end (of line)
id (of line)
x, y
x, y
end (of line)
other lines
end (of file)

polygon generate file format

sample

meaning (of each line)

701,7,7.5
3,9
4,5
8,4
9,7
6,9
3,9
END
702,20,31
19,19
18,36
31,35
27,15
END
.
END
id (of poly), x, y (of label point)
x, y (vertex)
x, y (vertex)
x, y (vertex)
x, y (vertex)
x, y (vertex)
x, y (vertex)
end (of polygon)
id (of poly), x, y (of label point)
x, y (vertex)
x, y (vertex)
x, y (vertex)
x, y (vertex)
end (of polygon)
other polygons
end (of file)

Generate files can be used to recreate ArcInfo coverages, and if used in conjunction with exported tables, can also recreate the attribute data for coverages. You will most likely never need to use generate files, but it is a very simple file format if you need to brute-force a solution to import coordinates to another application.

Tables are easily exported to any of the source formats (personal geodatabase table, dBASE, delimited text, INFO, and SDE table). Like the creation of any other file, the file type, name, and location on the file system needs to be provided during the export process. Exporting tables is performed by using the Options > Export control while a table is open and active.

If there are any active selections on tables, only selected records will be exported. If you want to export all records from the table, make sure to clear any active selections.

A word of caution: the dBASE files that ArcGIS uses to store data have a 10-character limit on field names. If you have a source table containing fields with names longer than 10 characters, ArcGIS exported tables will output only the first 10 characters of the field names.

If you export to delimited text, complete field names will be exported, even if the field names are longer than 10 characters.

"Exporting" data frames and layouts

Layouts and data frames can be saved as graphics files by selecting File > Export Map from the menu. Details of this are covered in the cartography lab exercise.

There are a number of different output image formats. The files that are created from exporting data frames and layouts can be used in any application that supports these types of files.

Exporting 3D scenes as VRML

ArcScene or ArcGlobe views, which will be covered in 3-D Analysis and Surface Modeling, can be exported as VRML (Virtual Reality Markup Language) files, which can be loaded into Netscape or other applications that support VRML. The VRML file will look exactly like the 3D scene, including all features and symbols, offsets, and extrusions. A free VRML plug-in for Netscape and Microsoft Internet Explorer is available at Cosmo Software. Several other VRML viewers are available, such as GLView.

The VRML scene's symbology cannot be altered in the web browser, but users do not need ArcGIS or other specialized software in order to view and navigate the surface model.

VRML files can take a long time to generate, and the files can be very large. TINs are generally far more compact than grids when exporting to VRML. Here is an image of a 3D scene within ArcGIS.

And the same scene exported as a VRML file displayed within a web browser:

You can create ArcScene or ArcGlobe documents and then publish them to web pages a number of free VRML viewers exist.


Make a Map Tour Story Map

If you’ve seen an Esri story map that presents a tour with a map and associated images, such as this Palm Springs Map Tour, and wondered how to make your own, then this tip is for you! All you will need is an ArcGIS Online account, access to a web server, a simple graphics program, Microsoft Excel or a text editor, and (optionally) ArcGIS for Desktop.

The Storytelling Map Tour template is one of the free templates Esri provides for creating story maps. This tip shows you how to create a map tour story map by downloading the template Esri provides, creating a web map using ArcGIS Online for your tour, and then configuring the template to display your web map. It’s easier than you think!


The map tour template lets people explore an area by stepping through a sequence of large photos with captions. Pictured here is the Palm Springs Map Tour.

Step 1—Come up with your tour idea

The Storytelling Map Tour template is designed for presenting geographic information where there is a compelling photographic element to the story you want to tell. Be creative! Here are some potential uses. Click to see an example of each:

Step 2—Install the template

Download the ZIP file containing the map tour template. Unzip this file and copy the contents into a new folder in the file structure of an existing website or web server that you have access to so that the folder is publicly accessible to users on the web.

This step in the process is sometimes misunderstood. You don’t need to have or set up a web server to deploy the template. You simply put the template files onto any website or web server that you have access to or that your organization maintains. For example, if you work for a small conservation organization whose website is hosted on one of the popular web hosting sites, like iPage or Bluehost, you’d log in to your account on that site and then upload the template files into a new folder in the file tree for your website. If you work in a large organization, you might work with the administrator of your organization’s website or web server to install the template files.

The location of the template’s index.html file defines the URL that will be used to access your map tour. For example, if your website is using a web server like Internet Information Services (IIS), and you create a folder in its root called C:inetpubwwwrootmap_tour, and your website’s domain is http://www.example.com, then the URL of your map tour will be http://www.example.com/map_tour.

Step 3—Assemble Your Images

For each point in your map tour, you will need two image files: one at full size for display to the left of the map and a small thumbnail image for display in the thumbnail strip underneath the map. Images should be in JPEG format.

For full-size images, landscape (lengthwise) orientation is recommended instead of portrait orientation. The recommended image size is 1,000 pixels wide by 750 pixels tall (a 4:3 aspect ratio). This will ensure your images look sharp on a variety of monitor sizes and fill the image area to the left of the map nicely. Images in the common 3:2 aspect ratio also work well, in which case 1,000 pixels wide by 666 pixels tall is recommended. Don’t worry if your images don’t match these recommendations exactly, because images that are larger or smaller or have a different aspect ratio still work.

The thumbnail images should be in landscape orientation and ideally 200 pixels wide by 133 pixels tall (3:2 aspect ratio).

Each point in your map tour references its full-size image and its thumbnail image on the web via a URL, so you will need to make your image files available on the web. You could put them into the same folder on your web server into which you installed the template, into a different folder or web server, or into a photo sharing service such as Flickr. (If you use a photo sharing site, make sure you can access the photo via a URL that goes directly to the actual JPEG image file and not to a web page in which the image file is embedded.)

Step 4—Assemble your map tour points in a file

Assemble your map tour points in a comma-separated value (CSV) file, which is a simple text file. Each record in that file defines one point in your tour. Call your file Locations.csv. The file needs to contain name, caption, image URL, and thumbnail URL fields that are required by the template. In addition, the geographic location of each point has to be given either as latitude and longitude fields in decimal degrees or as a street address (in a single field or in separate address, city, state, and ZIP code fields).

You can create your CSV file in a text editor, like Windows Notepad, or in Microsoft Excel, which lets you export a worksheet to CSV format. The map tour template you downloaded in step 2 above includes a Samples folder that contains ready-to-use CSV and Excel files with all the required fields that you can use as the basis for your file, so you don’t have to create it from scratch. There’s also a README file in the template download that details the fields the template requires if you need more information.


Here, the tour points file is being edited in Excel, which makes it easy to edit long strings because they wrap around in the spreadsheet cells.

Keep the caption text short, because it will appear on top of the full-size image, and on smaller displays like the iPad, a lot of text could cover up too much of the image. Limit your captions to 350 characters or less, including spaces. The caption text can include HTML tags to define formatting and links. For example, the caption text below is formatted so that the photo credit appears on a separate line in a smaller italic font than the rest of the caption:

The caption text below contains a hyperlink. Use the target attribute to make the link open in a new browser tab so that users don’t lose their place in the tour.

The order of the records in the file determines the order in which the points will appear on the map. The first record in your map tour file is automatically treated as the introductory image by the template so that you can start the tour showing a compelling image to set the scene. The location of this record will not be shown on the map as a numbered point in your tour. You will still need to specify a location for this record in your file, but that location will not be displayed in the map tour. You can override this behavior if you don’t want your map tour to start with an introductory image. That aspect will be covered later in this tip.

Optionally, you can assemble the tour points in ArcMap as a point layer using a geodatabase feature class and then export that layer’s attribute table as a CSV file. This handy workflow saves you from having to manually assemble latitude-longitude coordinates or addresses for your points. The Samples folder contains a point feature class in a layer package with the required fields that you can use in ArcMap to edit your points. You can take advantage of ArcMap editing tools to interactively place and edit the points in your layer or use existing GIS data as the source for the points. Before you export your point layer’s attribute table from ArcMap to a CSV file, you populate the latitude-longitude fields in the feature class’s attribute table using the Calculate Geometry command in the ArcMap table window. As the order of the points in the layer determines their order in the tour, you can use the Sort geoprocessing tool if you want to reorder the records. To export the table to a CSV file, look for the Export command on the ArcMap table window’s Options menu.


Here, map tour points are being edited in ArcMap before being exported to a CSV file. You can use the Cell Height setting in the table window Appearance dialog box to make the long text strings wrap for easier reading and editing.

Step 5—Create your web map

Log in to ArcGIS Online using either a free public account or ArcGIS for Organizations subscription account and create a web map for your map tour using the map viewer. Load the Locations.csv file you created in the previous step into the web map as a new layer using the Add Layer from File command on the Add menu or by simply dragging the file onto the map.

You don’t need to specify symbology or pop-up windows for the layer in the web map. The template automatically defines how the tour points layer will be displayed.

In addition to the layer containing your map tour points, you can also add supporting layers into the web map that your map tour will display. For example, if your map tour covers a particular study area, like a park or historic district, you could add a boundary into the web map showing the outline of that area. If your tour is a walking or driving tour, you could add a line to the map showing the recommended route. You can add supporting features and layers into the web map using shapefiles or any other data types supported in ArcGIS Online. Symbolize supporting layers in the web map as you want them to appear on your map tour. You don’t need to define pop-up windows for these layers because the map tour template currently doesn’t support pop-up windows for them. They are just providing context for the map reader.

Before you save your map, navigate to the default extent you want the map to display when it is used in the map tour template. The extent that your map is displaying when you save it will be the initial extent users will see when they launch your map tour. Your initial extent is therefore an important information design choice for your map tour. You may want all the tour points to be visible when the user first opens your map tour, or you may prefer that the initial extent is zoomed in to a subset of the points.

Finally, save your web map. The title and summary you use when you save the map will automatically become the title and subtitle of your map tour. Click Share and choose Everyone (public) to make the web map available to everyone.

Step 6—Configure the template

Now that you have created your web map and shared it publicly, you are ready to configure your template.

    First, configure the template to use your web map. In the template folder, open the index.html file in any text editor, such as Windows Notepad or Windows Wordpad. Look for the template configuration section of the file.

configOptions = <
// The web map id
webmap: “a5019e8c55d547eab69c0777dcd7509a”,

// Use the first data record as an introduction instead of a point
firstRecordAsIntro: true,


gvee's helpful answer is a pragmatic solution that ensures that the columns appear in the desired order, because the order in which you pass property names to Select-Object is the order in which the properties are added to the resulting [pscustomobject] instances.

It is, however, inefficient, because the desired column order can be ensured at the time $Record is defined, without needing an additional pipeline stage that effectively duplicates the result objects:

Define $Record as an ordered hashtable as follows (requires PSv3+):

This guarantees that the [pscustomobject] instances later created by the New-Object PSObject -property $Record calls contain properties in the same order as the keys were defined in $Record .

  • New-Object PSObject -property $Record could be simplified to [pscustomobject] $Record
  • Building up a large array incrementally is more efficiently handled with a [System.Collections.ArrayList] instance to which you add elements with .Add() rather than using PowerShell's built-in arrays with += , which creates a copy of the array every time. Even better is to let PowerShell create the array for you, simply by capturing the output from your foreach loop in a variable ( $Table = foreach . - see this answer)

Supplemental information:

The source of the problem is that regular hashtables ( [hashtable] instances) enumerate their keys in an effectively unpredictable order (the order is an implementation detail and not guaranteed), and when you create a [pscustomobject] from a hashtable, that unpredictable key ordering is reflected in the ordering of the resulting object's properties.

By contrast, in PSv3+ you can create an ordered hashtable by placing the [ordered] keyword before a hashtable literal, which results in a [System.Collections.Specialized.OrderedDictionary] instance whose keys are ordered based on the order in which they were added.
Creating a [pscustomobject] instance from an ordered hashtable then preserves that key ordering in the resulting object's properties.

Note that PowerShell v3+ offers a convenient shortcut for creating a [pscustomobject] instance from a hashtable using a cast e.g.:

Note how the key-definition order was preserved, even though [ordered] was not specified.
In other words: When you cast a hashtable literal directly to [pscustomobject] , [ordered] is implied, so the above is equivalent to:

Caveat: This implicit ordering only applies when a hashtable literal is directly cast to [pscustomboject] , so the key/property order is not preserved in the following variations:

Therefore, when not casting a hashtable literal directly to [pscustomobject] , define it with [ordered] explicitly.


Field properties for the layer

Each field, or column, in a table has properties that describe its contents and how the data in it should be displayed. You can view and, in some cases, edit the field properties in fields view. These settings in fields view are used to determine how attributes will be shown in ArcGIS Pro, including in the attribute table window, in the Pop-up window, and when editing in the Attributes pane.

Below are a list of properties that you can set for fields in the layer:

Check or uncheck the box next to the field. To turn all fields on or off, use the checkbox in the column header.

Determine whether a field is editable

Check or uncheck the box next to the field. To turn all fields on or off, use the checkbox in the column header.

Set a descriptive name for the field

Click the field alias column for the field row and enter a field alias.

Turn on highlighting for a field to accentuate the field when displayed.

Check or uncheck the box next to the field. To turn all fields on or off, use the checkbox in the column header.

Set the display formatting for numeric field types

Click the ellipsis button to open the Number Format dialog box.

These settings also apply to fields that are appended in a join, although you are only able to edit the joined fields when they are accessed from the origin table.

Layer properties are only available when fields view is opened from the layer. If fields view was opened from the data source (from the Catalog pane), the layer properties will not be shown. If you have opened fields view from the layer, you can use the Current Layer drop-down in fields view to switch from layer properties view to the data source view. The data source view displays field properties that are at the feature class level, such as the alias for a field, or the field name.


Watch the video: How to calculate area in ArcGIS from attribute table