GithubHelp home page GithubHelp logo

Comments (3)

mejackreed avatar mejackreed commented on August 22, 2024

@ebenenglish Can you confirm what the expected return values are for set_viewpoint? Also is the anticipated behavior to return something to set the map location in the UI?

from blacklight-maps.

ebenenglish avatar ebenenglish commented on August 22, 2024

@mejackreed set_viewpoint is used to set the Leaflet map bounds in the UI when there are a diverse set of locations being passed to the map. The function loops through all the coordinates in the GeoJSON FeatureCollection and returns a bounding box or coordinate set that is passed to the Leafleft fitBounds method, which determines the correct center point and zoom level. The result it that all the locations are visible in the map window in the UI (with a little bit of padding), and the zoom is as deep as possible where all the locations can still be seen on the initial load.

set_viewpoint should either return:

  • (a) an array with one coordinate point
  • (b) an array with two members, where each member is a coordinate point array

For example (pseudo code warning!):

set_viewpoint(FeatureCollection with 1 item) => [29.646923, 91.117212]
set_viewpoint(FeatureCollection with >1 item) => [[20.593684, 78.96288], [35.86166, 104.195397]]

It could probably be broken down into several smaller functions or moved into a class.

from blacklight-maps.

mejackreed avatar mejackreed commented on August 22, 2024

Thanks for the great reply. I'm working on it

Sent from my iPhone

On Apr 16, 2015, at 8:20 AM, Eben English [email protected] wrote:

@mejackreed set_viewpoint is used to set the Leaflet map bounds in the UI when there are a diverse set of locations being passed to the map. The function loops through all the coordinates in the GeoJSON featureCollection and returns a bounding box or coordinate set that is passed to the Leafleft fitBounds method, which determines the correct center point and zoom level. The result it that all the locations are visible in the map window in the UI (with a little bit of padding), and the zoom is as deep as possible where all the locations can still be seen on the initial load.

set_viewpoint should either return (a) an array with one coordinate point; or (b) an array with two members, where each member is a coordinate point array :

point => [29.646923, 91.117212]
bbox => [[20.593684, 78.96288], [35.86166, 104.195397]]
It could probably be broken down into several smaller functions or moved into a class.


Reply to this email directly or view it on GitHub.

from blacklight-maps.

Related Issues (20)

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.