User Tools

Site Tools


map_suite_windows_phone_edition_faq_projection

Map Suite Windows Phone Edition FAQ Projection

How do I display world coordinate on a map?

This question has a corresponding sample application(s) associated with it.

Sample:World Coordinates

The purpose of this project is to complete the section “Screen & World Coordinates” of the “How Do I?” sample apps. You will learn how to display world coordinates at the mouse event. Notice that the Layer is in Mercator projection and we use a projection conversion to display Longitude and Latitude in addition to the world coordinates values in meters from the Mercator projection. Also, we are reusing the DecimalDegrees static class we used in a previous project for formatting decimal degrees.

How do I display proper world coordinates when a map is being rotated?

This question has a corresponding sample application(s) associated with it.

Sample:World Coordinate with Rotation

In the “How Do I” sample apps, in the section “Projection”, you can find the sample “Use RotationProjection for a feature layer”. It allows to basically rotating the map to any angle. You can see how useful this can be by having the map rotated according to a vehicle direction, for example. Now, what is missing in this sample are the world coordinates in the status bar at the mouse move event. Today we show how to do that and what technique to use.

How can I change the datum while keeping the projection the same?

This question has a corresponding sample application(s) associated with it.

Sample:Datum Transformation

The purpose of today’s project is show how to handle the scenario where you have to apply a datum transformation to your data while keeping the same projection. This project addresses some confusion that might exist about the difference between datum and projection. We take a concrete example of a point in degrees using the ED50 datum and we apply a datum transformation so that it is in degrees using the WGS84 datum. Please, read carefully the comments to better grasp some key concepts.

How do I get the intersecting point of two streets?

This question has a corresponding sample application(s) associated with it.

Sample:Street Intersection

From a request in the Discussion Forum, we decided to post a project today related to street intersection. In this project, we show how to get the intersection point of two streets. Basically, we get all the street features according to the street name and based on the shapes from those features, we do use some geometric function to determine what the intersection point of those two streets is. Keep in mind that the code provided in this sample app might not be the fastest or more optimized but it basically shows the algorithm for that purpose. This algorithm will be used to complement the Map Suite Geocoder product for Intersection geocoding.

How do I know which state plane projection to use based on a decimal degree point?

This question has a corresponding sample application(s) associated with it.

Sample:Geodetic to State Plane

Having to project a layer from geodetic (decimal degrees) to State Plane is a common task in GIS. One of the challenges is to know what State Plane zone a layer belongs to. This project is basically a little utility for State Plane projection needs. With the help of the State Plane zones layer provided, any layer in geodetic can be projected automatically to State Plane without having to do research to know the specific zone a layer belongs to. The opposite task (that comes even more frequently) of going from State Plane to Geodetic is unfortunately impossible to accomplish the same automatic way.

How do I automatically project my decimal degree data to UTM?

This question has a corresponding sample application(s) associated with it.

Sample:Geodetic to UTM on the fly

A common situation with dealing with geographic data from different sources is to have to “match” data in decimal degrees (Geodetic) with data in the local system of UTM. For example, you may have vector data in decimal degrees and an image in UTM. Projecting vector data is always more straightforward than projecting image data, that is why it is preferable to project the vector data to the image, rather than the opposite. In this project, we show the example of projecting a vector layer in decimal degrees (Geodetic) to UTM to “match” a tiff in that projection.

The appropriate EPSG number for our example can be found at: http://spatialreference.org/

How do I convert shape file data from one projection to another?

This question has a corresponding sample application(s) associated with it.

Sample:Save To Projection

In the Projection section of the “How Do I” sample apps, there is a sample app that shows how to project on the fly a layer in one projection to another. While this is useful, you may be in the need to actually create a new layer in the desired projection. This project shows how to use the API SaveToProjection of ShapeFileFeatureLayer. In this project we use the example where you need your data in a regional projection saved to WGS84 (decimal degrees) to match other data such as GPS readings or the WorldMapKit.

How do I route in one projection and display the route information in another projection?

This question has a corresponding sample application(s) associated with it.

Sample:Routing with Projections

From a Discussion Forum request, in today’s project we show how to perform routing in one projection and display the result in another. You may be in the situation where you have your routable street data in State Plane meters and you have your base map in Geodetic (decimal degrees). This project shows you how to handle this case.

How do I show a great circle line across the pacific rim?

This question has a corresponding sample application(s) associated with it.

Sample:Great Circle on Pacific Rim

This project extends what we learned in Pacific Rim. We show how to apply the Offset projection to Great Circle to have it displaying correctly over the pacific as opposed to Google Map where the same Great Circle is shown broken down.

How can I visualize the distortion of a projection will cause on my data?

This question has a corresponding sample application(s) associated with it.

Sample:Projection Distortion

Today’s project is more about learning and raising awareness about map projections than about a specific programming technique. By monitoring the Discussion Forum, we have encountered a large number of questions related to projections and distances. Many Map Suite users are unsettled by getting different distances from the same locations on various projections. To try to demystify this a little bit, we show how a regular grid on lat/long points get distorted in various ways depending on the projection applied. By visually seeing the distortion happening, it helps understand why distances can vary so wildly. You will also find some link to study this topic a little further if you wish.

How do I measure the distance of a line accurately in different projections?

This question has a corresponding sample application(s) associated with it.

Sample:Projection Distance LineStyle

This Web project is similar to the project “Distance Line Style”. Here we show how to use a projection of choice different from the projection used on the map. For example, you may have your map using Google map as a background. Google map uses Spherical Mercator projection which is not ideal for distance measurements, that is why using a more appropriate projection for distance measurement such as State Plane will give more accurate results. The CustomDistanceLineStyle inheriting from LIneStyle has the logic built in to have the distance calculated based on a projection of choice instead of the projection of the map. As for the previous project “Distance Line Style”, you can see how the DrawCore function is overridden for the a specific need of style: displaying the distance label on each line segment making up a LineShape. In addition to the overriding of the DrawCore function, you will find useful some geometry functions such as GetPointOnLine to find the midpoint of a line segment and GetAngleFromTwoVertices to incline correctly the labels according to the orientation of each line segment. You will notice that the CustomDistanceLineStyle works for features made of LineShape and you will have to slightly modify to have it working with MultilineShape.

How do I display a polygon across the Meridian?

This question has a corresponding sample application(s) associated with it.

Sample:Polygon across Meridian

Following a request from the Discussion Forum on how to handle cases where the shape straddles the 180 degree meridian on a Decimal Degree map, we created this project. The solution is to split the shape into two main parts to be displayed on the two ends of the map. In this case, we use the case of a Polygon but this could easily be adapted for any other shapes such as lines.

How can I get an accurate measurement between two points in decimal degrees?

This question has a corresponding sample application(s) associated with it.

Sample:Measurements Decimal Degrees

This project is in response to a Discussion Forum post that has generated plenty of debate on the meaning of measuring area for shapes in decimal degrees. In this project, you will see how to get area and length measurements according to the projection used from a shape in decimal degrees. For more information on why different measurements can be obtained from the same shapes, please read the Discussion Forum “GetArea on Buffered shape not working as expected” http://gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/6565/afv/topic/Default.aspx

How do you display the Pacific Rim area?

This question has a corresponding sample application(s) associated with it.

Sample:Pacific Rim

This project shows how to display the Pacific Rim and Asia if you pan to the west, so that the world “wraps around,” as it does with Google Maps. Many of our Map Suite sample applications include an example of the world being displayed using a world ShapeFile. The ShapeFile is in Decimal Degrees and it displays the world according to longitude and latitude value ranges. These ranges are from -180 to 180 for longitude and 90 to -90 for latitude. In our various examples that use this ShapeFile, you see the Western Hemisphere on the left and the Eastern Hemisphere on the right. Now, a common request that we receive is to display the Pacific Rim and Asia if you pan to the west, so that the world “wraps around,” as it does with Google Maps. This can be accomplished in Map Suite 3.x by using a custom projection that offsets all of the points by 360 for the x (longitude) values. (180 + 180 = 360). You will see how to create OffsetProjection class inheriting from Projection. Notice the code in the overrided method GetexternalProjection. It simply loops thru all the points making each feature and offset the X value by 360.

How to use GetFeaturesWithinDistanceOf/GetFeaturesNearestTo methods when the data is reprojected?

This question has a corresponding sample application(s) associated with it.

Sample:Distance Query on Projected Layers

In this sample, we learned how to use the method GetFeaturesWithDistanceOf when the data is projected. We just input the unit which is projected to, do not need to mind what the real unit is for the internal data before projection. It works fine with Map Suite Assemblies 4.5.54.0 or later.

How to use custom parameters projection?

This question has a corresponding sample application(s) associated with it.

Sample:Custom Parameters Projection

In today’s Wpf project, we learn more about projection and how to handle a special case where the projection information in the PRJ file of a shapefile is not found as an EPSG or ESRI code in the spatial reference web site (www.spatial-reference.org). The strategy in this case is to build a proj4 string based on the parameters found in the PRJ file. Note that you must pay special attention to the false easting or northing parameters as they are always expressed in meters even if the projection is in another unit such as feet. For this example, we show how to convert from the local projection in Lambert Conformal Conic with regional specific parameters to Geodetic (WGS84) to match the World Map Kit.

How to use custom rotation projection?

This question has a corresponding sample application(s) associated with it.

Sample:Custom Rotation Projection

In today’s project, we show how to create your own projection class that allows projecting a layer from any internal projection to any external while doing a rotation at the same time. Having the capability to apply those two operations in one step may come handy if the original layer was created in a different projection with the north at an angle and you want to align it on the base map. This is a Wpf project and you will need references to MapSuiteCore.dll and WpfDesktopEdition.dll to run it.

How to use local datum UTM?

This question has a corresponding sample application(s) associated with it.

Sample:Local Datum UTM

The purpose of this Wpf sample is to get familiar with the concept of datum and datum shift in UTM and Geographic coordinates. Using local data, you might be required to apply datum transformation to your data to go from an old datum to a more recent datum. Here we are taking the example of Australia which went to change its datum (from AGD84 to GDA94) for its mapping purposes. We show how to apply the datum transformation in both the longitude/latitude coordinate system and in the local UTM systems (AMG based on AGD84 and MGA based on GD94). See the code and read with attention the comments in the MouseMove event where all the projection logic is taken place. Notice that the correction is about 200 meters. Once you understand for the case of Australia, you will be able to apply the same principles for your own datums in UTM. For further reading: http://www.cage.curtin.edu.au/~will/datum.html http://www.usq.edu.au/course/material/SVY3107/lectures/Breeze/SVY2106amgmgafund/index.html

How to google Map to Geodetic?

This question has a corresponding sample application(s) associated with it.

Sample:Google Map to Geodetic

In today’s Wpf project, we are showing a trick for getting the current extent of the map with Google Map as an image and displaying it on a map in decimal degrees unit. You may be in a situation where you want the details and accuracy of Google Map, especially the satellite view but want to have it displayed on your map in decimal degrees. In this sample, you will see how to get the Google Map image and create the accompanying world file for decimal degrees. Notice that we are realizing an affine transformation on the image to go to Geodetic as illustrated in the case 3 http://en.wikipedia.org/wiki/World_file#Definition. You can also use this technique for any other background maps such as Bing Map, Open Street Map using Spherical Mercator. Warning: It is possible to use a world file with parameters for a Geodetic system from an image originally in Spherical Mercator due to some similar projection characteristics. Applying the same operation for other projections such as Lambert or UTM will not work.

How to wrap dateline with projection?

This question has a corresponding sample application(s) associated with it.

Sample:Wrap Dateline Mode With Projection

In this Wpf project, we show a new property of Overlay, WrapDatelineMode. This property that allows to continuously pan west or east with world map was already available in the dev branch. This concept was shown in the previous sample “WrapDatelineMode”. Now it is fully supported in Map Suite 5 and you can see in this sample how the behavior for the map in both Decimal Degrees (Lat/Long) and Spherical Mercator (Google Map/Bing map projection). In order to run this sample, you will need the latest release for Wpf with references to MapSuiteCore.dll and WpfDesktopEdition.dll.

How to use Spherical Mercator Projection Adjustment?

This question has a corresponding sample application(s) associated with it.

Sample:Spherical Mercator Projection Adjustment

The purpose of this sample is to address a projection issue that you may encounter when converting your data from your local projection to Google Map. It has been reported by Map Suite users that in some cases reprojecting their data to Google Map or other base maps using Spherical Mercator (Bing Map, Open Street Map etc) is inaccurate with the data being shifted a few hundreds of meters. This problem has been identified as being caused by an unnecessary grid shift when going from ellipsoid datum to spherical datum. Among other projections, the British National Grid (BNG) and the German Gauss-Kruger system have that problem when going to Spherical Mercator. This sample uses the example of BNG to demonstrate the problem and how to fix it. The Map Suite development team will offer a permanent solution to this projection issue but in the meantime, as a rule of thumb, if your data shows some inaccuracies when going to Spherical Mercator, use the method you find this sample. This is a Desktop app but the concept shown applies to all editions of Map Suite.

map_suite_windows_phone_edition_faq_projection.txt · Last modified: 2015/09/11 03:38 by admin