ThinkGeo.com    |     Documentation    |     Premium Support

Projection

Hi everybody


I have a shape file with the following projection; WSG 84 zone 37 S. Can anybody help me with how to specify this projection on the

Best Regards,


Vincent


 



GetProjectionsCore() of my plugin?



Hi, Vincent


I guess that you mean “WGS 84 / UTM zone 37S”. I have checked that, its prj4 string is “+proj=utm +zone=37 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs” and the CRS number is 32737, so that you need to add “EPSG: 32737” to GetProjectionsCore method, like the codes below:
protected override Collection<string> GetProjectionsCore()
{
    return new Collection<string> { "EPSG:32737" };
}
If you have additional questions, please let us know.
Thanks,
Khalil

Hi Khalil


Thank you for the reply. I have added it to GetProjectionCore(),  but this time it is returning a blunk map with a watermark saying "we don't support EPSG:4326"


Best Regards,


Vincent



Hi, Vincent


If you need to use another projection on the server-side, and you need to specify it on the client-side. For the TiledWmsLayer and you can add it like this way:
            tiledWmsLayer.Crs = "EPSG:32737";
And for WmsOverlay or other overlays used to consume WMS Server and you can add it like this way:
          wmsOverlay.Parameters.Add("SRS", "EPSG:32737");
Thanks,
Khalil

Hi Khalil


Thank you for the reply. Basically what I am trying to do is to programmatically set up my plugin to open an ESRI shape file. I have tried to follow the instructions you have given me but I have not yet managed to open the shape file. If you have any other alternative way of openning an ESRI shape file or even a sample code snipet, I truly appreciate if you pass it to me.


Best Regards,


Vincent



Hi, Vincent


I guess there is some problem in your codes.
Can you send the ESRI shape file to us? So we can have a try for it. If you would like to do that, please send it to forumsupport@thinkgeo.com. If so, I suggest you send it using another email account, because your last email includes virus and your account seems has been blocked.
Also you can give a try for the Map Suite Explorer which is a home grown explore tool for shape files, and you just need to drag your data to it.
If you have additional questions, please let me know.
Thanks,
Khalil

Hi Khalil


Thank you for your reply. I have opened my shape file using Map Suite explorer and detected that, it was missing spatial index. Having created the spatial index the shape file opened in the explorer. In my code now, there is no more error messages but it is opening a blunk map and the customColumn fetch event does not fire. Can you say something based on this clue?


Best Regards,


Vincent



Hi Khalil


On the Map suite explorer, if I begin by adding countries layer from your sample data is shows well, and then if I Add my layer, the layer of mine does not show. And if I begin with adding my layer and then yours, mine show but yours does not.


I think there is a problem of scaling. And the same might be happening in my code because my shape file does not show and unlike the previous trials, this time there is no any error message returned.


Best Regards,


Vincent



Vincent,


These two shape files have different projections so that they can’t overlap with each other in the Map Suite Explorer.


Have you set the projection on the FeatureSource of ShapeFileFeatureLayer? If you use ESRI shape file and its projection is not “EPSG:4326” and you need to project it. If you don’t familiar with how to set the projection, please refer to the samples included in the “Samples\Projection” folder in our installed samples.


If you still can’t show it, please send your data to us and we will address it quickly. Your help will be appreciated.


Thanks,


Khalil


 



Hi Khalil


Thank you for the help. I have put projection in my code for the ESRI shape file and everything is going well, even the customColumnFetch event is firing, except that there is no any map displayed. There is no error message returned. Below is my code.


 



 



protected override MapConfiguration GetMapConfigurationCore(string style, string crs)// Get the directory to the sample data

 


//string worldLayerFilePath = Directory.GetParent(Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).FullName).FullName + "\\SampleData\\Countries02.shp";

 


 


 


 


 


proj4.InternalProjectionParametersString = proj;


proj4.ExternalProjectionParametersString =


 


 


 


worldLayer.FeatureSource.Projection = proj4;


worldLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle =


worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle =


worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel =


worldLayer.FeatureSource.CustomColumnFetch +=


 


 


mapConfiguration.Layers.Add(


 


 


 


}


 


{


string worldLayerFilePath = Directory.GetParent(Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).FullName).FullName + "\\SampleData\\MAKUTI_region.shp";string proj = "+proj=utm +zone=37 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs";Proj4Projection proj4 = new Proj4Projection(); Proj4Projection.GetEpsgParametersString(4326);ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(worldLayerFilePath);TextStyles.Capital1("Test11");AreaStyles.Country1;ApplyUntilZoomLevel.Level20;new EventHandler<CustomColumnFetchEventArgs>(FeatureSource_CustomColumnFetch);MapConfiguration mapConfiguration = new MapConfiguration(); "WorldLayer", worldLayer);return mapConfiguration;void FeatureSource_CustomColumnFetch(object sender, CustomColumnFetchEventArgs e)

 


e.ColumnValue =


 


}


 


string columnName = e.ColumnName;"My Country"; 


{


 


 



Sorry Khalil


The code in the above post does not show well. I have attached a text file here with the same code.


Best Regards,


Vincent.



MyCode.txt (2.02 KB)

Hi, Vincent 
  
 Maybe there is some problem beteween 32737 of EPSG and 4326 of EPSG. Can you send us the data you are consuming? So that we can test it. 
  
 Thanks, 
  
 Khalil

Hi Khalil


Thank you for the reply. I have learned that, the map is openning but at a very tiny scale. I have attached my latest code on the issue. Can you please help me with how to set a scale to the map programatically.


Best Regards,


Vincent



001_MyCode.txt (2.36 KB)

Hi, Vincent


Thanks for you attached shape file from email. I have tried to render it, please see the codes in the attached “arterial_shape_file” flat file.
If you want to set the scale, and you need to get the BoundingBox from the ShapeFileFeatureLayer like the codes below:
  worldLayer.Open();
  RectangleShape extent = worldLayer.GetBoundingBox();
 worldLayer.Close();
And then set it on the CurrentExtent property of map control.
Thanks,
Khalil

Hi, Vincent


I have got the “Dar_Ward” shape file just now, and I have given a try for that. You don’t need to project it. Please refer to the code in the attachment.
If you have additional questions, please let us know.
Thanks,
Khalil

Codes_Server&Client.txt (2.17 KB)

Hi Khalil


Thank you for the reply. It has worked and I have discovered where I was making mistakes. My big problem is on specifying RectangleShape in the plugin side and client side. Can you give me any elaborative material that I can read through and get more insights over the issue here?


 


Best Regards,


Vincent



Hi Khalil


I have also been trying without success to access the same plugin from a silverlight client. Can you please give me a sample code to display the same Dar_Ward.shp in the silverlight client?


Best Regards,


Vincent



Hi, Vincent


Here is a sample code for how to consume WMS service in MapSuite SilverlightEdition product. Please have a look at it.
Thanks,

Khalil



SilverlightApplicationForVincent.zip (18.4 KB)

 


Hi Khalil
Thank you for the reply. It has worked and I have discovered where I was making mistakes. My big problem is on specifying RectangleShape in the plugin side and client side. Can you give me any elaborative material that I can read through and get more insights over the issue here
Best Regards,

Hi, Vincent


I suggest that you can refer to our Quick Start Guide which will tell you what is ShapeFileFeatureLayer or Map, and how to use Styles etc., and will help you become familiar with Map Suite products.
 
Also if you have any questions about our products, and you can raise a post in Map Suite Discussion Forums and you will get a quick response for your questions.
 
Thanks,
 
Khalil