All Downloads are FREE. Search and download functionalities are using the official Maven repository.

br.zuq.osm.parser.model.OSMNode Maven / Gradle / Ivy

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.zuq.osm.parser.model;

import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.io.WKBWriter;
import java.util.Map;

/**
 *
 * @author Willy Tiengo
 */
public class OSMNode extends AbstractNode {

    public String lat;
    public String lon;

    public OSMNode(String id, String visible, String timestamp, String version, String changeset, String user, String uid, String lat, String lon, Map tags) {
        super(id, visible, timestamp, version, changeset, user, uid, tags);
        this.lat = lat;
        this.lon = lon;
        this.tags = tags;
    }

    public String getLocation() {
        Point p = new GeometryFactory().createPoint(
                new Coordinate(Double.valueOf(lon), Double.valueOf(lat)));

        return WKBWriter.bytesToHex(new WKBWriter().write(p));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy