<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: map with a statistics table in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/map-with-a-statistics-table/m-p/1129817#M49695</link>
    <description>&lt;P&gt;Looks great JianwuChen, would you care to share your python script with us?&lt;/P&gt;&lt;P&gt;Thanks in advance, have a great 2022!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bert&lt;/P&gt;</description>
    <pubDate>Fri, 31 Dec 2021 08:33:24 GMT</pubDate>
    <dc:creator>Gisbert61</dc:creator>
    <dc:date>2021-12-31T08:33:24Z</dc:date>
    <item>
      <title>map with a statistics table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/map-with-a-statistics-table/m-p/1129789#M49694</link>
      <description>&lt;P&gt;Today I had a little fun in playing ArcGIS Pro to create a map with an inserted table. The data source of the table was create using SQL (specifically select ... group by ...). The data processing and map creation are a automation using a python script file. Cheer.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 19:07:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/map-with-a-statistics-table/m-p/1129789#M49694</guid>
      <dc:creator>JianwuChen</dc:creator>
      <dc:date>2022-01-10T19:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: map with a statistics table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/map-with-a-statistics-table/m-p/1129817#M49695</link>
      <description>&lt;P&gt;Looks great JianwuChen, would you care to share your python script with us?&lt;/P&gt;&lt;P&gt;Thanks in advance, have a great 2022!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bert&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 08:33:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/map-with-a-statistics-table/m-p/1129817#M49695</guid>
      <dc:creator>Gisbert61</dc:creator>
      <dc:date>2021-12-31T08:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: map with a statistics table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/map-with-a-statistics-table/m-p/1129903#M49696</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/548038"&gt;@JianwuChen&lt;/a&gt;&amp;nbsp;thank you for posting this! This script and the result you posted do not fit under the category of 'Ideas', as we have them configured for Esri Community. Ideas request improvements to be made to Esri software applications, rather than novel scripts or workflows user create on their own using existing functionality in an application such as ArcGIS Pro. Please review the&amp;nbsp;&lt;LI-MESSAGE title="Community Idea Exchange Guidelines" uid="1116066" url="https://community.esri.com/t5/community-help-documents/community-idea-exchange-guidelines/m-p/1116066#U1116066" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;for future reference. Let me check to see what would be the best board for you or other users to post scripts and workflows to, as 'Questions' does not seem to fit either. I will get back to you shortly on this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you and have a happy New Year!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Amelia&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 22:03:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/map-with-a-statistics-table/m-p/1129903#M49696</guid>
      <dc:creator>AmeliaBradshaw</dc:creator>
      <dc:date>2021-12-31T22:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: map with a statistics table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/map-with-a-statistics-table/m-p/1130179#M49697</link>
      <description>&lt;P&gt;Hi Bert,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the source code of python script file. Please note that feature class Parcels and TIF_Districts are in database schema gio in a sde-schema geodatabase in a SQL Server database. I expect the users to know SQL and python and ArcGIS Pro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"""&lt;BR /&gt;This python script finds property parcels inside the City's limit, in a TIF district, and calculates their statistics.&lt;/P&gt;&lt;P&gt;Author: Jianwu Chen - jianwu.chen@cityofrockhill.com&lt;BR /&gt;Date: 01/03/2022&lt;BR /&gt;"""&lt;BR /&gt;import os&lt;BR /&gt;import pyodbc&lt;BR /&gt;import pandas&lt;BR /&gt;import datetime&lt;BR /&gt;import arcpy&lt;/P&gt;&lt;P&gt;statistics_csv = r"C:\temp\CityParcels\data\statistics.csv"&lt;BR /&gt;aprx_file = r"C:\temp\CityParcels\map.aprx"&lt;BR /&gt;pdf_path = r"C:\temp\CityParcels\PDF"&lt;BR /&gt;pdf_name = "CityParcels_" + datetime.date.today().isoformat() + ".pdf" # CityParcels_2021-01-01.pdf&lt;BR /&gt;pdf = os.path.join(pdf_path, pdf_name)&lt;BR /&gt;resolution = 400&lt;BR /&gt;image_quality = "BEST"&lt;BR /&gt;compress_vector_graphics = False&lt;BR /&gt;image_compression = "ADAPTIVE"&lt;BR /&gt;embed_fonts = True&lt;BR /&gt;layers_attributes = "LAYERS_ONLY"&lt;BR /&gt;georef_info = True&lt;BR /&gt;jpeg_compression_quality = 80&lt;BR /&gt;clip_to_elements = False&lt;BR /&gt;output_as_image = False&lt;BR /&gt;embed_color_profile = False&lt;/P&gt;&lt;P&gt;connection_str = """&lt;BR /&gt;Driver={ODBC Driver 17 for SQl Server};&lt;BR /&gt;Server=YOUR_DATABASE_SERVER;&lt;BR /&gt;Database=YOUR_GEODATABASE;&lt;BR /&gt;Uid=YOUR_LOGIN;&lt;BR /&gt;Pwd=YOUR_PASSWORD;&lt;BR /&gt;"""&lt;/P&gt;&lt;P&gt;sql_find_city_parcels = """&lt;BR /&gt;SET NOCOUNT ON&lt;/P&gt;&lt;P&gt;SELECT TaxMapID, OwnerName, OwnerAddress, OwnerCityStateZIP, PreviousOwner, PropertyAddress, LandUse, ImprovedStatus, BuildingType,&lt;BR /&gt;BuildingCount, FinishedSQFT, SaleLandUse, SaleDate, SalePrice, AprLandVal, AprBldgVal, AprMiscVal, AprTotVal, TaxLandVal, TaxBldgVal, TaxMiscVal,&lt;BR /&gt;TaxAgCredit, TaxTotVal, AsdLandVal, AsdBldgVal, AsdMiscVal, AsdTotVal, Shape.STArea()*0.0000229568 AS 'Acreage', Jurisdiction&lt;BR /&gt;INTO #prcl&lt;BR /&gt;FROM gio.Parcels&lt;BR /&gt;WHERE Jurisdiction = 'ROCK HILL'&lt;/P&gt;&lt;P&gt;ALTER TABLE #prcl ADD TIF_District varchar(20)&lt;/P&gt;&lt;P&gt;UPDATE #prcl&lt;BR /&gt;SET TIF_District = t.Name&lt;BR /&gt;FROM (&lt;BR /&gt;SELECT tif.NAME, p.TaxMapID&lt;BR /&gt;FROM gio.TIF_Districts AS tif&lt;BR /&gt;INNER JOIN gio.Parcels AS p ON p.Shape.STCentroid().STWithin(tif.Shape) = 1 AND p.Jurisdiction = 'ROCK HILL'&lt;BR /&gt;) AS t&lt;BR /&gt;WHERE t.TaxMapID = #prcl.TaxMapID&lt;/P&gt;&lt;P&gt;SELECT *&lt;BR /&gt;INTO #statistics&lt;BR /&gt;FROM (&lt;BR /&gt;SELECT CASE WHEN TIF_District IS NULL THEN 'Non-TIF District' ELSE TIF_District END AS 'Measurement\District',&lt;BR /&gt;COUNT(TaxMapID) AS 'Number of Parcels',&lt;BR /&gt;FORMAT(SUM(Acreage), '#,##0.00') AS 'Parcel Acreage',&lt;BR /&gt;FORMAT(SUM(AprLandVal), '#,##0') AS 'Market Land Value($)',&lt;BR /&gt;FORMAT(SUM(AprBldgVal), '#,##0') AS 'Market Building Value($)',&lt;BR /&gt;FORMAT(SUM(AprMiscVal), '#,##0') AS 'Market Misc Value($)',&lt;BR /&gt;FORMAT(SUM(AprTotVal), '#,##0') AS 'Market Total Value($)',&lt;BR /&gt;FORMAT(SUM(TaxLandVal), '#,##0') AS 'Taxable Land Value($)',&lt;BR /&gt;FORMAT(SUM(TaxBldgVal), '#,##0') AS 'Taxable Building Value($)',&lt;BR /&gt;FORMAT(SUM(TaxMiscVal), '#,##0') AS 'Taxable Misc Value($)',&lt;BR /&gt;FORMAT(SUM(TaxAgCredit),'#,##0') AS 'Agriculture Credit($)',&lt;BR /&gt;FORMAT(SUM(TaxTotVal), '#,##0') AS 'Taxable Total Value($)',&lt;BR /&gt;FORMAT(SUM(AsdLandVal), '#,##0') AS 'Assessed Land Value($)',&lt;BR /&gt;FORMAT(SUM(AsdBldgVal), '#,##0') AS 'Assessed Building Value($)',&lt;BR /&gt;FORMAT(SUM(AsdMiscVal), '#,##0') AS 'Assessed Misc Value($)',&lt;BR /&gt;FORMAT(SUM(AsdTotVal), '#,##0') AS 'Assessed Total Value($)'&lt;BR /&gt;FROM #prcl&lt;BR /&gt;GROUP BY TIF_District&lt;BR /&gt;UNION&lt;BR /&gt;SELECT 'City-Wide Total' AS 'Measurement\District',&lt;BR /&gt;COUNT(TaxMapID) AS 'Number of Parcels',&lt;BR /&gt;FORMAT(SUM(Acreage), '#,##0.00') AS 'Parcel Acreage',&lt;BR /&gt;FORMAT(SUM(AprLandVal), '#,##0') AS 'Market Land Value($)',&lt;BR /&gt;FORMAT(SUM(AprBldgVal), '#,##0') AS 'Market Building Value($)',&lt;BR /&gt;FORMAT(SUM(AprMiscVal), '#,##0') AS 'Market Misc Value($)',&lt;BR /&gt;FORMAT(SUM(AprTotVal), '#,##0') AS 'Market Total Value($)',&lt;BR /&gt;FORMAT(SUM(TaxLandVal), '#,##0') AS 'Taxable Land Value($)',&lt;BR /&gt;FORMAT(SUM(TaxBldgVal), '#,##0') AS 'Taxable Building Value($)',&lt;BR /&gt;FORMAT(SUM(TaxMiscVal), '#,##0') AS 'Taxable Misc Value($)',&lt;BR /&gt;FORMAT(SUM(TaxAgCredit),'#,##0') AS 'Agriculture Credit($)',&lt;BR /&gt;FORMAT(SUM(TaxTotVal), '#,##0') AS 'Taxable Total Value($)',&lt;BR /&gt;FORMAT(SUM(AsdLandVal), '#,##0') AS 'Assessed Land Value($)',&lt;BR /&gt;FORMAT(SUM(AsdBldgVal), '#,##0') AS 'Assessed Building Value($)',&lt;BR /&gt;FORMAT(SUM(AsdMiscVal), '#,##0') AS 'Assessed Misc Value($)',&lt;BR /&gt;FORMAT(SUM(AsdTotVal), '#,##0') AS 'Assessed Total Value($)'&lt;BR /&gt;FROM #prcl&lt;BR /&gt;) AS t&lt;BR /&gt;"""&lt;/P&gt;&lt;P&gt;sql_get_city_parcel_statistics = """&lt;BR /&gt;SELECT * FROM #statistics ORDER BY 'Number of Parcels'&lt;BR /&gt;drop table #prcl&lt;BR /&gt;drop table #statistics&lt;BR /&gt;"""&lt;/P&gt;&lt;P&gt;# 1. Use the SQL Server database to find parcels inside the City's limit, and calcluate their statistics, and&lt;BR /&gt;# export statistics table from database to python's dataframe in local computer's memory.&lt;BR /&gt;cnx = pyodbc.connect(connection_str);&lt;BR /&gt;cursor = cnx.cursor();&lt;BR /&gt;cursor.execute(sql_find_city_parcels)&lt;BR /&gt;cnx.commit()&lt;BR /&gt;print("Parcels found inside the City's limit.")&lt;/P&gt;&lt;P&gt;df = pandas.read_sql(sql_get_city_parcel_statistics, cnx)&lt;BR /&gt;print("Parcels' statistics read into pandas dataframe.")&lt;BR /&gt;cursor.close()&lt;BR /&gt;del cursor&lt;BR /&gt;cnx.close()&lt;/P&gt;&lt;P&gt;# 2. Export the statistics to CSV file.&lt;BR /&gt;statistics = df.T&lt;BR /&gt;statistics.to_csv(statistics_csv, header=False) # for the table in the PDF map.&lt;BR /&gt;print("Export statistics to CSV file.")&lt;/P&gt;&lt;P&gt;# 3. Create a PDF map.&lt;BR /&gt;aprx = arcpy.mp.ArcGISProject(aprx_file)&lt;BR /&gt;for lyt in aprx.listLayouts():&lt;BR /&gt;&amp;nbsp; if lyt.name == "City Parcels":&lt;BR /&gt;&amp;nbsp; &amp;nbsp; lyt.exportToPDF(pdf, resolution=resolution, image_quality=image_quality, compress_vector_graphics=compress_vector_graphics,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; image_compression=image_compression, embed_fonts=embed_fonts, layers_attributes=layers_attributes, georef_info=georef_info,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; jpeg_compression_quality=jpeg_compression_quality, clip_to_elements=clip_to_elements,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output_as_image=output_as_image, embed_color_profile=embed_color_profile)&lt;/P&gt;&lt;P&gt;print("PDF map created.")&lt;BR /&gt;print("Job done!")&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 01:22:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/map-with-a-statistics-table/m-p/1130179#M49697</guid>
      <dc:creator>JianwuChen</dc:creator>
      <dc:date>2022-01-04T01:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: map with a statistics table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/map-with-a-statistics-table/m-p/1130182#M49698</link>
      <description>&lt;P&gt;Hi Amelia,&amp;nbsp;&lt;/P&gt;&lt;P&gt;My bad I didn't look at the requirements on post. Please relocate the post to wherever is appropriate. thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 22:33:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/map-with-a-statistics-table/m-p/1130182#M49698</guid>
      <dc:creator>JianwuChen</dc:creator>
      <dc:date>2022-01-03T22:33:23Z</dc:date>
    </item>
  </channel>
</rss>

