1

I am trying to get the latitude and longitude and create a table from it, and show in a map, using Leaflet, however I didn't find anything that could help me in my project, the files that I have made are the following:

class Local for the Location

using System.ComponentModel.DataAnnotations;

namespace maps.Models

{
    public class Local
    {
        //[Key]
        public int ID { get; set; }
        public double latitude { get; set;}
        public double longitude { get; set;}


        //observe that 

    }
}

And for the table I use:

using Microsoft.EntityFrameworkCore;
using System;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace maps.Models

{
    public class TestDbcontext : DbContext
    {   
        public DbSet<Local> Locals { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder options)
            => options.UseSqlite(@"Data Source=C:\Users\joaov\Downloads\local.db");

    }
}

I just could implement the following:

var map = L.map('map').setView([51.5, -0.09], 13);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

var seekPlace = L.Control.geocoder().addTo(map);

But it's far from what I want, which is, given latitude and longitude (Back-end), to put a marker on the map, and to show the saved data in a table.

5
  • 1
    GIS SE is a site for focused Q&A, it is not a discussion forum. Your question includes several questions, so please limit it to only one question, you can ask other questions later.
    – TomazicM
    Jul 24 at 15:48
  • I just want to know how to get latitude and longitude using leaflet, from a user and displaying in a map. Jul 24 at 18:01
  • Then edit the question and formulate it like this.
    – TomazicM
    Jul 24 at 18:19
  • I agree this question is a bit broad, but am willing to help in chat or some less restrictive conversation Jul 26 at 14:23
  • I would like to know something quite simple in the area, I am surprised that no one knows the answer to it. Jul 27 at 11:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.