Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

239
Views
Get Leaflet map tile image for polygon

For a project I need to generate previews of polygons that we store in the backend. A polygon typically has this format: [lat,long]

const polygon = [
    [
        4.329064,
        51.276626
    ],
    [
        4.330755,
        51.276416
    ],
    [
        4.329064,
        51.276626
    ]
]

Screenshot mockup

Polygons

I already found out that I can calculate the center of a polygon with polygon.getBounds().getCenter(); and center the map view there, but I rather not load a new Leaflet map for each and every polygon that is stored in the project :)

Are there easier ways to get a map tile as .PNG for example and reference this in my Angular template or do I really have to render a separate map everytime?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I found a library that let's me export images of Leaflet maps, which I will store as preview for each polygon.

https://github.com/mapbox/leaflet-image

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!