function readFeatureByGeoJSON(geoJson, sourceCode, targetCode) {
try {
var view = map.getView();
if (!geoJson) {
return null;
}
var format = new ol.format.GeoJSON();
var feature = format.readFeatureFromObject(geoJson, {
featureProjection: targetCode || view.getProjection(),
dataProjection: sourceCode || view.getProjection(),
});
return feature;
} catch (e) {
return null;
}
}