typpo / ca-property-tax

CA property tax visualization
https://www.officialdata.org/ca-property-tax/
GNU Affero General Public License v3.0
88 stars 17 forks source link

Adding Napa County #11

Closed miloconway closed 3 years ago

miloconway commented 3 years ago

Following the same format as that done for Solano County. However ran into a wrinkle - the coordinate system from the shp file doesn't seem to be long-lat and not quite sure how to work with it.

The input data file contains an associated XML file for the SHP that has the following:

<coordRef>
<type Sync="TRUE">Projected</type>
<geogcsn Sync="TRUE">GCS_North_American_1983</geogcsn>
<csUnits Sync="TRUE">Linear Unit: Foot_US (0.304801)</csUnits>
<projcsn Sync="TRUE">NAD_1983_StatePlane_California_II_FIPS_0402_Feet</projcsn>
<peXml Sync="TRUE"><ProjectedCoordinateSystem xsi:type='typens:ProjectedCoordinateSystem' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:typens='http://www.esri.com/schemas/ArcGIS/10.7'><WKT>PROJCS[&quot;NAD_1983_StatePlane_California_II_FIPS_0402_Feet&quot;,GEOGCS[&quot;GCS_North_American_1983&quot;,DATUM[&quot;D_North_American_1983&quot;,SPHEROID[&quot;GRS_1980&quot;,6378137.0,298.257222101]],PRIMEM[&quot;Greenwich&quot;,0.0],UNIT[&quot;Degree&quot;,0.0174532925199433]],PROJECTION[&quot;Lambert_Conformal_Conic&quot;],PARAMETER[&quot;False_Easting&quot;,6561666.666666666],PARAMETER[&quot;False_Northing&quot;,1640416.666666667],PARAMETER[&quot;Central_Meridian&quot;,-122.0],PARAMETER[&quot;Standard_Parallel_1&quot;,38.33333333333334],PARAMETER[&quot;Standard_Parallel_2&quot;,39.83333333333334],PARAMETER[&quot;Latitude_Of_Origin&quot;,37.66666666666666],UNIT[&quot;Foot_US&quot;,0.3048006096012192],AUTHORITY[&quot;EPSG&quot;,2226]]</WKT><XOrigin>-115211800</XOrigin><YOrigin>-93821500</YOrigin><XYScale>36983428.057351544</XYScale><ZOrigin>-100000</ZOrigin><ZScale>10000</ZScale><MOrigin>-100000</MOrigin><MScale>10000</MScale><XYTolerance>0.0032808333333333331</XYTolerance><ZTolerance>0.001</ZTolerance><MTolerance>0.001</MTolerance><HighPrecision>true</HighPrecision><WKID>102642</WKID><LatestWKID>2226</LatestWKID></ProjectedCoordinateSystem></peXml>
</coordRef>

This probably contains the info needed to translate the coordinates but not sure how to use it

miloconway commented 3 years ago

OK, figured out the coordinate system translation, updated.

Generated file: https://drive.google.com/file/d/14ec-92Fmkn-VL5QrzL3T0tDVMZ2_2tjN/view?usp=sharing

typpo commented 3 years ago

This is looking great!

The XY coordinates are CA State Plane coordinates at Napa is in Zone 2 (ESPG 2226):

from pyproj import Transformer

# California Zone 2
# https://epsg.io/2226
transformer = Transformer.from_crs(2226, 4326)

# ....later on in your parcel loop....
lat, lng = transformer.transform(y_coord, x_coord)

You may have to swap x/y lng/lat. I've seen the order of the coordinate vary between datasources.

Hope this helps :+1:

miloconway commented 3 years ago

@typpo yup! i examined the generated geojson output for the default output and previously working samples and figured out how to get it working, the code and the linked g-drive data in the subsequent comment should work!

typpo commented 3 years ago

Oops, I totally missed that. Merging & updating the data now!