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 8054691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:12:20+00:00 2026-06-05T08:12:20+00:00

I am new in Google map and I need to save the Google Map

  • 0

I am new in Google map and I need to save the Google Map view into database (long + lat +zoom).
I know MVC but I don’t know how to get Google Map view information (long + Lat +zoom) when it is shown on a view.

Also when I am retrieving data from database, how can I change the view of Google Map in a razor view?

Any help, including some reference to read is very appreciated.

One way that I am thinking of doing this, is to create three hidden inputs that their value is changes when user play with map and changing Google Map view. But I don’t know how to do this using JS and Google Map.

  • 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-06-05T08:12:20+00:00Added an answer on June 5, 2026 at 8:12 am

    Let’s say you have model Map in your code, smth like:

        public class MapModel
    {
        /// <summary>
        /// Lattitude on map
        /// </summary>
        public decimal Lat { get; set; }
    
        /// <summary>
        /// Longtidute on map
        /// </summary>
        public decimal Lon { get; set; }
    
        /// <summary>
        /// Map zoom level
        /// </summary>
        public int Zoom { get; set; }
    }
    

    Place Google Maps script in your view:

    <head runat="server">
    <title>Index</title>
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    
      function initialize()
      {
        var mapDiv = document.getElementById('MapDiv');
        var map = new google.maps.Map(mapDiv, {
          center: new google.maps.LatLng(<%= Model.Lat %>, <%= Model.Lon %>),
          zoom: <%= Model.Zoom %>,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        });
    
        google.maps.event.addListener(map, 'click', function(event)
        {
            // Puts coordinates to form (then pass to DB using Ajax, etc)
            document.getElementById("Lat").value = event.latLng.lat();
            document.getElementById("Lon").value = event.latLng.lng();
            document.getElementById("Zoom").value = map.getZoom();
        });
      }
      google.maps.event.addDomListener(window, 'load', initialize);
    
    
    <div id="MapDiv" style="width: 500px; height: 500px"></div>
    <input type="text" id="Lat" value="0" /><br />
    <input type="text" id="Lon" value="0" /><br />
    <input type="text" id="Zoom" value="0" /><br />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Google map api. My goal is to overlay a series of
I want to refresh Google Map and send new geolocalization request without refreshing the
I am a new android app developer and i want to use google map
I am creating a map using the new(ish) v3 of the Google Maps API
I have been trying to create a new google custom search engine, but when
I'm working on a Google Map in JavaScript(v3). I need to show some markers
function initialize() { var myOptions = { center: new google.maps.LatLng(23.71181,90.407467), zoom: 8, mapTypeId: google.maps.MapTypeId.ROADMAP
I have a present need to display a Google Map, inside a FancyBox. The
I have implemented the Google map successfully. But one more thing has left to
I need to be able to update a google map from a html select

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.