Skip to main content

Hi. I will try to explain my doubt.


I have a WMS layer with VEGETATION_INDEX. I have used playground to generate code to implement into my siteweb. Perfect.


I use leaflet and I have been able to place the wms layer on top of the google map, but I only want place one polygon over google map, not all WMS layer.


¿is possible?


Sorry for my english.

You have to add parameter GEOMETRY to the call.


See
https://www.sentinel-hub.com/faq/how-can-i-clip-image-specific-polygon


I had already seen it but I don’t know how to add it to my WMS Layer.


This is my code. But it don’t works.


var baseUrl = “https://services.sentinel-hub.com/ogc/wms/<INSTANCE_ID>?SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&LAYERS=VEGETATION_INDEX&MAXCC=20&WIDTH=640&HEIGHT=640&CRS=EPSG:4326&BBOX=-7.885,38.540,-7.870,38.560&GEOMETRY=POLYGON((-7.877244 38.546511,-7.876377 38.547818,-7.871950 38.546125,-7.872611 38.545023,-7.871241 38.544475,-7.869831 38.544560,-7.866011 38.550445,-7.872323 38.552895,-7.874112 38.551451,-7.877110 38.552537,-7.878791 38.552976,-7.879413 38.553099,-7.880600 38.553320,-7.881314 38.553126,-7.882678 38.552762,-7.883951 38.552667,-7.885064 38.552160,-7.885370 38.549346,-7.877244 38.546511))&FORMAT=image/png&TRANSPARENT=1”;


continue…


var sentinelHub = L.tileLayer.wms(baseUrl, {

tileSize: 512,

attribution: ‘©️ Sentinel Hub’,

urlProcessingApi:“https://services.sentinel-hub.com/ogc/wms/0f7ce419-0d50-XXX”,

maxcc:20,

minZoom:6,

maxZoom:20,

preset:“VEGETATION_INDEX”,

layers:“VEGETATION_INDEX”,

time:“2018-06-01/2018-06-17”

});


map.addLayer(sentinelHub);


Well, first of all, you should not be using Sentinel Playground’s instance key. You should use your own account’s one.


This seems to work for me (I replaced part of the instance ID with XXX)


https://services.sentinel-hub.com/ogc/wms/8faa39b3-d061-XXX?SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&LAYERS=VEGETATION_INDEX&MAXCC=20&WIDTH=640&HEIGHT=640&CRS=EPSG:4326&BBOX=-7.885,38.540,-7.870,38.560&GEOMETRY=POLYGON((-7.877244 38.546511,-7.876377 38.547818,-7.871950 38.546125,-7.872611 38.545023,-7.871241 38.544475,-7.869831 38.544560,-7.866011 38.550445,-7.872323 38.552895,-7.874112 38.551451,-7.877110 38.552537,-7.878791 38.552976,-7.879413 38.553099,-7.880600 38.553320,-7.881314 38.553126,-7.882678 38.552762,-7.883951 38.552667,-7.885064 38.552160,-7.885370 38.549346,-7.877244 38.546511))&FORMAT=image/png&TRANSPARENT=1


What you might have an issue with is that your web app is working with EPSG:4357 (Pop Web Mercator) and your geometry is in WGS84. You should obviously have both in the same system.


Reply