尝试使用Oracle Application Express添加经度和纬度

时间:2017-04-30 23:05:54

标签: oracle

大家好,我是使用Oracle Application Express的新手,我正在尝试添加经度和纬度,但它给了我错误,任何人都可以帮助请...我正在使用Oracle Application Express。 PS。这是PL / SQL ..谢谢......

function render_map (
p_region in apex_plugin.t_region,
p_plugin in apex_plugin.t_plugin,
p_is_printer_friendly in boolean )

return apex_plugin.t_region_render_result
as
subtype plugin_attr is varchar2(32767);

l_result    apex_plugin.t_region_render_result;
l_script    varchar2(32767);
l_region    varchar2(100);
l_js_params varchar2(1000);
l_lat       number;
l_lng       number;
l_readonly  varchar2(1000) := 'false';

 if l_api_key is not null then
    l_js_params := '?key=' || l_api_key;
    if l_sign_in = 'Y' then
        l_js_params := l_js_params||'&'||'signed_in=true';
    end if;

 else

 l_sign_in      := 'N';
    l_geocode_item := null;
    l_country      := null;
    l_address_item := null;

end if;

if l_readonly_expr is not null then
  l_readonly := apex_plugin_util.get_plsql_expression_result (
    'case when (' || l_readonly_expr
    || ') then ''true'' else ''false'' end');
  if l_readonly not in ('true','false') then
    raise_application_error(-20000, 'Read-only attribute must evaluate to true or false.');
  end if;
end if;

 apex_javascript.add_library
  (p_name                  => 'js' || l_js_params
  ,p_directory             => 'https://maps.googleapis.com/maps/api/'
  ,p_skip_extension        => true);

apex_javascript.add_library
  (p_name                  => 'simplemap'
  ,p_directory             => p_plugin.file_prefix
  ,p_check_to_add_minified => true);

l_lat := to_number(substr(l_latlong,1,instr(l_latlong,',')-1));
l_lng := to_number(substr(l_latlong,instr(l_latlong,',')+1));

l_region := case
            when p_region.static_id is not null
            then p_region.static_id
            else 'R'||p_region.id
            end;

l_script := replace('
var opt_#REGION# = {
container: "map_#REGION#_container"
,regionId: "#REGION#"
,initZoom: '||l_zoom||'
,initLat: '||TO_CHAR(l_lat,'fm999.9999999999999999')||'
,initLng: '||TO_CHAR(l_lng,'fm999.9999999999999999')||'
,markerZoom: '||l_marker_zoom||'
,icon: "'||l_icon||'"
,syncItem: "'||l_item_name||'"
,geocodeItem: "'||l_geocode_item||'"
,country: "'||l_country||'"'||
 CASE WHEN l_mapstyle IS NOT NULL THEN '
,mapstyle: '||l_mapstyle
END || '
,addressItem: "'||l_address_item||'"'||
CASE WHEN l_geolocate = 'Y' THEN '
,geolocate: true' ||
CASE WHEN l_geoloc_zoom IS NOT NULL THEN '
,geolocateZoom: '||l_geoloc_zoom
END
END || '
,readonly: '||l_readonly||'
};

0 个答案:

没有答案