I'm new in openlayers 3 and Geoserver,I have shape files (coordinates Lambert 93) and i uploaded them as layers on Geoserver after that i imported on of them as a Geojson to openlayers but it doesn't appear on my map, i don't know if the mistake in the projection!This is my script
proj4.defs("EPSG:2154","+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs");var extent = [-378305.81, 6093283.21, 1212610.74, 7186901.68];var projection = ol.proj.get('EPSG:2154');projection.setExtent(extent);selector = 'map';var vS = new ol.source.Vector({//url: ',' url:'http://localhost:8080/geoserver/smartcity/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=smartcity:Meters&maxFeatures=50&outputFormat=application/json', format: new ol.format.GeoJSON({ projection: 'EPSG:2154' }) });var vL= new ol.layer.Vector({source: vS, style: new ol.style.Style({ stroke: new ol.style.Stroke({ color: 'rgba(0, 0, 255, 1.0)', width: 2 }) }) });var map = new ol.Map({layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }), vL],target: selector,view: new ol.View({ //center: ol.proj.transform([3.142041,50.609232], 'EPSG:4326', 'EPSG:3857'), projection: projection, center: [710074.61,7056933.63], zoom: 12}) });
أكثر...
proj4.defs("EPSG:2154","+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs");var extent = [-378305.81, 6093283.21, 1212610.74, 7186901.68];var projection = ol.proj.get('EPSG:2154');projection.setExtent(extent);selector = 'map';var vS = new ol.source.Vector({//url: ',' url:'http://localhost:8080/geoserver/smartcity/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=smartcity:Meters&maxFeatures=50&outputFormat=application/json', format: new ol.format.GeoJSON({ projection: 'EPSG:2154' }) });var vL= new ol.layer.Vector({source: vS, style: new ol.style.Style({ stroke: new ol.style.Stroke({ color: 'rgba(0, 0, 255, 1.0)', width: 2 }) }) });var map = new ol.Map({layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }), vL],target: selector,view: new ol.View({ //center: ol.proj.transform([3.142041,50.609232], 'EPSG:4326', 'EPSG:3857'), projection: projection, center: [710074.61,7056933.63], zoom: 12}) });
أكثر...