ThinkGeo.com    |     Documentation    |     Premium Support

Map projections

Hey Guys,

One more question for you.

I know that the background maps like openstreetmaps/bing/google are typically in spherical mercator. The problem I’m currently running into is that I’m trying to plot a whole bunch of data as points on the map, and all our data is in WGS84.

I know I can reproject the data points so they match the background layer projection, but that’s taking a significant amount of time.

As an example, we are at times having to plot upwards of 20,000 data points. As you can imagine, converting all this data to a different projection takes quite a while.

is there a way to reproject the background layers to WGS84 (4326), so that we can quickly plot our data?

As an added note for this application I believe I’ll be using bing maps for the background.

Thanks for any help.

Regards,

Aaron

Thanks Aaron,
I think even you don’t convert the projection just drop 20k points to the inmemorylayer it will take some time. I recommend you pre-process the points data. You can covert these data to the 3857(Bing/google/openstreetmap projection) and save them to the shape file. And load the shape file to render.This will much faster. Only load the data which will change to the inmemorylayer.
Here is the code to generate the shape file.

        Crate new file

        DbfColumn dc = new DbfColumn("Test", DbfColumnType.Character, 10, 0);
        Collection<DbfColumn> collection = new Collection<DbfColumn>();
        collection.Add(dc);
        ShapeFileFeatureSource.CreateShapeFile(ShapeFileType.Point, @"D:\test.shp", collection);


        //Open new file
        ShapeFileFeatureSource newFeatureSource = new ShapeFileFeatureSource(@"D:\test.shp", System.IO.FileAccess.ReadWrite);
        newFeatureSource.Open();
        newFeatureSource.BeginTransaction();
        TransactionResult result = new TransactionResult();
        for (int j = 0; j < 100; j++)
        {
            Feature feature = new Feature(new PointShape(10, 10)); // Do the projection convert here
            feature.ColumnValues.Add("Test", "T");
            newFeatureSource.AddFeature(feature);
        }
        newFeatureSource.CommitTransaction();

Let me know if this work for you.

Thanks

Frank

Thanks again Frank.

I did what you suggested, but with a slight difference.
Rather than reprojecting the point when adding it to the shape file, I added all data in its native projection.
Once the file was created I loaded it using ShapeFileFeatureLayer, which I then set the ProjectionConverter on.

This allowed all data to be loaded pretty quickly, and avoided reprojecting each individual point.

Thanks for the suggestion.

Aaron

Thanks Aaron,
Good to know it works. Reprojecting is pretty fast. Adding 20k points to inmemorylayer is slow. The shape file has the R-tree index. It only load what you need to display from disk. so it pretty fast.

Let us know if you have any more questions.

Thanks

Frank