Sunday, 26 February 2017

geocoding - Do shapefiles sometimes contain the necessary data for address resolution?



Right now I am doing address resolution with a ESRI file called Street_Addresses_US.loc which works. I have been given a shape file that contains streets that was compiled by the state. Is it theoretically possible that I could use this streets shapefile for address resolution? Or do shapefiles never contain the necessary data for address resolution?


By address resolution I mean put in an address get a lat / long. ArcEngine 10 C# VS2010.




ESRI support suggested converting a shapefile into a geodatabase file (.gdb) or (.mdb) so I went looking for that, and I'm going to post it here for the community




 public void ShapeFileToAccess()
{
//output
IWorkspaceName pWorkspaceName = new WorkspaceNameClass() as IWorkspaceName;
pWorkspaceName.WorkspaceFactoryProgID = "esriCore.AccessWorkspaceFactory";

pWorkspaceName.PathName = "c:\\Data\\test.mdb"; //this is the output file that is created
IFeatureClassName pFeatureClassName = new FeatureClassNameClass();
IDatasetName pDataSetName = pFeatureClassName as IDatasetName;
pDataSetName.WorkspaceName = pWorkspaceName;
pDataSetName.Name = "test";

//input
IWorkspaceName pInShpWorkspaceName = new WorkspaceNameClass() as IWorkspaceName;
pInShpWorkspaceName.PathName = "c:\\Data\\Shapefiles";
pInShpWorkspaceName.WorkspaceFactoryProgID = "esriCore.ShapefileWorkspaceFactory";

//define the dataset
IFeatureClassName pFCName = new FeatureClassNameClass() as IFeatureClassName;
IDatasetName pShpDatasetName = pFCName as IDatasetName;
pShpDatasetName.Name = "Roads.shp"; //this is your input file
pShpDatasetName.WorkspaceName = pInShpWorkspaceName;

//convert
IFeatureDataConverter pShpToFc;
pShpToFc = new FeatureDataConverterClass();
pShpToFc.ConvertFeatureClass(pFCName, null, null, pFeatureClassName, null, null, "", 1000, 0);

}

Answer



It is possible that the attributes necessary are available in the shapefile to do a reverse address lookup, but it's not required. I've seen shapefiles that didn't have any data other than the shape, so there's no guarantee that enough data will be available for you to perform a lookup with the shapefile alone.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...