M.App Enterprise Discussions

Discuss topics with other M.App Enterprise Product pioneers and experts to get the most out of it.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Contributor
Posts: 26
Registered: ‎05-31-2016

Add point to Map views

Hi All

 

Are possible to use map views in M.App enterprise as visualization platform like google Maps to visualize coordinate with simple marker methode like below

 

https://www.google.com/maps/search/?api=1&query=-6.2610629,106.7947314

 

Thanks

 

regads

Highlighted
Technical Evangelist
Posts: 683
Registered: ‎11-12-2015

Re: Add point to Map views

Hi PancalR,

 

Are you meaning for method to capture points in a Browser M.App? Browser is really designed to be a 'viewer' of an existing configured map.

 

Are you aware of this functionality in Mobile M.App?

Highlighted
Contributor
Posts: 71
Registered: ‎10-10-2015

Re: Add point to Map views

If you need only view de coordinate in the map, can use tha samples in M.App Enterprise 

 

Captura de Pantalla 2019-11-19 a la(s) 1.56.21 p. m..png

 

 

And modify it

 

var queryDict = {};
    parent.location.href.substr(0).split("&").forEach(function(item) {  queryDict[item.split("=")[0]] = item.split("=")[1]});
    
    var coord_x =parseFloat(queryDict['coord_x']);
    var coord_y = parseFloat(queryDict['coord_y']);
    
    if (!coord_x){
        alert("Sin Coordenada X");
        return;
    }
    
    if (!coord_y){
        alert("Sin Coordenada Y");
        return;
    }
    
    var factor = 0.02;
    
    var x1 = (coord_x + factor);
    var x2 = (coord_x - factor);
    var y1 = (coord_y + factor);
    var y2 = (coord_y - factor);

var bounds = [{x: x1, y: y1}, {x: x2, y: y2}];

gsp.crs.transform({
    sourceCrsId: "EPSG:4326",
    targetCrsId: gsp.crs.getCurrent(),
    points: bounds
},  function(result) {
    
    
    
    
    var b1 = result.points[0],
        b2 = result.points[1];
    
    gsp.map.zoom([parseFloat(b1.x), parseFloat(b1.y), parseFloat(b2.x), parseFloat(b2.y)]);
    
    
    // clear pins
    gsp.map.pin.clear();
    /*
    // simple point
    gsp.map.pin.add({
        geojson: { "type": "Point", "coordinates": [-5, 51.5] }
    });

    // feature with attributes
    gsp.map.pin.add({
        geojson: {
            "type": "Feature",
            "geometry": { "type": "Point", "coordinates": [0, 51.5] },
            "properties": { "name": "London" }
        }
    });

    // feature with changed css class attribute
    gsp.map.pin.add({
        geojson: {
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [-5, 48.5]
            }
        }
    });    
    */
    
    gsp.map.pin.add({
        geojson: { "type": "Point", "coordinates": [coord_x, coord_y] }
    });
    
},
function(result) {
    gsp.ui.info(result.msg, { type: "error" });
});
Highlighted
Contributor
Posts: 26
Registered: ‎05-31-2016

Re: Add point to Map views

Hi Schlow

 

No, i mean i want to plot some coordinate in map view, I have the need to plot the coordinates from the location provider where the provider is giving me the coordinate of the callers 110, 110 is like 911, so every time a caller comes in, the location will be visible on the map.

 

Thanks

 

regards, 

Highlighted
Staff
Posts: 1,054
Registered: ‎10-18-2015

Re: Add point to Map views

so I think the answer above is what you are looking for. As an alternative you may use Feature Analyzer with a WebService as datasource. The way points are added to datasource must be managed externally.

 

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Highlighted
Contributor
Posts: 26
Registered: ‎05-31-2016

Re: Add point to Map views

Hi Sturcato

 

Do you have a sample web service datasource for Feature Analyzer? or do you know how to consume rest API in FA

 

Thanks

 

Regards,

 

Highlighted
Staff
Posts: 33
Registered: ‎07-16-2019

Re: Add point to Map views

Do you already have a rest service you want to use? if not, the easy way is to create a service that returns the coordinates in a csv, topoJSON or geojson format, then you could use the online source to load your data.

 

Maybe if you give us some more inforation on you usecase we could be more specific...

 

Highlighted
Contributor
Posts: 26
Registered: ‎05-31-2016

Re: Add point to Map views

[ Edited ]

HI Sfonseca

 

i have a service URL with output JSON, methode POST, with header key tokenAuth and value, and some request body, do you know how to consume that service in FA?

 

Thanks

 

regards,

Highlighted
Staff
Posts: 33
Registered: ‎07-16-2019

Re: Add point to Map views

sorry, I think there is no option for you to use POST, either the web service or the online file use GET