<gh_stars>0
#!/Users/privateprivate/envs/bin/python
import dash 
import dash_leaflet as dl
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_leaflet.express as dlx


from dash_extensions.javascript import Namespace



#import plotly.express as px
#import pandas as pd


from app import app

osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
osmUrlattribution = '<a href="http://openstreetmap.org">OpenStreetMap</a>'

googleUrl= 'http://mt0.google.com/vt/lyrs=s&x={x}&y={y}&z={z}'
googleUrlattribution = 'google'

esriUrl = 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}'
esriUrlattribution = 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'

mosaic_50cm='http://apollo.cdngiportal.co.za/erdas-iws/ogc/wms/CDNGI_Imagery_50cm_MOSAIC'
'CDNGI_50cm_MOSAIC_2008-2016'



# A few cities in Denmark.
sites = [dict(name="Site 1", lat=-27.2, lon=27.8),
					dict(name="Site 2", lat=-28.3, lon=30),
					dict(name="Site 2", lat=-27.5, lon=29)]
				


# Create app.

layout = html.Div([dl.Map([
		dl.LayersControl(
				[dl.BaseLayer(dl.TileLayer(url=osmUrl, attribution=osmUrlattribution),
											name="OSM", checked= "OSM"=="OSM")]+									
				[dl.BaseLayer(dl.TileLayer(url=googleUrl, attribution=googleUrlattribution),
											name="Google Sat")]+									
				[dl.BaseLayer(dl.TileLayer(url=esriUrl, attribution=esriUrlattribution),
											name="Esri")]+
			[dl.Overlay(dl.LayerGroup(dl.WMSTileLayer(url="http://apollo.cdngiportal.co.za/erdas-iws/ogc/wms/CDNGI_Imagery_50cm_MOSAIC",
				layers="CDNGI_Imagery_50cm_MOSAIC", format="image/png", transparent=True)), name="CDNGI_Imagery_50cm_MOSAIC")]+
		[dl.Overlay(dl.LayerGroup(dl.WMSTileLayer(url='http://apollo.cdngiportal.co.za/erdas-iws/ogc/wms/CDNGI_Imagery_25cm_MOSAIC_2017',
				layers="CDNGI_Imagery_25cm_MOSAIC_2017", format="image/png", transparent=True)), name="CDNGI_Imagery_25cm_MOSAIC_2017")]+
			[dl.Overlay(dl.LayerGroup(dl.WMSTileLayer(url='http://apollo.cdngiportal.co.za/erdas-iws/ogc/wms/CDNGI_Imagery_25cm_MOSAIC_2018',
							layers="CDNGI_Imagery_25cm_MOSAIC_2018", format="image/png", transparent=True)), name="CDNGI_Imagery_25cm_MOSAIC_2018")]+
				
				
		[dl.TileLayer(),
				dl.MeasureControl(position="topleft", primaryLengthUnit="kilometers", primaryAreaUnit="hectares",
							activeColor="#214097", completedColor="#972158")]
		
		
				
#									+
#				[dl.Overlay(dl.LayerGroup(markers), name="markers", checked=True),
#					dl.Overlay(dl.LayerGroup(polygon), name="polygon", checked=True)]
		) #, dl.GestureHandling()
],  zoom=5, center=(-30, 27), style={'width': '75%', 'height': '75vh', 'margin': "auto", "display": "block"},   id="map"),
	html.Div(id="Marc_state")

])

@app.callback(Output("Marc_state", "children"), [Input("map", "click_lat_lng")])
def state_hover(click_lat_lng):
	return "{}".format(click_lat_lng)
				
#!/Users/privateprivate/envs/bin/python
import dash 
import dash_leaflet as dl
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_leaflet.express as dlx


from dash_extensions.javascript import Namespace



#import plotly.express as px
#import pandas as pd


from app import app

osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
osmUrlattribution = '<a href="http://openstreetmap.org">OpenStreetMap</a>'

googleUrl= 'http://mt0.google.com/vt/lyrs=s&x={x}&y={y}&z={z}'
googleUrlattribution = 'google'

esriUrl = 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}'
esriUrlattribution = 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'

mosaic_50cm='http://apollo.cdngiportal.co.za/erdas-iws/ogc/wms/CDNGI_Imagery_50cm_MOSAIC'
'CDNGI_50cm_MOSAIC_2008-2016'



# A few cities in Denmark.
sites = [dict(name="Site 1", lat=-27.2, lon=27.8),
					dict(name="Site 2", lat=-28.3, lon=30),
					dict(name="Site 2", lat=-27.5, lon=29)]
				


# Create app.

layout = html.Div([dl.Map([
		dl.LayersControl(
				[dl.BaseLayer(dl.TileLayer(url=osmUrl, attribution=osmUrlattribution),
											name="OSM", checked= "OSM"=="OSM")]+									
				[dl.BaseLayer(dl.TileLayer(url=googleUrl, attribution=googleUrlattribution),
											name="Google Sat")]+									
				[dl.BaseLayer(dl.TileLayer(url=esriUrl, attribution=esriUrlattribution),
											name="Esri")]+
			[dl.Overlay(dl.LayerGroup(dl.WMSTileLayer(url="http://apollo.cdngiportal.co.za/erdas-iws/ogc/wms/CDNGI_Imagery_50cm_MOSAIC",
				layers="CDNGI_Imagery_50cm_MOSAIC", format="image/png", transparent=True)), name="CDNGI_Imagery_50cm_MOSAIC")]+
		[dl.Overlay(dl.LayerGroup(dl.WMSTileLayer(url='http://apollo.cdngiportal.co.za/erdas-iws/ogc/wms/CDNGI_Imagery_25cm_MOSAIC_2017',
				layers="CDNGI_Imagery_25cm_MOSAIC_2017", format="image/png", transparent=True)), name="CDNGI_Imagery_25cm_MOSAIC_2017")]+
			[dl.Overlay(dl.LayerGroup(dl.WMSTileLayer(url='http://apollo.cdngiportal.co.za/erdas-iws/ogc/wms/CDNGI_Imagery_25cm_MOSAIC_2018',
							layers="CDNGI_Imagery_25cm_MOSAIC_2018", format="image/png", transparent=True)), name="CDNGI_Imagery_25cm_MOSAIC_2018")]+
				
				
		[dl.TileLayer(),
				dl.MeasureControl(position="topleft", primaryLengthUnit="kilometers", primaryAreaUnit="hectares",
							activeColor="#214097", completedColor="#972158")]
		
		
				
#									+
#				[dl.Overlay(dl.LayerGroup(markers), name="markers", checked=True),
#					dl.Overlay(dl.LayerGroup(polygon), name="polygon", checked=True)]
		) #, dl.GestureHandling()
],  zoom=5, center=(-30, 27), style={'width': '75%', 'height': '75vh', 'margin': "auto", "display": "block"},   id="map"),
	html.Div(id="Marc_state")

])

@app.callback(Output("Marc_state", "children"), [Input("map", "click_lat_lng")])
def state_hover(click_lat_lng):
	return "{}".format(click_lat_lng)
#!/Users/privateprivate/envs/bin/python #import plotly.express as px #import pandas as pd # A few cities in Denmark. # Create app. #									+ #				[dl.Overlay(dl.LayerGroup(markers), name="markers", checked=True), #					dl.Overlay(dl.LayerGroup(polygon), name="polygon", checked=True)] #, dl.GestureHandling()