Select to view content in your preferred language

MapServer via https?

1944
10
02-28-2012 06:47 AM
JimMichael
Emerging Contributor
Is there an https implementation of the MapServer? We are using ESRI hosted map server and geometry functions to draw on rendered maps. We would like to be able to retrieve via https so as not to get security warnings on client systems. Is this possible?
0 Kudos
10 Replies
derekswingley1
Deactivated User
Using https is dependent on the server hosting the map services, not the map services themselves. You can use ArcGIS Online services (and the JS API via https), here's an example I put together a while back:  https://servicesbeta.esri.com/demos/https/basemap-gallery.html
0 Kudos
JimMichael
Emerging Contributor
Yes, we're using ArcGisOnline, specifically ArcGISTiledMapService. I think they were successful in getting the maps to render but the geometry tasks (drawing circles & lines) were not. I'll have a look at your example. Thank you.
0 Kudos
derekswingley1
Deactivated User
ArcGIS Online is a web app that provides services (basemaps, geometry, geocoding, routing) while ArcGISTiledMapServiceLayer is a class in the API. The former is set up with use https/SSL while the latter uses whatever you give it (it's up to you to specify a service that uses SSL).

For the geometry operations, if you're drawing shapes, that's all done client side and https isn't part of the equation. Did I misunderstand what you're doing?
0 Kudos
JimMichael
Emerging Contributor
Sorry, it's been a few months since I worked on this. Code snippets below. If I understand correctly we should be able to simply replace all the http: with https:, correct?

      map = new esri.Map("map");
      var layer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcg
isonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
      map.addLayer(layer);
      map.setExtent(esri.geometry.geographicToWebMercator(new esri.geometry.Exte
nt(xMin, yMin, xMax, yMax, new esri.SpatialReference({wkid: 4326}))));
      gsvc = new esri.tasks.GeometryService("http://sampleserver3.arcgisonline.c
om/ArcGIS/rest/services/Geometry/GeometryServer");
      dojo.connect(map, "onLoad", doAll);
  
    function doAll() {
        drawLine(Xref,Yref,Xloc,Yloc);
        var x = Xloc;
        var y = Yloc;
        var dist = <%=radius%>;
        color = RED;
        drawCircle(x,y,dist,color);
        x = Xref;
        y = Yref;
        color = BLUE;
        dist = <%=refRadius%>;
        drawCircle(x,y,dist,color);
    }
    function drawLine(x1,y1,x2,y2) {
      var p1 = new esri.geometry.Point(x1, y1, new esri.SpatialReference({wkid:4
326}));
      var p2 = new esri.geometry.Point(x2, y2, new esri.SpatialReference({wkid:4
326}));
      var geographicGeometry = new esri.geometry.Polyline(new esri.SpatialRefere
nce({wkid:4326}));
      geographicGeometry = geographicGeometry.addPath([p1,p2]);
      var mapGeometry = esri.geometry.geographicToWebMercator(geographicGeometry
);
      var symbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol
.STYLE_SOLID, new dojo.Color([255, 0, 0]), 3);
      var graphic = new esri.Graphic(mapGeometry ,symbol);
      map.graphics.add(graphic);
    }


    function drawCircle(x,y,dist) {
      var params = new esri.tasks.BufferParameters();
      var myPoint = new esri.geometry.Point(x, y, new esri.SpatialReference({wki
d: 4326}) );
      params.geometries = [ myPoint ];
      params.distances = [ dist ];
      params.unit = esri.tasks.GeometryService.UNIT_KILOMETER;
      params.outSpatialReference = map.spatialReference;
      gsvc.buffer(params, showBuffer);
     
    }
0 Kudos
derekswingley1
Deactivated User
If I understand correctly we should be able to simply replace all the http: with https:, correct?


For the base maps on arcgisonline.com, yes. For the geometry service on sampleserver3, no because sample server 3 does not have a SSL cert.
0 Kudos
JimMichael
Emerging Contributor
Ah, OK. Thank you for the clarification.
0 Kudos
JimMichael
Emerging Contributor
Is there an equivalent geometry server under premiumtasks.arcgisonline.com with https implemented?
0 Kudos
derekswingley1
Deactivated User
I'm not sure as I don't use those services. Tech support would know and should be able to give you a quick answer. Can you contact them?
0 Kudos
JimMichael
Emerging Contributor
We should have a contact. I'll have someone look into it. Thanks again.
0 Kudos