ThinkGeo.com    |     Documentation    |     Premium Support

"The projection is not open..." error msg

In my application, I am using the Google Map and overlayed with 2 or 3 shape files .  I have started testing the application on a different server and accessing it via Internet Explorer 6.  I installed the application on the test web server by simply copying the existing files from my development system, including the "bin" directory, into the "wwwroot" directory of the test server.  The first time I ran the application, remotely, it crashed with the error message that it couldn't find the "MapSuiteProjection.dll" file.  I thought this was strange, as this file isn't in the "bin" directory where the other dll files are.  On my development system, I found the "MapSuiteProjection.dll" file in the "System32" directory, where the entire beta version is installed.  I copied the file into the "bin" directory on the test server and then it worked.



Do I need to install the entire evaluation version on the test server?  I didn't need to do that in the past.



Another problem is that sometimes the shape files don't display and there is a message in the upper left corner stating: "The projection is not open.  Please open it before calling this method."  I assume that this has something to do with the Proj4Projection class.  I followed the examples, setting the projection of the shape files to the variable created from this class.



I am also creating 2 InMemoryFeatureLayers, but am NOT setting the projection for them, as that caused errors.



Both of these issues seem to only happen when running the app with Internet Explorer 6...which seems kind of strange...unless it is a client-side thing...



Any ideas?



Thanks as always,

Tom


PS  The transparency issue works just fine now in IE6!! :-)



Tom 
  
 You don’t need to install the evaluation version on the Test server, but you need to copy some assemblies there. Those assemblies will only be invoked when you are using certain functions and I think that’s why you didn’t need to do that in the past.  For example, besides MapSuiteProjection.dll there are some others assemblies like MapSuiteECW2005.dll or MapSuiteMrSids2005.dll, it doesn’t matter if they exists in your new server if you are not displaying ECW or MrSids pics. 
  
 We recreated your second problem and confirmed that’s a bug. It happens occasionally no matter you are using IE6 or IE7. We have input it into our issue system and will work on it. 
  
 Any more queries please let us know. 
  
 Ben 


I’m using the 3.1.16 full version, I’m in the same situation of Tom. 
 Using some InMemoryFeatureLayer, I obtain the following error: “The projection is not open.  Please open it before calling this method.”. 
  
 I’ve tried to call the Open method on Proj4Projection and on InMemoryFeatureLayer.FeatureSource, but with no luck. 
  
 Do you have any suggestion or patch? 
  
 Thanks 
  
 Fabio

I have the same error when I use shapefiles whith units metrics.


My code:


------------------------------------------------------------------------------------------------


Map1.MapUnit = GeographyUnit.Meter;

Map1.CurrentExtent = new RectangleShape(274000, 7454000, 430000, 7300000);


ShapeFileFeatureLayer municipio = new ShapeFileFeatureLayer(@"C:\Projeto\teste_utm_geo\mapas\utm\MUNICIPIO.shp", ShapeFileReadWriteMode.ReadOnly);

municipio.FeatureSource.Projection = new Proj4Projection(29183, 29183);

municipio.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.County1;

municipio.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

Map1.StaticOverlay.Layers.Add(municipio);


ShapeFileFeatureLayer bairro = new ShapeFileFeatureLayer(@"C:\Projeto\teste_utm_geo\mapas\utm\BAIRRO.shp", ShapeFileReadWriteMode.ReadOnly);

bairro.FeatureSource.Projection = new Proj4Projection(29183, 29183);

bairro.ZoomLevelSet.ZoomLevel09.DefaultAreaStyle = AreaStyles.Tundra1;

bairro.ZoomLevelSet.ZoomLevel09.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

Map1.StaticOverlay.Layers.Add(bairro);


------------------------------------------------------------------------------------------------


When I open the project it works, but when I apply zoom in return the message of error:


"The projection is not open. Please open it before calling this method.".


Thanks.


 


 



Fabio and Helio, 
  
 We used to have this problem in the previous version but it should now be solved in the current 3.1.16 one. Following is our test code which works fine on my machine (Dual Core). Could you please try the following codes or the “ShapeFileOverGoogleMap” sample under Samples->Overlays to see if the problem exists there? If problem only exists with your sample, can you send it to us so we can have a test here? 
  
 Here is the codes we tested with, it works fine on my machine. 
  
 
if (!Page.IsPostBack)
        {
            Map1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#B3C6D4"));
            Map1.CurrentExtent = new RectangleShape(-5518141.94,15849982.18301,19059114.37809,-2113330.95);
            Map1.MapUnit = GeographyUnit.Meter;
            Map1.MapTools.MouseCoordinate.Enabled = true;
 
            GoogleOverlay google = new GoogleOverlay("Google Map");
            google.JavaScriptLibraryUri = new Uri(ConfigurationManager.AppSettings["GoogleUri"]);
            google.GoogleMapType = GoogleMapType.Normal;
            Map1.BackgroundOverlay = google;
 
            InMemoryFeatureLayer inMemoryLayer = new InMemoryFeatureLayer();
            inMemoryLayer.InternalFeatures.Add("Polygon", new Feature(BaseShape.CreateShapeFromWellKnownData("POLYGON((10 60,40 70,30 85, 10 60))")));
            inMemoryLayer.InternalFeatures.Add("Multipoint", new Feature(BaseShape.CreateShapeFromWellKnownData("MULTIPOINT(12 20, 30 20,40 20, 12 30, 30 30, 40 30)")));
            inMemoryLayer.InternalFeatures.Add("Line", new Feature(BaseShape.CreateShapeFromWellKnownData("LINESTRING(60 60, 70 70,75 60, 80 70, 85 60,95 80)")));
            inMemoryLayer.InternalFeatures.Add("Rectangle", new Feature(new RectangleShape(65, 30, 90, 15)));

            inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(100, GeoColor.StandardColors.RoyalBlue);

            inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColor.StandardColors.Blue;
            inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle.OuterPen = new GeoPen(GeoColor.FromArgb(200, GeoColor.StandardColors.Red), 5);
            inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.SymbolPen = new GeoPen(GeoColor.FromArgb(255, GeoColor.StandardColors.Green), 8);
            inMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;


            Proj4Projection proj4 = new Proj4Projection();
            proj4.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4326);
            proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString();
            inMemoryLayer.FeatureSource.Projection = proj4;
 
            Map1.DynamicOverlay.Layers.Add(inMemoryLayer);
        }
 
  
 Thanks, 
  
 Ben 


Hi Ben, 
 I found the error: I shared the Proj4Projection object between 2/3 layers. 
 My application has several layers, and in some of them I forgot to create new Proj4Projection. 
 After setting a new projection for each layer, the program works fine! 
  
 Thanks for your support. 
  
 Fabio

Fabio, 


That’s great your app now works fine.
 
With the version (3.1.16), it should not have problem even when multi layer are using one proj4 object.  Just wonder if it’s not too inconvenient, can you let us know more about your application which have this issue? For any sensitive data, please send it to support@thinkgeo.com and ask to forward to Ben.
 
Thanks,
 
Ben

Helio, 
  
 It doesn’t make too much sense for the following code 
 
municipio.FeatureSource.Projection = new Proj4Projection(29183, 29183);
 
 We use Proj4Projection when we want to convert the data from one projection to another. For example, if I have the city data in DecimalDegree and I want to plot it on GoogleMap, I need to use the Proj4Projection object to convert the city data’s projection from DecimalDegree to GoogleMap’s projection (see sample: Markers->AddProjectedMarkers).  
  
 In your above code, the “ToProjection” and “FromProjection” are the same (29183), that’s not a conversion and the projection doesn’t take any effects. If your data is in another projection and you just want to display it, you just need to set the right map unit (meter or inch which fits the projection) and your data will show fine. 
  
 Hope that helps! 
  
 Thanks, 
  
 Ben