Giter VIP home page Giter VIP logo

leafletblazor's People

Contributors

darnton avatar jgilm avatar thomasprioul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

leafletblazor's Issues

LeafLet on Blazor ServerSide

I have Leaflet working on a Blazor-WASM project without problem, but when I try to get it working on a ServerSide project I get "Microsoft.JSInterop.JSException: Could not find 'L.map' ('L' was undefined).". I have tried everything I know but am unable to get around this issue. If you have any advice for me it would be greatly appreciated.

Development status

Hi, I read your blog post. Thanks for the step-by-step explanation! It was really helpful.

  1. Do you plan on actively maintaining this library?
  2. You are probably aware of https://github.com/Mehigh17/BlazorLeaflet. Are there any specific reasons (e.g. missing requirements, incompatibilities) for why you chose to create a new one?

Load my local Tiles.

Greetings,
I'm trying to display some tiles I produced placed outside the wwwroot directory of a Blazor server.
As urlTemplate I insert the string "Tiles / MyMap / {z} / {x} / {y} .png" but LeafletMap does not display any map. is the correct way to describe urlTemplate?

How to add Icon to MarkerOptions?

I tried to extend the MarkerOptions by an Icon object like that.

public class Icon : InteropObject
{
        [JsonIgnore]
        public IconOptions IconOptions { get; set; }

        public Icon(string iconUrl)
        {
            this.IconOptions = new IconOptions()
            {
                IconUrl = iconUrl,
            };

        }

        protected override async Task<IJSObjectReference> CreateJsObjectRef()
        {
            return await JSBinder.JSRuntime.InvokeAsync<IJSObjectReference>("L.icon", IconOptions);
        }
}

public class IconOptions
{
    public string IconUrl { get; set; }
} 

Unfortunately the JS-Runtime throws an error because createIcon() does not exist. What is missing?

Adding an icon to a marker.

I was trying to add logic for including an Icon with a marker.

Should I not be able to do the following

Where Options represent Icon Options with the same names as ones provided by leaflet.

public class LeafletIcon .....

protected override async Task CreateJsObjectRef()
{
return await JSBinder.JSRuntime.InvokeAsync("L.icon", Options);
}

Then in the Marker options adding a property of LeafletIcon.

When I try the above I receive the following:

"Microsoft.JSInterop.JSException: t.icon.createIcon is not a function"

Or is there another way to go about adding an Icon to a marker ?

Two components on the same page?

I am testing your interesting component .It works fine with your demo.
But if we put 2 components on the same page we got an error :
_Unhandled exception rendering component: Map container is already initialized.
How to proceed to use more than a component on one page?

With Blazor Server app, exception being thrown when adding Marker in OnAfterRenderAsync

I duplicated the existing TestRig with the exception of it being a Server (rather than WebAssembly) App. All works fine.

However, if I try to add markers to the map prior to viewing, the 'marker.AddTo' code throws an exception as JSBinder=null in Marker.CreateJsObjectRef

My noob understanding is that Interop should be available at the point OnAfterRenderAsync is called, but clearly everything isn't ready yet.

Any pointers are welcome.

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        await base.OnAfterRenderAsync(firstRender);

        var ll = new LatLng(-42, 175);

        var marker = new Marker(ll, new MarkerOptions
        {
            Title = "Test"
        });

        await marker.AddTo(PositionMap);

    }

Stack

	Darnton.Blazor.Leaflet.dll!Darnton.Blazor.Leaflet.LeafletMap.Marker.CreateJsObjectRef() Line 36	C#
 	Darnton.Blazor.Leaflet.dll!Darnton.Blazor.Leaflet.InteropObject.BindJsObjectReference(Darnton.Blazor.Leaflet.LeafletMapJSBinder jsBinder) Line 31	C#
 	Darnton.Blazor.Leaflet.dll!Darnton.Blazor.Leaflet.LeafletMap.Layer.AddTo(Darnton.Blazor.Leaflet.LeafletMap.Map map) Line 20	C#
 	LeafletServerBlazorTestRig.dll!LeafletServerBlazorTestRig.Pages.Index.OnAfterRenderAsync(bool firstRender) Line 177	C#

Map not rendering with css

I am using a Web Assembly with hosted project and when trying copy the example, I noticed that when I try to set the reference to leaflet.css in index.html that the page is blank with no map rendering. If I take it out then parts of the map start to render. Any suggestions what would be causing this ? There are no errors showing up on the console.

Call Leaflet methods

Hi, I really like your leaflet library and the simplicity! Is there a way to access all the leaflet methods so I can get the current position, change that position, zoom in and out etc.? I mean all that stuff in the doc, for example this: https://leafletjs.com/reference-1.7.1.html#map-methods-for-getting-map-state. There are hundreds of methods in Leaflet so I guess that would be a huge effort to implement or is there a generic way to call any method? Any plans for the future?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.