Select to view content in your preferred language

How to integrate onemap.sg API with flex?

1159
3
06-23-2014 05:30 PM
NarendraMongiya
New Contributor
Onemap.sg provides their own REST api (http://www.onemap.sg/api/help/) and they suggested it can be consumed in flex using ArcGis. Does anybody has an information how to do it?

Thanks
Naren
Tags (2)
0 Kudos
3 Replies
AnthonyGiles
Frequent Contributor II
Naren,

I can get an esri base map to overlay on top of onemap but it does not work the other way round I think it may be a projection problem, try the following code in the javascript sandbox:

http://developers.arcgis.com/javascript/sandbox/sandbox.html

<!DOCTYPE html>
<html>
  <head>
    <script type='text/JavaScript' src='http://www.onemap.sg/API/JS?accessKEY=xkg8VRu6Ol+gMH+SUamkRIEB7fKzhwMvfMo/2U8UJcFhdvR4yN1GutmUIA3A6r3LDhot215OVVkZvNRzjl28TNUZgYFSswOi'></script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
    <title>Simple Map</title>
    <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/esri/css/esri.css">
    <style>
      html, body, #map {
        height: 100%;
        width: 100%;
        margin: 0;
        padding: 0;
      }
      body {
        background-color: #FFF;
        overflow: hidden;
        font-family: "Trebuchet MS";
      }
    </style>
    <script src="http://js.arcgis.com/3.9/"></script>
    <script language="JavaScript" type="text/JavaScript">
      var map;
     var centerPoint="28968.103,33560.969";
      var myLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer");
      myLayer.opacity = 0.5;
      var OneMap = new GetOneMap('map','SM',{level:7,center:centerPoint,layer:myLayer}); //add one map here
      
      function init() {
       map=OneMap.map;
         dojo.connect(OneMap.map, "onExtentChange", showExtent);
      }

    dojo.addOnLoad(init);
    </script>

  </head>
  <body>
    <div id="map"></div>
  </body>
</html>


Regards

Anthony
0 Kudos
AnthonyGiles
Frequent Contributor II
Naren,

I can't see anywhere on the documentation that says it will interact with the flex api. It is based around the javascript api.

The services are coming from an ArcGIS Server so in theory you should be able to but you need to generate a token to access the maps, they may also not have a cross domain file on their sever to allow you to do so.

Regards

Anthony
0 Kudos
NarendraMongiya
New Contributor
Hi Anthony

I tried with the following code in Flex and it is showing maps in flex from onemap server.
<esri:ArcGISDynamicMapServiceLayer url="http://e1.onemap.sg/arcgis/rest/services/LOT_VIEW/MapServer"/>

And It does not ask for any Security token/AccessKey. But I do not know whether it will support all properties of ArcGis or not?

Regards,
Naren
0 Kudos