Code Monkey home page Code Monkey logo

rand-land-coords's Introduction

rand-land-coords

Random latitude and longitude decimal coordinates.

About

NASA bathymetry source image:

Converted into bitmap-esque PNG:

Used to get random latitude/longitude decimal coordinate above land.

Inspired by this post: HOW TO add random markers to a map BUT avoiding the sea?

Usage

$ npm i mhulse/rand-land-coords

See test.js for an example.

License

Copyright © 2019 Michael Hulse.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

rand-land-coords's People

Contributors

mhulse avatar

Stargazers

 avatar

Watchers

 avatar

rand-land-coords's Issues

Restrict to an area

Might be cool to allow someone to pass an area into the options and restrict lat/lon finding to that area.

Add explicit parens

return {
latitude: ((pixelY / (height / 180) - 90) / -1),
longitude: (pixelX / (width / 360) - 180)
};

Just need to refresh my memory on JS's order of operation for mathematical operators.

Improve pixel finding

I am betting there's a faster way to find black pixels, and then map that find back to the larger image; this would really optimize the search for coords.

Also would help if someone uploaded a custom image with only one continent.

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.