question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I have this service ArcGIS Server convert the point where GeoJSON . to convert moving slightly upward

image

i use esri leaflet is goog

image

angular
    .module('geomarketing.services')
    .factory('utilityService', ['$q', '$log','$http',
function ($q, $log,$http) {
    var utilityService = {};
    utilityService.arcgisToFeatureCollection = '';
    utilityService.arcgisToFeatureCollection = function (url, callback) {

        $http.get(url).
          success(function (data, status, headers, config) {
              callback(null, createGeoJson(data));
              // this callback will be called asynchronously
              // when the response is available
          }).
          error(function (data, status, headers, config) {
              callback(null, null);
          });


        createGeoJson = function (json) {

            var features = json.features;
            //var idField = response.operationalLayers[0].featureCollection.layers[0].layerDefinition.objectIdField;

            // empty geojson feature collection
            var featureCollection = {
                type: 'FeatureCollection',
                features: []
            };

            for (var i = features.length - 1; i >= 0; i--) {
                // convert ArcGIS Feature to GeoJSON Feature

                var feature = {
                    "type": "Feature",
                    "geometry": { "type": "Point", "coordinates": [features[i].geometry.x, features[i].geometry.y] },
                    "properties": features[i].attributes
                };

                // unproject the web mercator coordinates to lat/lng
                var latlng = L.Projection.Mercator.unproject(L.point(feature.geometry.coordinates));
                feature.geometry.coordinates = [latlng.lng, latlng.lat];

                featureCollection.features.push(feature);
            }

           return featureCollection
        };

    };



    return utilityService;
}]);

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rbonillajrcommented, Dec 18, 2019

Hi @ibrahimawadhamid, one of the problems may be the projection with which you have published the ArcgisSever service. If you can send me some code with pleasure I can help you.

This is my code to consume the service (Require the Leaflet / esri-leaflet.js library):

utilityService.getFeature = function (url, filter, callback) {

                L.esri.Tasks.query({
                    url: url
                }).where(filter).run(function (err, result, response) {
                    callback(null, result);
                });
            };
1reaction
rbonillajrcommented, Jun 12, 2015

http://esri.github.io/esri-leaflet/examples/parse-feature-collection.html in this sample using L.Projection.Mercator.unproject() for convert to geojson. I need convert for generate buffer with turfjs but marker moved upward.

thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Projection | Definition, Theories, & Facts - Britannica
projection, the mental process by which people attribute to others what is in their own minds. For example, individuals who are in a ......
Read more >
Projection Definition & Meaning - Merriam-Webster
Kids Definition ; 1 · a method of showing a curved surface (as the earth) on a flat one (as a map) ;...
Read more >
Psychological projection - Wikipedia
Psychological projection is the process of misinterpreting what is "inside" as coming from "outside". It forms the basis of empathy by the projection...
Read more >
Projection in Psychology: Definition, Defense Mechanism ...
In psychology, projection refers to placing your own negative traits or unwanted emotions onto others, usually without reason. We'll dive into why humans...
Read more >
What Is Projection as a Defense Mechanism? - Verywell Mind
Projection is when one sees the traits that they find unacceptable in themselves in others. Learn about the origin and impact of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found