More

Print Selected Area in Map in Arcgis javascript API

Print Selected Area in Map in Arcgis javascript API


I'm working on arcgis javascript api, and I'm trying to implement a selection print tool, I'm new to this api, and don't know how to select area of the map, and after that, print the selected drawn area. Any help?


As far as I can tell, you'll need to just zoom in on the selected area and print it, assuming you're using the Print Task found here: https://developers.arcgis.com/javascript/jsapi/printtask-amd.html. It doesn't look like there's an option to print only part of what's visible.

Note: The PrintTask requires an ArcGIS Server 10.1 Export Web Map Task. So make sure you've got that first.

Create a navigation toolbar and set it to ZOOM_IN: https://developers.arcgis.com/javascript/jsapi/navigation-amd.html. That will be your "select an area of the map".

Now, there is also an option that's just referred to as "export": http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Export_Map/02r3000000v7000000/

1) This is not the same thing as the Export Web Map task.

2) It does not print the basemap, only the layers on your server.

3) It does allow you to specify a bounding box.

If export is available on your server and you choose this option you'll want to use the Draw toolbar instead of the navigation area: https://developers.arcgis.com/javascript/jsapi/draw-amd.html. Get the extent of the shape once it's drawn and pass the xmin, ymin, xmax, ymax to the export function.


The spatial reference of the output feature class will be the same as the input geography boundary layer.

Use the Append Fields From Geography Boundary to Output option to include the demographic data of an ESRI dataset in the output trade areas.

The Table Containing Matching Geography Fields must be in a format compatible with ArcMap. Your tabular data can be in the form of a database file format (.dbf) file, a comma- or tab-delimited text (.txt) file, or a relational database management system (RDBMS).

All nonmatching ZIP Codes will be excluded in the output trade area.

Nonmatching ZIP Codes are ZIP Code records in the Table Containing Matching Geography IDs that are not valid and do not have a corresponding feature in the input geography boundary layer.

If you want to select from a list of available geographic features to create a study area, you can use the Trade Area wizard in ArcMap. Selecting geographic features is not available as a geoprocessing tool.

In ArcMap, trade areas will only be created for features that are within the active study area or analysis extent.


1 Answer 1

I've confirmed with API maintainers that this is expected behavior.

The PrintWidget that ships with the JS API will treat your feature layer features as client side graphics for purposes of exporting.

In my case, a single US ZIP Codes feature layer as low scale, this translated into requests on order of 20MB and larger being sent to the server. The recommended workaround in this case was to not use the provided PrintWidget and serialize the map manually as JSON, using feature IDs instead of geometries.


2. Make a web map

Make a web map in an ArcGIS organization. This can be in your ArcGIS Online organization or in Portal for ArcGIS . When you make a web map, you overlay the map services that best tell your story. Often, a web map displays a map service with business data (such as available stands of timber) on top of a map service with reference information (such as imagery or a shaded relief map). Sometimes a reference map service containing boundaries or labels is placed on top of the whole thing to create a "map sandwich": two reference layers with the "meat," or business data, in between.

ArcGIS.com is a good place to practice building a web map, but the steps below can be followed in Portal for ArcGIS with your data and resulting map stored on-premises.

  1. Open a web browser to arcgis.com.
  2. Click Sign In and sign in with your ArcGIS Online user name and password. This ensures that you'll be able to save and come back to the maps you make.
  3. Click Map . You'll see a basemap service already added for you. This is hosted by Esri.
  4. Click Add to add map services on top of the basemap. You can search for publicly available services, such as those hosted by Esri, or you can type the URL to your own ArcGIS Server site if it is public facing.
  5. Pan and zoom to your area of interest.
  6. Click Save and save your map. Your map information is stored on Esri's ArcGIS Online cloud and you can always come back to it using your ArcGIS Online account.

From here, you can print your map, explore it, or even edit features in it, if it includes a service on which editing has been enabled. See Working with maps in the ArcGIS.com Help for ideas of how to create and use maps. Or continue reading below to learn how to put your map in a web application.

This is a "map sandwich" in ArcGIS.com containing a base layer, business data (retail spending potential), and a reference overlay layer with roads and labels.


Print Selected Area in Map in Arcgis javascript API - Geographic Information Systems

Description

This sample shows how to use esri.arcgis.utils.createWebMap to create a map using an object that is a by value representation of the webmap.This is an alternative to other samples in this folder that create a map using the webmap id from ArcGIS.com. The code below creates a new webmap and sets the title, description and initial extent of the map.

Next, the layers that make up the map are defined. In this sample, the World Terrain basemap from ArcGIS.com is added along with an overlay layer that adds additional information to the map such as boundaries, cities, water features and landmarks and roads. An operational layer is added that displays soil information from the U.S. Department of Agriculture.

Note: You can retrieve the item definition from an ArcGIS.com item using esri.arcgis.utils.getItem()

Once the webmap is created, we'll use the createMap method to build a map from the provided information.


EEA public map services

The EEA covers thematic areas such as air, water, climate change, biodiversity, land and noise. Our services are made accessible in as many ways as possible. All these map services contain metadata and have a simple interface.

These map-services are available via many other portals such as INSPIRE, ArcGis, GEOS. The EEA allows users to re-link these services into their own websites or portals, but maintains its metadata only from the services hosted in this infrastructure.

EEA standard re-use policy: Unless otherwise indicated, reuse of content on the EEA website for commercial or non-commercial purposes is permitted free of charge, provided that the source is acknowledged.

Our map services can be found at

and under specific topics like

For updates, please log in to Twitter, Facebook or LinkedIn. Feedback and comments are welcome.

Naming convention

A map-service name has three elements of information, separated by the underscore character (_).

  • The first part describes the content of the map service.
  • The second part relates to cached and dynamic layers.
    • A cached layer (also called a tiled layer) has the information already preprocessed and prepared as tiles. These map services have a very high drawing performance but are limited in their use. This type of map service is appropriate for applications that many users will access.
    • Dynamic layers are versatile, but they may be limited by available CPU power. The EEA can handle about 50 000 dynamic map requests per hour.

    EEA "Web map" Working environment

    If you are an EEA partner and are producing web maps you are entitled to use EEA workspace for web map creation. Ask your project manager in EEA to provide you access tos http:eea.maps.arcgis.com

    Map services in DiscoMap for developers: example

    Services from discomap.eea.europa.eu are allowed to be re-used by anybody. EEA content can be integrated in many different ways by developers or by any end-user who might find an interest in combining EEA's information with there own or other public map-services.

    Example: A map service based on Corine Land Cover 2000.

    For developpersMap-service URL
    Javascript version (ArcGIS-API) http://land.discomap.eea.europa.eu/ArcGIS/rest/services/Land/CLC2000_Cach_WM/MapServer?f=jsapi
    WMS-service http://land.discomap.eea.europa.eu/ArcGIS/services/Land/CLC2000_Cach_WM/MapServer/WMSServer?request=GetCapabilities&service=WMS

    Map services for desktop applications: example

    Map services are mostly used in web applications or are integrated into websites. But they are also increasingly used in desktop applications. Many applications can be used with the Open Geospatial Consortium (OGC) Web Map Service (WMS) as a source of information. All applications need different URLs to use EEA's map services. The URLs below demonstrate how to add EEA Discomap services into different applications.

    Desktop usersMap-service URL
    Google Earth Please contact us for more info
    ArcGis Explorer Please contact us for more info
    ArcMap Please contact us for more info
    ArcGis.com Please contact us for more info
    UdIG Please contact us for more info
    Quantum GIS Please contact us for more info
    . There is an endless list, if you use one not listed please let us know

    The environmental information published at DiscoMap is aligned with the INSPIRE Directive where possible.

    The INSPIRE home page


    Print Selected Area in Map in Arcgis javascript API - Geographic Information Systems

    Note: This data is derived from the State of West Virginia e911 mapping and includes point locations of buildings that have an address.

    Though this information is believed to be accurate, it may not be updated in specific area of the state. Please use caution when using this data for detailed planning purposes.

    About

    The West Virginia Infrastructure and Jobs Development Council (IJDC) amd the West Virginia Water Development Authority (WDA), in order to maximize the use of infrastructure funds and address the needs of the unserved and underserved population of West Virginia, retained CDM Smith Inc. to help develop several technology tools, including this Geographic Information System (GIS), to help manage, prioritize, track, and accelerate the planning and completion of infrastructure projects.

    This GIS application provides a portal to the IJDC’s GIS and project management environments and is based on Esri’s ArcGIS Server, ArcGIS Online, Esri’s Javascript API, and SQL Server technologies. Utility mapping data referenced by this application was supplied by the utilities and by the Regional Planning Councils and consultants who support those utilities. Other data referenced through this application was acquired through State of West Virginia data sources and publically-available map services.

    The utility layers are also available through the WV Tech Center. These services can be added to local GIS applications so that users can visualize the data in conjunction with their own data sets and generate their own plots.

    Disclaimer:
    We make every effort to provide and maintain accurate, complete, usable, and timely information on this viewer, within the limits described in the metadata accompanying this web application. Users are cautioned to consider carefully the limitations of the data and information provided before using them for decisions that concern personal or public safety or to conduct business that involves substantial monetary or operational consequences. Conclusions drawn from, or actions undertaken on the basis of, such data and information are the sole responsibility of the user. Neither the West Virginia Infrastructure & Jobs Development Council, the West Virginia Water Development Authority, the State of West Virginia, nor any other agency thereof, nor any of their employees, contractors, or subcontractors, make any warranty, express or implied, nor assume any legal liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, nor represent that its use would not infringe on privately owned rights.

    By using this application, you, the user, acknowledge that any reliance upon any information shall be at the sole risk of the user. The West Virginia Infrastructure & Jobs Development Council reserves the right, in its sole discretion, to make improvements to, or correct any error or omissions in, any portion of the site. In no event shall the State of West Virginia be liable for any direct, indirect, incidental or consequential damage of any kind whatsoever with respect to the information gathered from this web application.

    The West Virginia Infrastructure & Jobs Development Council can be reached at:

    West Virginia Infrastructure & Jobs Development Council
    1009 Bullitt Street, Charleston, West Virginia 25301
    T - (304) 414 - 6501
    F - (304) 414 - 0866

    If you have questions regarding State of West Virginia infrastructure projects and funding, please use the contact form located here.


    User Interface

    As the end user of the application I want…

    AGO CWM IMF2 SMK
    Can I print a map with a user-defined scale, paper size or in combination with a report?
    Can I draw and edit an Area of Interest ?
    Can data be downloaded that was created on the map ie. Area of Interest AOI 7
    Can I import/export data layers that are in different geographic projection as the map? no* available in ESRI Javascript API/desktop tools import CSV supports projection specification as does WFS/WMS map is Geographic
    Can I add markup text or drawings onto my map for printing?
    Can I turn on or off specific map layers while viewing the map?
    Can I download operational business data from the map/application? yes* webappbuilder csv, snippet of data no redirects to DataBC Distribution for BCGW data Selection/extraction of feature is a configurable feature
    Can you import or load data for use in the map? 7
    Can you search for geographic locations or a specific feature on the map?
    Does the application provide map navigation tools such as mouse wheel zoom, zoom to extent or zoom to a feature?
    Can you select different basemaps which are either an image or a different style of map? ??
    Can I save data queries within the map to find locations or interests?
    Can the client easily customize report outputs, either on-screen or printable?
    Can I share a link or a saved session so my client either internal or external to government can look at the same layout, zoom scale, and layers.
    Can I measure distance or area on my map?
    Can you use this solution on a mobile device (phone or tablet) with a browser?
    Can you access on mobile devices?
    Are there a variety of base maps to choose from?
    Can I identify and discover relationships among features? 2
    Can I detect statistically significant patterns?
    Can I make predictions using analytical models 3
    Can I re-symbolize, modify, or customize map data or labels? 4 4
    Can I customize printing of maps? 4 4
    Can I save and share the work with others?
    Can I prepare specific datasets for off-line use? 7
    Can I collect data on this application? 5 7
    Can I edit data on this application? 6 6 7
    Can I work off-line (access without Internet) on this application? 7 7


    Procedure

    1. Define the study area to be the extent limit of the color-coded map.
      1. Launch Business Analyst Online and open a project.
      2. Click the Maps tab > Define Areas for Reports > Select Geography.
      3. In the Select Geography pane on the left, select a method to search for the study area from the provided options (Search, Select from Map, and Select from Full List). Refer to the following document for more information on how to use the three geography selection method, Business Analyst Web App: Select geography.

      1. Click the Create Maps from Data tab > Color-Coded Maps.
      2. In the Color-Coded Maps pane, select the variable to map.
      3. The current default display extent of the color-coded map is Current map extent. To filter the color-coded map to the study area, click the drop-down arrow next to Current map extent, and select the study area defined in Step 1.

        A color-coded map is created covering the extent of the study area.

      Learn ArcGIS lesson

      Set Up an ArcGIS Organization

      You’re an instructor at Laurel Junction, a community college in central Pennsylvania. The Geography Department is considering using ArcGIS Online to help teach students how to analyze data with maps. As a member of the department, you’ve been tasked with setting up a trial ArcGIS organization so you and other instructors can evaluate whether it would be a good resource for your courses.

      Overview

      A colleague familiar with administering ArcGIS Online advised you on the initial steps to set up a trial organization. First, you’ll activate the trial and complete some basic configuration tasks. You want an appealing site, so you’ll add a custom banner and feature some apps and maps on the home page. You’ll review some calculations to understand how credits are charged for the tools and storage that your department will use. You’ll also create accounts for four instructors who will help you test. Finally, you’ll learn where to download ArcGIS Pro, ArcGIS® Maps for Office®, and other apps, and assign licenses to members. Once your organization is ready for use and you are familiar with basic administration tasks, you can continue on your own with a more thorough configuration of the site.