반응형

진행하고 있던 프로젝트에서 지도 정보가 필요하여 찾아봤던 자료들 입니다.

 

무료로 좌표계를 받을수 있는 곳을 찾기가 힘들어 고생했던 기억이 있어서 그당시 찾아봤던 site들을 정리해봤습니다.

 

 

결국 위도 경도 정보를 data로 구해야 해서 저는 python panda로 data를 구했었습니다.

 

 

 

https://www.esrikr.com/arcgis-guide/arcgis-pro-master-2/

 

 

[ArcGIS Pro 완전 정복!] ②기본 | 한국에스리

☞ 2차원 맵과 3차원 씬 연결 [보기(View)] → [뷰 연결(Link Views)] → [중심 및 축척(Center and Scale)] 클릭 데이터 탭을 클릭하여 드래그 → 뷰에서 십자형 사각형 중 원하는 모양에 배치하면 2차원 맵과

www.esrikr.com

 

 

 

 

지도 정보 찾기

 

 

 

https://earthdata.nasa.gov/

 

Earthdata

The Earth Observing System Data and Information System is a key core capability in NASA’s Earth Science Data Systems Program. It provides end-to-end capabilities for managing NASA’s Earth science data from various sources—satellites, aircraft, field

earthdata.nasa.gov

 

Global Map data archives

 

https://globalmaps.github.io/

 

Global Map data archives

Use of geospatial information is crucial for solving various issues around the world including global environmental problems. In order to solve these diversified issues and to advance sustainable development, it is important to make fundamental geospatial

globalmaps.github.io

 

https://globalmaps.github.io/glcnmo.html#code

 

Land Cover (GLCNMO) - Global version - Global Map

The Global Land Cover by National Mapping Organizations (GLCNMO) is geospatial information in raster format which classifies the status of land cover of the whole globe into 20 categories. The classification is based on LCCS developed by FAO. Therefore, it

globalmaps.github.io

 

 

http://www.diva-gis.org/datadown

 

Spatial Data Download | DIVA-GIS

 

www.diva-gis.org

 

 

https://datascienceschool.net/view-notebook/ef921dc25e01437b9b5c532ba3b89b02/

 

Data Science School

Data Science School is an open space!

datascienceschool.net

pandas

 

 

import geopandas as gpd
import matplotlib.pyplot as plt
import matplotlib.path as mpath
import matplotlib.patches as mpatches

gpd.__version__


def get_pos(PosData) : 
    return PosData[0],PosData[1]


print(gpd.__version__)

countries = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
cities = gpd.read_file(gpd.datasets.get_path('naturalearth_cities'))

#countries.tail(3)

print(countries.name)


china = countries[countries.name == "China"].geometry



china.boundary.squeeze()

china.plot()


rect = china.total_bounds

fig = plt.figure()
ax =fig.add_axes(rect,)

fig.delaxes(ax)
fig.add_axes(ax)


# sub plot

# ax = plt.subplots()   

# pos = [[china.total_bounds[0],china.total_bounds[1]],
#         [china.total_bounds[2],china.total_bounds[1]],
#         [china.total_bounds[2],china.total_bounds[3]],
#         [china.total_bounds[0],china.total_bounds[3]]]
# Path = mpath.Path
# path_data = [
#     (Path.MOVETO, (pos[0])),
#     (Path.LINETO, (pos[1])),
#     (Path.LINETO, (pos[2])),
#     (Path.LINETO, (pos[3])),
#      (Path.CLOSEPOLY, (pos[0])),
#      ] 
# ax.plot(path_data)        
# #    
# codes, verts = zip(*path_data)
# path = mpath.Path(verts, codes)
# patch = mpatches.PathPatch(path, facecolor='r', alpha=0.5)

#  ax.add_patch(patch)

# x, y = zip(*path.vertices)
# line, = ax.plot(x, y, 'go-')
# ax.grid()
# ax.axis('equal')

plt.figimage(fig)
plt.show()


#china.

with open("china_map.txt", mode='wt') as f:
    f.write(china)

print(china)
#ax.set_title("세계 지도")
#ax.set_axis_off()


#print(countries)
i=0
while 1 :
    i+=i

 

 

결과 

더보기

result: 

"{\"type\": \"FeatureCollection\", \"features\": [{\"id\": \"139\", \"type\": \"Feature\", \"properties\": {}, \"geometry\": {\"type\": \"MultiPolygon\", \"coordinates\": [[[[109.47520958866365, 18.197700913968575], [108.65520796105616, 18.507681993071387], [108.62621748254044, 19.367887885001906], [109.11905561730804, 19.821038519769345], [110.21159874882281, 20.101253973872033], [110.78655073450221, 20.077534491450052], [111.01005130416458, 19.69592987719072], [110.57064660038677, 19.25587921800927], [110.33918786015147, 18.678395087147592], [109.47520958866365, 18.197700913968575]]], [[[80.2599902688853, 42.34999929459906], [80.1801501809943, 42.92006785742694], [80.86620649610126, 43.18036204688101], [79.96610639844141, 44.91751699480463], [81.9470707539181, 45.31702749285312], [82.45892581576906, 45.539649563166506], [83.18048383986047, 47.33003123635086], [85.16429039911324, 47.0009557155161], [85.72048383987067, 47.452969468773105], [85.7682328633083, 48.45575063739699], [86.59877648310336, 48.549181626980626], [87.35997033076265, 49.21498078062912], [87.75126427607671, 49.297197984405486], [88.01383222855173, 48.599462795600616], [88.85429772334676, 48.069081732772965], [90.28082563676392, 47.69354909930793], ...

'개발 Note > it 이야기' 카테고리의 다른 글

DevOps 선택하기...  (0) 2022.05.25
SW를 개발하기 위해서는 가장 중요한것이 무엇인가??  (0) 2021.08.20
AI assistant battle  (1) 2019.10.29
Synergy  (0) 2019.09.27
Galaxy Home - mini  (0) 2019.08.28
반응형

STL의 map,array의 성능에 차이는 없을까?

key값이 string인 경우와 int인 경우의 차이는 얼마나 될까?

이것을 확인하기 위해서 아래와 같이 간단한 성능 테스트 프로그램을 작성해봤습니다.

 

 

stringMapTC()는 strStr 에 들어있는 string들을 key로 하여 map의 요소에 접근하는 테스트

stringUnorderedMapTC()는 strStr 에 들어있는 string들을 key로 하여 unordered_map의 요소에 접근하는 테스트

intMapTC()는 int 값을 key로 하여 map의 요소에 접근하는 테스트

intArrayTC()는 stl::array로 요소에 접근하는 테스트

cArrayTC()는 stl container가 아닌 srcStr[] 에서 직접 35번 요소에 접근하는 테스트

 
 

테스트 결과 - 10000회 수행 시간 (초)

 

함수  데이터 형식  1  2  3  4
stringMapTC()

std::map
<const std::string, int>
0.0049 0.0052 0.0054 0.0053
stringUnorderedMapTC() std::unordered_map
<const std::string, int>
0.0018 0.0019 0.0019 0.0019
 intMapTC()

std::map
<int, const std::string>
0.0006 0.0008 0.0008 0.0008
 intArrayTC()

std::array
<std::string, 100>
0.0001 0.0001 0.0001 0.0001
 cArrayTC()

char* srcStr[] 0.0001 0.0001 0.0001 0.0001
 

 

stringMapTC의 경우는 key compare를 위해 string 을 비교해야 하기에 가장 오래걸립니다.

stringUnorderedMapTC는 map에 비해 약 2.7배 정도 빠른 성능을 보입니다.

code가 길어서 그렇지 성능을 높이려면 map 쓰는 곳을 모두 unordered_map으로 변경하면 비약적인(?) 성능 향상이 이뤄지겠네요 ^^.

 

intMapTC의 경우는 key값이 int라서 string 을 key로 사용하는 것에 비해 많이 빠릅니다. 그러나 stl::array에 비해서는 느리게 결과가 나왔습니다.

당연히 intArrayTC의 경우는 당연히 map보다는 빠를 수 밖에 없습니다. 전체 서치가 아니라 array의 index (= array[index]) 를 key처럼 사용하기 때문에 key값이 당연히 정렬이 되어있어서 빠를 수 밖에 없습니다.

cArrayTC() 와 비슷한 결과가 나올 수 밖에 없습니다.

 

[source code]

#include <time.h>
#include <map>
#include <unordered_map>
#include <array>
#include <string>
using namespace std;

const char *srcStr[] =
    {
        "hello"
        "bounds",
        "contentBounds",
        "contentOpacity",
        "renderOperation",
        "opacity",
        "showState",
        "anchor",
        "anchorZ",
        "transform",
        "childrenTransform",
        "zPosition",
        "zOrderGroup",
        "clipToParent",
        "clipChildren",
        "projection",
        "surfaceOpaque",
        "name",
        "propertyPropagation",
        "implicitAnimation",
        "detach",
        "attach",
        "bounds.",
        "bounds.position",
        "bounds.size",
        "transform.",
        "transform.rotation.x",
        "transform.rotation.y",
        "transform.rotation.z",
        "transform.scale.x",
        "transform.scale.y",
        "transform.scale.z",
        "transform.translation.x",
        "transform.translation.y",
        "transform.translation.z",
        "transform.rotation.anchor.x",
        "transform.rotation.anchor.y",
        "transform.rotation.anchor.z",
        "transform.scale.anchor.x",
        "transform.scale.anchor.y",
        "transform.scale.anchor.z",
        "transform.rotation.xy",
        "transform.scale.xy",
        "transform.translation.xy",
        "transform.rotation.anchor.xy",
        "transform.scale.anchor.xy",
        "childrenTransform.",
        "childrenTransform.rotation.x",
        "childrenTransform.rotation.y",
        "childrenTransform.rotation.z",
        "childrenTransform.scale.x",
        "childrenTransform.scale.y",
        "childrenTransform.scale.z",
        "childrenTransform.translation.x",
        "childrenTransform.translation.y",
        "childrenTransform.translation.z",
        "childrenTransform.rotation.anchor.x",
        "childrenTransform.rotation.anchor.y",
        "childrenTransform.rotation.anchor.z",
        "childrenTransform.scale.anchor.x",
        "childrenTransform.scale.anchor.y",
        "childrenTransform.scale.anchor.z",
        "childrenTransform.rotation.xy",
        "childrenTransform.scale.xy",
        "childrenTransform.translation.xy",
        "childrenTransform.rotation.anchor.xy",
        "childrenTransform.scale.anchor.xy",
        "__showOpacity",
};

double stringMapTC()
{
    std::map<const std::string, int> strMap;
    int i = 0;
    for (auto str : srcStr)
    {
        strMap.insert({str, i++});
    }

    int v = 0;
    clock_t start = clock();
    for (int j = 0; j < 10000; j++)
    {
        v = strMap["childrenTransform.rotation.anchor.x"];
    }
    clock_t end = clock();
    return (double)(end - start) / CLOCKS_PER_SEC;
}


double stringUnorderedMapTC()
{
    std::unordered_map<std::string, int> strMap;
    int i = 0;
    for (auto str : srcStr)
    {
        strMap.insert({str, i++});
    }

    int v=0;
    clock_t start = clock();
    for (int j = 0; j < 10000; j++)
    {
        v= strMap["childrenTransform.rotation.anchor.x"];
    }
    clock_t end = clock();
    return (double)(end - start) / CLOCKS_PER_SEC;
}

double intMapTC()
{

    std::map<int, const std::string> strMap;
    int i = 0;
    for (auto str : srcStr)
    {
        strMap.insert({i++, str});
    }

    clock_t start = clock();
    std::string v;
    for (int j = 0; j < 10000; j++)
    {
        v= strMap[35];
    }
    clock_t end = clock();
    return (double)(end - start) / CLOCKS_PER_SEC;
}


double intArrayTC()
{

    std::array<std::string, 100> strMap;
    int i = 0;
    for (auto str : srcStr)
    {
        strMap[i++] = str;
    }

    clock_t start = clock();
    std::string v;
    for (int j = 0; j < 10000; j++)
    {
        v = strMap[35];
    }
    clock_t end = clock();

    return (double)(end - start) / CLOCKS_PER_SEC;
}

double cArrayTC()
{

    clock_t start = clock();
    std::string v;
    for (int j = 0; j < 10000; j++)
    {
        v = srcStr[35];
    }
    clock_t end = clock();

    return (double)(end - start) / CLOCKS_PER_SEC;
}

#define PRINT_TC(_FUNC)                     \
    {                                       \
        double res = _FUNC();               \
        printf("%.4f %s()\n", res, #_FUNC); \
    }
int main(void)
{

    PRINT_TC(stringMapTC);
    PRINT_TC(stringUnorderedMapTC);
    PRINT_TC(intMapTC);
    PRINT_TC(intArrayTC);
    PRINT_TC(cArrayTC);
}

 

 

테스트 결과

$ ./main
0.0054 stringMapTC()
0.0021 stringUnorderedMapTC()
0.0009 intMapTC()
0.0001 intArrayTC()
0.0001 cArrayTC()

+ Recent posts