Using URL parameters in pop-ups

URL variables are a handy way to pass information from one web page to another. The ArcGIS Online map viewer takes the ID of the web map to open as a URL parameter, and ArcGIS Online web maps can make use of URL parameters to define things such as the basemap, layers, and extent.

In this example we’ll take a look at how to construct a string to pass information from a pop-up to another website using URL parameters from feature attributes.

The Map

In this example we’re working with a parcel layer in our map. The pop-up for the parcel layer is shown below, note that the field APN contains the unique identifier for each parcel.

The Website

The county assessor’s website delivers detailed information for each parcel via the Property Information Management System (PIMS). The information can be retrieved by searching on the owner name, APN, or map book number. Below we’ve gotten the results for one of the parcels by entering the owner’s name.

Taking a closer look at the URL we can see that the unique identifier (the APN) for each parcel is included as a parameter in the URL, appearing at the end after ?parcel=

The Mission

We’d like to access the PIMS website from the parcel pop-up, retrieving the specific information for the parcel that was clicked. Currently there is no direct link in our pop-up to access the assessor’s PIMS website, but we do have the unique parcel identifier (in the APN field) for each parcel.

At the PIMS website we’ve learned that the URL takes the unique identifier (APN) as a parameter to retrieve information for any given parcel.

Our challenge is to construct a link that passes the contents of the APN field as a URL parameter to the PIMS website, so we can open the parcel’s information from the feature pop-up.

Connecting the dots

One way to accomplish this is to construct a custom link for our parcel pop-up (in the layers shown below named Map Book). First choose Configure Pop-up:

Then from the drop-down options under pop-up Contents, choose A custom attribute display:

Using this option you can use a combination of rich text, attributes, and links to create a custom information pop-up. For example, below we’ve combined a string with an attribute. Attributes appear in curly braces, and will display the specific data from that attribute for each feature.

Here’s our custom attribute display:

And here’s what the pop-up looks like.

Our next task is to configure a custom link that will add the APN to the URL to open the PIMS web page for each parcel. In Configure Attribute Display, we added the string “View PIMS info,” selected it, then clicked Create Link:

In Link Properties, we copied and pasted the URL from the PIMS site, including ?parcel=, then added the field {APN} at the end. We noticed there were four extra trailing zeros that we also needed to include after the APN. Shown below is the end of the URL, with the field {APN} passed as a parameter plus the trailing zeros:

The pop-up now looks like this, with the View PIMS info hyperlink:

When clicked, the hyperlink opens the PIMS page for the parcel – mission accomplished!

For more information see About displaying attributes with pop-up windows and Configuring pop-up windows.

This entry was posted in ArcGIS Online and tagged , . Bookmark the permalink.

Leave a Reply

13 Comments

  1. berniejconnors says:

    Bernie,

    This is a great feature. I have just setup a similar web map for the parcel maps in my jursidiction with a link into our online land registry. However – what would make this map really useful is the ability to search for a parcel using the parcel ID number. Is ESRI working on a new feature for ArcGIS.com that would allow users to setup custom search fields? Currently we can display attributes in a pop-up but we cannot search our attributes.

    Bernie.

    • Bern Szukalski says:

      Bernie – thanks for the comments. Yes, attribute display, queries, and query definitions on layers are in-progress, and should be available in the November update for ArcGIS Online.

      • berniejconnors says:

        Great! Thanks for the speedy reply.

      • berniejconnors says:

        Hey Bernie S, what is the update on “attribute display, queries, and query definitions on layers”?

        • Bern Szukalski says:

          berniejconnors – next week’s ArcGIS Online update will add new capabilities which address these. From the development version of the Help (subject to change):
          • Apply filtered views of feature layers—Map authors can now create filters for presenting focused view of feature data in your web map. You can answer simple questions such as, “What is in this dataset and what information applies to my work?” To the person viewing a filtered web map, the filter appears as just another layer in the map. For example, you might create a filter on crime data to only show arsons and petty thefts. You can also provide prompts and hints about the attributes in the layer as a way to guide your audience towards the information they are likely to be interested in.

          • Show tables—Anybody viewing a map in the ArcGIS.com map viewer can display an interactive table of the attribute information in the web map. Tables can be a useful way to quickly view the data in a feature layer of a map.

          More information will be available in the help once released, and we’ll cover these topic in more detail in future blog posts.

  2. Brett Lord-Castillo says:

    Maybe I am overlooking something obvious, but what if I have the entire url as an attribute?
    How do I make a link in a custom attribute display that uses the contents of that attribute for its url? I always get a message that the value entered is not valid.

    • Bern Szukalski says:

      Brett – I believe we’ve covered this in our email correspondences – for comment viewers the answer here is that this is not currently supported, but will be a future enhancement.

  3. ryan_a says:

    Is there any way to extract a substring of the field value result? In my instance I have a PLSS file that only has the Section-Township-Range as a single combined attribute with a dash separating (36-12-07). I need the Section Township Range without the dash to create a link to a pdf for the section(361207).

  4. maestro_red1 says:

    Hello guys! can this feature be used as an advertisement tool? say someone is browsing my map and sees a restaurant, then clicks on the POI and this pop up comes out already linked to the restaurant’s url?? if not, is there another ArcGIS online you can recommend for this kind of marketing concept? Regards, -Julio

  5. steinj14 says:

    How do you do this if you’re defining the web map via code and not using an ArcGIS Online web map? The only options I see for popup configuration is field, image, and chart. I need to create a link where I can pass in field values just like you did here.

  6. carrie.mack says:

    I have the same question Brett did:
    “Maybe I am overlooking something obvious, but what if I have the entire url as an attribute?
    How do I make a link in a custom attribute display that uses the contents of that attribute for its url? I always get a message that the value entered is not valid.”
    I have an ArcOnline map of city and watershed district boundaries, and I would like to send the map user to the website of the appropriate jurisdiction, but can’t find a way to make an attribute (www.google.com for example) to be a hyperlink. I’ve used the customize pop up window and used the hyperlink function/button to indicate that the URL be the field {website}, but it navigates to a nonexistent url that starts with http://www.ArcGIS.com\……and ends with my specification (\www.google.com to use the above example).

    • Bern Szukalski says:

      Using custom configurations you can have any text be a link. The blog post uses a concatenation technique to add the value from one field (APN in the blog case) to a URL string, passing the APN as a parameter.

      You can use any link you have in your attributes, though a better way to present that might be in a pop-up which lists attribute contents (the default) rather than a custom pop-up configuration. I can’t tell for sure what you are attempting to do, but if your map is public I can take a look. Send the link to your map to bszukalski@esri.com