Eagleeye view exception

Source: Internet
Author: User

Based on the 3 sdnmap tutorial, an application is built.ProgramFrame. When running, use eagleeye to operate the map. If an exception occurs, the main map control can be displayed normally when you right-click the eagleeye frame. When you left-click the eagleeye, the main map control becomes blank. At first, I thought it was not displayed. Later, I checked and found that the map moved a lot to the east. Removed from the current view range. The primary map control and eagleeye control are loaded with the same map. If you try another map, the function is normal.

Later it was found that an exception occurred because the secondary map contains different coordinate systems. Although it can be normally superimposed and displayed together, the map coordinates obtained through parameter E in the mousemove event are inconsistent with those obtained from the primary map, the eagleeye control is abnormal.

The main map control contains the following layers:

1. Dem WGS-1984 coordinate system.

2. Perimeter. SHP Xi'an 1980 Coordinate System

Add a map to the eagleeye ControlCodeAs follows:

This. axmapcontrol2.addlayer (this. axmapcontrol1.map. get_layer (this. axmapcontrol1.layercount-I ));

To ensure data display consistency, add the last layer of mapcontrol1 before adding data. Therefore, the first layer added to the eagleeye control is the border. SHP. The Coordinate System of the control is the Xi'an 1980 coordinate system, and the layers subsequently added are automatically converted to the coordinate system. The coordinate system of the main map control is the first layer, that is, the wgs1984 coordinate system. Therefore, the eagleeye control and the main map control have different spatial references, leading to an exception in the eagleeye operation.

Solution:

To make the eagleeye control consistent with the space reference of the main map control, add the following code:

Axmapcontrol2.spatialreference = axmapcontrol1.spatialreference;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.