Arcade Succeeds in Map Viewer but Fails in Field Maps

187
3
04-12-2024 09:15 AM
Labels (3)
ZachBodenner
MVP Regular Contributor

Hello,

I am building an Arcade expression that I am overall quite happy with. Essentially, it will display information from a feature (parcels) and also pull information from a second layer (zoning) based on matching up PIDs. The complication is that the polygons of the zoning layer don't necessarily match the parcel layer. For example, if a parcel gets subdivided, the polygon on the zoning layer will often stay the same shape as it was pre-division. The resulting split parcels will have new PIDs, and a value in the attribute "Parent PID" that matches the original pre-division parcel. So in order to correctly match the parcel to the zoning polygon, I need to check both attributes. I start with PID, and if that fails, I check Parent PID.

But I'm running into a strange problem: this works great in map viewer and the resulting Experience Builder app, but when I open this in Field Maps, I get an error message that simply says: "Unable to Load All Data Some expressions failed to evaluate." Sharing the error shows an error code 400, Unable to complete operation.

I don't know exactly why this would be other than that based on my testing it has something to do with the // ZONING // section. I commented it all out and then was able to view the remainder in Field Maps successfully. Is there something in this code that would work in Map Viewer but not Field Maps? 

The code below is very long but I didn't want to abbreviate it in case there's something that I just don't know to look for.

// ESTABLISH PARCEL PID AND AREA INFO//
  var parcelPID = $feature.PID
  var parentPID = $feature.Parent_PID
  var acres = Text($feature.ACRES,'#,###.##')
  var sqft = Text($feature.AREA_SQFT,'#,###')
  var properAddress = $feature.ADDRESS

// PLAT LINK //
  var platLink = $feature.Plat_No_Link;
  var platName = $feature.PlatName;
  var pl = `<a href="${platLink}" target="_blank"><span style="color:#295e8f;">${PlatName}</span></a>`

// WATERSHED DISTRICT //
  // convert numbers to WSD names and finish
  var watershed = $feature.Watershed;
  var wsd = decode(watershed, '04', "Riley-Purgatory-Bluff Creek WSD", '01', "Nine Mile Creek WSD", "Minnesota River WSD")
  console (wsd)

// ZONING //
      /* One of two situations can occur when trying to match a parcel to a zoning district polygon. 
          A) The PID of the parcel matches the PID of a zoning polygon exactly (in this case, the zoning district poly is just a parcel)
          B) The PID does not match (in this case, the parcel polygon is one of many on a zoning parcel, or viceversa, and there are many zoning polygons touching the parcel)

          If A) we will run a filter where the PID of the zoning parcel matches this parcel's PID (see subsection a))
          If B) we will run a filter where the PID of the zoning parcel matches this parcel's Parent PID (see subsection b))
      */
  // Zoning Variables
    var zoningLayer = FeatureSetByName($map, "Zoning",['PID','ZONING','TAZ']);
    //variable used in html return
    var z = ''
    // first zoining district, used in subsection c) to determine the color of the header
    var fZd = ''

  // ss a) 
    // run the filter and determine how many matches there are
      var zdFilter = Filter(zoningLayer, 'PID=@parcelPID');
      var cZDF  = count(zdFilter)
      console ("Count of items passing zdFilter: "+cZDF)

  // ss b) 
    // run the intersect and determine how many matches there are
      var zdParent = Filter(zoningLayer, 'PID=@parentPID')
      var cZDP = count(zdParent)
      console ("Count of items passing zdParent: "+cZDP)

  // ss c) 
    // Determine the color of the header by figuring out if a single zoning polygon matches a parcel PID. If no match, attempt to match Parent PID
      if (cZDF ==1)
        { fZd = first(zdFilter)}
      else 
        { fZd = first(zdParent)}
      var zColor = decode(fZd.ZONING,  "RURAL","#FDE8BD","R1-44","#D1AB7B","R1-22","#A06632","R1-13.5","#FFFF00","R1-9.5","#E0B700","RM-6.5","#E09300","RM-2.5","#b58151","OFC","#F9C2FE","N-COM","#FEB3B3","C-COM","#FE8181","C-HWY","#FF00FF","C-REG-SER","#FF4040","C-REG","#c47243","TC-C","#F57A7Al","TC-R","#CD6666","TC-MU","#CD6666","I-2","#D1BDFE","I-5","#B579F4","I-GEN","#864AFE","PUB","#8FBC8F","GC","#D3FFBE","Water","#A4F9FE","RIGHT-OF-WAY","#D2D2D2","#D2D2D2")

  // ss d)
    // determine what will appear in the table. We want to privilege the main PID because that means there's an exact match between the parcels and the zoning. So, if ANY features pass the filter, we will use them here

      if (cZDF ==1){
        for (var zoningPIDs in zdFilter)
        {
        // Set links to EP Municode
        var zl = decode(zoningPIDs.ZONING,"RURAL","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.10URDI","R1-44","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.11ONFAREDI","R1-22","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.11ONFAREDI","R1-13.5","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.11ONFAREDI","R1-9.5","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.11ONFAREDI","RM-6.5","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.15RMMUMIREDI","RM-2.5","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.15RMMUMIREDI","OFC","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.20OFFFDI","N-COM","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.25OMDI","C-COM","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.25OMDI","C-HWY","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.25OMDI","C-REG-SER","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.25OMDI","C-REG","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.25OMDI","TC-C","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.27TCTOCEDI","TC-R","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.27TCTOCEDI","TC-MU","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.27TCTOCEDI","I-2","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.30NDDI","I-5","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.30NDDI","I-GEN","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.30NDDI","PUB","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.35PUUB","GC","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.36LFCO","Water","","RIGHT-OF-WAY","","Please Call City 952-949-8485","",'')
        // Final zoning description (convert code to readable text)
        var zd = decode(zoningPIDs.ZONING,  "RURAL","Rural","R1-44","R1-44: One Family- 44,000 sf. min.","R1-22","R1-22: One Family-22,000 sf min.","R1-13.5","R1-13.5: One Family-13,500 sf min.","R1-9.5","R1-9.5: One Family-9,500 sf min.","RM-6.5","RM-6.5: Multi-Family-6.7 U.P.A. max.","RM-2.5","RM-2.5: Multi-Family-17.4 U.P.A. max.","OFC","Office","N-COM","Neighborhood Commercial","C-COM","Community Commercial","C-HWY","Highway Commercial","C-REG-SER","Regional Service Commercial","C-REG","Regional Commercial","TC-C","Town Center - Commercial","TC-R","Town Center - Residential","TC-MU","Town Center - Mixed Use","I-2","Industrial Park - 2 Acre Min.","I-5","Industrial Park - 5 Acre Min.","I-GEN","General Industrial - 5 Acre Min.","PUB","Public","GC","Golf Course","Water","Water","RIGHT-OF-WAY","Right-of-Way","Please Call City 952-949-8485","Right-of-Way","")    
        console("zoning districts match PIDs: "+zd)
        var zoneList = `<span style="color:#295e8f;">${zd}</span>`+'\n'
        z += Trim(`<a href="${zl}" target="_blank"><span style="color:#295e8f;">${zoneList}</span></a>`)
        }
      }

      //but if there is not a match with the current PIDs, we will use the parent PID which is the number of the parcel before subdivision.
      else {
        for (var zoningPIDs in zdParent)
        {
            // Set links
        var zl = decode(zoningPIDs.ZONING,"RURAL","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.10URDI","R1-44","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.11ONFAREDI","R1-22","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.11ONFAREDI","R1-13.5","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.11ONFAREDI","R1-9.5","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.11ONFAREDI","RM-6.5","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.15RMMUMIREDI","RM-2.5","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.15RMMUMIREDI","OFC","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.20OFFFDI","N-COM","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.25OMDI","C-COM","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.25OMDI","C-HWY","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.25OMDI","C-REG-SER","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.25OMDI","C-REG","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.25OMDI","TC-C","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.27TCTOCEDI","TC-R","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.27TCTOCEDI","TC-MU","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.27TCTOCEDI","I-2","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.30NDDI","I-5","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.30NDDI","I-GEN","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.30NDDI","PUB","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.35PUUB","GC","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.36LFCO","Water","","RIGHT-OF-WAY","","Please Call City 952-949-8485","",'')
        // Final zoning description
        var zd = decode(zoningPIDs.ZONING,  "RURAL","Rural","R1-44","R1-44: One Family- 44,000 sf. min.","R1-22","R1-22: One Family-22,000 sf min.","R1-13.5","R1-13.5: One Family-13,500 sf min.","R1-9.5","R1-9.5: One Family-9,500 sf min.","RM-6.5","RM-6.5: Multi-Family-6.7 U.P.A. max.","RM-2.5","RM-2.5: Multi-Family-17.4 U.P.A. max.","OFC","Office","N-COM","Neighborhood Commercial","C-COM","Community Commercial","C-HWY","Highway Commercial","C-REG-SER","Regional Service Commercial","C-REG","Regional Commercial","TC-C","Town Center - Commercial","TC-R","Town Center - Residential","TC-MU","Town Center - Mixed Use","I-2","Industrial Park - 2 Acre Min.","I-5","Industrial Park - 5 Acre Min.","I-GEN","General Industrial - 5 Acre Min.","PUB","Public","GC","Golf Course","Water","Water","RIGHT-OF-WAY","Right-of-Way","Please Call City 952-949-8485","Right-of-Way","")    
        console("Zoning District match parent PIDs: "+zd)
        var zoneList = `<span style="color:#295e8f;">${zd}</span>`+'\n'
        z += Trim(`<a href="${zl}" target="_blank"><span style="color:#295e8f;">${zoneList}</span></a>`)
        }
      }


  // ss e)
    // Set popup section title color Note: this is a workaround because div colors for text do not work in the arcade return.
    var title = `<span style="color:#000">Parcel Information - ${properAddress}</span>`


return { 
  type : 'text', 
  text : `<div style="color:#ffffff;font-size:16px;background-color:${zColor};padding:5px;">
    <span style><strong>${title}</strong></span>
</div>
                <table style="width:100%">
                    <tbody>
                        <tr>
                            <td style="width:40%;padding-left:2%">
                                <span><strong>PID</strong></span>
                            </td>
                            <td style="width:60%;padding-left:2%">
                                <span>${parcelPID}</span>
                            </td>
                        </tr>
                        <tr>
                            <td style="background-color:#e1e1e1;padding-left:2%">
                                <span><strong>Address</strong></span>
                            </td>
                            <td style="background-color:#e1e1e1;padding-left:2%">
                                <span>${properAddress}</span>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-left:2%">
                                <span><strong>Area (Sq.Ft.)</strong></span>
                            </td>
                            <td style="padding-left:2%">
                                <span>${sqft}</span>
                            </td>
                        </tr>
                        <tr>
                            <td style="background-color:#e1e1e1;padding-left:2%">
                                <span><strong>Acres</strong></span>
                            </td>
                            <td style="background-color:#e1e1e1;padding-left:2%">
                                <span>${acres}</span>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-left:2%">
                                <span><strong>Addition Name</strong></span>
                            </td>
                            <td style="padding-left:2%">
                                <span>${pl}</span>
                            </td>
                        </tr>
                        <tr>
                            <td style="background-color:#e1e1e1;padding-left:2%">
                                <span><strong>Lot</strong></span>
                            </td>
                            <td style="background-color:#e1e1e1;padding-left:2%">
                                <span>${$feature.Lot}</span>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-left:2%">
                                <span><strong>Block</strong></span>
                            </td>
                            <td style="padding-left:2%">
                                <span>${$feature.Block}</span>
                            </td>
                        </tr>
                        <tr>
                            <td style="background-color:#e1e1e1;padding-left:2%">
                                <span><strong>Watershed District</strong></span>
                            </td>
                            <td style="background-color:#e1e1e1;padding-left:2%">
                                <span>${wsd}</span>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-left:2%">
                                <span><strong>Zoning</strong></span>
                            </td>
                            <td style="padding-left:2%">
                                <span>${z}</span>
                            </td>
                        </tr>
                        
                    </tbody>
                </table>
         
           `
}

 

0 Kudos
3 Replies
ClayDonaldsonSWCA
Occasional Contributor II

my guess would be that it is trying to evaluate and the filter or count is returning 0 or null. I would wrap any processing with a if count > 0 loop, to ensure that it is properly handling instances where it unable to filter.

I find that field maps tends to do best with arcade when you have handling for any possible outcome of filter.

0 Kudos
ZachBodenner
MVP Regular Contributor

I will definitely give that a try, though I wonder if you know why Field Maps would have a tough time with it when the map viewer does not?

0 Kudos
ZachBodenner
MVP Regular Contributor

Alright so I've been trying to tweak this and I think that these changes should catch all possibilities, correct? So in both ss c) and ss d) have one of two possibilities in the IF statement, either the count is greater than zero, or it is zero. Again, the code continues to work fine in map viewer, but throws an error when opening the popup in Field Maps.

// ESTABLISH PARCEL PID AND AREA INFO//
  var parcelPID = $feature.PID
  var parentPID = $feature.Parent_PID
  var acres = Text($feature.ACRES,'#,###.##')
  var sqft = Text($feature.AREA_SQFT,'#,###')
  var properAddress = $feature.ADDRESS

// PLAT LINK //
  var platLink = $feature.Plat_No_Link;
  var platName = $feature.PlatName;
  var pl = `<a href="${platLink}" target="_blank"><span style="color:#295e8f;">${PlatName}</span></a>`

// WATERSHED DISTRICT //
  // convert numbers to WSD names and finish
  var watershed = $feature.Watershed;
  var wsd = decode(watershed, '04', "Riley-Purgatory-Bluff Creek WSD", '01', "Nine Mile Creek WSD", "Minnesota River WSD")
  console (wsd)

// ZONING //
      /* One of two situations can occur when trying to match a parcel to a zoning district polygon. 
          A) The PID of the parcel matches the PID of a zoning polygon exactly (in this case, the zoning district poly is just a parcel)
          B) The PID does not match (in this case, the parcel polygon is one of many on a zoning parcel, or viceversa, and there are many zoning polygons touching the parcel)

          If A) we will run a filter where the PID of the zoning parcel matches this parcel's PID (see subsection a))
          If B) we will run a filter where the PID of the zoning parcel matches this parcel's Parent PID (see subsection b))
      */
  // Zoning Variables
    var zoningLayer = FeatureSetByName($map, "Zoning",['PID','ZONING','TAZ']);
    //variable used in html return
    var z = ''
    // first zoining district, used in subsection c) to determine the color of the header
    var fZd = ''

  // ss a) 
    // run the filter and determine how many matches there are
      var zdFilter = Filter(zoningLayer, 'PID=@parcelPID');
      var cZDF  = count(zdFilter)
      console ("Count of items passing zdFilter: "+cZDF)

  // ss b) 
    // run the intersect and determine how many matches there are
      var zdParent = Filter(zoningLayer, 'PID=@parentPID')
      var cZDP = count(zdParent)
      console ("Count of items passing zdParent: "+cZDP)

  // ss c) 
    // Determine the color of the header by figuring out if a single zoning polygon matches a parcel PID. If no match, attempt to match Parent PID
      if (cZDF >0)
        { fZd = first(zdFilter)}
      if (cZDF == 0) 
        { fZd = first(zdParent)}
      var zColor = decode(fZd.ZONING,  "RURAL","#FDE8BD","R1-44","#D1AB7B","R1-22","#A06632","R1-13.5","#FFFF00","R1-9.5","#E0B700","RM-6.5","#E09300","RM-2.5","#b58151","OFC","#F9C2FE","N-COM","#FEB3B3","C-COM","#FE8181","C-HWY","#FF00FF","C-REG-SER","#FF4040","C-REG","#c47243","TC-C","#F57A7Al","TC-R","#CD6666","TC-MU","#CD6666","I-2","#D1BDFE","I-5","#B579F4","I-GEN","#864AFE","PUB","#8FBC8F","GC","#D3FFBE","Water","#A4F9FE","RIGHT-OF-WAY","#D2D2D2","#D2D2D2")
      
  // ss d)
    // determine what will appear in the table. We want to privilege the main PID because that means there's an exact match between the parcels and the zoning. So, if ANY features pass the filter, we will use them here

      if (cZDF >0){
        for (var zoningPIDs in zdFilter)
        {
        // Set links to EP Municode
        var zl = decode(zoningPIDs.ZONING,"RURAL","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.10URDI","R1-44","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.11ONFAREDI","R1-22","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.11ONFAREDI","R1-13.5","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.11ONFAREDI","R1-9.5","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.11ONFAREDI","RM-6.5","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.15RMMUMIREDI","RM-2.5","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.15RMMUMIREDI","OFC","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.20OFFFDI","N-COM","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.25OMDI","C-COM","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.25OMDI","C-HWY","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.25OMDI","C-REG-SER","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.25OMDI","C-REG","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.25OMDI","TC-C","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.27TCTOCEDI","TC-R","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.27TCTOCEDI","TC-MU","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.27TCTOCEDI","I-2","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.30NDDI","I-5","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.30NDDI","I-GEN","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.30NDDI","PUB","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.35PUUB","GC","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.36LFCO","Water","","RIGHT-OF-WAY","","Please Call City 952-949-8485","",'')
        // Final zoning description (convert code to readable text)
        var zd = decode(zoningPIDs.ZONING,  "RURAL","Rural","R1-44","R1-44: One Family- 44,000 sf. min.","R1-22","R1-22: One Family-22,000 sf min.","R1-13.5","R1-13.5: One Family-13,500 sf min.","R1-9.5","R1-9.5: One Family-9,500 sf min.","RM-6.5","RM-6.5: Multi-Family-6.7 U.P.A. max.","RM-2.5","RM-2.5: Multi-Family-17.4 U.P.A. max.","OFC","Office","N-COM","Neighborhood Commercial","C-COM","Community Commercial","C-HWY","Highway Commercial","C-REG-SER","Regional Service Commercial","C-REG","Regional Commercial","TC-C","Town Center - Commercial","TC-R","Town Center - Residential","TC-MU","Town Center - Mixed Use","I-2","Industrial Park - 2 Acre Min.","I-5","Industrial Park - 5 Acre Min.","I-GEN","General Industrial - 5 Acre Min.","PUB","Public","GC","Golf Course","Water","Water","RIGHT-OF-WAY","Right-of-Way","Please Call City 952-949-8485","Right-of-Way","")    
        console("zoning districts match PIDs: "+zd)
        var zoneList = `<span style="color:#295e8f;">${zd}</span>`+'\n'
        z += Trim(`<a href="${zl}" target="_blank"><span style="color:#295e8f;">${zoneList}</span></a>`)
        }
      }

      //but if there is not a match with the current PIDs, we will use the parent PID which is the number of the parcel before subdivision.
      if (cZDF == 0) {
        for (var zoningPIDs in zdParent)
        {
            // Set links
        var zl = decode(zoningPIDs.ZONING,"RURAL","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.10URDI","R1-44","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.11ONFAREDI","R1-22","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.11ONFAREDI","R1-13.5","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.11ONFAREDI","R1-9.5","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.11ONFAREDI","RM-6.5","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.15RMMUMIREDI","RM-2.5","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.15RMMUMIREDI","OFC","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.20OFFFDI","N-COM","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.25OMDI","C-COM","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.25OMDI","C-HWY","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.25OMDI","C-REG-SER","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.25OMDI","C-REG","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.25OMDI","TC-C","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.27TCTOCEDI","TC-R","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.27TCTOCEDI","TC-MU","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.27TCTOCEDI","I-2","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.30NDDI","I-5","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.30NDDI","I-GEN","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.30NDDI","PUB","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.35PUUB","GC","https://library.municode.com/mn/eden_prairie/codes/code_of_ordinances?nodeId=CH11LAUSREZO_S11.36LFCO","Water","","RIGHT-OF-WAY","","Please Call City 952-949-8485","",'')
        // Final zoning description
        var zd = decode(zoningPIDs.ZONING,  "RURAL","Rural","R1-44","R1-44: One Family- 44,000 sf. min.","R1-22","R1-22: One Family-22,000 sf min.","R1-13.5","R1-13.5: One Family-13,500 sf min.","R1-9.5","R1-9.5: One Family-9,500 sf min.","RM-6.5","RM-6.5: Multi-Family-6.7 U.P.A. max.","RM-2.5","RM-2.5: Multi-Family-17.4 U.P.A. max.","OFC","Office","N-COM","Neighborhood Commercial","C-COM","Community Commercial","C-HWY","Highway Commercial","C-REG-SER","Regional Service Commercial","C-REG","Regional Commercial","TC-C","Town Center - Commercial","TC-R","Town Center - Residential","TC-MU","Town Center - Mixed Use","I-2","Industrial Park - 2 Acre Min.","I-5","Industrial Park - 5 Acre Min.","I-GEN","General Industrial - 5 Acre Min.","PUB","Public","GC","Golf Course","Water","Water","RIGHT-OF-WAY","Right-of-Way","Please Call City 952-949-8485","Right-of-Way","")    
        console("Zoning District match parent PIDs: "+zd)
        var zoneList = `<span style="color:#295e8f;">${zd}</span>`+'\n'
        z += Trim(`<a href="${zl}" target="_blank"><span style="color:#295e8f;">${zoneList}</span></a>`)
        }
      }


  // ss e)
    // Set popup section title color Note: this is a workaround because div colors for text do not work in the arcade return.
    var title = `<span style="color:#000">Parcel Information - ${properAddress}</span>`


return { 
  type : 'text', 
  text : `<div style="color:#ffffff;font-size:16px;background-color:${zColor};padding:5px;">
    <span style><strong>${title}</strong></span>
</div>
                <table style="width:100%">
                    <tbody>
                        <tr>
                            <td style="width:40%;padding-left:2%">
                                <span><strong>PID</strong></span>
                            </td>
                            <td style="width:60%;padding-left:2%">
                                <span>${parcelPID}</span>
                            </td>
                        </tr>
                        <tr>
                            <td style="background-color:#e1e1e1;padding-left:2%">
                                <span><strong>Address</strong></span>
                            </td>
                            <td style="background-color:#e1e1e1;padding-left:2%">
                                <span>${properAddress}</span>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-left:2%">
                                <span><strong>Area (Sq.Ft.)</strong></span>
                            </td>
                            <td style="padding-left:2%">
                                <span>${sqft}</span>
                            </td>
                        </tr>
                        <tr>
                            <td style="background-color:#e1e1e1;padding-left:2%">
                                <span><strong>Acres</strong></span>
                            </td>
                            <td style="background-color:#e1e1e1;padding-left:2%">
                                <span>${acres}</span>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-left:2%">
                                <span><strong>Addition Name</strong></span>
                            </td>
                            <td style="padding-left:2%">
                                <span>${pl}</span>
                            </td>
                        </tr>
                        <tr>
                            <td style="background-color:#e1e1e1;padding-left:2%">
                                <span><strong>Lot</strong></span>
                            </td>
                            <td style="background-color:#e1e1e1;padding-left:2%">
                                <span>${$feature.Lot}</span>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-left:2%">
                                <span><strong>Block</strong></span>
                            </td>
                            <td style="padding-left:2%">
                                <span>${$feature.Block}</span>
                            </td>
                        </tr>
                        <tr>
                            <td style="background-color:#e1e1e1;padding-left:2%">
                                <span><strong>Watershed District</strong></span>
                            </td>
                            <td style="background-color:#e1e1e1;padding-left:2%">
                                <span>${wsd}</span>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-left:2%">
                                <span><strong>Zoning</strong></span>
                            </td>
                            <td style="padding-left:2%">
                                <span>${z}</span>
                            </td>
                        </tr>
                        
                    </tbody>
                </table>
         
           `
}

 

0 Kudos