Package org.opentripplanner.openstreetmap.model

Examples of org.opentripplanner.openstreetmap.model.OSMNode


     *
     * @param c The location of the node to create.
     * @return The created node.
     */
    private OSMNode createVirtualNode(Coordinate c) {
        OSMNode node = new OSMNode();
        node.lon = c.x;
        node.lat = c.y;
        node.setId(virtualNodeId);
        virtualNodeId--;
        waysNodeIds.add(node.getId());
        nodesById.put(node.getId(), node);
        return node;
    }
View Full Code Here


    public void testParser(OSMMap map) throws Exception {
        Map<Long, OSMNode> nodes = map.getNodes();
        assertEquals(7197, nodes.size());

        OSMNode nodeA = map.getNodeForId(27308461);
        assertEquals(27308461, nodeA.getId());
        assertEquals(52.3887673, nodeA.lat, 0.0000001);
        assertEquals(16.8506243, nodeA.lon, 0.0000001);
        Map<String, String> tags = nodeA.getTags();
        assertEquals("JOSM", tags.get("created_by"));
        assertEquals("survey", tags.get("source"));

        OSMNode nodeB = map.getNodeForId(27308457);
        assertEquals(27308457, nodeB.getId());
        assertEquals(52.3850672, nodeB.lat, 0.0000001);
        assertEquals(16.8396962, nodeB.lon, 0.0000001);
        tags = nodeB.getTags();
        assertEquals("Wieruszowska", tags.get("name"));
        assertEquals("tram_stop", tags.get("railway"));
        assertEquals("survey", tags.get("source"));
        assertEquals("1", tags.get("layer"));

        OSMNode nodeC = map.getNodeForId(299769943);
        assertTrue(nodeC.hasTag("name"));
        assertNull(nodeC.getTag("not-existing-tag"));
        assertEquals("Apteka Junikowska", nodeC.getTag("name"));
        assertTrue(nodeC.isTagTrue("dispensing"));
        assertFalse(nodeC.isTagFalse("dispensing"));
        assertFalse(nodeC.isTagTrue("not-existing-tag"));
        assertFalse(nodeC.isTagFalse("not-existing-tag"));

        OSMNode nodeD = map.getNodeForId(338912397);
        assertTrue(nodeD.isTagFalse("dispensing"));
        assertFalse(nodeD.isTagTrue("dispensing"));

        Map<Long, OSMWay> ways = map.getWays();
        assertEquals(1511, ways.size());

        OSMWay wayA = map.getWayForId(13490353);
View Full Code Here

TOP

Related Classes of org.opentripplanner.openstreetmap.model.OSMNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.