GithubHelp home page GithubHelp logo

merterdemir / ol3-aswcr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mrpl0p/ol3-aswcr

0.0 2.0 0.0 104 KB

Advanced styles in OpenLayers 3 - Image fill style features with canvas renderer

JavaScript 100.00%

ol3-aswcr's Introduction

OpenLayers 3 - Advanced styles with the canvas renderer
This JavaScript file allows OpenLayers 3 users to assign an image property to the fill object.
No mater the image size, it will repeatedly fill the feature which has the advanced style.
Version: v1.0
-------------------------------------------------------------------------------------------------------------
How to include : 
To use the ol-aswcr.js file, you have to include it in your html page AFTER the ol JavaScript file including.

<html>
	<head>
		...
	</head>
	<body>
		...
		<script src="../Ressources/ol-debug.js" type="text/javascript"></script>
        <script src="../Ressources/ol-aswcr.js" type="text/javascript"></script>
		
		<script>
			...Your script...
		</script>
	</body>
</html>

-------------------------------------------------------------------------------------------------------------
How to style :
the 'image' property of the fill object is an array : [imageObject, opacityNumber]

imageObject : the image object with which you want to fill features
opacityNumber : the transparency intensity, number between 0 and 1, in which 0 is fully transparent and 1 is fully opaque

<script>
	var img = new Image();
	img.src = 'yourImagePath';

	var yourStyle = [new ol.style.Style({
		fill: new ol.style.Fill({
			image: [img, 0.4]
		}),
		stroke: new ol.style.Stroke({
			color: "black",
			width: 2
		})
	})];
</script>

ol3-aswcr's People

Contributors

mrpl0p avatar

Watchers

 avatar  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.