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

  • Home
  • SEARCH
  • 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 6988013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:00:53+00:00 2026-05-27T19:00:53+00:00

I have a ASP.NET website which contains a Google Map. I am using the

  • 0

I have a ASP.NET website which contains a Google Map. I am using the GoogleMapForASPNet framework made by some clever and helpful individual.

Anywho, I have a problem with centering the map after inserting two pins.

Basically, I am calculating the middle point of the pins and setting that as the Center Point of the map.

Below is my code:

GooglePoint newPoint = new GooglePoint();
        double newLat = 0;
        double newLong = 0;

        if (googlePointA.Latitude > googlePointB.Latitude)
        {
            newLat = googlePointA.Latitude - googlePointB.Latitude;
            newPoint.Latitude = googlePointA.Latitude - newLat;
        }
        else
        {
            newLat = googlePointB.Latitude - googlePointA.Latitude;
            newPoint.Latitude = googlePointB.Latitude + newLat;
        }
        if (googlePointA.Longitude > googlePointB.Longitude)
        {
            newLong = googlePointA.Longitude - googlePointB.Longitude;
            newPoint.Longitude = googlePointA.Longitude - newLong;
        }
        else
        {
            newLong = googlePointB.Longitude - googlePointA.Longitude;
            newPoint.Longitude = googlePointB.Longitude + newLong;
        }

        GoogleMapForASPNet1.GoogleMapObject.CenterPoint = newPoint;
        GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 8;

It works half and half, but not properly. As in, when I feed different Pins, it doesn’t really center the map, but close enough. Or sometimes, the other pin will be off the map but only an inch, which means the map isn’t centered at all.

The zoom is static because the pins will always be close by, so there’s no need for me to make it dynamic.

Any help is extremely, extremely, extremely appreciated.

Thank you.

  • 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-27T19:00:54+00:00Added an answer on May 27, 2026 at 7:00 pm

    The Google Maps API has an object to do that: google.maps.LatLngBounds

    Just create a LatLngBounds object, add your pin coordinates to it with the extend() method, then use the map panToBounds(yourBounds) method and you’re all set!

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

Sidebar

Related Questions

Suppose I have an ASP.NET website running with its corresponding web.config file, which contains
I have an asp.net website which contains a few pages that I'd like to
I have an ASP.NET website which is using a filestream to read in a
I have a asp.net website developed in asp.net 2.0 on production which is using
I have an company asp.net website with textboxes which may contain several hundred words.
I have an ASP.Net website which has a remember me feature for Login page.
I have an ASP.Net hosted website which displays a list of results as a
I have an existing ASP.NET website which I would like to painlessly add CMS
We have a large ASP.Net website that has a single css stylesheet which is
I have a Silverlight web app which uses ASP.net Website administration tool for user

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.