Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
cedarmaps-sdk-web-public
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Cedar Studios
cedarmaps-sdk-web-public
Commits
3591c491
Commit
3591c491
authored
Jun 10, 2018
by
Deployer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a demo file showing how to draw a kml file on the map.
parent
5b2811f7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
0 deletions
+77
-0
test-route.kml
demos/data/test-route.kml
+2
-0
drawing-kml.html
demos/drawing-kml.html
+75
-0
leaflet-omnivore.min.js
demos/js/leaflet-omnivore.min.js
+0
-0
No files found.
demos/data/test-route.kml
0 → 100644
View file @
3591c491
<?xml version="1.0" encoding="UTF-8"?>
<kml
xmlns=
"http://www.opengis.net/kml/2.2"
><Document><Placemark><ExtendedData></ExtendedData><LineString><coordinates>
51.33799548626,35.69989544172 51.33602138042,35.71233623864 51.33949752331,35.71177870947 51.3440465498,35.71216201119 51.3499688673,35.71373004451 51.35273693919,35.71458371243 51.35326265216,35.71458371243 51.35358451724,35.71449660121 51.35375617862,35.71440948989 51.3539600265,35.71419171119 51.35394929767,35.71399135426 51.35378836513,35.71365161744 51.35333775401,35.71353837151 51.35302661777,35.71359935011 51.35268329501,35.71386939762 51.35251163363,35.71431366734 51.3523828876,35.71534157602 51.35218976855,35.71663079867 51.35202883601,35.71711860721 51.35159968257,35.71788515745 51.35109542727,35.71839037971 51.34995817065,35.71933984047 51.34953974605,35.72019347443 51.34951828837,35.72118646569 51.34956120372,35.72237107066 51.34962557673,35.72379954146 51.34964703441,35.72579413161 51.34972213626,35.72767544598 51.34898184657,35.73044507795 51.34793042064,35.73398971797 51.34794114947,35.73432936807 51.34808062434,35.73446871128 51.34846686244,35.73453838279 51.34909986377,35.73454709173 51.35266183734,35.73434678598 51.35594755143,35.73432065258 51.35592072934,35.73445564133 51.35509460896,35.73447305922
</coordinates></LineString></Placemark></Document></kml>
\ No newline at end of file
demos/drawing-kml.html
0 → 100644
View file @
3591c491
<!DOCTYPE html>
<html>
<head>
<meta
charset=
utf-8
/>
<title>
CedarMaps - Simple Map Load
</title>
<script
src=
'../dist/v1.7.0/cedarmaps.uncompressed.js'
></script>
<script
src=
'../access-token.js'
></script>
<script
src=
'./js/leaflet-omnivore.min.js'
></script>
<link
href=
'../dist/v1.7.0/cedarmaps.css'
rel=
'stylesheet'
/>
<style>
body
{
margin
:
0
;
padding
:
0
;
}
.map
{
position
:
absolute
;
top
:
0
;
bottom
:
0
;
width
:
100%
;
}
</style>
</head>
<body>
<div
id=
'map'
class=
'map'
>
</div>
<script>
try
{
L
.
cedarmaps
.
accessToken
=
accessToken
;
}
catch
(
err
)
{
throw
new
Error
(
'You need to get an access token to be able to use cedarmaps SDK. '
+
'Send us an email to <info@cedar.ir>'
);
}
/**
* Initilizing Map View
*/
// Getting maps info from a tileJSON source
var
tileJSONUrl
=
'https://api.cedarmaps.com/v1/tiles/cedarmaps.streets.json?access_token='
+
L
.
cedarmaps
.
accessToken
;
// initilizing map into div#map
var
map
=
L
.
cedarmaps
.
map
(
'map'
,
tileJSONUrl
,
{
scrollWheelZoom
:
true
}).
setView
([
35.757448286487595
,
51.40876293182373
],
15
);
/**
* Drawing our KML data
*/
// We draw a sample route to map using a test kml file.
// We use leaflet-omnivore plugin for parsing this format: https://github.com/mapbox/leaflet-omnivore
var
customLayer
=
L
.
geoJson
(
null
,
{
// http://leafletjs.com/reference.html#geojson-style
style
:
function
(
feature
)
{
return
{
color
:
'#f00'
};
}
});
var
runLayer
=
omnivore
.
kml
(
'./data/test-route.kml'
,
null
,
customLayer
)
.
on
(
'ready'
,
function
()
{
map
.
fitBounds
(
runLayer
.
getBounds
());
})
.
addTo
(
map
);
</script>
</body>
</html>
\ No newline at end of file
demos/js/leaflet-omnivore.min.js
0 → 100644
View file @
3591c491
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment