I am in the process of evaluating the Map Suite MVC Edition and Geocoder. I am attempting to recreate the quick start demo for the Geocoder located here using an MVC Web Project with an OpenStreetMap layer as the base layer. I have encountered a problem in that the marker for 1701 Thome Ave is being placed in Lake Michigan. I believe the geocoding to be working correctly, but something is obviously wrong when I go to place the marker on the map. I have several questions.
1. First, the marker on the map is not drawn until I either zoom in or out. Why is this? I am making an explicit call to the redrawLayer function of the map. The following .js are attached to a button to initiate the geocoding process serverside and update the page with the response:
functionGeocode() {varaddress = $("#idAddressBox").val();varparam = { address: address };Map.ajaxCallAction(‘Home’,‘Geocode’, param, callback);};
functioncallback(result) {varresultString = result.get_responseData();if(resultString !=“”) {$("#idResultsArea").val(resultString);}Map.redrawLayer(“MarkerLayer”);};
2. When an InMemoryFeatureLayer is created, what is the default projection used? I think I read somewhere in the forums that an InMemoryFeatureLayer uses the same projection as the base overlay, though I may be remembering incorrectly.
3. The result from geocoding returns a centroid point defined: [CentroidPoint, POINT(-87.671919 41.9956200000006)] which is used to place the marker on the map using an InMemoryFeatureLayer. The coordinates are obviously geodetic. Currently I am using a custom function to convert the returned geodetic coordinates into spherical mercator, and then using those to create a PointShape which I then use to add a new feature into the InMemoryFeatureLayer. Is there no functionality to do this built in, or does there exist a means of doing this without having to manually convert the coordinates? The normal means of handling projection changes using the Proj4Projection class, say between OSM and a NAD83 shapefile would seem not to apply in this situation.