<commit_before>from django.contrib.gis.gdal import SpatialReference
from django.contrib.gis.utils import LayerMapping
from django.db import IntegrityError
import dbfread
import os
import shutil

import glob
import tempfile
from urllib import request
from urllib.parse import urlparse
from zipfile import ZipFile

from parcel.models import Parcel

name = "<NAME>"
shapefile_url = "http://wsgw.mass.gov/data/gispub/shape/l3parcels/L3_SHP_M274_SOMERVILLE.zip"

# Note: This is the WKT from M274TaxPar.prj, with one important difference. The
# given WKT specifies Lambert_Conformal_Conic, which is ambiguous. The intended
# meaning is Lambert_Conformal_Conic_2SP.
srs_wkt = 'PROJCS["NAD_1983_StatePlane_Massachusetts_Mainland_FIPS_2001",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["False_Easting",200000.0],PARAMETER["False_Northing",750000.0],PARAMETER["Central_Meridian",-71.5],PARAMETER["Standard_Parallel_1",41.71666666666667],PARAMETER["Standard_Parallel_2",42.68333333333333],PARAMETER["Latitude_Of_Origin",41.0],UNIT["Meter",1.0]]'


def import_shapes(shapefile_path, logger):
    srs = SpatialReference(srs_wkt)
    lm = LayerMapping(
        Parcel,
        shapefile_path, {
            "shape_leng": "SHAPE_Leng",
            "shape_area": "SHAPE_Area",<commit_msg>Updated the MassGIS shapefiles URL<commit_after>from django.contrib.gis.gdal import SpatialReference
from django.contrib.gis.utils import LayerMapping
from django.db import IntegrityError
import dbfread
import os
import shutil

import glob
import tempfile
from urllib import request
from zipfile import ZipFile

from parcel.models import Parcel

name = "<NAME>"
shapefile_url = "http://download.massgis.digital.mass.gov/shapefiles/l3parcels/L3_SHP_M274_SOMERVILLE.zip"

# Note: This is the WKT from M274TaxPar.prj, with one important difference. The
# given WKT specifies Lambert_Conformal_Conic, which is ambiguous. The intended
# meaning is Lambert_Conformal_Conic_2SP.
srs_wkt = 'PROJCS["NAD_1983_StatePlane_Massachusetts_Mainland_FIPS_2001",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["False_Easting",200000.0],PARAMETER["False_Northing",750000.0],PARAMETER["Central_Meridian",-71.5],PARAMETER["Standard_Parallel_1",41.71666666666667],PARAMETER["Standard_Parallel_2",42.68333333333333],PARAMETER["Latitude_Of_Origin",41.0],UNIT["Meter",1.0]]'


def import_shapes(shapefile_path, logger):
    srs = SpatialReference(srs_wkt)
    lm = LayerMapping(
        Parcel,
        shapefile_path, {
            "shape_leng": "SHAPE_Leng",
            "shape_area": "SHAPE_Area",
{'fraction_non_alphanumeric': 0.11015193370165746, 'fraction_numerical': 0.08632596685082873, 'mean_word_length': 7.137640449438202, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6257256', 'n_tokens_mistral': 1206, 'n_tokens_neox': 1019, 'n_words': 161}