ThinkGeo.com    |     Documentation    |     Premium Support

House number searching with Map Suite Geocoder

 Hello,


I am new to ThinkGeo Map Suite. As I look at the sample code come with the Map Suite Geocoder, I found that Map Suite Geocoder able to search for house number, street and more (address) within an USA area using usaGeocoder. But if I want to use Map Suite Geocoder for other country data, I have to build my own index file for the match. And now I have some questions that relate to building the index file and address searching.


a) Is there any possible way to build my own index file with address house number in range, street name, street number and city to able for searching?


b) If possible, how I going to search for a house number and show the result on the map using Map Suite Web Edition?


Thanks,


 


 

 



Chamroeun,



Thanks for your post, you are right, if you want to use MapSuite Geocoder for the other countries, you have to build the special index data for the other countries, when you are building your own index data,  you have to determine the data source first, in our case, we imported all data soure into the SQL Server and export it to the index dbf file. Here are the steps for creating an index dbf file:


1, Get streets dbf columns according to your data source:


 


 



Collection<DbfMatchingPluginColumn> streetsColumnList = new Collection<DbfMatchingPluginColumn>();
            streetsColumnList.Add(new DbfMatchingPluginColumn(ThinkGeo.MapSuite.MapSuiteGeocoder.GeocoderHelper.streetColumnName, ThinkGeo.MapSuite.MapSuiteGeocoder.DbfMatchingPluginColumnType.Long, 4));
            streetsColumnList.Add(new DbfColumnDefinition(ThinkGeo.MapSuite.MapSuiteGeocoder.GeocoderHelper.prefixColumnName, ThinkGeo.MapSuite.MapSuiteGeocoder.DbfColumnType.Long));
            streetsColumnList.Add(new DbfColumnDefinition(ThinkGeo.MapSuite.MapSuiteGeocoder.GeocoderHelper.suffixColumnName, ThinkGeo.MapSuite.MapSuiteGeocoder.DbfColumnType.Long));
            streetsColumnList.Add(new DbfColumnDefinition(ThinkGeo.MapSuite.MapSuiteGeocoder.GeocoderHelper.streetTypeColumnName, ThinkGeo.MapSuite.MapSuiteGeocoder.DbfColumnType.Long));
            streetsColumnList.Add(new DbfMatchingPluginColumn(ThinkGeo.MapSuite.MapSuiteGeocoder.GeocoderHelper.dtTlidColumnName, ThinkGeo.MapSuite.MapSuiteGeocoder.DbfMatchingPluginColumnType.Long, 4));
            streetsColumnList.Add(new DbfMatchingPluginColumn(ThinkGeo.MapSuite.MapSuiteGeocoder.GeocoderHelper.fromLeftColumnName, ThinkGeo.MapSuite.MapSuiteGeocoder.DbfMatchingPluginColumnType.Long, 4));
            streetsColumnList.Add(new DbfMatchingPluginColumn(ThinkGeo.MapSuite.MapSuiteGeocoder.GeocoderHelper.toLeftColumnName, ThinkGeo.MapSuite.MapSuiteGeocoder.DbfMatchingPluginColumnType.Long, 4));
            streetsColumnList.Add(new DbfMatchingPluginColumn(ThinkGeo.MapSuite.MapSuiteGeocoder.GeocoderHelper.fromRightColumnName, ThinkGeo.MapSuite.MapSuiteGeocoder.DbfMatchingPluginColumnType.Long, 4));
            streetsColumnList.Add(new DbfMatchingPluginColumn(ThinkGeo.MapSuite.MapSuiteGeocoder.GeocoderHelper.toRightColumnName, ThinkGeo.MapSuite.MapSuiteGeocoder.DbfMatchingPluginColumnType.Long, 4));
            streetsColumnList.Add(new DbfMatchingPluginColumn(ThinkGeo.MapSuite.MapSuiteGeocoder.GeocoderHelper.dtZipColumnName, ThinkGeo.MapSuite.MapSuiteGeocoder.DbfMatchingPluginColumnType.String, 5));
            streetsColumnList.Add(new DbfMatchingPluginColumn(ThinkGeo.MapSuite.MapSuiteGeocoder.GeocoderHelper.fromLongitudeColumnName, ThinkGeo.MapSuite.MapSuiteGeocoder.DbfMatchingPluginColumnType.Long, 4));
            streetsColumnList.Add(new DbfMatchingPluginColumn(ThinkGeo.MapSuite.MapSuiteGeocoder.GeocoderHelper.fromLatitudeColumnName, ThinkGeo.MapSuite.MapSuiteGeocoder.DbfMatchingPluginColumnType.Long, 4));
            streetsColumnList.Add(new DbfMatchingPluginColumn(ThinkGeo.MapSuite.MapSuiteGeocoder.GeocoderHelper.toLongitudeColumnName, ThinkGeo.MapSuite.MapSuiteGeocoder.DbfMatchingPluginColumnType.Long, 4));
            streetsColumnList.Add(new DbfMatchingPluginColumn(ThinkGeo.MapSuite.MapSuiteGeocoder.GeocoderHelper.toLatitudeColumnName, ThinkGeo.MapSuite.MapSuiteGeocoder.DbfMatchingPluginColumnType.Long, 4));
            streetsColumnList.Add(new DbfMatchingPluginColumn(ThinkGeo.MapSuite.MapSuiteGeocoder.GeocoderHelper.stateColumnName, ThinkGeo.MapSuite.MapSuiteGeocoder.DbfMatchingPluginColumnType.String, 2));
            streetsColumnList.Add(new DbfMatchingPluginColumn(ThinkGeo.MapSuite.MapSuiteGeocoder.GeocoderHelper.countyColumnName, ThinkGeo.MapSuite.MapSuiteGeocoder.DbfMatchingPluginColumnType.String, 25));
            streetsColumnList.Add(new DbfMatchingPluginColumn(ThinkGeo.MapSuite.MapSuiteGeocoder.GeocoderHelper.cityColumnName, ThinkGeo.MapSuite.MapSuiteGeocoder.DbfMatchingPluginColumnType.String, 30));
            streetsColumnList.Add(new DbfMatchingPluginColumn(ThinkGeo.MapSuite.MapSuiteGeocoder.GeocoderHelper.pointsStartIndexColumnName, ThinkGeo.MapSuite.MapSuiteGeocoder.DbfMatchingPluginColumnType.Long, 4));
            streetsColumnList.Add(new DbfMatchingPluginColumn(ThinkGeo.MapSuite.MapSuiteGeocoder.GeocoderHelper.pointCountColumnName, ThinkGeo.MapSuite.MapSuiteGeocoder.DbfMatchingPluginColumnType.Long, 4));

2, Create streets dbf file and prepared to build it from the data source:



DbfMatchingPlugin.CreateDbf(Path.Combine(indexFilePath, "streets.dbf"), streetsColumnList);
                DbfMatchingPlugin streetdbf = new DbfMatchingPlugin(Path.Combine(indexFilePath, "streets.dbf"), DbfMatchingPluginReadWriteMode.ReadWrite);
                streetdbf.Open();

3, Start to build the streets index dbf file:  
 streetdbf.AddRecord(new object[] { 
                                                   streetNameIndex,   
                                                   PrefixDirection,
                                                   SuffixDirection,
                                                   StreetType,
                                                   tlid,
                                                   lfromadd,
                                                   ltoadd,
                                                   rfromadd,
                           rtoadd,
                                                   zip,
                                                   FromLongitude,
                                                   FromLaitude,
                                                   ToLongitude,
                                                   ToLaitude,
                                                   STATEFP,
                                                    county,
                                                    city,
                                                    pointStartIndex,
                                                    VerticesCount});


This is just a sample code to show you how to build your own index dbf file use MapSuiteGeocoder, the code cannot be compiled successfully because of you must use your own variable to instead fo the current one and maybe your data source is not the same as the sample.  About your second questions, you can use the MapSuiteGeocoder component with MapSuite web edition directly in your project, you just need to reference it and use it.   In addition, if you need our helps to build your own index dbf file with your data source, we are pleasure to work on that,   


Thanks,  


Scott,