Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6005035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:20:48+00:00 2026-05-23T01:20:48+00:00

This Monotouch code below will not cause an exception, but it also won’t show

  • 0

This Monotouch code below will not cause an exception, but it also won’t show the polygon on the map.

var coords = new CLLocationCoordinate2D()
{
new CLLocationCoordinate2D(32.67, -81.9),
new CLLocationCoordinate2D(32.77, -81.9),
new CLLocationCoordinate2D(32.61, -81.9),
new CLLocationCoordinate2D(32.43, -81.9),
new CLLocationCoordinate2D(32.67, -81.9)
};

var mkp = MKPolygon.FromCoordinates(coords);

mapView.AddOverlay(mkp);

I’ve centered the map on coords[0] and that works fine, as does a SetRegion with coords[0]. Using the coords[0], I have no problem adding an Annotation to the MapView.

I also tried this with same results (no errors, but no overlay displayed):

var mkc = MKCircle.Circle(coords[0], 100);

mapView.AddOverlay(mkc);

Thinking that perhaps the MapView wasn’t "ready" yet, I even tried a thread that waited a second, and then created the Polygon, via the InvokeOnMainThread. The map did the animated move to the coord, but still just showed the map and no overlays.

If I add this:

var mkp = new MKPolygonView(mkp);

mapView.AddOverlay(mkpv);

I get this exception:

"Objective-C exception thrown. Name: NSInvalidArgumentException Reason: – [MKPolygonView boundingMapRect] unrecognized selector sent to instance 0x7579100"

Is there perhaps a problem with my coordinate list? I’ve tried with the first coordinate at the end of the list to close the polygon and without that, with the same results.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:20:49+00:00Added an answer on May 23, 2026 at 1:20 am

    Adding an overlay object to the map view is not enough. You have to create a delegate object and implement the GetViewForOverlay method:

    public class MapDelegate : MKMapViewDelegate
    {
    
        public override MKOverlayView GetViewForOverlay (MKMapView mapView, NSObject overlay)
        {
    
            MKPolygon polygon = overlay as MKPolygon;
            if (null != polygon) // "overlay" is the overlay object you added
            {
    
                MKPolygonView polyView = new MKPolygonView(polygon);
                // customize code for the MKPolygonView
                return polyView;
            } 
    
            return null;
    
        }
    }
    

    You then assign a new instance of this delegate object to your map view’s Delegate property:

    myMapView.Delegate = new MapDelegate();
    

    Every annotation or overlay you add to a map view, needs a corresponding view.

    The exception you are getting is because you are adding an MKOverlayView derived object where an MKOverlay derived is expected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a bit of a long shot, but if anyone can figure it
This is kinda oddball, but I was poking around with the GNU assembler today
This might seem like a stupid question I admit. But I'm in a small
This is a difficult and open-ended question I know, but I thought I'd throw
I'm currently implementing a Monotouch application that will eventually be ported to Monodroid. The
I'm using MonoTouch and also System.Data to create a DataSet (just xml to those
This is starting to vex me. I recently decided to clear out my FTP,
This is my first post here and I wanted to get some input from
This past summer I was developing a basic ASP.NET/SQL Server CRUD app, and unit
This error just started popping up all over our site. Permission denied to call

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.