GithubHelp home page GithubHelp logo

atomjoy / openlayers-map-marker Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2.51 MB

How to create a simple map with a marker and popup using OpenLayers? How to add a marker to OpenLayers map?

Home Page: https://github.com/atomjoy/openlayers-map-marker

JavaScript 48.00% HTML 47.18% CSS 4.82%
map-marker-popup openlayers-map-marker openlayers-maps map-marker-openlayers openlayers-map-marker-popup map-marker map-polygon

openlayers-map-marker's Introduction

Openlayers map marker (ver. 6.4.3)

How to create a simple map with a marker and popup using OpenLayers? How to add a marker to OpenLayers map? OpenLayers map marker with popup. Create marker with geolocation or double click. Delivery area with polygon. Multiple markers with html popups. Animated markers.

Map version get from builds

<!-- OpenLayers map -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.4.3/css/ol.css" type="text/css">
<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.4.3/build/ol.js"></script>

Map file contains

  • Add image marker to map
  • Show map popup on click
  • Create marker on double click
  • Clear all layer markers on double click
  • Create map polygon from points array
  • Create delivery area, export polygon
  • Test delivery area with polygon
  • Search location from address (geolocation)
  • Animate marker, marker highlight (ontop)
  • Animate marker popup
  • Multiple tags with popups from an array or database

Map marker, geolocation or onclick

Map marker onclick https://github.com/atomjoy/openlayers-map-marker/blob/master/map-marker-click.html.

Delivery area with polygon

Create, load or edit polygon sample. Load polygon in json format. Download polygon file https://github.com/atomjoy/openlayers-map-marker/blob/master/map-polygon.html.

Map multipe markers

Multiple tags with popups from an array or database https://github.com/atomjoy/openlayers-map-marker/blob/master/map-multiple-markers.html.

Important

Set map div height.

map {
  float: left; 
  width: 100%;
  height: 400px;
}

Check if the point (coordinates) is inside the polygon

/*
    Test delivery area coordinates
    var coordinate = [21.002902, 52.22885]
    var polygon_points = [[20.57, 53.30], [21.24, 53.30], [22.152810, 52.648142], [21.24, 52], [20.50, 52], [19.785212, 52.783446]];
*/

function PointInPolygon(coordinate, polygon_points_array)
{
    var polygon = new ol.geom.Polygon([polygon_points_array]);
    var out = polygon.intersectsCoordinate(coordinate);
    return out;
}

openlayers-map-marker's People

Contributors

atomjoy avatar

Watchers

 avatar

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.